Terraform MCP Server
๐๏ธ๐๏ธโ๏ธ - The official Terraform MCP Server seamlessly integrates with the Terraform ecosystem, enabling provider discovery, module analysis, and direct Registry API integration for advanced Infrastructure as Code workflows.
What is Terraform MCP Server?
Terraform MCP Server is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to ๐๏ธ๐๏ธโ๏ธ - the official terraform mcp server seamlessly integrates with the terraform ecosystem, enabling provider discovery, module analysis, and direct registry api integration for advanced infrastr...
๐๏ธ๐๏ธโ๏ธ - The official Terraform MCP Server seamlessly integrates with the Terraform ecosystem, enabling provider discovery, module analysis, and direct Registry API integration for advanced Infrastructure as Code workflows.
This server falls under the Cloud Services category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- providerDetails
- resourceUsage
- moduleSearch
- listDataSources
- resourceArgumentDetails
Use Cases
Maintainer
Works with
Installation
NPM
npx -y terraform-mcp-serverManual Installation
npx -y terraform-mcp-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Terraform MCP Server
The official HashiCorp Terraform MCP Server integrates AI assistants directly with the Terraform ecosystem, exposing tools to search providers, inspect resource schemas, analyze modules from the Terraform Registry, and manage HCP Terraform or Terraform Enterprise workspaces and runs. It enables AI-driven Infrastructure as Code workflows where the assistant can look up real provider argument details, generate accurate resource configurations, and trigger remote Terraform plan and apply operations. DevOps engineers and platform teams use it to speed up IaC authoring, catch configuration errors before deployment, and automate routine workspace and variable management tasks.
Prerequisites
- Docker installed, or Go 1.21+ to build from source
- An MCP client such as Claude Desktop, Amazon Q Developer, or Claude Code
- A HCP Terraform or Terraform Enterprise account with an API token (TFE_TOKEN) if you want workspace and run management features
- Network access to registry.terraform.io for provider and module registry queries
Pull and run the Docker image
The simplest way to run the server is via the official Docker image in stdio mode, which is the default transport compatible with most MCP clients.
docker pull hashicorp/terraform-mcp-server:1.0.0
docker run -i --rm hashicorp/terraform-mcp-server:1.0.0Alternatively, install from source with Go
If you prefer a binary without Docker, install the server directly using the Go toolchain.
go install github.com/hashicorp/terraform-mcp-server/cmd/terraform-mcp-server@latest
terraform-mcp-server stdioConfigure your MCP client with Docker
Add the server to your MCP client configuration. Pass your HCP Terraform API token via the TFE_TOKEN environment variable. The TFE_ADDRESS variable is only needed for Terraform Enterprise (self-hosted); omit it for HCP Terraform.
Enable optional Terraform operations (plan/apply)
Tools that trigger Terraform runs are gated behind an explicit opt-in flag for safety. Set ENABLE_TF_OPERATIONS=true in the environment to enable them.
# Add to your docker run command or MCP env block:
# -e ENABLE_TF_OPERATIONS=trueTest with a registry query
Ask your MCP client to look up a Terraform provider. If the server is running correctly, it will return real resource and data source schemas from registry.terraform.io.
Terraform MCP Server Examples
Client configuration (Claude Desktop with Docker)
Claude Desktop configuration using the Docker image in stdio mode with HCP Terraform authentication.
{
"mcpServers": {
"terraform": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "TFE_TOKEN=your_hcp_terraform_token",
"-e", "ENABLE_TF_OPERATIONS=true",
"hashicorp/terraform-mcp-server:1.0.0"
]
}
}
}Prompts to try
Example prompts that exercise the Terraform MCP server's registry and workspace management tools.
- "List all resources available in the AWS Terraform provider version 5.x."
- "Show me the required and optional arguments for the aws_s3_bucket resource."
- "Search the Terraform Registry for modules that set up a VPC on AWS."
- "What data sources does the Google Cloud provider expose for IAM?"
- "List all workspaces in my HCP Terraform organization and show their current run status."
- "Create a new workspace called 'staging-api' in my HCP Terraform organization."Troubleshooting Terraform MCP Server
401 Unauthorized errors when accessing HCP Terraform workspaces
Verify that TFE_TOKEN is set correctly in the Docker environment or MCP config env block. Generate a new token at app.terraform.io under User Settings > Tokens. For Terraform Enterprise, also set TFE_ADDRESS to your self-hosted instance URL.
Tools for triggering runs are not available or return 'not enabled'
Set the environment variable ENABLE_TF_OPERATIONS=true. These tools are disabled by default as a safety measure and require explicit opt-in.
Corporate proxy or TLS errors when connecting to registry.terraform.io from Docker
Mount your corporate CA certificate bundle into the container. Use a Docker volume mount such as '-v /etc/ssl/certs/corporate-ca.crt:/usr/local/share/ca-certificates/corporate-ca.crt' and set the appropriate HTTPS_PROXY environment variable.
Frequently Asked Questions about Terraform MCP Server
What is Terraform MCP Server?
Terraform MCP Server is a Model Context Protocol (MCP) server that ๐๏ธ๐๏ธโ๏ธ - the official terraform mcp server seamlessly integrates with the terraform ecosystem, enabling provider discovery, module analysis, and direct registry api integration for advanced infrastructure as code workflows. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Terraform MCP Server?
Install via npm with the command: npx -y terraform-mcp-server. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).
Which AI clients work with Terraform MCP Server?
Terraform MCP Server works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Terraform MCP Server free to use?
Yes, Terraform MCP Server is open source and available under the MPL-2.0 license. You can use it freely in both personal and commercial projects.
Terraform MCP Server Alternatives โ Similar Cloud Services Servers
Looking for alternatives to Terraform MCP Server? Here are other popular cloud services servers you can use with Claude, Cursor, and VS Code.
Open WebUI
โ 138.2kUser-friendly AI Interface (Supports Ollama, OpenAI API, ...)
Anything LLM
โ 60.4kThe all-in-one AI productivity accelerator. On device and privacy first with no annoying setup or configuration.
LocalAI
โ 46.4kLocalAI is the open-source AI engine. Run any model - LLMs, vision, voice, image, video - on any hardware. No GPU required.
Nacos
โ 33.0kan easy-to-use dynamic service discovery, configuration and service management platform for building AI cloud native applications.
Xiaozhi ESP32
โ 26.7kๆฌ้กน็ฎไธบxiaozhi-esp32ๆไพๅ็ซฏๆๅก๏ผๅธฎๅฉๆจๅฟซ้ๆญๅปบESP32่ฎพๅคๆงๅถๆๅกๅจใBackend service for xiaozhi-esp32, helps you quickly build an ESP32 device control server.
Gateway
โ 11.8kA blazing fast AI Gateway with integrated guardrails. Route to 1,600+ LLMs, 50+ AI Guardrails with 1 fast & friendly API.
Browse More Cloud Services MCP Servers
Explore all cloud services servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Terraform MCP Server in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Terraform MCP Server?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.