# Terraform

Connects your AI assistant to Terraform Registry and HCP Terraform: provider and module lookup, workspace management.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 1553
- Author: hashicorp
- License: MPL-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/hashicorp/terraform-mcp-server
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/mcp/terraform

## What it does

The server wires an assistant into the public Terraform Registry and the HCP Terraform and Terraform Enterprise APIs. From chat you can search providers, modules and policies, and manage workspaces: create, update, delete, set variables and tags, start runs. Private registry access for an organization is included.

It runs in a container, so Docker has to be installed and running. Stdio is the default transport; streamable-http mode lets you set host, port and the `/mcp` endpoint path. In HTTP mode the HCP Terraform address comes only from `TFE_ADDRESS` — a client cannot pass it through a header. Private registry and workspace work needs a `TFE_TOKEN`.

Streamable-http mode exposes OpenTelemetry metrics: tool-call volume, latency and failures. The README warns that depending on the query the server may hand Terraform data to the MCP client and the model, so untrusted clients are a bad fit.

## Requirements
- Needs: Docker
- Works with: Terraform

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add terraform -- docker run -i --rm docker.io/hashicorp/terraform-mcp-server:1.4.1
```

### Codex

**Platform CLI**
```bash
codex mcp add terraform -- docker run -i --rm docker.io/hashicorp/terraform-mcp-server:1.4.1
```

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "terraform": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "docker.io/hashicorp/terraform-mcp-server:1.4.1"
            ]
        }
    }
}
```

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "terraform": {
            "type": "stdio",
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "docker.io/hashicorp/terraform-mcp-server:1.4.1"
            ]
        }
    }
}
```

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add terraform docker run -i --rm docker.io/hashicorp/terraform-mcp-server:1.4.1
```

## When to use it
- find the current version of a provider in the registry
- assemble a module from existing blocks instead of searching by hand
- create a workspace with variables and tags
- start a run and check its status
- pull policies from an organization's private registry

## Example prompts
- Find the AWS provider in the Terraform Registry and show its latest version
- Create a workspace `staging` in the organization and add a `region` variable
- Which registry modules fit a VPC on GCP?

## Similar
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [Oh My Posh Validator](https://affpapa.org/en/nevibecode/mcp/oh-my-posh-validator.md) — MCP server · ★ 23643
- [Keploy](https://affpapa.org/en/nevibecode/mcp/keploy.md) — MCP server · ★ 18727
- [Coder](https://affpapa.org/en/nevibecode/mcp/coder.md) — MCP server · ★ 17160
- [mcp](https://affpapa.org/en/nevibecode/mcp/kubeshark-mcp.md) — MCP server · ★ 12109

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
