Terraform MCP Server
Official HashiCorp Terraform MCP server connecting AI assistants with Terraform Registry, HCP Terraform, and Terraform Enterprise.
About this Server
Official Terraform MCP Server (`terraform` / `hashicorp/terraform-mcp-server`) provides deep integration between AI assistants and the HashiCorp Terraform ecosystem. It empowers coding agents to query the public Terraform Registry for providers, modules, and policies, as well as interact with HCP Terraform and Terraform Enterprise APIs to inspect workspaces, manage state variables, review runs, and trigger automated IaC executions.
Direct low-latency RPC protocol communication with structured JSON schemas.
Restricted capability bounds to prevent accidental modifications or leakage.
Security & Best Practices
When to Use (and When Not To)
- •Discovering and comparing official Terraform modules and providers directly from your editor
- •Managing HCP Terraform and Terraform Enterprise workspaces, variables, and speculative plan runs
- •Automating multi-cloud IaC workflows alongside AWS, Azure, and Kubernetes servers
- •Static AWS cost policy checking on raw .tf files without executing (use CloudBurn MCP instead)
- •Direct raw AWS CLI commands or local pipe execution (use AWS Cloud MCP Server instead)
- •Single-click frontend site hosting and DNS setup (use DropTheHassle MCP instead)
Install & Setup
claude mcp add terraform -s user -t stdio -- docker run -i --rm -e TFE_TOKEN="${TFE_TOKEN}" -e TFE_ADDRESS="${TFE_ADDRESS}" hashicorp/terraform-mcp-server:1.4.1Exposed Tools & Endpoints
6 toolsFunctions your AI agent can invoke via this Model Context Protocol server
Searches the public Terraform Registry for verified modules matching specific infrastructure patterns and cloud providers.
Looks up Terraform providers, supported resource schemas, data sources, and version constraints.
Lists HCP Terraform / Terraform Enterprise workspaces within an organization including execution modes and VCS branches.
Retrieves comprehensive configuration, current run status, and locked state details for an HCP Terraform workspace.
Inspects recent plan and apply runs for a workspace, displaying run status, cost estimates, and policy results.
Reads and modifies Terraform variables (HCL/string) and sensitive environment variables in an HCP workspace.