Data as of

Terraform MCP Server for Claude Code: Setup & Config

Claude Code: Connect MCP assistants to Terraform Registry data and HCP Terraform or Terraform Enterprise.

What you can do with Terraform in Claude Code

Choose it for Terraform Registry research and platform workspace operations through one MCP integration.

  • Look up provider and module information while drafting Terraform configuration.
  • Expose selected Terraform capabilities to a shared HTTP MCP client.

Before you start: Terraform in Claude Code

  • Docker installed and running
  • An MCP-compatible assistant

This command is the README's local Claude Code Docker launch. HCP Terraform or Enterprise access additionally uses TFE_ADDRESS and TFE_TOKEN, which must be forwarded into the container as shown in the README's client-specific examples. Public Registry use and platform access are distinct configurations.

Terraform Claude Code configuration

  1. Choose Claude Code configuration scope

    For Terraform MCP Server, open Project scope: .mcp.json at the repository root. Project JSON: merge into mcpServers; user scope: use the CLI.

  2. Add Terraform MCP Server to Claude Code

    Use the terraform-mcp-server entry below in mcpServers. Keep Terraform MCP Server's documented stdio connection fields and your other Claude Code entries.

  3. Check Terraform MCP Server in Claude Code

    Terraform MCP Server: Inspect claude mcp list and /mcp status.

Config file · Project scope: .mcp.json at the repository root

JSON
{
  "mcpServers": {
    "terraform-mcp-server": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "hashicorp/terraform-mcp-server"
      ],
      "env": {}
    }
  }
}

CLI (POSIX shell)
claude mcp add-json --scope project 'terraform-mcp-server' '{"type":"stdio","command":"docker","args":["run","-i","--rm","hashicorp/terraform-mcp-server"],"env":{}}'

Terraform tools available to Claude Code

Terraform's stored tool list documents 2 tools; compare it with Claude Code's connected tool list, because the stored list is not a live check.

search_providers

For Terraform's search_providers, review the permission request and arguments in Claude Code before approval.

Search Terraform providers; named in the README's tool-filtering example.

get_provider_details

For Terraform's get_provider_details, review the permission request and arguments in Claude Code before approval.

Terraform: full stored tool descriptions

Troubleshooting Terraform in Claude Code

  • If Terraform MCP Server fails to start, check docker and a running Docker engine, the working directory, and Claude Code's selected scope; inspect claude mcp list and /mcp.
  • Terraform MCP Server uses stdio here: Claude Code must keep the configured process running; protocol output belongs on stdout and diagnostics on stderr.
  • Known limitation: Connected clients and models may receive sensitive Terraform data.
  • Known limitation: Write-capable platform operations need deliberate permission and tool configuration.
  • Known limitation: The complete tool catalog is linked externally rather than included in the supplied README.
  • General Claude Code troubleshooting lives in the /clients/claude-code guide.

Terraform MCP Server — details. Claude Code guide

Frequently asked questions

Register Terraform MCP Server with the displayed claude mcp add-json --scope project command, or merge the JSON into .mcp.json at the repository root.

Claude Code's terraform-mcp-server example uses stdio.

Terraform MCP Server's Claude Code configuration invokes docker and a running Docker engine.

Terraform MCP Server's stored list contains 2 tools, including search_providers, get_provider_details. Compare those names with Claude Code's connected tool list; the stored list is not a live check.

No. The README also documents HCP Terraform and Terraform Enterprise workspace and private registry features.

Optional OpenTelemetry metrics cover tool calls, failures, and durations, plus HTTP metrics in streamable HTTP mode.