tfmcp: Terraform Model Context Protocol Tool
About
๐ Terraform Model Context Protocol (MCP) Tool - An experimental CLI tool that enables AI assistants to manage and operate Terraform environments. Supports reading Terraform configurations, analyzing plans, applying configurations, and managing state with Claude Desktop integrati
Details
- License
- MIT
Explore
- ๐ Terraform Integration
Deeply integrates with the Terraform CLI to analyze and execute operations.
- ๐ MCP Server Capabilities
Runs as a Model Context Protocol server, allowing AI assistants to access and manage Terraform.
- ๐ฌ Module Health Analysis
Whitebox approach to Infrastructure as Code with cohesion/coupling analysis, health scoring, and refactoring suggestions based on software engineering principles.
- ๐ Resource Dependency Graph
Visualize resource relationships including explicit depends_on and implicit reference dependencies.
- ๐ฆ Module Registry Integration
Search and explore Terraform modules from the registry, get module details and versions.
- ๐ Enterprise Security
Production-ready security controls with configurable policies, audit logging, and access restrictions.
- ๐ Advanced Analysis
Detailed Terraform configuration analysis with best practice recommendations and security checks.
- ๐ Guideline Compliance (v0.1.8)
Future Architect Terraform guidelines integration with compliance scoring, secret detection, and variable quality checks.
- โก๏ธ Blazing Fast
High-speed processing powered by the Rust ecosystem with optimized parsing and caching.
- ๐ ๏ธ Automatic Setup
Automatically creates sample Terraform projects when needed, ensuring smooth operation even for new users.
- ๐ณ Docker Support
Run tfmcp in a containerized environment with all dependencies pre-installed.
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
tfmcp: Terraform Model Context Protocol ToolCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
- Rust (edition 2021)
- Terraform CLI installed and available in PATH
- Claude Desktop (for AI assistant integration)
- Docker (optional, for containerized deployment)
cargo install --path .
docker run -it -e TFMCP_LOG_LEVEL=debug tfmcp
- TERRAFORM_DIR: Set this to specify a custom Terraform project directory. If not set, tfmcp will use the directory provided by command line arguments, configuration files, or fall back to ~/terraform. You can also change the project directory at runtime using the set_terraform_directory tool.
- TFMCP_LOG_LEVEL: Set to debug, info, warn, or error to control logging verbosity.
- TFMCP_DEMO_MODE: Set to true to enable demo mode with additional safety features.
- TFMCP_ALLOW_DANGEROUS_OPS: Set to true to enable apply/destroy operations (default: false)
- TFMCP_ALLOW_AUTO_APPROVE: Set to true to enable auto-approve for dangerous operations (default: false)
- TFMCP_MAX_RESOURCES: Set maximum number of resources that can be managed (default: 50)
- TFMCP_AUDIT_ENABLED: Set to false to disable audit logging (default: true)
- TFMCP_AUDIT_LOG_FILE: Custom path for audit log file (default: ~/.tfmcp/audit.log)
- TFMCP_AUDIT_LOG_SENSITIVE: Set to true to include sensitive information in audit logs (default: false)
```bash
โ ๏ธ This project includes production-ready security features but is still under active development. While the security system provides robust protection, please review all operations carefully in production environments. โ ๏ธ
tfmcp is a command-line tool that helps you interact with Terraform via the Model Context Protocol (MCP). It allows LLMs to manage and operate your Terraform environments, including:
tfmcp provides 31 MCP tools for AI assistants:
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"tfmcp: terraform model context protocol tool": {
"tfmcp": {
"command": "docker",
"args": [
"build",
"-t",
"tfmcp",
"."
]
}
}
}
}
McpServers
{
"tfmcp": {
"command": "docker",
"args": [
"build",
"-t",
"tfmcp",
"."
]
}
}
โ ๏ธ This project includes production-ready security features but is still under active development. While the security system provides robust protection, please review all operations carefully in production environments. โ ๏ธ
tfmcp is a command-line tool that helps you interact with Terraform via the Model Context Protocol (MCP). It allows LLMs to manage and operate your Terraform environments, including:
๐ฎ Demo
See tfmcp in action with Claude Desktop:

- Reading Terraform configuration files
- Analyzing Terraform plan outputs
- Applying Terraform configurations
- Managing Terraform state
- Creating and modifying Terraform configurations
๐ Latest Release
The latest version of tfmcp (v0.1.9) is now available on Crates.io! You can easily install it using Cargo:
cargo install tfmcp
๐ What's New in v0.1.9
- ๐ Plan Analysis: Structured plan analysis with risk scoring and recommendations - ๐ State Analysis: Deep state inspection with drift detection - ๐ Workspace Management: Full terraform workspace support (list, show, new, select, delete) - ๐ฅ Import Helper: Guided resource import with config generation - โจ Code Formatting: terraform fmt integration - ๐ Dependency Graph: terraform graph visualization with DOT output - ๐ค Output Management: terraform output access - ๐ท๏ธ Taint/Untaint: Resource taint management (with deprecation notices for 1.5+) - ๐ State Refresh: Explicit state refresh operations - ๐ฆ Provider Info: Detailed provider information with lock file parsing - ๐ฆ Rust Edition 2024: Migrated to Rust Edition 2024 (requires Rust 1.85.0+)Features
- ๐ Terraform Integration
Deeply integrates with the Terraform CLI to analyze and execute operations.
- ๐ MCP Server Capabilities
Runs as a Model Context Protocol server, allowing AI assistants to access and manage Terraform.
- ๐ฌ Module Health Analysis
Whitebox approach to Infrastructure as Code with cohesion/coupling analysis, health scoring, and refactoring suggestions based on software engineering principles.
- ๐ Resource Dependency Graph
Visualize resource relationships including explicit depends_on and implicit reference dependencies.
- ๐ฆ Module Registry Integration
Search and explore Terraform modules from the registry, get module details and versions.
- ๐ Enterprise Security
Production-ready security controls with configurable policies, audit logging, and access restrictions.
- ๐ Advanced Analysis
Detailed Terraform configuration analysis with best practice recommendations and security checks.
- ๐ Guideline Compliance (v0.1.8)
Future Architect Terraform guidelines integration with compliance scoring, secret detection, and variable quality checks.
- โก๏ธ Blazing Fast
High-speed processing powered by the Rust ecosystem with optimized parsing and caching.
- ๐ ๏ธ Automatic Setup
Automatically creates sample Terraform projects when needed, ensuring smooth operation even for new users.
- ๐ณ Docker Support
Run tfmcp in a containerized environment with all dependencies pre-installed.
Installation
From Source
```bashSign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



