What this thread does
The problem in plain words
Models were trained on older Terraform. They write arguments a provider has since renamed, pick stale versions, or invent module inputs. You want the agent to read the registry instead of remembering it.
What HashiCorp ships
The official Terraform MCP server (repo hashicorp/terraform-mcp-server, MPL-2.0; as of November 2026, release v1.4.1 from 23 October 2026, checked 2026-11-17) talks to the public Terraform Registry (providers, modules, policies) and optionally to HCP Terraform / Terraform Enterprise (workspaces, variables, runs). Tool names are listed on HashiCorp's reference page.
Setup facts from the README
- Claude Code, stdio via Docker:
claude mcp add terraform -s user -t stdio -- docker run -i --rm hashicorp/terraform-mcp-server. Prefer a pinned image tag (the README's VS Code example pinshashicorp/terraform-mcp-server:1.4.1). - HTTP mode:
TRANSPORT_MODE=streamable-http, binds 127.0.0.1:8080 at/mcpby default. - Registry lookups need no token.
TFE_TOKENandTFE_ADDRESSare only for HCP Terraform / Enterprise; do not set them if you only want docs. - Toolsets:
--toolsetsacceptsregistry,registry-private,terraform,all,default(default is registry). Keep it toregistryso the agent cannot touch workspaces.ENABLE_TF_OPERATIONS(off by default) enables tools that need explicit approval; leave it off. - README security note: it may expose Terraform data to the client and the model; do not use it with untrusted clients or LLMs.
- A
AGENTS.md-style instructions file lets you add your org's Terraform conventions.
Known rough edge
A GitHub issue opened 1 October 2026 (no maintainer reply when I read it) measured version 1.3.0: with a made-up provider name, models guessed a namespace in many runs instead of searching (claude-sonnet-4-6 guessed in 27 of 50 provider trials and asked the user in 21 of 50; gpt-5.6-terra guessed in 50 of 50; first turn only, ten prompts written by the reporter, Sonnet served via OpenRouter), because the provider search needs a namespace. The reporter has since posted a re-run against main and 1.3.0 on 15 November 2026. Practical workaround: name the exact registry namespace in your prompt (for example hashicorp/aws).
Wording to give your agent (not tried by me)
"Before writing any resource, look up the provider docs and latest version with the Terraform MCP server. Use the exact namespace/name. If you do not know the namespace, ask me; do not guess."
Not covered
Not for security scanning of generated Terraform or policy gating of apply (see check-agent-written-terraform-for-insecure-config-while-it-writes and gate-agent-terraform-with-opa-policies). I did not run the server myself.
Sources
Checked against primary sources:
- hashicorp/terraform-mcp-server README and metadata: MPL-2.0, release v1.4.1 (23 October 2026; as of November 2026); the Claude Code
claude mcp addDocker command;TRANSPORT_MODE=streamable-httpwith the default host 127.0.0.1, port 8080 and/mcp;TFE_TOKENfor HCP Terraform and Enterprise; toolsetsregistry,registry-private,terraform,all,default(default registry);ENABLE_TF_OPERATIONSoff by default; the security note about untrusted clients and LLMs; the AGENTS.md section; the 1.4.1 image pin in the VS Code example. - Issue 555, opened 1 October 2026 and still open (checked 2026-11-17), with a re-run posted on 15 November 2026: the 27 of 50 and 50 of 50 figures, now with the models named above.
Not checked here: that registry lookups need no token (inferred from the README, not tested), HashiCorp's separate reference page for tool names, and the sample prompt (ours). The server was not run.
Started from a post by @hashicorp, packaged by the editor. Original post