Terraform MCP Server logo

Terraform MCP Server

by hashicorp

Connects AI assistants to Terraform Registry and HCP Terraform for discovery, workspace management, and IaC workflows.

Install Terraform MCP Server

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

Streamable HTTP (Remote)
Server URL
https://mcp.terraform.io/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 and HCP Terraform APIs. It supports provider, module, and policy discovery, private registry access, and HCP Terraform workspace operations such as managing variables, tags, and runs. The server runs over stdio by default or Streamable HTTP for centralized deployments, with optional approval-gated Terraform operations. Reach for it when an assistant needs Terraform ecosystem context or controlled access to HCP Terraform resources.

Use cases

  • Discover Terraform providers and modules
  • Inspect private Terraform Registry content
  • Manage HCP Terraform workspaces
  • Review workspace variables, tags, and runs
  • Monitor tool calls with OpenTelemetry metrics

Key features

  • Terraform Registry provider, module, and policy access
  • HCP Terraform and Terraform Enterprise integration
  • Workspace, variable, tag, and run management
  • Stdio and Streamable HTTP transports
  • Approval-gated Terraform operations
  • Optional OpenTelemetry metrics

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.

51/51 checks healthy over the last 92d

Adoption & maintenance

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

GitHub stars1.6kStargazers on the source repository.
Last commitTodayMost 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 exposes Terraform Registry and HCP Terraform capabilities through the Model Context Protocol. It is intended for Infrastructure as Code workflows where an MCP-compatible assistant needs to look up Terraform content or interact with HCP Terraform and Terraform Enterprise.

Registry access covers public providers, modules, and policies. HCP Terraform and Terraform Enterprise support includes organization and project listing, private registry access, workspace management, and run-related operations. Workspace actions can include creating, updating, and deleting workspaces, along with handling workspace variables and tags.

The server can also expose tools that require explicit approval. These operations are disabled by default and can be enabled through configuration.

How it works

The default transport is stdio, which suits local MCP client configurations. Streamable HTTP is also available for deployments where the server is accessed over an HTTP endpoint. HTTP settings include the bind host, port, MCP path, session mode, CORS behavior, TLS certificate and key files, and request rate limits.

HCP Terraform or Terraform Enterprise access uses an address and API token. The address must include a protocol such as https://app.terraform.io. HTTP deployments use the configured address rather than receiving it from a client header or query parameter.

For centralized deployments, the server can forward a client IP to HCP Terraform or Terraform Enterprise and can restrict HTTP access to an organization allowlist. Stateful and stateless session modes are supported. OpenTelemetry metrics can track tool-call volume, latency, failures, and default HTTP server metrics when enabled.

Setup and configuration

Docker is required for the containerized setup, and an AI assistant with MCP support is required for use. The server can be configured with environment variables or command-line options for logging, transport, Terraform access, security controls, and metrics.

Common settings include:

  • TFE_ADDRESS for the HCP Terraform or Terraform Enterprise API address
  • TFE_TOKEN for the Terraform API token
  • TRANSPORT_MODE=streamable-http to select HTTP instead of stdio
  • TRANSPORT_HOST, TRANSPORT_PORT, and MCP_ENDPOINT for the HTTP listener
  • ENABLE_TF_OPERATIONS=true for approval-required Terraform tools
  • MCP_TLS_CERT_FILE and MCP_TLS_KEY_FILE for non-localhost TLS deployments
  • OTEL_METRICS_ENABLED=true and related settings for OpenTelemetry metrics

TLS verification can be disabled with TFE_SKIP_TLS_VERIFY, although this changes the security posture of calls to HCP Terraform or Terraform Enterprise. The shared-secret option should be used only over TLS.

Tools and capabilities

Available capabilities include:

  • Searching and inspecting Terraform Registry providers
  • Finding and analyzing Terraform modules
  • Accessing Terraform policies
  • Listing HCP Terraform organizations and projects
  • Working with private registry content
  • Creating, updating, and deleting workspaces
  • Managing workspace variables and tags
  • Managing or inspecting Terraform runs
  • Filtering the tools exposed to an MCP client
  • Exporting tool and server metrics through OpenTelemetry

The exact data returned to the assistant depends on the request and the connected MCP client.

Limitations and notes

Terraform data may be exposed to the MCP client and its language model depending on the query. Use the server only with MCP clients and language models that are trusted for the data involved.

Assistant-generated outputs and recommendations can vary with the query, model, and client. Review proposed changes for security, cost, and compliance before applying them. HTTP deployments also require careful configuration of TLS, CORS, rate limits, trusted proxy hops, and forwarded client IP handling.

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, workspace management, variables, tags, and Terraform run operations over stdio or Streamable HTTP.

Install Docker and an MCP-compatible AI assistant, then configure the server for the selected client. The server supports containerized use and can run with stdio by default or Streamable HTTP when `TRANSPORT_MODE=streamable-http` is selected.

Set `TFE_ADDRESS` to the HCP Terraform address, including its protocol, and provide a Terraform API token through `TFE_TOKEN`. Streamable HTTP deployments must use the configured address rather than supplying it through a client header or query parameter.

Yes, Cursor is listed as a supported client. Configure Cursor to launch the server through its MCP settings, using stdio for a local process or the Streamable HTTP endpoint for an HTTP deployment.

Set `ENABLE_TF_OPERATIONS=true` to enable tools that require explicit approval. These tools are disabled by default, so enabling them should be part of a deliberate deployment and review process.

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>