Terraform-MCP-Server
该项目提供了MCP(模型上下文协议)服务器,该服务器通过自然语言揭示Terraform基础架构AS代码操作。它使LLM可以执行TerraForm命令并检索有关基础结构的信息,而无需特定的命令语法知识。
1
Github Watches
1
Github Forks
2
Github Stars
Terraform MCP Assistant
A FastMCP-based server that provides natural language interface to Terraform operations. This assistant allows you to manage your infrastructure using simple English commands instead of remembering specific Terraform syntax.
Features
- Natural language processing of Terraform commands
- Execution plan visualization
- State inspection and management
- Infrastructure deployment and destruction
- Configuration documentation
- Automatic workspace validation
- Error handling and formatted output
Installation
- Clone the repository:
git clone https://github.com/yourusername/terraform-mcp-server.git
cd terraform-mcp-server
- Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Optional: Install Graphviz for plan visualization:
- Windows: Download from Graphviz Download Page
- Linux:
sudo apt-get install graphviz - macOS:
brew install graphviz
Configuration
- Set up environment variables (optional):
export TERRAFORM_WORKSPACE="/path/to/terraform/workspace"
export LOG_LEVEL="INFO"
- Place your Terraform configuration files in the workspace directory.
Usage
- Start the MCP server:
python src/main.py
- Example commands:
- "Initialize the Terraform workspace"
- "What will change if I apply?"
- "Show me the current state"
- "Apply the configuration"
- "List all resources"
- "Destroy the infrastructure"
Project Structure
terraform-mcp-assistant/
├── docs/ # Documentation
├── examples/ # Example Terraform configurations
├── src/ # Source code
│ ├── handlers/ # Command handlers
│ ├── main.py # Entry point
│ └── config.py # Configuration management
├── tests/ # Test files
├── .env # Environment variables (not in VCS)
└── README.md # This file
Development
- Install development dependencies:
pip install -r requirements-dev.txt
- Run tests:
pytest
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
相关推荐
I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.
Confidential guide on numerology and astrology, based of GG33 Public information
Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.
Your go-to expert in the Rust ecosystem, specializing in precise code interpretation, up-to-date crate version checking, and in-depth source code analysis. I offer accurate, context-aware insights for all your Rust programming questions.
Take an adjectivised noun, and create images making it progressively more adjective!
Reviews
user_UW2gW5D4
MCP Reporter by cyanheads is an essential tool for any MCP enthusiast. Its intuitive design and seamless integration make data reporting a breeze. The user-friendly interface ensures you can get started quickly without any hassle. Highly recommend for anyone looking to streamline their MCP usage. Check it out at: https://mcp.so/server/mcp-reporter/cyanheads.