How to connect Terraform to Claude Code
The Terraform MCP server is published by hashicorp, which the listing marks as the vendor, and this guide adds it to Claude Code. It runs on your machine through Docker. The listing names no required key, though the publisher's command has placeholders to fill in. The setup comes from the listing's install data and Claude Code's documentation, last read on 2026-10-26.
Updated Oct 26, 2026 · Built from catalog data; how we rank and grade
Checked against Claude Code's documentation on Oct 26, 2026. Commands and config blocks are generated from the same install data as each listing page.
Before you start
- Claude Code installed and able to start.
- Docker (the server starts with docker).
- No API key is listed for Terraform.
1. Check what you need
Docker launches this server, so confirm it responds on your machine before you register anything with Claude Code.
Check that it is installed docker --version- The listing names no required key.
2. Add Terraform to Claude Code
The command passes
TFE_ADDRESS,TFE_TOKENandENABLE_TF_OPERATIONSto the server with-eflags. The.mcp.jsonform carries the same placeholders.Add it for you in every project claude mcp add --transport stdio --scope user terraform-mcp-server -- docker -e 'TFE_ADDRESS={address}' -e 'TFE_TOKEN={token}' -e 'ENABLE_TF_OPERATIONS={enabled}' docker.io/hashicorp/terraform-mcp-server:1.4.1Or share it with the project: put this in .mcp.json at the project root .mcp.json{ "mcpServers": { "terraform-mcp-server": { "command": "docker", "args": [ "-e", "TFE_ADDRESS={address}", "-e", "TFE_TOKEN={token}", "-e", "ENABLE_TF_OPERATIONS={enabled}", "docker.io/hashicorp/terraform-mcp-server:1.4.1" ] } } }- The publisher's command contains {address}, {token} and {enabled}. Replace it with your own value before you run the command.
3. Restart or reload if it does not appear
If Terraform is not listed after you add it, this step explains the docs' position on restarts and project approval.
- The docs do not say a restart is needed after claude mcp add. Servers connect at startup and can be reconnected from the /mcp menu.
- In an interactive session Claude Code asks you to approve servers from a project .mcp.json before it uses them; claude mcp reset-project-choices resets those answers.
Check that it works
Run claude mcp list or open /mcp. Once connected, the catalog records 61 tools for Terraform, for example action_run and add_team_member.
claude mcp list- Run claude mcp list from the shell, or /mcp inside a session. The list shows each server as Connected, Needs authentication, Failed to connect, or Pending approval.
- Once it is connected, Claude Code should list its tools; the catalog records 61 for Terraform, including action_run, add_team_member and attach_policy_set_to_workspaces.
Troubleshooting
- Error: MCP server has a "url" but no "type"
- Add "type": "http" (or sse) to the entry in the JSON file. Source
- MCP server already exists in local config
- Remove it from the other scope first with claude mcp remove <name> --scope <scope>, then add it again. Source
- A ${VAR} in the config stays literal
- The variable is unset. Export it before starting Claude Code or give it a default with ${VAR:-default}; claude mcp list shows a warning. Source
- Server shows disconnected in a session
- Open /mcp and reconnect it. Source
Security notes
- Publisher: hashicorp, listed as the vendor's own server; license MPL-2.0.
- It runs on your machine with your user account's permissions, so it can reach any file or network resource you can. Read its source before you give it access: https://github.com/hashicorp/terraform-mcp-server.
- The listing declares no required keys; use a token with the narrowest scope if the service asks for one.
- This listing has no security grade: Agent Market has not published security grades yet, so the choice is yours to make from the source and the permissions.
Servers and skills in this guide
Next, see other Terraform servers, compare them with this one, or open the general Claude Code guide.
- 1Terraform
hashicorpOfficial
Generate more accurate Terraform and automate workflows for HCP Terraform and Terraform Enterprise
★ 1.6KLast active Oct 23, 2026Local (stdio)Claude Code, Codex, VS Code, Cursor +2
AFreshness: A–Security: not graded yet
Related
Sources
- Connect Claude Code to tools via MCP · fetched Oct 26, 2026
Cite this page
How to connect Terraform to Claude Code. Agent Mart. https://agentmart.dev/guides/connect-terraform-to-claude-code (last updated 2026-10-26)