MCP server · Cloud and DevOps
Terraform MCP server
The Terraform MCP server is HashiCorp’s official MCP server. It lets an assistant look up current Terraform provider, module and policy docs and manage HCP Terraform workspaces, runs and variables. It runs locally in Docker; a TFE_TOKEN is needed only for workspace and run tools, so scope that token tightly.
- Maintainer
- HashiCorp (official)
- Licence
- MPL-2.0
- Runs
- Locally (docker)
- Sign-in
- Optional token
- Registry version
- 1.4.1 (updated 2026-10-23)
- Last activity
- 2026-10-13
Overview
What can the Terraform MCP server do?
The Terraform MCP Server connects an assistant to the public Terraform Registry and, if you supply a token, to HCP Terraform or Terraform Enterprise. HashiCorp distributes it as a Docker image and documents both stdio and Streamable HTTP transports. With no token the default registry toolset still works, so the assistant can search providers, read resource documentation, find the latest provider and module versions and look up Sentinel policies.
Adding TFE_TOKEN (and TFE_ADDRESS for Terraform Enterprise) enables the terraform toolset: list organisations, projects and workspaces, inspect runs, plans and applies, manage variables and variable sets, and search private modules and providers. It is a good fit when you write Terraform with an assistant and want it to use real, current provider schemas instead of guessing. You can narrow tools with --toolsets or --tools, and HashiCorp warns not to use it with untrusted clients or models.
Tools
Tools it gives the assistant
- Provider tools: search providers, get provider details, capabilities and latest version
- Module tools: search modules, get module details and latest version
- Policy tools: search Sentinel policies and get policy details
- HCP Terraform and Terraform Enterprise: organisations, projects, workspaces and runs
- Plan and apply details, logs and JSON plan output
- Variable and variable set management
- Private registry modules and providers
Install
How do I install Terraform MCP in Claude Code, Cursor or VS Code?
You need:
- Docker
- An HCP Terraform or Terraform Enterprise API token only for workspace and run tools
Run in your project. --scope local keeps the servers private to you in this project; use user for every project.
claude mcp add --env TFE_TOKEN="${TFE_TOKEN}" --scope local terraform -- docker run -i --rm -e TFE_TOKEN hashicorp/terraform-mcp-server:1.3.0
claude mcp add --env TFE_TOKEN="$env:TFE_TOKEN" --scope local terraform -- docker run -i --rm -e TFE_TOKEN hashicorp/terraform-mcp-server:1.3.0
- Set TFE_TOKEN first, e.g. export TFE_TOKEN=… in your shell. The command saves the value, not the variable.
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json · Windows: %APPDATA%\Claude\claude_desktop_config.json (Settings → Developer → Edit Config). Restart Claude after saving.
{
"mcpServers": {
"terraform": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"TFE_TOKEN",
"hashicorp/terraform-mcp-server:1.3.0"
],
"env": {
"TFE_TOKEN": "<TFE_TOKEN>"
}
}
}
}
- Claude Desktop doesn’t read variables in this file: replace <TFE_TOKEN> with the real values.
- This file contains your keys once filled in. It lives in your user folder; never commit or share it.
In your project, or ~/.cursor/mcp.json for every project.
{
"mcpServers": {
"terraform": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"TFE_TOKEN",
"hashicorp/terraform-mcp-server:1.3.0"
],
"env": {
"TFE_TOKEN": "${env:TFE_TOKEN}"
}
}
}
}
In your workspace. VS Code asks for each secret the first time a server starts and stores it securely.
{
"inputs": [
{
"type": "promptString",
"id": "tfe-token",
"description": "TFE_TOKEN",
"password": true
}
],
"servers": {
"terraform": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"TFE_TOKEN",
"hashicorp/terraform-mcp-server:1.3.0"
],
"env": {
"TFE_TOKEN": "${input:tfe-token}"
}
}
}
}
Need another app? Open Terraform MCP Server in the MCP config generator for a shared project .mcp.json, Devin, or several servers at once; it writes one file per app. The snippets follow the setup in the server’s README, checked on 2026-10-14.
Is the Terraform MCP server safe? Check before you install
- With TFE_TOKEN set, the server can read workspace state and variables and create runs; scope the token to what the assistant needs.
- ENABLE_TF_OPERATIONS=true (off by default) gates only action_run (apply, discard, cancel), delete_workspace_safely, force_unlock_workspace, delete_project, delete_team and create_run’s auto_approve and is_destroy options. create_workspace and update_workspace work with any valid token.
- A local MCP server runs with your user account’s permissions. Install it only from the source linked above. See how to choose a safe server.
FAQ
Terraform MCP questions
Is the Terraform MCP server official?
Yes. HashiCorp publishes and maintains it, under the MPL-2.0 licence. Install it only from the source linked on this page, not from a copy in another directory.
Is Terraform MCP server remote or local?
Local. Your MCP app starts it on your machine with docker, and it runs with your user account’s permissions.
Does Terraform MCP server need an API key or account?
Not to start. It works without a key, and an API key or token from the service adds higher limits or more tools. You also need: Docker; An HCP Terraform or Terraform Enterprise API token only for workspace and run tools.
Why it’s listed
Why we list it
HashiCorp’s own server keeps an assistant’s Terraform code in line with real registry docs, with risky operations off by default.
Related
Alternatives and related servers: cloud and devops
- Firebase MCP Server
- Heroku Platform MCP Server
- Cloud Run MCP
- Pulumi MCP Server
- Render MCP Server
- Cloudflare Documentation MCP Server
All MCP serversMCP config generatorGuide: MCP servers in Claude CodeGuide: what is MCP?