Terraform MCP Server
Lets your AI agent use Terraform Registry data and manage HCP Terraform and Terraform Enterprise workspaces.
1.6k stars on GitHubby HashiCorpLicense MPL-2.0Updated 18 days ago
How to install
This MCP is local: it runs on your computer.
It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Codeβ¦). Choose your app:
Paste in the terminal:
claude mcp add terraform -- docker run -i --rm -e "TFE_ADDRESS=<address>" -e "TFE_TOKEN=<token>" -e "ENABLE_TF_OPERATIONS=<enabled>" docker.io/hashicorp/terraform-mcp-server:1.4.1
Ready! Now test it
Restart the app and paste one of these requests in the chat:
Find the latest AWS provider resource for an S3 bucket and write the Terraform.
Create a new workspace called staging-network in my HCP Terraform organization.
What it is
The Terraform MCP Server connects your AI agent to the Terraform Registry, so it can look up providers, modules and policies and write more accurate Terraform. It also connects to HCP Terraform and Terraform Enterprise to manage workspaces, variables, tags and runs.
What it can do
- Terraform Registry lookups for providers, modules and policies
- Create, update and delete HCP Terraform workspaces
- Manage workspace variables, tags and runs
- List organizations and projects
- Private registry access
- OpenTelemetry metrics on tool usage in HTTP mode
When to use
- βΊWhen you want your agent to write Terraform using current provider documentation.
- βΊWhen you want to manage HCP Terraform workspaces from chat.
- βΊWhen you want to review runs and variables across projects.
What you need
Skills that pair well
MCP or skill?
The MCP gives the agent the hands. The skill teaches the right way to use them. Together, the result is better and uses fewer tokens.
terraform-skillHelps your agent write, test, and review Terraform or OpenTofu infrastructure code, covering modules, CI/CD, security scanning, and state issues.terraform-patternsHelps your agent write and review Terraform infrastructure code, with secure state setup, reusable modules and checks for misconfigurations.terraform-infrastructureHelps your agent manage cloud infrastructure with Terraform. It teaches creating modules, managing state, and automating provisioning for scale.Frequently asked questions
Is it official?
Yes, it is the Terraform MCP Server from HashiCorp (the readme refers to IBM in its legal note).
Do I need a token?
A TFE_TOKEN is needed for HCP Terraform or Terraform Enterprise features. Public Registry lookups use public Terraform Registry APIs.
Which transports are supported?
Stdio (the default) and StreamableHTTP.
Is it safe to use with any model?
The readme warns that Terraform data may be exposed to the MCP client and LLM, so do not use it with untrusted clients or LLMs.
Should I trust its output?
The readme says outputs are generated dynamically and should be reviewed against your security, cost and compliance requirements.
Can I turn tools off?
Yes. There are --toolsets and --tools options, and a tool filtering section in the readme.
If it does not work
- βΊMake sure Docker is installed and running before starting the server.
- βΊSet TFE_TOKEN (and TFE_ADDRESS with https:// for Enterprise) for HCP Terraform features.
- βΊBehind a corporate proxy with TLS inspection, see the readme's troubleshooting section; TFE_SKIP_TLS_VERIFY is available.
5 new skills a week. 1 minute to read.