GitHub - severity1/terraform-cloud-mcp: A Model Context Protocol (MCP) server that integrates AI assistants with the Terraform Cloud API, allowing you to manage your infrastructure through natural conversation (original) (raw)

MseeP.ai Security Assessment Badge

Terraform Cloud MCP Server

A Model Context Protocol (MCP) server that integrates AI assistants with the Terraform Cloud API, allowing you to manage your infrastructure through natural conversation. Built with Pydantic models and structured around domain-specific modules, this server is compatible with any MCP-supporting platform including Claude, Claude Code CLI, Claude Desktop, Cursor, Copilot Studio, and others.

Version Python Type Checking Code Quality


Features


Quick Start

Prerequisites


Installation

Clone the repository

git clone https://github.com/severity1/terraform-cloud-mcp.git cd terraform-cloud-mcp

Create virtual environment and activate it

uv venv source .venv/bin/activate

Install package

uv pip install .

Adding to Claude Environments

Adding to Claude Code CLI

Add to Claude Code with your Terraform Cloud token

claude mcp add -e TFC_TOKEN=YOUR_TF_TOKEN -s user terraform-cloud-mcp -- "terraform-cloud-mcp"

Adding to Claude Desktop

Create a claude_desktop_config.json configuration file:

{ "mcpServers": { "terraform-cloud-mcp": { "command": "/path/to/uv", # Get this by running: which uv "args": [ "--directory", "/path/to/your/terraform-cloud-mcp", # Full path to this project "run", "terraform-cloud-mcp" ], "env": { "TFC_TOKEN": "my token..." # replace with actual token } } } }

Replace your_terraform_cloud_token with your actual Terraform Cloud API token.

Other MCP-Compatible Platforms

For other platforms (like Cursor, Copilot Studio, or Glama), follow their platform-specific instructions for adding an MCP server. Most platforms require:

  1. The server path or command to start the server.
  2. Environment variables for the Terraform Cloud API token.
  3. Configuration to auto-start the server when needed.

Available Tools

Account Tools

Workspace Management Tools

Create & Update

Delete

Lock & Unlock

Run Management Tools

Plan Management Tools

Apply Management Tools

Project Management Tools

Organization Management Tools

Cost Estimation Tools


Development Guide

For detailed development guidance including code standards, Pydantic patterns, and contribution workflows, see our Development Documentation.

Quick Development Setup

Clone the repository

git clone https://github.com/severity1/terraform-cloud-mcp.git cd terraform-cloud-mcp

Create virtual environment and activate it

uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate

Install in development mode with development dependencies

uv pip install -e . uv pip install black mypy pydantic ruff

Basic Development Commands

Run the server in development mode

mcp dev terraform_cloud_mcp/server.py

Run tests and quality checks

uv run -m mypy . uv run -m ruff check . uv run -m black .

For detailed information on code organization, architecture, development workflows, and code quality guidelines, refer to docs/DEVELOPMENT.md.


Documentation

The codebase includes comprehensive documentation:

Troubleshooting

  1. Check server logs (debug logging is enabled by default)
  2. Use the MCP Inspector (http://localhost:5173) for debugging
  3. Debug logging is already enabled in server.py:
    import logging
    logging.basicConfig(level=logging.DEBUG)

Contributing

Contributions are welcome! Please open an issue or pull request if you'd like to contribute to this project.

See our Contributing Guide for detailed instructions on how to get started, code quality standards, and the pull request process.

Disclaimer

This project is not affiliated with, associated with, or endorsed by HashiCorp or Terraform.
"Terraform" and "Terraform Cloud" are trademarks of HashiCorp.
This project merely interacts with the Terraform Cloud public API under fair use.