Terraform MCP Server logo

Terraform MCP Server

by hashicorp

Connects MCP clients to Terraform Registry, HCP Terraform, and Terraform Enterprise for discovery and workspace operations.

Install Terraform MCP Server

Pick your client, then add it in one click or paste the config.

Streamable HTTP (Remote)
Server URL
http://localhost:8080/mcp

Remote servers are added in the app, not the config file: Customize → Connectors → Add custom connector, then paste this URL.

Overview

hashicorp/terraform-mcp-server connects MCP-compatible AI assistants to the Terraform Registry, HCP Terraform, and Terraform Enterprise APIs. It exposes tools for provider, module, and policy discovery, private registry access, workspace management, variables, tags, and runs. The server supports stdio by default and Streamable HTTP for local or centralized deployments, with optional approval-gated Terraform operations. Reach for it when an agent needs to inspect Terraform resources or manage HCP Terraform workspaces through an MCP interface.

Use cases

  • Discover Terraform providers and modules
  • Inspect public or private Registry resources
  • List HCP Terraform organizations and projects
  • Manage Terraform workspaces and variables
  • Review workspace runs through an MCP client

Key features

  • Terraform Registry provider, module, and policy discovery
  • HCP Terraform and Terraform Enterprise API access
  • Workspace, variable, tag, and run management
  • Stdio and Streamable HTTP transports
  • Optional approval-gated Terraform operations
  • OpenTelemetry and Instana observability options

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked Today

Recent health check succeeded.

29/29 checks healthy over the last 79d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars1.6kStargazers on the source repository.
Last commit1d agoMost recent push to the default branch.
Directory activity3 viewsConfig copies, upvotes, and views on AllMCPs.

How Terraform MCP Server works

What hashicorp/terraform-mcp-server does

hashicorp/terraform-mcp-server gives MCP clients access to Terraform ecosystem APIs. It can query public Registry data for providers, modules, and policies, and it supports HCP Terraform and Terraform Enterprise features such as organization and project listing, private registry access, and workspace operations.

Workspace-oriented operations include creating, updating, and deleting workspaces, working with workspace variables and tags, and managing runs. Operations that require explicit approval can be enabled separately through configuration.

How it works

The server communicates with MCP clients over stdio or Streamable HTTP. Stdio is the default transport. HTTP deployments can bind to a configured host and port, expose a configurable MCP endpoint, use stateful or stateless sessions, and apply CORS and rate-limit settings.

Terraform Enterprise or HCP Terraform requests use the configured service address and API token. HTTP deployments can also pass a shared secret, forward client IP information, restrict access by organization, and terminate TLS using certificate and key files. OpenTelemetry metrics can record tool-call volume, latency, failures, and server HTTP metrics when enabled; Instana instrumentation is also available for Streamable HTTP deployments.

Setup and configuration

Docker is required for the containerized setup, and the client must support MCP. Configuration is available through environment variables. TFE_ADDRESS selects the HCP Terraform or Terraform Enterprise endpoint, while TFE_TOKEN supplies its API token. TRANSPORT_MODE=streamable-http switches from stdio to HTTP; TRANSPORT_HOST, TRANSPORT_PORT, and MCP_ENDPOINT control the HTTP listener.

HTTP deployments can configure MCP_SESSION_MODE, MCP_ALLOWED_ORIGINS, MCP_CORS_MODE, MCP_TLS_CERT_FILE, MCP_TLS_KEY_FILE, and rate limits. Logging uses LOG_LEVEL and LOG_FORMAT. Set ENABLE_TF_OPERATIONS=true to enable approval-requiring tools. Metrics use the OTEL_* settings, and INSTANA_ENABLED=true enables Instana instrumentation when an accessible Instana agent is available.

The project documents configuration examples for Visual Studio Code, Cursor, Claude Desktop, Claude Code, Codex CLI, and Gemini extensions. It also supports building and running the server from source or as a locally built Docker image.

Tools and capabilities

  • Search Terraform Registry providers, modules, and policies.
  • List HCP Terraform or Terraform Enterprise organizations and projects.
  • Access private registry content.
  • Create, update, and delete workspaces.
  • Manage workspace variables, tags, and runs.
  • Expose optional tool-usage and HTTP metrics through OpenTelemetry.

Limitations and notes

Queries can expose Terraform data to the MCP client and its connected language model, so the server should not be used with untrusted clients or models. Generated outputs and recommendations vary with the query, model, and client; review them against security, cost, and compliance requirements before applying them.

For centralized HTTP deployments, TLS, origin controls, rate limits, trusted proxy settings, and organization allowlists should be configured according to the deployment topology. Skipping TLS verification is available as an option, but it changes certificate validation behavior.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Terraform MCP Server

hashicorp/terraform-mcp-server is an MCP server that connects AI assistants to the Terraform Registry, HCP Terraform, and Terraform Enterprise. Its main tools support provider, module, and policy discovery, private registry access, organization and project listing, and workspace operations including variables, tags, and runs.

Install Docker for the containerized setup and use an MCP-compatible AI assistant. The server can also be built from source or run from a locally built Docker image. Client-specific setup instructions are provided for Visual Studio Code, Cursor, Claude Desktop, Claude Code, Codex CLI, and Gemini extensions.

Set TFE_ADDRESS to the HCP Terraform or Terraform Enterprise URL and provide TFE_TOKEN with an API token. HTTP mode requires the address to come from configuration, and additional settings can control TLS verification, shared-secret authentication, organization access, and client-IP forwarding.

Set TRANSPORT_MODE to streamable-http. Use TRANSPORT_HOST, TRANSPORT_PORT, and MCP_ENDPOINT to configure the listener and MCP path. HTTP deployments can additionally configure sessions, CORS, TLS certificates, allowed origins, rate limits, and organization allowlists.

Yes, Cursor is one of the documented client integrations. Configure Cursor to launch the server through its MCP settings, then provide the Terraform endpoint and token through the server configuration when HCP Terraform or Terraform Enterprise access is needed.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewTerraform MCP Server AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/hashicorp-terraform-mcp-server?style=directory)](https://allmcps.com/mcp/hashicorp-terraform-mcp-server)
HTML Embed
<a href="https://allmcps.com/mcp/hashicorp-terraform-mcp-server"><img src="https://allmcps.com/api/badge/hashicorp-terraform-mcp-server?style=directory" alt="Terraform MCP Server on AllMCPs" /></a>