# Terraform MCP server

> Look up Terraform Registry providers, modules and policies, and manage HCP Terraform and Terraform Enterprise workspaces.

- Listing: https://mcp.tc/i/terraform
- Connect: this is a local (stdio) server; install it on your machine (see Install). The listing link is a page, not an MCP endpoint.
- Type: local (stdio)
- Auth: optional (works without sign-in)
- Category: [Cloud & DevOps](https://mcp.tc/c/cloud-devops)
- Vendor: HashiCorp
- Verified: yes, mcp.tc checked that this is the official server (https://mcp.tc/verify). It says who runs the server, not that it is safe.
- Homepage: <https://developer.hashicorp.com/terraform/mcp-server>
- Repository: <https://github.com/hashicorp/terraform-mcp-server>
- Package: oci `docker.io/hashicorp/terraform-mcp-server`

## About

Connects an AI assistant to the public Terraform Registry APIs for providers, modules and policies, and to HCP Terraform or Terraform Enterprise for workspace management. It helps the model write more accurate Terraform configuration and automate workspace tasks such as creating, updating and deleting workspaces, with variables, tags and runs.

Runs locally as a Docker container over stdio (docker run -i --rm hashicorp/terraform-mcp-server). Registry tools need no token. Set TFE\_TOKEN, and TFE\_ADDRESS for Terraform Enterprise, to enable HCP Terraform tools. A streamable HTTP mode is also available.

## What it can do

- Search Terraform Registry providers, modules and policies
- Manage HCP Terraform and Terraform Enterprise workspaces
- Create, update and delete workspaces with variables and tags
- Manage runs in workspaces
- List organizations and projects
- Access private registry content
- Optional OpenTelemetry metrics in HTTP mode

## Example prompts

- "Find the latest AWS provider version in the Terraform Registry"
- "Search the registry for a VPC module for AWS"
- "List my HCP Terraform workspaces in the acme organization"
- "Create a workspace named staging-network in HCP Terraform"

## Install

### Claude Code

1. Run this in a terminal, in your project folder:

```bash
claude mcp add --transport stdio terraform -- docker run -i --rm hashicorp/terraform-mcp-server
```

2. Start Claude Code and type `/mcp`. **terraform** should show as connected.

Add `--scope user` to make it available in every project.

### Claude Desktop

1. Open **Settings → Developer → Edit Config**. It opens `claude_desktop_config.json`. Add:

`claude_desktop_config.json`:

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

2. Save the file and restart Claude Desktop.

Needs Docker on your computer. The file lives in `~/Library/Application Support/Claude/` on macOS and `%APPDATA%\Claude\` on Windows.

### Cursor

[Add to Cursor](<https://cursor.com/install-mcp?name=terraform&config=eyJjb21tYW5kIjoiZG9ja2VyIiwiYXJncyI6WyJydW4iLCItaSIsIi0tcm0iLCJoYXNoaWNvcnAvdGVycmFmb3JtLW1jcC1zZXJ2ZXIiXX0%3D>) (opens Cursor)

Or add it by hand to `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (this project):

`mcp.json`:

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

Needs Docker on your computer.

### VS Code

[Install in VS Code](<https://vscode.dev/redirect/mcp/install?name=terraform&config=%7B%22type%22%3A%22stdio%22%2C%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22hashicorp%2Fterraform-mcp-server%22%5D%7D>) (opens VS Code)

Or from a terminal:

```bash
code --add-mcp '{"name":"terraform","type":"stdio","command":"docker","args":["run","-i","--rm","hashicorp/terraform-mcp-server"]}'
```

Or commit it to the repo in `.vscode/mcp.json`:

`.vscode/mcp.json`:

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

Needs Docker on your computer.

### Devin Desktop

1. Add it to `~/.config/devin/mcp_config.json` (macOS and Linux) or `%APPDATA%\devin\mcp_config.json` (Windows):

`mcp_config.json`:

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

2. Refresh the MCP server list in Cascade.

Devin Desktop is the new name for Windsurf.

### Codex

```bash
codex mcp add terraform -- docker run -i --rm hashicorp/terraform-mcp-server
```

Or edit `~/.codex/config.toml` directly:

`config.toml`:

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

Needs Docker on your computer.

### Gemini CLI

```bash
gemini mcp add terraform docker -- run -i --rm hashicorp/terraform-mcp-server
```

This adds it to the current project. Add `-s user` to use it everywhere.

### Any client

Most clients that start local servers accept this shape:

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

Zed puts servers under `context_servers` in its settings, with the same `command`, `args` and `env` fields.

Needs Docker on your computer.

## Details

- Server version: 1.0.0
- Last checked: 2026-10-03
- Listed: 2026-10-03
- Updated: 2026-10-03

---
Source: https://mcp.tc/i/terraform (mcp.tc is an independent directory, not affiliated with this server's publisher). Corrections: https://mcp.tc/report
