Terraform MCP Server

Manage infrastructure as code with Terraform through your AI assistant - plan, apply, and inspect infrastructure resources.

April 15, 2026
mcpdevopsterraformiacinfrastructure

Terraform MCP Server

Manage Terraform infrastructure directly from your AI assistant.

What it Does

  • Plan Inspection: Review terraform plan output in natural language
  • State Management: List and inspect resources in terraform state
  • Configuration Help: Generate and validate Terraform configurations
  • Resource Queries: Find resources by type, name, or attributes
  • Drift Detection: Identify resources that have drifted from configuration

Installation

# Using npx
npx -y @anthropic-ai/mcp-server-terraform

# Using Docker
docker run -i --rm -v $(pwd):/workspace mcp/terraform

Configuration

{
  "mcpServers": {
    "terraform": {
      "command": "npx",
      "args": ["-y", "@anthropic-ai/mcp-server-terraform"],
      "env": {
        "TF_WORKSPACE": "production"
      }
    }
  }
}

Example Prompts

  • "Show me all resources in the current terraform state"
  • "What would happen if I apply these changes?"
  • "Generate a terraform configuration for an S3 bucket"
  • "Check for drift in our AWS resources"
  • "List all EC2 instances managed by terraform"

Supported Providers

Works with any Terraform provider: AWS, Azure, GCP, Cloudflare, Datadog, Kubernetes, and more.