Terraform MCP Server

by @hashicorp

Terraform MCP Server

Connect MCP assistants to Terraform Registry data and HCP Terraform or Terraform Enterprise. It supports infrastructure research, private registry access, and workspace operations with selectable tools and deployment transports.

Cloud & DevOps1,550goMPL-2.0

Server facts

Terraform MCP Server

GitHub stars

1,550

Last commit

Oct 17, 2026

Runtime

go

License

MPL-2.0

Project

Author
hashicorp
License
MPL-2.0

Tech

Runtime
goGo
Transports
stdio
Remote access
No

Activity

GitHub stars
1,550
Last commit
Data as of

Tags

  • Go
  • Infrastructure As Code
  • Terraform
  • Terraform Registry
  • Workspace Management

Overview

Terraform MCP Server brings Terraform information and platform operations into assistant-driven infrastructure workflows. It integrates with public Registry APIs for providers, modules, and policies, while also connecting to HCP Terraform and Terraform Enterprise. The README describes organization and project listing, private registry access, and workspace management. This makes the server relevant both when researching infrastructure components and when working with an existing Terraform platform environment.

Workspace capabilities include creating, updating, and deleting workspaces, plus handling variables, tags, and runs. Tool filtering allows deployments to select groups or individual operations rather than exposing the entire surface. Operations requiring explicit approval are controlled by a separate setting that defaults to disabled. The documentation also warns that queried Terraform data may be passed to the client and language model, and recommends reviewing generated recommendations against security, cost, and compliance requirements before implementation.

The server supports stdio and streamable HTTP. Docker examples cover common assistant clients, and Go installation is documented for a native executable. Platform address and token settings configure HCP Terraform or Enterprise access. HTTP settings include session behavior, allowed origins, TLS files, organization restrictions, and rate limits. Optional OpenTelemetry metrics report tool activity and HTTP behavior in network mode. The README links out to a fuller tool reference; the supplied text itself names provider search and detail tools in a filtering example but does not provide the complete catalog.

Install & configure

Requirements

  • Docker installed and running
  • An MCP-compatible assistant
Documented launch / install command
docker run -i --rm hashicorp/terraform-mcp-server

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.

Config file · macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Use Settings → Developer → Edit Config when available. Do not assume a Linux configuration path; check the client documentation for your platform. Remote servers use the app’s connector flow when supported, not the local stdio file shown here. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Desktop configuration
{
  "mcpServers": {
    "terraform-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "hashicorp/terraform-mcp-server"
      ],
      "env": {}
    }
  }
}

Read the Claude Desktop setup guide

Config file · Project: .cursor/mcp.json

User: ~/.cursor/mcp.json

The project path is relative to the workspace root. The tilde denotes your user home directory. Use Cursor’s MCP settings to confirm which configuration and scope your installed version is reading. Merge this example with existing settings; do not overwrite unrelated servers.

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

Read the Cursor setup guide

Config file · Workspace: .vscode/mcp.json

For user scope, use the “MCP: Open User Configuration” command if available. Do not guess a user configuration path across operating systems, profiles, containers, or remote workspaces; check the client documentation. Merge this example with existing settings; do not overwrite unrelated servers.

VS Code configuration
{
  "servers": {
    "terraform-mcp-server": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "hashicorp/terraform-mcp-server"
      ],
      "env": {}
    }
  }
}

Read the VS Code setup guide

Config file · macOS/Linux: ~/.codeium/windsurf/mcp_config.json

Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json

Open the MCP configuration through Windsurf’s settings when possible to confirm the active file. Paths can differ in managed or future releases; check the client documentation if this location is not present. Merge this example with existing settings; do not overwrite unrelated servers.

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

Read the Windsurf setup guide

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

The project file uses mcpServers. For user scope, use claude mcp add --scope user rather than assuming .mcp.json in your home directory is the user configuration. Check the client documentation for managed settings and storage details. Merge this example with existing settings; do not overwrite unrelated servers.

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

Read the Claude Code setup guide

Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.

Tools

Source: repository README. Tool descriptions are a documented snapshot, not a live capability check.

ToolWhat it does
search_providersSearch Terraform providers; named in the README's tool-filtering example.
get_provider_detailsRetrieve provider details; named in the README's tool-filtering example.

Use cases

  • Look up provider and module information while drafting Terraform configuration.
  • Access private registry information for an existing organization.
  • Manage Terraform workspaces, variables, tags, and runs.
  • Expose selected Terraform capabilities to a shared HTTP MCP client.

Strengths

  • Combines public Registry access with HCP Terraform and Enterprise integration.
  • Supports local stdio and configurable streamable HTTP.
  • Offers tool selection and optional OpenTelemetry metrics.

Limitations

  • Connected clients and models may receive sensitive Terraform data.
  • Write-capable platform operations need deliberate permission and tool configuration.
  • The complete tool catalog is linked externally rather than included in the supplied README.

Terraform MCP Server setup notes

  • Terraform MCP Server's stdio example needs a client that launches local processes.

Frequently asked questions

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

Related MCP servers