home / mcp / terry-form mcp server
Provides a safe, containerized MCP server for local Terraform execution with integrated LSP for intelligent development and diagnostics.
Configuration
View docs{
"mcpServers": {
"aj-geddes-terry-form-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"-t",
"--rm",
"-v",
"$(pwd)\":\"/mnt/workspace\"",
"terry-form-mcp"
]
}
}
}Terry-Form MCP with LSP Integration provides a secure, containerized bridge that lets AI assistants run Terraform commands locally and get intelligent development support through an integrated Language Server. It executes safe Terraform operations inside isolated Docker containers, offers code completion and documentation via LSP, and returns structured results for AI processing to help you manage infrastructure more efficiently.
You use Terry-Form MCP by running its container and then sending Terraform-related requests from your MCP client. The server restricts operations to safe actions and provides LSP-powered development features that help you write, validate, and plan Terraform configurations without modifying state.
Typical patterns you’ll follow include initializing workspaces, validating and formatting Terraform code, and generating plans. You can also leverage LSP capabilities for real-time hover explanations, completions, and diagnostics as you edit your Terraform files. All actions occur inside the container, using a mounted workspace in /mnt/workspace.
Prerequisites you need before starting: Docker installed and running, Python 3.8 or newer for development/testing, and access to your Terraform configurations in your workspace.
Step 1: Build the Docker image. You have two primary options. Use the provided script for a streamlined build, or build directly with Docker.
# Build using the provided script (Linux/macOS)
./build.sh
# Or for Windows users
build.bat
# Alternatively, build directly with Docker
docker build -t terry-form-mcp .Step 2: Run Terry-Form MCP as a server in a container and mount your workspace. The following command starts the server and shares your current directory as /mnt/workspace inside the container.
docker run -it --rm \
-v "$(pwd)":/mnt/workspace \
terry-form-mcpYou can perform a broad set of Terraform actions in read-only mode inside isolated containers. The architecture ensures workspace isolation by mounting your local workspace at /mnt/workspace and restricting access to those files. You can query environment readiness and LSP status to verify that the system is prepared for development.
Common workflow includes: initializing a workspace, running a plan, and using LSP features for code completion and diagnostics. The system supports batch operations and returns JSON-structured results for easy consumption by AI tools.
If you want to check readiness before development, you can run an environment check to confirm Terraform and the LSP integration are available.
MCP server configuration in IDEs typically involves pointing the MCP client to the terry-form-mcp container and mounting your workspace. The example below demonstrates a generic configuration shape that works across environments.
{
"mcpServers": {
"terry": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-v", "$(pwd):/mnt/workspace",
"terry-form-mcp"
]
}
}
}Security is built into the execution model. All Terraform commands run in ephemeral Docker containers, with read-only mounts for your workspace and no access to external networks. Only safe operations are allowed, such as init, validate, fmt, and plan. Destructive actions like apply or destroy are blocked to prevent unintended changes.
Key safety features include path validation, input sanitization, and structured output that makes it easier to reason about results from AI assistants.
LSP not initializing or features not working? Check the LSP status and environment readiness, then initialize the LSP client for your workspace if needed.
If Docker mount issues occur, verify the host paths and file permissions for the workspace you mounted into /mnt/workspace.
For Terraform execution errors, ensure you have initialized the workspace and validated syntax with LSP-based diagnostics.
Use verbose debugging to troubleshoot locally. You can enable detailed Python logs and run the container in interactive mode to observe behavior.
If you want to customize the image, you can modify the Dockerfile and rebuild the image with Docker.
Basic Terraform execution example: initialize and validate a project with Terry-Form MCP, then proceed to plan as needed.
LSP-powered development example: initialize the LSP client for a workspace, request hover information and completions, format files via LSP, and validate with diagnostics.
Executes Terraform commands in a containerized environment and returns structured results.
Validates Terraform files using LSP for detailed diagnostics.
Provides documentation for Terraform elements at a given cursor position.
Offers intelligent code completion suggestions for Terraform files.
Formats Terraform files using LSP-powered formatting.
Checks the status of the terraform-ls Language Server.
Checks the environment for Terraform and LSP readiness.
Gives detailed debugging information for the LSP integration.
Analyzes Terraform workspace structure and readiness.
Manually initializes the LSP client for a workspace.
Checks a Terraform file for syntax and structure issues.
Creates a properly structured Terraform workspace.
Gets Terraform and server version information.
Lists all Terraform workspaces in the mounted directory.
Analyzes Terraform configuration for best practices.
Provides improvement recommendations for Terraform code.
Scans Terraform configuration for security issues.
Clones or updates a GitHub repository.
Lists Terraform files in a repository.
Gets information about Terraform configuration in a repository.
Prepares a Terraform workspace from a GitHub repository.
Lists Terraform Cloud workspaces in an organization.
Gets detailed workspace information in TF Cloud.
Lists recent runs for a workspace in TF Cloud.
Gets state outputs from a TF Cloud workspace.