๐ 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 integration. โก๏ธ
# tfmcp: Terraform Model Context Protocol Tool
[](https://archestra.ai/mcp-catalog/nwiizo__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:
```bash
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
```bash
# Clone the repository
git clone https://github.com/nwiizo/tfmcp...