home / mcp / terraform plan analyzer mcp server
Analyzes Terraform plan outputs, generates reports, and tracks logs via MCP with support for environment variables.
Configuration
View docs{
"mcpServers": {
"codessrockman-terraform-plan-mcp-server": {
"command": "python",
"args": [
"server.py"
]
}
}
}You can run and analyze Terraform plans through this MCP Server, which lets you execute Terraform commands, parse plan outputs, generate markdown reports, and track log files—all controlled through the MCP protocol so you can automate analyses in your workflows.
Start the server locally in stdio mode so it communicates over standard input and output with your MCP client. Run the server with the Python interpreter and the server script.
Once the server is running, you can invoke its tools through your MCP client to: run a Terraform plan, analyze the produced plan output, generate a comprehensive report, or execute a custom Terraform command with environment variables. Use these tools to drive reproducible plan analysis, apply filters to ignore common non-actionable patterns, and keep track of log files generated during processing.
Prerequisites you need before starting the server:
pip install -r requirements.txtEnsure Terraform is installed and available in your PATH so the server can invoke Terraform commands safely.
Filtering patterns are applied to ignore certain resource lines in plan output. The default patterns include manifest, version, nat-vm, and nat_vm. You can customize these patterns when you analyze a Terraform plan by providing your own filter_patterns.
If you do not specify a working directory when calling a tool, the server will use the directory from which you started the server.
The server executes shell commands as part of its operations. Run it in a secure environment and ensure that environment variables are restored after custom commands run. The server logs errors to help with debugging and performs cleanup of temporary files.
If you encounter issues, check the logs for error messages, verify that Terraform is installed and reachable in your PATH, and confirm that your MCP client configuration is set up to communicate with the server using stdio transport.
To add new tools, define a function with the appropriate MCP decorator in your codebase, document its parameters and return type, and ensure proper error handling and logging. This makes new capabilities available to MCP clients in a consistent, observable way.
Execute a Terraform plan command and return the output.
Analyze Terraform plan output and extract changes.
Generate a comprehensive markdown report from Terraform plan output.
Execute a custom Terraform command with optional environment variables.
Track and expose generated log files from Terraform plan analyses.