{"id":29113989,"url":"https://github.com/hashicorp/terraform-mcp-server","last_synced_at":"2026-04-08T01:01:04.583Z","repository":{"id":294249989,"uuid":"969282615","full_name":"hashicorp/terraform-mcp-server","owner":"hashicorp","description":"The Terraform MCP Server provides seamless integration with Terraform ecosystem, enabling advanced automation and interaction capabilities for Infrastructure as Code (IaC) development.","archived":false,"fork":false,"pushed_at":"2026-04-03T12:14:22.000Z","size":951,"stargazers_count":1302,"open_issues_count":35,"forks_count":139,"subscribers_count":11,"default_branch":"main","last_synced_at":"2026-04-05T00:03:44.712Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hashicorp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-19T19:49:09.000Z","updated_at":"2026-04-04T17:53:43.000Z","dependencies_parsed_at":"2025-06-27T18:21:29.259Z","dependency_job_id":"8e7125eb-3985-4da3-96cd-8bf63c80c817","html_url":"https://github.com/hashicorp/terraform-mcp-server","commit_stats":null,"previous_names":["hashicorp/terraform-mcp-server"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/hashicorp/terraform-mcp-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashicorp%2Fterraform-mcp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashicorp%2Fterraform-mcp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashicorp%2Fterraform-mcp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashicorp%2Fterraform-mcp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hashicorp","download_url":"https://codeload.github.com/hashicorp/terraform-mcp-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashicorp%2Fterraform-mcp-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31535203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-29T11:06:00.134Z","updated_at":"2026-04-08T01:01:04.572Z","avatar_url":"https://github.com/hashicorp.png","language":"Go","funding_links":[],"categories":["Cloud \u0026 Devops Mcp Servers","Cloud \u0026 Infrastructure","Go","📚 Projects (1974 total)","Production-Ready Servers","⚙️ DevOps","官方 MCP 服务器列表","Servers","Developer Tools","Containerised MCP Servers","MCP Ecosystem","Cloud Platforms","🏗️ Infrastructure, Utils \u0026 Orchestration","MCP Servers"],"sub_categories":["Virtualization \u0026 IaC","MCP Servers","Cloud \u0026 Infrastructure","How to Submit","DevOps \u0026 Infrastructure","Servers","☁️ Cloud \u0026 Container Security","Cloud \u0026 DevOps"],"readme":"# \u003cimg src=\"public/images/Terraform-LogoMark_onDark.svg\" width=\"30\" align=\"left\" style=\"margin-right: 12px;\"/\u003e Terraform MCP Server\n\nThe Terraform MCP Server is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction)\nserver that provides seamless integration with Terraform Registry APIs, enabling advanced\nautomation and interaction capabilities for Infrastructure as Code (IaC) development.\n\n## Features\n\n- **Dual Transport Support**: Both Stdio and StreamableHTTP transports with configurable endpoints\n- **Terraform Registry Integration**: Direct integration with public Terraform Registry APIs for providers, modules, and policies\n- **HCP Terraform \u0026 Terraform Enterprise Support**: Full workspace management, organization/project listing, and private registry access\n- **Workspace Operations**: Create, update, delete workspaces with support for variables, tags, and run management\n- **OTel metrics for monitoring tool usage**: Integration with open telemetry meters to track tool-call volume, latency and failures in Streamable HTTP mode\n\n\u003e **Security Note:** At this stage, the MCP server is intended for local use only. If using the StreamableHTTP transport, always configure the MCP_ALLOWED_ORIGINS environment variable to restrict access to trusted origins only. This helps prevent DNS rebinding attacks and other cross-origin vulnerabilities.\n\n\u003e **Security Note:** Depending on the query, the MCP server may expose certain Terraform data to the MCP client and LLM. Do not use the MCP server with untrusted MCP clients or LLMs.\n\n\u003e **Legal Note:** Your use of a third party MCP Client/LLM is subject solely to the terms of use for such MCP/LLM, and IBM is not responsible for the performance of such third party tools. IBM expressly disclaims any and all warranties and liability for third party MCP Clients/LLMs, and may not be able to provide support to resolve issues which are caused by the third party tools.\n\n\u003e **Caution:**  The outputs and recommendations provided by the MCP server are generated dynamically and may vary based on the query, model, and the connected MCP client. Users should thoroughly review all outputs/recommendations to ensure they align with their organization’s security best practices, cost-efficiency goals, and compliance requirements before implementation.\n\n## Prerequisites\n\n1. Ensure [Docker](https://www.docker.com/) is installed and running to use the server in a containerized environment.\n1. Install an AI assistant that supports the Model Context Protocol (MCP).\n\n## Command Line Options\n\n**Environment Variables:**\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `TFE_ADDRESS` | HCP Terraform or TFE address | `\"https://app.terraform.io\"` |\n| `TFE_TOKEN` | Terraform Enterprise API token | `\"\"` (empty) |\n| `TFE_SKIP_TLS_VERIFY` | Skip HCP Terraform or Terraform Enterprise TLS verification | `false` |\n| `LOG_LEVEL` | Logging level: `trace`, `debug`, `info`, `warn`, `error`, `fatal`, `panic` (overrides `--log-level` flag) | `info` |\n| `LOG_FORMAT` | Logging format: `text` or `json` (overrides `--log-format` flag)| `text` |\n| `TRANSPORT_MODE` | Set to `streamable-http` to enable HTTP transport (legacy `http` value still supported) | `stdio` |\n| `TRANSPORT_HOST` | Host to bind the HTTP server | `127.0.0.1` |\n| `TRANSPORT_PORT` | HTTP server port | `8080` |\n| `MCP_ENDPOINT` | HTTP server endpoint path | `/mcp` |\n| `MCP_KEEP_ALIVE` | Keep-alive interval for SSE connections (e.g., 30s, 1m). 0 to disable | `0` |\n| `MCP_SESSION_MODE` | Session mode: `stateful` or `stateless` | `stateful` |\n| `MCP_ALLOWED_ORIGINS` | Comma-separated list of allowed origins for CORS | `\"\"` (empty) |\n| `MCP_CORS_MODE` | CORS mode: `strict`, `development`, or `disabled` | `strict` |\n| `MCP_TLS_CERT_FILE` | Path to TLS cert file, required for non-localhost deployment (e.g. `/path/to/cert.pem`) | `\"\"` (empty) |\n| `MCP_TLS_KEY_FILE` |  Path to TLS key file, required for non-localhost deployment (e.g. `/path/to/key.pem`)| `\"\"` (empty) |\n| `MCP_RATE_LIMIT_GLOBAL` | Global rate limit (format: `rps:burst`) | `10:20` |\n| `MCP_RATE_LIMIT_SESSION` | Per-session rate limit (format: `rps:burst`) | `5:10` |\n| `ENABLE_TF_OPERATIONS` | Enable tools that require explicit approval | `false` |\n| `OTEL_METRICS_ENABLED` | Enable tools metrics using otel | `false` |\n| `OTEL_METRICS_SERVICE_VERSION` | Version of the terraform-mcp-server sending metrics, which is used to set metric attributes. It also helps track metrics across different deployments | `latest` |\n| `OTEL_METRICS_SERVICE_NAME` | Identifies the source of the metrics (e.g., \"terraform-mcp-server\") | `terraform-mcp-server` |\n| `OTEL_METRICS_EXPORT_INTERVAL` | Controls the frequency of metric flushes | `2` |\n| `OTEL_METRICS_ENDPOINT` | URL of your OTel Collector or backend | `localhost:4318` |\n\n\n```bash\n# Stdio mode\nterraform-mcp-server stdio [--log-file /path/to/log] [--log-level info] [--log-format text] [--toolsets \u003ctoolsets\u003e] [--tools \u003ctools\u003e]\n\n# StreamableHTTP mode\nterraform-mcp-server streamable-http [--transport-port 8080] [--transport-host 127.0.0.1] [--mcp-endpoint /mcp] [--log-file /path/to/log] [--log-level info] [--log-format text] [--toolsets \u003ctoolsets\u003e] [--tools \u003ctools\u003e]\n```\n\n## Instructions\n\nDefault instructions for the MCP server is located in `cmd/terraform-mcp-server/instructions.md`, if those do not seem appropriate for your organization's Terraform practices or if the MCP server is producing inaccurate responses, please replace them with your own instructions and rebuild the container or binary. An example of such instruction is located in `instructions/example-mcp-instructions.md`\n\n`AGENTS.md` essentially behaves as READMEs for coding agents: a dedicated, predictable place to provide the context and instructions to help AI coding agents work on your project. One `AGENTS.md` file works with different coding agents. An example of such instruction is located in `instructions/example-AGENTS.md`, in order to use it commit a file name `AGENTS.md` to the directory where your Terraform configurations reside.\n\n## Installation\n\n### Usage with Visual Studio Code\n\nAdd the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing `Ctrl + Shift + P` and typing `Preferences: Open User Settings (JSON)`.\n\nMore about using MCP server tools in VS Code's [agent mode documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers).\n\n\u003ctable\u003e\n\u003ctr\u003e\u003cth\u003eVersion 0.3.0+ or greater\u003c/th\u003e\u003cth\u003eVersion 0.2.3 or lower\u003c/th\u003e\u003c/tr\u003e\n\u003ctr valign=top\u003e\n\u003ctd\u003e\n\n```json\n{\n  \"mcp\": {\n    \"servers\": {\n      \"terraform\": {\n        \"command\": \"docker\",\n        \"args\": [\n          \"run\",\n          \"-i\",\n          \"--rm\",\n          \"-e\", \"TFE_TOKEN=${input:tfe_token}\",\n          \"-e\", \"TFE_ADDRESS=${input:tfe_address}\",\n          \"hashicorp/terraform-mcp-server:0.5.1\"\n        ]\n      }\n    },\n    \"inputs\": [\n      {\n        \"type\": \"promptString\",\n        \"id\": \"tfe_token\",\n        \"description\": \"Terraform API Token\",\n        \"password\": true\n      },\n      {\n        \"type\": \"promptString\",\n        \"id\": \"tfe_address\",\n        \"description\": \"Terraform Address\",\n        \"password\": false\n      }\n    ]\n  }\n}\n```\n\u003c/td\u003e\n\u003ctd\u003e\n\n```json\n{\n  \"mcp\": {\n    \"servers\": {\n      \"terraform\": {\n        \"command\": \"docker\",\n        \"args\": [\n          \"run\",\n          \"-i\",\n          \"--rm\",\n          \"hashicorp/terraform-mcp-server:0.2.3\"\n        ]\n      }\n    }\n  }\n}\n```\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\nOptionally, you can add a similar example (i.e. without the mcp key) to a file called `.vscode/mcp.json` in your workspace. This will allow you to share the configuration with others.\n\n\u003ctable\u003e\n\u003ctr\u003e\u003cth\u003eVersion 0.3.0+ or greater\u003c/th\u003e\u003cth\u003eVersion 0.2.3 or lower\u003c/th\u003e\u003c/tr\u003e\n\u003ctr valign=top\u003e\n\u003ctd\u003e\n\n```json\n{\n  \"servers\": {\n    \"terraform\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"-i\",\n        \"--rm\",\n        \"-e\", \"TFE_TOKEN=${input:tfe_token}\",\n        \"-e\", \"TFE_ADDRESS=${input:tfe_address}\",\n        \"hashicorp/terraform-mcp-server:0.5.1\"\n      ]\n    }\n  },\n  \"inputs\": [\n    {\n      \"type\": \"promptString\",\n      \"id\": \"tfe_token\",\n      \"description\": \"Terraform API Token\",\n      \"password\": true\n    },\n    {\n      \"type\": \"promptString\",\n      \"id\": \"tfe_address\",\n      \"description\": \"Terraform Address\",\n      \"password\": false\n    }\n  ]\n}\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n```json\n{\n  \"servers\": {\n    \"terraform\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"-i\",\n        \"--rm\",\n        \"hashicorp/terraform-mcp-server:0.2.3\"\n      ]\n    }\n  }\n}\n```\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\n[\u003cimg alt=\"Install in VS Code (docker)\" src=\"https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square\u0026label=Install%20Terraform%20MCP\u0026color=0098FF\"\u003e](https://vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22terraform%22%2C%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22hashicorp%2Fterraform-mcp-server%22%5D%7D)\n[\u003cimg alt=\"Install in VS Code Insiders (docker)\" src=\"https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square\u0026label=Install%20Terraform%20MCP\u0026color=24bfa5\"\u003e](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%7B%22name%22%3A%22terraform%22%2C%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22hashicorp%2Fterraform-mcp-server%22%5D%7D)\n\n### Usage with Cursor\n\nAdd this to your Cursor config (`~/.cursor/mcp.json`) or via Settings → Cursor Settings → MCP:\n\n\u003ctable\u003e\n\u003ctr\u003e\u003cth\u003eVersion 0.3.0+ or greater\u003c/th\u003e\u003cth\u003eVersion 0.2.3 or lower\u003c/th\u003e\u003c/tr\u003e\n\u003ctr valign=top\u003e\n\u003ctd\u003e\n\n```json\n{\n  \"mcpServers\": {\n    \"terraform\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"-i\",\n        \"--rm\",\n        \"-e\", \"TFE_ADDRESS=\u003c\u003cPASTE_TFE_ADDRESS_HERE\u003e\u003e\",\n        \"-e\", \"TFE_TOKEN=\u003c\u003cPASTE_TFE_TOKEN_HERE\u003e\u003e\",\n        \"hashicorp/terraform-mcp-server:0.5.1\"\n      ]\n    }\n  }\n}\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n```json\n{\n  \"servers\": {\n    \"terraform\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"-i\",\n        \"--rm\",\n        \"hashicorp/terraform-mcp-server:0.2.3\"\n      ]\n    }\n  }\n}\n```\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\u003ca href=\"cursor://anysphere.cursor-deeplink/mcp/install?name=terraform\u0026config=eyJjb21tYW5kIjoiZG9ja2VyIiwiYXJncyI6WyJydW4iLCItaSIsIi0tcm0iLCJoYXNoaWNvcnAvdGVycmFmb3JtLW1jcC1zZXJ2ZXIiXX0%3D\"\u003e\n  \u003cimg alt=\"Add terraform MCP server to Cursor\" src=\"https://cursor.com/deeplink/mcp-install-dark.png\" height=\"32\" /\u003e\n\u003c/a\u003e\n\n### Usage with Claude Desktop / Amazon Q Developer / Kiro CLI\n\nMore about using MCP server tools in Claude Desktop [user documentation](https://modelcontextprotocol.io/quickstart/user). Read more about using MCP server in [Amazon Q Developer](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/qdev-mcp.html) and [Kiro CLI](https://kiro.dev/docs/mcp/).\n\n\u003ctable\u003e\n\u003ctr\u003e\u003cth\u003eVersion 0.3.0+ or greater\u003c/th\u003e\u003cth\u003eVersion 0.2.3 or lower\u003c/th\u003e\u003c/tr\u003e\n\u003ctr valign=top\u003e\n\u003ctd\u003e\n\n```json\n{\n  \"mcpServers\": {\n    \"terraform\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"-i\",\n        \"--rm\",\n        \"-e\", \"TFE_ADDRESS=\u003c\u003cPASTE_TFE_ADDRESS_HERE\u003e\u003e\",\n        \"-e\", \"TFE_TOKEN=\u003c\u003cPASTE_TFE_TOKEN_HERE\u003e\u003e\",\n        \"hashicorp/terraform-mcp-server:0.5.1\"\n      ]\n    }\n  }\n}\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n```json\n{\n  \"mcpServers\": {\n    \"terraform\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"-i\",\n        \"--rm\",\n        \"hashicorp/terraform-mcp-server:0.2.3\"\n      ]\n    }\n  }\n}\n```\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n### Usage with Claude Code\n\nMore about using and adding MCP server tools in Claude Code [user documentation](https://docs.claude.com/en/docs/claude-code/mcp)\n\n- Local (`stdio`) Transport\n\n```sh\nclaude mcp add terraform -s user -t stdio -- docker run -i --rm hashicorp/terraform-mcp-server\n```\n\n- Remote (`streamable-http`) Transport\n\n```sh\n# Run server (example)\ndocker run -p 8080:8080 --rm -e TRANSPORT_MODE=streamable-http -e TRANSPORT_HOST=0.0.0.0 hashicorp/terraform-mcp-server\n\n# Add to Claude Code\nclaude mcp add --transport http terraform http://localhost:8080/mcp\n```\n\n### Usage with Gemini extensions\n\nFor security, avoid hardcoding your credentials, create or update `~/.gemini/.env` (where ~ is your home or project directory) for storing HCP Terraform or Terraform Enterprise credentials\n\n```\n# ~/.gemini/.env\nTFE_ADDRESS=your_tfe_address_here\nTFE_TOKEN=your_tfe_token_here\n```\n\nInstall the extension \u0026 run Gemini\n\n```\ngemini extensions install https://github.com/hashicorp/terraform-mcp-server\ngemini\n```\n\n### Usage with Bob IDE / Shell\n\nMore about using and adding MCP servers tools in Bob IDE or Shell [Using MCP in Bob](https://bob.ibm.com/docs/ide/configuration/mcp/mcp-in-bob).\n\n\u003ctable\u003e\n\u003ctr\u003e\u003cth\u003eVersion 0.3.0+ or greater\u003c/th\u003e\u003cth\u003eVersion 0.2.3 or lower\u003c/th\u003e\u003c/tr\u003e\n\u003ctr valign=top\u003e\n\u003ctd\u003e\n\n```json\n{\n  \"mcpServers\": {\n    \"terraform\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"-i\",\n        \"--rm\",\n        \"-e\", \"TFE_ADDRESS=\u003c\u003cPASTE_TFE_ADDRESS_HERE\u003e\u003e\",\n        \"-e\", \"TFE_TOKEN=\u003c\u003cPASTE_TFE_TOKEN_HERE\u003e\u003e\",\n        \"hashicorp/terraform-mcp-server:0.5.1\"\n      ],\n      \"disabled\": false\n    }\n  }\n}\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n```json\n{\n  \"mcpServers\": {\n    \"terraform\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"-i\",\n        \"--rm\",\n        \"hashicorp/terraform-mcp-server:0.2.3\"\n      ],\n      \"disabled\": false\n    }\n  }\n}\n```\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## Install from source\n\nUse the latest release version:\n\n```console\ngo install github.com/hashicorp/terraform-mcp-server/cmd/terraform-mcp-server@latest\n```\n\nUse the main branch:\n\n```console\ngo install github.com/hashicorp/terraform-mcp-server/cmd/terraform-mcp-server@main\n```\n\n\u003ctable\u003e\n\u003ctr\u003e\u003cth\u003eVersion 0.3.0+ or greater\u003c/th\u003e\u003cth\u003eVersion 0.2.3 or lower\u003c/th\u003e\u003c/tr\u003e\n\u003ctr valign=top\u003e\n\u003ctd\u003e\n\n```json\n{\n  \"mcp\": {\n    \"servers\": {\n      \"terraform\": {\n        \"type\": \"stdio\",\n        \"command\": \"/path/to/terraform-mcp-server\",\n        \"env\": {\n          \"TFE_TOKEN\": \"\u003c\u003cTFE_TOKEN_HERE\u003e\u003e\"\n        },\n      }\n    }\n  }\n}\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n```json\n{\n  \"mcp\": {\n    \"servers\": {\n      \"terraform\": {\n        \"type\": \"stdio\",\n        \"command\": \"/path/to/terraform-mcp-server\"\n      }\n    }\n  }\n}\n```\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## Building the Docker Image locally\n\nBefore using the server, you need to build the Docker image locally:\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/hashicorp/terraform-mcp-server.git\ncd terraform-mcp-server\n```\n\n2. Build the Docker image:\n```bash\nmake docker-build\n```\n\n3. This will create a local Docker image that you can use in the following configuration.\n\n```bash\n# Run in stdio mode\ndocker run -i --rm terraform-mcp-server:dev\n\n# Run in streamable-http mode\ndocker run -p 8080:8080 --rm -e TRANSPORT_MODE=streamable-http -e TRANSPORT_HOST=0.0.0.0 terraform-mcp-server:dev\n\n# Filter tools (optional)\ndocker run -i --rm terraform-mcp-server:dev --toolsets=registry,terraform\ndocker run -i --rm terraform-mcp-server:dev --tools=search_providers,get_provider_details\n```\n\n\u003e **Note:** When running in Docker, you should set `TRANSPORT_HOST=0.0.0.0` to allow connections from outside the container.\n\n4. (Optional) Test connection in http mode\n\n```bash\n# Test the connection\ncurl http://localhost:8080/health\n```\n\n5. You can use it on your AI assistant as follow:\n\n```json\n{\n  \"mcpServers\": {\n    \"terraform\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"-i\",\n        \"--rm\",\n        \"terraform-mcp-server:dev\"\n      ]\n    }\n  }\n}\n```\n\n## Available Tools\n\n[Check out available tools here :link:](https://developer.hashicorp.com/terraform/docs/tools/mcp-server/reference#available-tools)\n\n## Available Resources\n\n[Check out available resources here :link:](https://developer.hashicorp.com/terraform/docs/tools/mcp-server/reference#available-tools)\n\n### Tool Filtering\n\nControl which tools are available using `--toolsets` (groups) or `--tools` (individual):\n\n```bash\n# Enable tool groups (default: registry)\nterraform-mcp-server --toolsets=registry,terraform\n\n# Enable specific tools only\nterraform-mcp-server --tools=search_providers,get_provider_details,list_workspaces\n```\n\nAvailable toolsets: `registry`, `registry-private`, `terraform`, `all`, `default`. See `pkg/toolsets/mapping.go` for individual tool names. Cannot use both flags together.\n\n## Transport Support\n\nThe Terraform MCP Server supports multiple transport protocols:\n\n### 1. Stdio Transport (Default)\nStandard input/output communication using JSON-RPC messages. Ideal for local development and direct integration with MCP clients.\n\n### 2. StreamableHTTP Transport\nModern HTTP-based transport supporting both direct HTTP requests and Server-Sent Events (SSE) streams. This is the recommended transport for remote/distributed setups.\n\n**Features:**\n- **Endpoint**: `http://{hostname}:8080/mcp`\n- **Health Check**: `http://{hostname}:8080/health`\n- **Environment Configuration**: Set `TRANSPORT_MODE=http` or `TRANSPORT_PORT=8080` to enable\n\n## Session Modes\n\nThe Terraform MCP Server supports two session modes when using the StreamableHTTP transport:\n\n- **Stateful Mode (Default)**: Maintains session state between requests, enabling context-aware operations.\n- **Stateless Mode**: Each request is processed independently without maintaining session state, which can be useful for high-availability deployments or when using load balancers.\n\nTo enable stateless mode, set the environment variable:\n```bash\nexport MCP_SESSION_MODE=stateless\n```\n## Troubleshooting\n\n### Corporate Proxy / TLS Inspection (Zscaler, etc.)\n\nIf you're behind a corporate proxy that performs TLS inspection (like Zscaler Internet Access), you may see certificate errors:\n```\ntls: failed to verify certificate: x509: certificate signed by unknown authority\n```\n\n**Solution: Mount your corporate CA certificate into the container:**\n```bash\ndocker run -i --rm \\\n  -v /path/to/corporate-ca.pem:/etc/ssl/certs/corporate-ca.pem \\\n  -e SSL_CERT_FILE=/etc/ssl/certs/corporate-ca.pem \\\n  hashicorp/terraform-mcp-server:0.5.1\n```\n\nFor MCP client configurations:\n```json\n{\n  \"mcpServers\": {\n    \"terraform\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"-i\",\n        \"--rm\",\n        \"-v\", \"/path/to/corporate-ca.pem:/etc/ssl/certs/corporate-ca.pem\",\n        \"-e\", \"SSL_CERT_FILE=/etc/ssl/certs/corporate-ca.pem\",\n        \"-e\", \"TFE_TOKEN=\u003c\u003e\",\n        \"hashicorp/terraform-mcp-server:0.5.1\"\n      ]\n    }\n  }\n}\n```\n\n**Alternative: Run the binary directly**\n\nIf Docker is not permitted in your environment, you can install and run the server binary directly, which will use your system's certificate store:\n```bash\ngo install github.com/hashicorp/terraform-mcp-server/cmd/terraform-mcp-server@latest\nterraform-mcp-server stdio\n```\n## Development\n\n### Prerequisites\n- Go (check [go.mod](./go.mod) file for specific version)\n- Docker (optional, for container builds)\n\n### Available Make Commands\n\n| Command | Description |\n|---------|-------------|\n| `make build` | Build the binary |\n| `make test` | Run all tests |\n| `make test-e2e` | Run end-to-end tests |\n| `make docker-build` | Build Docker image |\n| `make run-http` | Run HTTP server locally |\n| `make docker-run-http` | Run HTTP server in Docker |\n| `make test-http` | Test HTTP health endpoint |\n| `make clean` | Remove build artifacts |\n| `make help` | Show all available commands |\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch\n3. Make your changes\n4. Run tests\n5. Submit a pull request\n\n## License\n\nThis project is licensed under the terms of the MPL-2.0 open source license. Please refer to [LICENSE](./LICENSE) file for the full terms.\n\n## Security\n\nFor security issues, please contact security@hashicorp.com or follow our [security policy](https://www.hashicorp.com/en/trust/security/vulnerability-management).\n\n## Support\n\nFor bug reports and feature requests, please open an issue on GitHub.\n\nFor general questions and discussions, open a GitHub Discussion.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhashicorp%2Fterraform-mcp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhashicorp%2Fterraform-mcp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhashicorp%2Fterraform-mcp-server/lists"}