
tfmcp
by nwiizo·★ 364·综合分 52
tfmcp 是一个全面的 Terraform MCP 服务器,配备 31 个专业工具,让 AI 助手能够管理基础设施。
概述
tfmcp 是一个基于 Rust 的命令行工具,通过模型上下文协议扩展了 Terraform 的功能。它提供了全面的基础设施管理工具,包括配置分析、计划执行、状态管理和工作区操作。该工具具有强大的安全控制功能,包括可配置策略、审计日志和操作限制,适合生产环境使用。其高级分析功能包括模块健康评分、依赖关系图可视化和 Future Architect Terraform 指南的合规性检查。
试试问 AI
装完之后,这里有 7 个你可以让 AI 做的事:
什么时候选它
当您需要通过 AI 助手全面管理 Terraform,尤其是已经使用 Claude Desktop 并需要企业级安全功能时,选择 tfmcp。
什么时候不要选它
如果您需要 Terraform 以外的云提供商的 MCP 服务器支持,或者需要超出 Terraform 操作的写入能力,请避免使用 tfmcp。
此 server 暴露的工具
从 README 抽取出 12 个工具init_terraformInitialize Terraform working directory
get_terraform_planGenerate and show execution plan
apply_terraformApply Terraform configuration
destroy_terraformDestroy Terraform-managed infrastructure
validate_terraformValidate configuration syntax
analyze_planAnalyze plan with risk scoring and recommendations
terraform_workspaceManage Terraform workspaces (list, show, new, select, delete)
terraform_importImport existing resources into Terraform state
analyze_terraformAnalyze Terraform configuration
terraform_graphGenerate dependency graph of Terraform resources
search_terraform_modulesSearch Terraform modules in the registry
get_security_statusPerform security scan with secret detection
可对比工具
安装
安装
从 Crates.io 安装
cargo install tfmcp使用 Docker
git clone https://github.com/nwiizo/tfmcp
cd tfmcp
docker build -t tfmcp .
docker run -it tfmcpClaude Desktop 集成
添加到 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"tfmcp": {
"command": "/path/to/your/tfmcp",
"args": ["mcp"],
"env": {
"HOME": "/Users/yourusername",
"PATH": "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
"TERRAFORM_DIR": "/path/to/your/terraform/project"
}
}
}
}FAQ
- 如何启用 terraform apply 等危险操作?
- 设置环境变量:TFMCP_ALLOW_DANGEROUS_OPS=true。要启用自动批准,还需设置 TFMCP_ALLOW_AUTO_APPROVE=true。
- 审计日志存储在哪里?
- 默认情况下,审计日志存储在 ~/.tfmcp/audit.log。您可以使用 TFMCP_AUDIT_LOG_FILE 自定义路径。
Hacker News 讨论
开发者社区最近的相关讨论。
- 帖子 by lockedinspace · 2025-04-22
tfmcp 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。