# Terraform MCP Server

> Gives your agent current Terraform Registry docs, modules and policies, and lets it manage HCP Terraform workspaces and runs.

HashiCorp's own Terraform MCP Server. It gives your agent the live Terraform Registry, so the Terraform it writes uses current provider docs, module details and versions rather than old training data. With an HCP Terraform or Terraform Enterprise token, it can also work with your organization's workspaces, runs, variables and private registry.

What you can do with it
- Look up provider docs, resources and data sources, and the latest provider version
- Find modules and see their inputs, outputs and examples
- Search Sentinel policies for governance and compliance
- Search your organization's private modules and providers
- List and create workspaces, and manage their variables, variable sets and tags
- Start runs and read plan and apply details and logs
- Work with projects, teams, Stacks and state versions

How it connects
It runs on your machine in Docker, from the hashicorp/terraform-mcp-server image. The public registry tools need no account. For HCP Terraform or Terraform Enterprise, set TFE_TOKEN to your API token and TFE_ADDRESS to your address (it defaults to https://app.terraform.io). In Gemini CLI, install it as an extension with: gemini extensions install https://github.com/hashicorp/terraform-mcp-server. HashiCorp documents setup for Claude Desktop, Claude Code, Cursor, VS Code, Codex CLI, Gemini CLI and more. You can also run it as a streamable HTTP server, or install the binary with go install.

Safe by default
Tools that can change or destroy infrastructure, such as applying or discarding runs, deleting workspaces, projects or teams, and force-unlocking a workspace, stay off until you set ENABLE_TF_OPERATIONS to true. You can also limit it to chosen toolsets (registry, registry-private, terraform) or to named tools.

Good to know
- It needs Docker installed and running, unless you install the binary.
- HashiCorp warns that it can pass Terraform data to your agent and its model, so use it only with ones you trust, and review what it suggests before you apply it.

- Type: Plugin
- Made by: hashicorp
- Category: Cloud & DevOps
- Formats: Local MCP, Extensions
- Version: 1.3.0
- Website: https://developer.hashicorp.com/terraform/mcp-server
- Source: https://github.com/hashicorp/terraform-mcp-server
- Page: https://pluginboard.ai/plugins/terraform-mcp

## Works with

- Claude
- GitHub Copilot
- Cursor
- Claude Code
- Codex
- Antigravity
- Gemini CLI
- OpenClaw
- OpenCode
- Hermes Agent

## Install

### Claude

Add to claude_desktop_config.json:

```json
{
  "mcpServers": {
    "terraform-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "TFE_ADDRESS={address}",
        "-e",
        "TFE_TOKEN={token}",
        "-e",
        "ENABLE_TF_OPERATIONS={enabled}",
        "docker.io/hashicorp/terraform-mcp-server:1.4.1"
      ]
    }
  }
}
```

### GitHub Copilot

Add to VS Code: vscode:mcp/install?%7B%22name%22%3A%22terraform-mcp-server%22%2C%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22TFE_ADDRESS%3D%7Baddress%7D%22%2C%22-e%22%2C%22TFE_TOKEN%3D%7Btoken%7D%22%2C%22-e%22%2C%22ENABLE_TF_OPERATIONS%3D%7Benabled%7D%22%2C%22docker.io%2Fhashicorp%2Fterraform-mcp-server%3A1.4.1%22%5D%7D

Run in your terminal:

```shell
code --add-mcp '{"name":"terraform-mcp-server","command":"docker","args":["run","-i","--rm","-e","TFE_ADDRESS={address}","-e","TFE_TOKEN={token}","-e","ENABLE_TF_OPERATIONS={enabled}","docker.io/hashicorp/terraform-mcp-server:1.4.1"]}'
```

Copilot CLI:

```shell
copilot mcp add terraform-mcp-server -- docker run -i --rm -e 'TFE_ADDRESS={address}' -e 'TFE_TOKEN={token}' -e 'ENABLE_TF_OPERATIONS={enabled}' docker.io/hashicorp/terraform-mcp-server:1.4.1
```

### Cursor

Add to Cursor: cursor://anysphere.cursor-deeplink/mcp/install?name=terraform-mcp-server&config=eyJjb21tYW5kIjoiZG9ja2VyIiwiYXJncyI6WyJydW4iLCItaSIsIi0tcm0iLCItZSIsIlRGRV9BRERSRVNTPXthZGRyZXNzfSIsIi1lIiwiVEZFX1RPS0VOPXt0b2tlbn0iLCItZSIsIkVOQUJMRV9URl9PUEVSQVRJT05TPXtlbmFibGVkfSIsImRvY2tlci5pby9oYXNoaWNvcnAvdGVycmFmb3JtLW1jcC1zZXJ2ZXI6MS40LjEiXX0%3D

Add to .cursor/mcp.json:

```json
{
  "mcpServers": {
    "terraform-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "TFE_ADDRESS={address}",
        "-e",
        "TFE_TOKEN={token}",
        "-e",
        "ENABLE_TF_OPERATIONS={enabled}",
        "docker.io/hashicorp/terraform-mcp-server:1.4.1"
      ]
    }
  }
}
```

### Claude Code

Run in your terminal:

```shell
claude mcp add terraform-mcp-server -- docker run -i --rm -e 'TFE_ADDRESS={address}' -e 'TFE_TOKEN={token}' -e 'ENABLE_TF_OPERATIONS={enabled}' docker.io/hashicorp/terraform-mcp-server:1.4.1
```

### Codex

Run in your terminal:

```shell
codex mcp add terraform-mcp-server -- docker run -i --rm -e 'TFE_ADDRESS={address}' -e 'TFE_TOKEN={token}' -e 'ENABLE_TF_OPERATIONS={enabled}' docker.io/hashicorp/terraform-mcp-server:1.4.1
```

### Antigravity

Add to ~/.gemini/config/mcp_config.json:

```json
{
  "mcpServers": {
    "terraform-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "TFE_ADDRESS={address}",
        "-e",
        "TFE_TOKEN={token}",
        "-e",
        "ENABLE_TF_OPERATIONS={enabled}",
        "docker.io/hashicorp/terraform-mcp-server:1.4.1"
      ]
    }
  }
}
```

### Gemini CLI

Run in your terminal:

```shell
gemini extensions install https://github.com/hashicorp/terraform-mcp-server
```

### OpenClaw

In a terminal: Run openclaw mcp add terraform-mcp-server --command docker, with --arg before each argument (run -i --rm -e 'TFE_ADDRESS={address}' -e 'TFE_TOKEN={token}' -e 'ENABLE_TF_OPERATIONS={enabled}' docker.io/hashicorp/terraform-mcp-server:1.4.1) and --env NAME=value for each variable it needs.

### OpenCode

Run in your terminal:

```shell
opencode mcp add terraform-mcp-server -- docker run -i --rm -e 'TFE_ADDRESS={address}' -e 'TFE_TOKEN={token}' -e 'ENABLE_TF_OPERATIONS={enabled}' docker.io/hashicorp/terraform-mcp-server:1.4.1
```

### Hermes Agent

Add to ~/.hermes/config.yaml:

```json
{
  "mcp_servers": {
    "terraform-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "TFE_ADDRESS={address}",
        "-e",
        "TFE_TOKEN={token}",
        "-e",
        "ENABLE_TF_OPERATIONS={enabled}",
        "docker.io/hashicorp/terraform-mcp-server:1.4.1"
      ]
    }
  }
}
```

---
From Pluginboard (https://pluginboard.ai).
