Models hallucinate Terraform arguments constantly — a plausible attribute name that no provider version ever shipped. HashiCorp’s official MCP server fixes the root cause by giving the model live access to the Terraform Registry: real provider documentation, real modules, real policies, resolved against the version you are actually using.
Bring your own
Claude Sonnet 4.5
Chat with 60+ AI models on the same workflow — switch to a different model mid-conversation and re-run the same prompt, or use Compare mode to put several side-by-side and balance quality vs. cost.
No token required
How models use it and what it is built for.
The Terraform MCP server is a documentation and registry tool first. An agent searches for a provider, resolves it to a concrete version, and pulls the actual documentation for a resource or data source before it writes a single line of HCL — which is the difference between generated configuration that plans cleanly and configuration that fails on an unknown argument. The same search-then-fetch pattern covers registry modules and Sentinel policies. Beyond the public registry, setting a TFE address and token unlocks the HCP Terraform and Terraform Enterprise APIs, so an agent can list organizations and workspaces, inspect runs and read state versions. It runs over stdio for local clients and can also be started in streamable-HTTP mode when you want to host it for a team.
Typical tools an AI model can call. Exact names vary by version.
Taken from the official Terraform documentation — see hashicorp/terraform-mcp-server — official repository for the full reference.
Environment variables
TFE_ADDRESSBase URL of your HCP Terraform or Terraform Enterprise instance. Defaults to app.terraform.io.
TFE_TOKENAPI token for HCP Terraform or Terraform Enterprise. Required only for the workspace, run and state tools.
TRANSPORT_MODESet to http to run the server in streamable-HTTP mode instead of stdio, for hosting it centrally.
Client configuration
Docker (recommended)
HashiCorp publishes the image; nothing to install on the host beyond Docker itself.
{
"mcpServers": {
"terraform": {
"command": "docker",
"args": ["run", "-i", "--rm", "hashicorp/terraform-mcp-server"]
}
}
}With HCP Terraform access
Adds the workspace, run and state-version tools on top of the public registry lookups.
{
"mcpServers": {
"terraform": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "TFE_ADDRESS", "-e", "TFE_TOKEN",
"hashicorp/terraform-mcp-server"
],
"env": {
"TFE_ADDRESS": "https://app.terraform.io",
"TFE_TOKEN": "YOUR_TOKEN"
}
}
}
}Copy any of these into MCP Agent Studio after connecting.
What are the required arguments for aws_ecs_service in the latest AWS provider?
Find a registry module for a VPC with private subnets and show me its inputs.
Write a Terraform config for a Cloudflare DNS record, checking the real docs first.
Which of my HCP Terraform workspaces have runs that errored this week?
This is not a single-model product: you get the same MCP connection with 60+ models (Claude, GPT, Gemini, DeepSeek, open-weight, and more), you can switch mid-conversation, and you can open Compare mode to run the same prompt against multiple models at once. The card above is a suggested starting point for this server — not the only choice.
Default pick for Terraform
Claude Sonnet 4.5
Writing HCL against fetched documentation is a code-generation task with a verification step. Sonnet 4.5 reliably reads the docs before it writes rather than after.
Listing tools proves the server is reachable, not that a model can work with it. Evals go further: they read every tool on the server, write a test suite from its real schemas, and run it — code decides pass/fail on the responses (schema conformance, error codes, pagination, result caps) while a scoring model grades plain-English tasks driven through the tools.
Get a pass/fail report per tool with the evidence behind each verdict — and replay the same suite after every schema change. Destructive tools are excluded from the run.
Run evalsOpen MCP Agent Studio with the connection pre-filled. Add your token, pick any of 60+ models, and start chatting — no install required.
Open Agent StudioCommon questions about connecting, scoping and using it safely.
It is HashiCorp’s official MCP server for the Terraform ecosystem. It gives an AI agent live access to Terraform Registry provider documentation, modules and policies, and optionally to HCP Terraform or Terraform Enterprise workspaces and runs.
Not against your local working directory. The public tools are registry lookups, and the HCP Terraform tools read organizations, workspaces, runs and state versions through the API. It is a research and inspection server, not a local execution wrapper.
Because the model stops guessing. A provider’s arguments change between versions, and a model trained months ago will confidently produce an attribute that was renamed or never existed. Resolving the provider version and fetching the real documentation removes that whole failure mode.
Not for registry lookups, which are public and need no credentials. A TFE token is only required for the HCP Terraform and Terraform Enterprise tools.
Yes. Setting TRANSPORT_MODE to http starts the server in streamable-HTTP mode, so one instance can serve many clients instead of every developer running their own stdio process.
AWS
Query AWS docs, pricing and infrastructure through an AI agent.
Kubernetes
Inspect and operate a cluster through the Kubernetes API, not kubectl.
Docker
List containers, inspect images and manage your Docker environment with AI.
Cloudflare
Drive Workers, DNS, R2, D1 and the rest of the Cloudflare API with AI.