Skip to content

MCP setupDevOps and cloud

Terraform MCP Server

Give your agent HashiCorp's Terraform MCP server to look up current provider and module docs from the registry while it writes infrastructure code.

npx workspacetemplates add terraform-mcp --tool claude-code

Writes 1 file to your project root

.mcp.jsonmerge into your file13 lines · 194 BFile
{
  "mcpServers": {
    "terraform": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "hashicorp/terraform-mcp-server:1.4.1"
      ]
    }
  }
}

What it does

Models often write Terraform from memory of older provider versions. HashiCorp's MCP server lets the agent search the Terraform Registry for the real resource arguments, provider versions and modules before it writes a block.

The default toolset is registry lookups only, which needs no credentials. The server runs from HashiCorp's Docker image over stdio. Tools that act on HCP Terraform workspaces need a token and are a separate step you add later.

Example

you › Using the registry docs, write an aws_s3_bucket_versioning resource for my logs bucket and tell me which provider version it needs.

agent › The docs show aws_s3_bucket_versioning with a versioning_configuration block (status = "Enabled"), available in AWS provider 4.0 and later. Added to storage.tf with the bucket id wired in.

Questions

Do I need a Terraform Cloud token?
Not for registry lookups. TFE_TOKEN and TFE_ADDRESS matter only for HCP Terraform or Enterprise tools such as listing workspaces.
Can it run terraform apply?
Not in the default setup. Tools that need explicit approval stay off unless you set ENABLE_TF_OPERATIONS.
Why a pinned image tag?
A fixed tag keeps behavior the same between runs. Check the repository for a newer release when you want to update.
  • AWS Documentation MCP Server

    MCP setupDevOps and cloud

    Free
  • Azure MCP Server

    MCP setupDevOps and cloud

    Free
  • CircleCI MCP Server

    MCP setupDevOps and cloud

    Free
  • Cloudflare MCP Server

    MCP setupDevOps and cloud

    Free