Terraform Cloud MCP

Terraform Cloud MCP

A read-only MCP server for inspecting and diagnosing HCP Terraform workspaces, runs, and plan summaries from ChatGPT and other MCP clients. It provides tools to list workspaces, inspect runs, and summarize plans without exposing sensitive data.

Category
访问服务器

README

Terraform Cloud MCP

A read-only MCP server for inspecting and diagnosing HCP Terraform (formerly Terraform Cloud) from ChatGPT and other MCP clients.

The first version is deliberately narrow: it exposes workspaces, runs, and sanitized plan summaries while excluding variables, state, outputs, raw plan JSON, logs, and every write operation.

Capabilities

  • List workspaces in an allowlisted organization.
  • Inspect workspace configuration and lock state.
  • List and filter workspace runs.
  • Inspect one run and its available actions without executing them.
  • Summarize a plan: additions, changes, destructions, imports, and status.
  • Get a combined workspace/current-run/plan operational overview.

MCP tools

Tool Purpose
terraform_list_workspaces Discover workspace IDs and operational status.
terraform_get_workspace Inspect one workspace by ID or name.
terraform_list_runs List recent or filtered runs in a workspace.
terraform_get_run Inspect one run.
terraform_get_run_plan_summary Retrieve the sanitized numeric plan summary for a run.
terraform_get_workspace_overview Retrieve a workspace, current run, and plan in one call.

Every tool is annotated as read-only, non-destructive, and idempotent.

Security model

This project does not return:

  • Terraform variables or variable values.
  • State files or state outputs.
  • Raw plan JSON.
  • Plan or apply logs.
  • Terraform API tokens.
  • Apply, cancel, discard, unlock, delete, or workspace-update operations.

Organizations are restricted with TERRAFORM_ALLOWED_ORGANIZATIONS. Use a Terraform token with the minimum permissions required to read the intended workspaces and runs.

MCP_BEARER_TOKEN adds optional static bearer authentication for MCP clients that can send an Authorization header. For direct ChatGPT testing, prefer OpenAI's Secure MCP Tunnel or add standards-compliant OAuth before exposing the service publicly. Never deploy an unauthenticated public endpoint that contains a server-side Terraform token.

Requirements

  • Node.js 22+
  • An HCP Terraform user, team, or organization token with read access

Local setup

cp .env.example .env
npm install
npm run dev

Health check:

curl http://localhost:3000/health

MCP endpoint:

http://localhost:3000/mcp

Validate

npm run check
docker build -t terraform-cloud-mcp .

Environment variables

Variable Required Description
TERRAFORM_API_TOKEN Yes HCP Terraform API token.
TERRAFORM_ORGANIZATION Yes Default organization used by tools.
TERRAFORM_ALLOWED_ORGANIZATIONS No Comma-separated allowlist; defaults to the default organization.
TERRAFORM_API_BASE_URL No Defaults to https://app.terraform.io/api/v2.
MCP_BEARER_TOKEN No Optional incoming bearer token, minimum 16 characters.
REQUEST_TIMEOUT_MS No Terraform API timeout; defaults to 15000.
PORT No HTTP port; defaults to 3000.

Connect it to ChatGPT

  1. Run the server locally.
  2. Expose it securely over HTTPS using OpenAI Secure MCP Tunnel, or deploy it behind appropriate authentication.
  3. In ChatGPT, enable Developer mode under Settings → Security and login.
  4. Open Settings → Plugins, create a developer-mode app, and use the public /mcp URL.
  5. Verify the six advertised tools and add the app to a new conversation.

Example prompts:

List my Terraform workspaces and flag any that are locked or using an old Terraform version.
Give me an operational overview of the job-board-infra workspace.
Inspect the current run for job-board-infra and summarize the planned additions, changes, and destructions.

Architecture

ChatGPT / MCP client
        │ Streamable HTTP
        ▼
terraform-cloud-mcp
        │ JSON:API + Bearer token
        ▼
HCP Terraform API

The HTTP transport is stateless, which suits container platforms such as Cloud Run. A fresh MCP server and transport are created for each request.

Roadmap

  • OAuth 2.1 authentication for a safely hosted ChatGPT integration.
  • Policy-check and cost-estimate summaries.
  • Run event timelines.
  • Optional write operations behind explicit feature flags and confirmation, beginning with queueing speculative plans only.
  • Cross-provider diagnosis with Google Cloud and GitHub Actions.

References

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选