CloudFormation管理工具服务器

一个基于Sceptre的MCP服务器,为AI代理提供AWS CloudFormation堆栈的全生命周期管理功能。

  • by Sceptre
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 Sceptre/sceptre-mcp-server

使用说明

权杖mcp服务器

A. 模型上下文协议 暴露的(MCP)服务器 权杖 CloudFormation管理操作作为AI代理的工具。

它做什么

人工智能代理(Claude、Kiro等)可以连接到此服务器,并通过Sceptre的Python API管理AWS CloudFormation堆栈。服务器公开了22个涵盖整个堆栈生命周期的工具:

  • 堆栈生命周期 --创建、更新、删除、启动
  • 询问 --状态、描述、输出、资源、事件
  • 模板 --生成、验证
  • 差异和漂移 --与部署状态进行比较,检测并显示漂移
  • 更改集合 --创建、描述、列出、执行、删除
  • 发现 --列出堆栈,转储解析配置

需求

  • Python 3.10+
  • A已配置 权杖项目 和 config/ 和 templates/ 目录

安装

pip install sceptre-mcp-server

或者直接运行而不安装:

uvx sceptre-mcp-server

MCP客户端配置

基罗

添加 .kiro/settings/mcp.json:

{
  "mcpServers": {
    "sceptre": {
      "command": "uvx",
      "args": ["sceptre-mcp-server"],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

克劳德桌面

添加 claude_desktop_config.json:

{
  "mcpServers": {
    "sceptre": {
      "command": "uvx",
      "args": ["sceptre-mcp-server"]
    }
  }
}

工具参考

每个工具都需要一个 sceptre_project_dir 指向Sceptre项目根的参数。堆栈专用工具还需要 stack_path 相对于 config/ 目录。

堆栈生命周期

工具 参数 说明
create_stack sceptre_project_dir, stack_path 创建新的CloudFormation堆栈
update_stack sceptre_project_dir, stack_path 更新现有堆栈
delete_stack sceptre_project_dir, stack_path 删除堆栈
launch_stack sceptre_project_dir, stack_path 根据需要创建或更新堆栈

询问

工具 参数 说明
get_stack_status sceptre_project_dir, stack_path 获取当前堆栈状态
describe_stack sceptre_project_dir, stack_path 获取完整堆栈详细信息
describe_stack_outputs sceptre_project_dir, stack_path 获取堆栈输出值
describe_stack_resources sceptre_project_dir, stack_path 列出堆栈资源
describe_stack_events sceptre_project_dir, stack_path 获取堆栈事件历史记录

模板

工具 参数 说明
generate_template sceptre_project_dir, stack_path 渲染CloudFormation模板
validate_template sceptre_project_dir, stack_path 使用CloudFormation验证模板

差异与漂移

工具 参数 说明
diff_stack sceptre_project_dir, stack_path, diff_type 本地模板与部署模板的差异(deepdiff或difflib)
drift_detect sceptre_project_dir, stack_path 检测配置漂移
drift_show sceptre_project_dir, stack_path, drifted_only 显示漂移细节

更改集合

工具 参数 说明
create_change_set sceptre_project_dir, stack_path, change_set_name 创建变更集
describe_change_set sceptre_project_dir, stack_path, change_set_name 描述变更集
list_change_sets sceptre_project_dir, stack_path 列出所有变更集
execute_change_set sceptre_project_dir, stack_path, change_set_name 执行变更集
delete_change_set sceptre_project_dir, stack_path, change_set_name 删除更改集

发现和配置

工具 参数 说明
list_stacks sceptre_project_dir, stack_path (可选) 列出项目中的堆栈
dump_config sceptre_project_dir, stack_path 转储解析堆栈配置

示例用法

一旦连接,AI代理可以调用以下工具:

> List all stacks in my project at /home/user/infra

Calls: list_stacks(sceptre_project_dir="/home/user/infra")

> What's the status of the dev VPC stack?

Calls: get_stack_status(sceptre_project_dir="/home/user/infra", stack_path="dev/vpc.yaml")

> Show me what would change if I deploy the prod API stack

Calls: diff_stack(sceptre_project_dir="/home/user/infra", stack_path="prod/api.yaml")

AWS配置

Sceptre使用标准的AWS证书链。要指定配置文件或区域,请通过MCP客户端配置传递环境变量:

{
  "mcpServers": {
    "sceptre": {
      "command": "uvx",
      "args": ["sceptre-mcp-server"],
      "env": {
        "AWS_PROFILE": "my-profile",
        "AWS_DEFAULT_REGION": "us-west-2"
      }
    }
  }
}

贡献

看 贡献.md 用于开发设置、测试、预提交挂钩和类型检查。

许可证

阿帕奇-2.0