- Home
- MCP servers
- Terraform Plan Analyzer
Terraform Plan Analyzer
- python
0
GitHub Stars
python
Language
6 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
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.
How to use
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.
How to install
Prerequisites you need before starting the server:
pip install -r requirements.txt
Ensure Terraform is installed and available in your PATH so the server can invoke Terraform commands safely.
Configuration
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.
Security and maintenance notes
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.
Troubleshooting
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.
Extending the server
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.
Available tools
run_terraform_plan
Execute a Terraform plan command and return the output.
analyze_terraform_output
Analyze Terraform plan output and extract changes.
generate_plan_report
Generate a comprehensive markdown report from Terraform plan output.
run_custom_terraform_command
Execute a custom Terraform command with optional environment variables.
log_file_tracking
Track and expose generated log files from Terraform plan analyses.