Terraform Cloud MCP server

Integrates with Terraform Cloud API to enable natural language management of infrastructure through workspace and run operations including creation, updates, planning, and application.
Back to servers
Provider
John Reilly Pospos
Release date
Mar 17, 2025
Language
Python
Stats
10 stars

The Terraform Cloud MCP server integrates AI assistants with the Terraform Cloud API, allowing you to manage infrastructure through natural conversation. This server supports various MCP-compatible platforms including Claude, Claude Code CLI, Claude Desktop, Cursor, and Copilot Studio.

Installation

Prerequisites

  • Python 3.12+
  • Terraform Cloud API token
  • uv package manager (recommended) or pip

Setup Instructions

# 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 .

Configuration

Adding to Claude Code CLI

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

Adding to Claude Desktop

Create a configuration file at the appropriate location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "terraform-cloud-mcp": {
      "command": "/path/to/uv",
      "args": [
        "--directory",
        "/path/to/your/terraform-cloud-mcp",
        "run",
        "terraform-cloud-mcp"
      ],
      "env": {
        "TFC_TOKEN": "your_terraform_cloud_token"
      }
    }
  }
}

Configuration for Other MCP Platforms

For platforms like Cursor, Copilot Studio, or Glama:

  1. Configure the server path or start command
  2. Set environment variables for the Terraform Cloud API token
  3. Configure auto-start options according to the platform's documentation

Available Tools

Account Management

  • Get authenticated user account details

Workspace Management

Listing and Viewing

  • List and search workspaces within an organization
  • Get detailed information about specific workspaces

Creation and Modification

  • Create new workspaces with customizable parameters
  • Update existing workspace configurations
  • Delete workspaces (with safe deletion option)

State Control

  • Lock workspaces to prevent runs
  • Unlock workspaces to enable runs
  • Force unlock workspaces locked by other users

Run Management

  • Create and queue Terraform runs
  • List and filter runs by workspace or organization
  • Get detailed run information
  • Apply, discard, or cancel runs
  • Force cancel or execute runs

Plan Management

  • View plan details
  • Retrieve JSON execution plans with proper redirect handling
  • Get run plan JSON output

Apply Management

  • Get detailed information about applies
  • Recover from failed state uploads

Project Management

  • Create and update projects
  • List and filter projects
  • Get project details
  • Delete projects
  • Manage project tag bindings
  • Move workspaces between projects

Organization Management

  • View organization details and entitlements
  • List and filter organizations
  • Create new organizations
  • Update organization settings
  • Delete organizations

Troubleshooting

If you encounter issues:

  1. Check the server logs (debug logging is enabled by default)
  2. Use the MCP Inspector at http://localhost:5173 for debugging
  3. Debug logging is already configured in the server

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later