MCP/Terraform MCP Server
Terraform MCP Server logo

Terraform MCP Server

Verified Golden (1000+ GitHub stars)

Official HashiCorp Terraform MCP server connecting AI assistants with Terraform Registry, HCP Terraform, and Terraform Enterprise.

developer-tools•Cloud & Infrastructure
GitHub1.6k
License:MPL-2.0
OFFICIAL

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.

Real-time Interaction

Direct low-latency RPC protocol communication with structured JSON schemas.

Scoped Sandboxing

Restricted capability bounds to prevent accidental modifications or leakage.

Security & Best Practices

TFE Token Scoping: Configure API tokens (TFE_TOKEN) with least-privilege organization and workspace permissions.
Containerized Isolation: Run within isolated Docker containers to prevent ambient host credential leakage.
Approval Guardrails: Write operations and run triggers respect ENABLE_TF_OPERATIONS environment gating.

When to Use (and When Not To)

Best For
  • •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
Not For / Limitations
  • •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

terminal command
$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.1

Exposed Tools & Endpoints

6 tools

Functions your AI agent can invoke via this Model Context Protocol server

terraform_registry_search_modules

Searches the public Terraform Registry for verified modules matching specific infrastructure patterns and cloud providers.

terraform_registry_search_providers

Looks up Terraform providers, supported resource schemas, data sources, and version constraints.

terraform_list_workspaces

Lists HCP Terraform / Terraform Enterprise workspaces within an organization including execution modes and VCS branches.

terraform_get_workspace

Retrieves comprehensive configuration, current run status, and locked state details for an HCP Terraform workspace.

terraform_list_runs

Inspects recent plan and apply runs for a workspace, displaying run status, cost estimates, and policy results.

terraform_manage_variables

Reads and modifies Terraform variables (HCL/string) and sensitive environment variables in an HCP workspace.