Purpose: Terraform MCP Server is a Model Context Protocol (MCP) server that connects the Terraform ecosystem with AI assistants, providing automation and interaction capabilities for Infrastructure as Code (IaC) development.
Main capabilities: Supports two transports, Stdio and StreamableHTTP; integrates the public Terraform Registry API to query providers, modules, and policies; supports HCP Terraform and Terraform Enterprise, including workspace management, organization/project listing, and private registry access; workspace operations can create, update, and delete, and support variables, tags, and run management; in Streamable HTTP mode, records tool invocation counts, latency, and failures via OpenTelemetry, and exposes default HTTP server metrics.
Usage: Requires installing and running Docker (containerized deployment), and installing an MCP-compatible AI assistant. It can be configured for use in clients such as VS Code, Cursor, Claude Desktop, Amazon Q Developer, Kiro CLI, Claude Code, Codex CLI, Gemini extensions, Bob IDE/Shell, etc. The StreamableHTTP endpoint defaults to http://{hostname}:8080/mcp,健康检查为 /health; enable by setting TRANSPORT_MODE=http or TRANSPORT_PORT=8080. Use --toolsets (registry, registry-private, terraform, all, default) or --tools (individual tools) to control the tool scope; the two cannot be used at the same time. Kubernetes can be deployed using the Helm chart under helm/terraform-mcp-server, or built from source.
Limitations and security: The MCP server may expose Terraform data to MCP clients and LLMs; do not use it with untrusted clients or LLMs. Outputs and suggestions are dynamically generated and require human review before implementation. For centralized deployment, it is recommended to enable TLS, configure MCP_ALLOWED_ORIGINS, and avoid passing tokens in query parameters. TFE_ADDRESS cannot be set by clients and comes only from server-side environment variables. Use of third-party MCP clients/LLMs is subject to their own terms.
Other: The default instructions are located at cmd/terraform-mcp-server/instructions.md and can be replaced according to organizational practices and rebuilt; AGENTS.md can provide project context for coding agents. The license is MPL-2.0.