Production-ready Terraform automation with comprehensive LSP integration
Terry-Form MCP with LSP Integration
Documentation Site:
https://aj-geddes.github.io/terry-form-mcp
Version 3.0.0 - Production-ready Terraform automation with comprehensive LSP integration and 25 MCP tools
A Model Control Protocol (MCP) server that enables AI assistants to execute Terraform commands locally through a secure, containerized environment using HashiCorp's official Terraform image. Now enhanced with Language Server Protocol (LSP) integration for intelligent Terraform development capabilities.
What is Terry-Form?
Terry-Form MCP is a bridge between AI language models and Terraform infrastructure management. It provides a safe, controlled way for AI assistants like Claude to:
- Execute Terraform commands (
init,validate,fmt,plan) - Provide intelligent code completion, documentation, and validation using LSP
- Run operations in isolated Docker containers
- Work with Terraform configurations in your local workspace
- Pass variables dynamically to Terraform operations
- Return structured JSON results for AI processing
Architecture
Component Architecture
flowchart LR
%% Define nodes with improved styling
Claude["AI Assistant\n(Claude)"]:::claude
MCP["Terry-Form MCP\nServer"]:::server
Container["Terraform Docker\nContainer"]:::container
TF["Terraform CLI"]:::terraform
TFLS["Terraform-LS\nLanguage Server"]:::lsp
LocalTF[("Local Terraform\nConfigurations")]:::files
%% Define connections
Claude <---> MCP
MCP <---> Container
Container --> TF
Container --> TFLS
TF --- LocalTF
TFLS --- LocalTF
%% Define styles
classDef claude fill:#9C27B0,stroke:#6A1B9A,color:#FFFFFF,stroke-width:2px
classDef server fill:#2196F3,stroke:#0D47A1,color:#FFFFFF,stroke-width:2px
classDef container fill:#F5F5F5,stroke:#333333,stroke-width:2px
classDef terraform fill:#844FBA,stroke:#4C2889,color:#FFFFFF,stroke-width:2px
classDef lsp fill:#4CAF50,stroke:#2E7D32,color:#FFFFFF,stroke-width:2px
classDef files fill:#FFE0B2,stroke:#FB8C00,stroke-width:2px
%% Add a title
subgraph Terry-Form Component Architecture
end
Data Flow and Security Architecture
flowchart LR
%% Main components
Claude["AI Assistant\n(Claude)"]:::claude
%% Docker container with components
subgraph Container["Docker Container"]
MCP["Terry-Form MCP Server"]:::mcp
TF["Terraform Engine"]:::terraform
%% Operations subgraph
subgraph Operations["Operations"]
direction TB
%% Allowed operations
subgraph Allowed["✅ Allowed"]
Init("init"):::safe
Validate("validate"):::safe
Format("fmt"):::safe
Plan("plan"):::safe
LSP("LSP"):::safe
end
%% Blocked operations
subgraph Blocked["❌ Blocked"]
Apply("apply"):::blocked
Destroy("destroy"):::blocked
end
end
end
%% External components
Files[("Local Files\n(/mnt/workspace)")]:::files
External["Remote Services\n(State/Cloud APIs)"]:::external
%% Connections
Claude <--> MCP
MCP --> TF
TF --> Operations
Files <--> Container
Blocked -.- |"NO ACCESS"| External
%% Styling
classDef claude fill:#9C27B0,color:#FFFFFF,stroke-width:2px,font-weight:bold
classDef mcp fill:#2196F3,color:#FFFFFF,stroke-width:2px,font-weight:bold
classDef terraform fill:#844FBA,color:#FFFFFF,stroke-width:2px,font-weight:bold
classDef files fill:#FF9800,color:#000000,stroke-width:2px,font-weight:bold
classDef safe fill:#8BC34A,color:#000000,stroke-width:1px,font-weight:bold
classDef blocked fill:#F44336,color:#FFFFFF,stroke-width:1px,font-weight:bold
classDef external fill:#9E9E9E,color:#FFFFFF,stroke-width:1px,font-weight:bold
style Container fill:#F5F5F5,stroke:#333333,stroke-width:3px
style Operations fill:#FAFAFA,stroke:#616161,stroke-width:1px
style Allowed fill:#E8F5E9,stroke:#2E7D32,stroke-width:2px
style Blocked fill:#FFEBEE,stroke:#C62828,stroke-width:2px
Components
- server_enhanced_with_lsp.py: Primary FastMCP-based server with complete LSP integration (25 MCP tools)
- terry-form-mcp.py: Core Terraform execution logic and subprocess handling
- terraform_lsp_client.py: LSP client implementation for terraform-ls integration
Tools (5)
terraform_initInitialize a Terraform working directory.terraform_validateCheck whether the configuration is valid.terraform_fmtReformat your configuration in the standard style.terraform_planGenerate and show an execution plan.lsp_completeProvide intelligent code completion using Terraform Language Server.Environment Variables
TERRAFORM_WORKSPACErequiredThe local path to your Terraform configurations mapped inside the containerConfiguration
{"mcpServers":{"terry-form":{"command":"docker","args":["run","-i","--rm","-v","/path/to/your/terraform:/mnt/workspace","-e","TERRAFORM_WORKSPACE=/mnt/workspace","ajgeddes/terry-form-mcp:latest"]}}}