Terraform MCP Server

v0.5.0โ€ขCloud Servicesโ€ขstable

๐ŸŽ–๏ธ๐ŸŽ๏ธโ˜๏ธ - The official Terraform MCP Server seamlessly integrates with the Terraform ecosystem, enabling provider discovery, module analysis, and direct Registry API integration for advanced Infrastructure as Code workflows.

terraformmcpai-integration
Share:
1,373
Stars
0
Downloads
0
Weekly
0/5

What is Terraform MCP Server?

Terraform MCP Server is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to ๐ŸŽ–๏ธ๐ŸŽ๏ธโ˜๏ธ - the official terraform mcp server seamlessly integrates with the terraform ecosystem, enabling provider discovery, module analysis, and direct registry api integration for advanced infrastr...

๐ŸŽ–๏ธ๐ŸŽ๏ธโ˜๏ธ - The official Terraform MCP Server seamlessly integrates with the Terraform ecosystem, enabling provider discovery, module analysis, and direct Registry API integration for advanced Infrastructure as Code workflows.

This server falls under the Cloud Services category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • providerDetails
  • resourceUsage
  • moduleSearch
  • listDataSources
  • resourceArgumentDetails

Use Cases

Infrastructure as Code automation
Terraform provider and module analysis
hashicorp

Maintainer

LicenseMPL-2.0
Languagego
Versionv0.5.0
UpdatedMay 21, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

NPM

npx -y terraform-mcp-server

Manual Installation

npx -y terraform-mcp-server

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Terraform MCP Server

The official HashiCorp Terraform MCP Server integrates AI assistants directly with the Terraform ecosystem, exposing tools to search providers, inspect resource schemas, analyze modules from the Terraform Registry, and manage HCP Terraform or Terraform Enterprise workspaces and runs. It enables AI-driven Infrastructure as Code workflows where the assistant can look up real provider argument details, generate accurate resource configurations, and trigger remote Terraform plan and apply operations. DevOps engineers and platform teams use it to speed up IaC authoring, catch configuration errors before deployment, and automate routine workspace and variable management tasks.

Prerequisites

  • Docker installed, or Go 1.21+ to build from source
  • An MCP client such as Claude Desktop, Amazon Q Developer, or Claude Code
  • A HCP Terraform or Terraform Enterprise account with an API token (TFE_TOKEN) if you want workspace and run management features
  • Network access to registry.terraform.io for provider and module registry queries
1

Pull and run the Docker image

The simplest way to run the server is via the official Docker image in stdio mode, which is the default transport compatible with most MCP clients.

docker pull hashicorp/terraform-mcp-server:1.0.0
docker run -i --rm hashicorp/terraform-mcp-server:1.0.0
2

Alternatively, install from source with Go

If you prefer a binary without Docker, install the server directly using the Go toolchain.

go install github.com/hashicorp/terraform-mcp-server/cmd/terraform-mcp-server@latest
terraform-mcp-server stdio
3

Configure your MCP client with Docker

Add the server to your MCP client configuration. Pass your HCP Terraform API token via the TFE_TOKEN environment variable. The TFE_ADDRESS variable is only needed for Terraform Enterprise (self-hosted); omit it for HCP Terraform.

4

Enable optional Terraform operations (plan/apply)

Tools that trigger Terraform runs are gated behind an explicit opt-in flag for safety. Set ENABLE_TF_OPERATIONS=true in the environment to enable them.

# Add to your docker run command or MCP env block:
# -e ENABLE_TF_OPERATIONS=true
5

Test with a registry query

Ask your MCP client to look up a Terraform provider. If the server is running correctly, it will return real resource and data source schemas from registry.terraform.io.

Terraform MCP Server Examples

Client configuration (Claude Desktop with Docker)

Claude Desktop configuration using the Docker image in stdio mode with HCP Terraform authentication.

{
  "mcpServers": {
    "terraform": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "TFE_TOKEN=your_hcp_terraform_token",
        "-e", "ENABLE_TF_OPERATIONS=true",
        "hashicorp/terraform-mcp-server:1.0.0"
      ]
    }
  }
}

Prompts to try

Example prompts that exercise the Terraform MCP server's registry and workspace management tools.

- "List all resources available in the AWS Terraform provider version 5.x."
- "Show me the required and optional arguments for the aws_s3_bucket resource."
- "Search the Terraform Registry for modules that set up a VPC on AWS."
- "What data sources does the Google Cloud provider expose for IAM?"
- "List all workspaces in my HCP Terraform organization and show their current run status."
- "Create a new workspace called 'staging-api' in my HCP Terraform organization."

Troubleshooting Terraform MCP Server

401 Unauthorized errors when accessing HCP Terraform workspaces

Verify that TFE_TOKEN is set correctly in the Docker environment or MCP config env block. Generate a new token at app.terraform.io under User Settings > Tokens. For Terraform Enterprise, also set TFE_ADDRESS to your self-hosted instance URL.

Tools for triggering runs are not available or return 'not enabled'

Set the environment variable ENABLE_TF_OPERATIONS=true. These tools are disabled by default as a safety measure and require explicit opt-in.

Corporate proxy or TLS errors when connecting to registry.terraform.io from Docker

Mount your corporate CA certificate bundle into the container. Use a Docker volume mount such as '-v /etc/ssl/certs/corporate-ca.crt:/usr/local/share/ca-certificates/corporate-ca.crt' and set the appropriate HTTPS_PROXY environment variable.

Frequently Asked Questions about Terraform MCP Server

What is Terraform MCP Server?

Terraform MCP Server is a Model Context Protocol (MCP) server that ๐ŸŽ–๏ธ๐ŸŽ๏ธโ˜๏ธ - the official terraform mcp server seamlessly integrates with the terraform ecosystem, enabling provider discovery, module analysis, and direct registry api integration for advanced infrastructure as code workflows. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Terraform MCP Server?

Install via npm with the command: npx -y terraform-mcp-server. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).

Which AI clients work with Terraform MCP Server?

Terraform MCP Server works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Terraform MCP Server free to use?

Yes, Terraform MCP Server is open source and available under the MPL-2.0 license. You can use it freely in both personal and commercial projects.

Browse More Cloud Services MCP Servers

Explore all cloud services servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "terraform": { "command": "npx", "args": ["-y", "terraform-mcp-server"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide โ†’

Ready to use Terraform MCP Server?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides