# Terraform

> Look up Terraform Registry providers and modules, and manage HCP Terraform workspaces from an AI agent.

[Canonical HTML page](https://top-mcps.com/mcp/terraform) · [server.json](https://top-mcps.com/mcp/terraform.json) · [methodology](https://top-mcps.com/about/methodology)

## Install

### Claude Desktop — `claude_desktop_config.json`

Paste under mcpServers. Fully quit and reopen Claude after editing.

```json
{
  "mcpServers": {
    "terraform": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "hashicorp/terraform-mcp-server"
      ]
    }
  }
}
```

### Claude Code — `CLI or .mcp.json`

Run from your repo. Commit .mcp.json to share with your team.

```shell
claude mcp add terraform -- docker run -i --rm hashicorp/terraform-mcp-server
```

### Cursor — `.cursor/mcp.json`

Global path: ~/.cursor/mcp.json. Reload window after editing.

```json
{
  "mcpServers": {
    "terraform": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "hashicorp/terraform-mcp-server"
      ]
    }
  }
}
```

### VS Code — `.vscode/mcp.json`

VS Code uses the "servers" key (not "mcpServers").

```jsonc
{
  "servers": {
    "terraform": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "hashicorp/terraform-mcp-server"
      ]
    }
  }
}
```

### Windsurf — `~/.codeium/windsurf/mcp_config.json`

Open via Cascade → hammer icon → Configure.

```json
{
  "mcpServers": {
    "terraform": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "hashicorp/terraform-mcp-server"
      ]
    }
  }
}
```

### Cline — `cline_mcp_settings.json`

Open via the Cline sidebar → MCP Servers → Edit.

```json
{
  "mcpServers": {
    "terraform": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "hashicorp/terraform-mcp-server"
      ]
    }
  }
}
```

### Continue — `~/.continue/config.json`

Continue uses modelContextProtocolServers with a transport block.

```json
{
  "experimental": {
    "modelContextProtocolServers": [
      {
        "transport": {
          "type": "stdio",
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "hashicorp/terraform-mcp-server"
          ]
        }
      }
    ]
  }
}
```

### Codex CLI — `~/.codex/config.toml`

Codex uses TOML. Each server is a [mcp_servers.<name>] subtable.

```shell
# ~/.codex/config.toml
[mcp_servers.terraform]
command = "docker"
args = [
  "run",
  "-i",
  "--rm",
  "hashicorp/terraform-mcp-server",
]
```

### Zed — `~/.config/zed/settings.json`

Zed calls them "context_servers". Settings live-reload on save.

```jsonc
{
  "context_servers": {
    "terraform": {
      "command": {
        "path": "docker",
        "args": [
          "run",
          "-i",
          "--rm",
          "hashicorp/terraform-mcp-server"
        ]
      }
    }
  }
}
```

### ChatGPT — `ChatGPT → Apps directory`

Terraform doesn't ship a hosted HTTPS endpoint today. ChatGPT supports remote MCP servers only — to use this server in ChatGPT you'll need to deploy it to a public HTTPS URL first (e.g. via Cloudflare Workers or Vercel) or wait for an official remote build.

```none

```

## At a glance

- **Maintainer:** HashiCorp
- **Transport:** stdio, Streamable HTTP
- **Auth model:** None
- **Required secrets:** None
- **Supported clients:** Claude, Cursor, VS Code, Any MCP-compatible client, HCP Terraform accounts
- **License:** MPL-2.0
- **Language:** Go
- **Latest version:** latest
- **Last verified:** 2026-07-16
- **GitHub stars:** 1,470 (fetched 2026-07-17T12:42:37.301Z)
- **Score:** 90/100 (rubric 2026-04 — see https://top-mcps.com/about/methodology)
- **Source:** https://github.com/hashicorp/terraform-mcp-server

## Quick answer

**What it does.** Exposes Terraform Registry APIs (providers, modules, policies) and, with a token, HCP Terraform / Enterprise workspace management (create, update, delete, variables, tags, runs) as MCP tools.

**Best for:**
- Grounding generated HCL in real provider schemas
- Looking up module inputs and outputs
- HCP Terraform workspace + run management
- Discovering resources and data sources
- Registry-accurate code review

**Not for:**
- Unattended `terraform apply`
- Cloud-console operations (use AWS/Azure MCP)
- Air-gapped registries without network access

## Description

The official HashiCorp Terraform MCP (GA, MPL-2.0) gives an agent grounded access to the Terraform Registry — provider resources, data sources, module inputs, and policies — plus HCP Terraform / Terraform Enterprise workspace operations. It answers "which argument does this resource take" from the live registry instead of the model's memory.

## Why it matters

LLMs routinely hallucinate Terraform resource arguments. Grounding the agent in the live registry means generated HCL references real provider schemas — the single biggest source of broken `terraform plan` output goes away.

## Key features

- Live Terraform Registry provider + module lookup
- HCP Terraform / Enterprise workspace ops (with TFE_TOKEN)
- stdio + StreamableHTTP transports
- Production controls: TLS, CORS, rate limiting
- Official HashiCorp, MPL-2.0, Go

## FAQ

### Does registry lookup need a token?

No. Provider, module, and policy lookups against the public Terraform Registry work with zero credentials — that is the default `docker run` mode.

### How do I manage HCP Terraform workspaces?

Set `TFE_TOKEN` (and `TFE_ADDRESS` for Terraform Enterprise). That unlocks workspace create/update/delete, variables, tags, and run triggering.

### Can it run `terraform apply`?

It drives HCP Terraform runs but is designed to keep destructive apply under human control. Treat it as plan-and-review, not unattended apply.

## Changelog

- **2026-07-16** — Refreshed install snippets and fact sheet; verified for 2026.
- **2025-08-01** — Initial directory listing.
