Terraform MCP Server

Query the Terraform Registry and manage HCP Terraform workspaces and runs from your AI assistant.

October 19, 2026
MCP ServerDevelopment Tools & DevOpsTerraform MCP Server

Terraform MCP Server

This page documents HashiCorp's official Terraform MCP server: hashicorp/terraform-mcp-server. It connects MCP clients to the public Terraform Registry and to HCP Terraform / Terraform Enterprise APIs.

Use it to look up provider, module, and policy documentation, and to inspect or manage HCP Terraform workspaces and runs.

What it Does

  • Registry search: Find provider, module, and Sentinel policy documentation
  • Provider details: Retrieve resource, data source, and function documentation, capabilities, and latest versions
  • Module details: Retrieve inputs, outputs, examples, submodules, and latest versions
  • HCP Terraform workspaces: List and inspect workspaces
  • Runs and plans: List runs, inspect plan details, logs, and JSON output, and act on runs

Installation

The upstream project publishes the Docker image hashicorp/terraform-mcp-server.

# Docker (stdio)
docker run -i --rm -e TFE_TOKEN=YOUR_TOKEN hashicorp/terraform-mcp-server:1.3.0

Configuration

{
  "mcpServers": {
    "terraform": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "TFE_TOKEN=YOUR_TOKEN",
        "hashicorp/terraform-mcp-server:1.3.0"
      ]
    }
  }
}

For HCP Terraform or Terraform Enterprise, also pass -e TFE_ADDRESS=https://app.terraform.io (or your TFE address). Add -e ENABLE_TF_OPERATIONS=true to enable destructive tools. To limit the tool surface, append --toolsets=registry or --tools=<names> after the image name.

Available Tools

ToolPurposeCategory
search_providersFind provider documentation by service nameRegistry
get_provider_detailsRetrieve full documentation for a provider componentRegistry
get_provider_capabilitiesDiscover the resource types a provider supportsRegistry
get_latest_provider_versionRetrieve the latest version of a providerRegistry
search_modulesFind modules by name or functionalityRegistry
get_module_detailsGet inputs, outputs, examples, and submodulesRegistry
get_latest_module_versionRetrieve the latest version of a moduleRegistry
search_policiesFind Sentinel policies by topic or requirementRegistry
get_policy_detailsRetrieve policy documentationRegistry
list_workspacesSearch and list workspaces in an organizationHCP Terraform
get_workspace_detailsGet workspace configuration, variables, and state informationHCP Terraform
list_runsList or search runs in a workspaceHCP Terraform
get_plan_detailsFetch metadata for a specific planHCP Terraform
get_plan_logsRetrieve the logs for a specific planHCP Terraform
get_plan_json_outputRetrieve the structured JSON output of a planHCP Terraform
action_runApply, discard, or cancel a run (requires ENABLE_TF_OPERATIONS=true)HCP Terraform

The full tool list is in the Terraform MCP server reference.

Common Workflows

Finding Provider Documentation

  1. Search providers for the service you are configuring
  2. Retrieve the full documentation for the relevant resource or data source
  3. Check the provider's capabilities and latest version
  4. Ask for a configuration example based on the returned documentation

Finding and Inspecting a Module

  1. Search modules by name or functionality
  2. Get module details for inputs, outputs, and examples
  3. Retrieve the latest module version
  4. Ask for a usage example based on the module documentation

Inspecting Runs and Plans

  1. List workspaces to find the target workspace
  2. List runs for that workspace
  3. Retrieve plan details, plan logs, or the plan JSON output
  4. Use action_run only when ENABLE_TF_OPERATIONS=true is set

Example Prompts

  • "Find the documentation for the AWS S3 bucket resource"
  • "Show me modules for deploying a Kubernetes cluster on AWS"
  • "What Sentinel policies are available for enforcing tagging?"
  • "List my HCP Terraform workspaces"
  • "Show the plan JSON output for the latest run in staging"

Troubleshooting

IssueLikely CauseSolution
Docker command failsDocker is not installed or runningStart Docker and confirm the hashicorp/terraform-mcp-server image can be pulled
Registry tools work but HCP Terraform tools are missingNo valid TFE_TOKENSet TFE_TOKEN; the terraform and registry-private toolsets are registered only with a valid token
Authentication errorsWrong token or addressVerify TFE_TOKEN and TFE_ADDRESS; TFE_ADDRESS must include the protocol
Destructive tool is rejectedENABLE_TF_OPERATIONS is not enabledSet ENABLE_TF_OPERATIONS=true
Certificate error behind a TLS-inspecting proxyThe container does not trust the corporate CAConfigure the container to trust the proxy CA certificate; see the upstream README

Supported Providers

The registry tools query the public Terraform Registry, so they cover providers and modules published there, including AWS, Azure, Google Cloud, Kubernetes, and others. The HCP Terraform tools operate on workspaces and runs in your organization.

Sources