Token导航 LogoToken导航TokenDH.com
Cloud MCP AI Agent logo
AI代理stdio官方级别未说明来源级核验

Cloud MCP AI Agent

MCP Server

一个全面的模型上下文协议(MCP)系统,通过专门的MCP服务器为AI助手提供AWS服务访问,包括IAM管理和成本优化功能。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
成本优化PythonAI代理

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Developer-atomic-amardeep

提供方

Developer-atomic-amardeep

最后核验

2026/5/17 20:22

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python run_iam_server.py

详细介绍

云MCP AI智能体

一个全面的模型上下文协议(MCP)系统,通过专门的MCP服务器为AI助手提供访问AWS服务的途径。该项目包括用于AWS服务的MCP服务器以及一个智能客户端,该客户端能够自动将查询路由到相应的服务器。

🏗️ 建筑学

这个项目由三个主要部分组成:

  1. AWS IAM MCP 服务器 - 管理AWS身份和访问管理(IAM)操作
  2. AWS 账单与成本管理 MCP 服务器 - 负责AWS(亚马逊网络服务)的成本分析与优化
  3. 智能MCP客户端 - 使用层级选择将查询路由到适当的服务器

🚀 快速入门

先决条件

  1. Python 3.10及以上版本 - 使用以下方法安装 紫外线:
   uv python install 3.10
  1. AWS 凭据 - 使用以下方法之一进行配置:
   # Option 1: AWS Profile (recommended)
   export AWS_PROFILE=your-profile-name

   # Option 2: Environment Variables
   export AWS_ACCESS_KEY_ID=your-access-key
   export AWS_SECRET_ACCESS_KEY=your-secret-key
   export AWS_REGION=us-east-1
  1. Cerebras API密钥 - 对于智能客户端:
   export CEBRAS_API_KEY=your-cerebras-api-key

安装

# Clone the repository
git clone 
cd Cloud-MCP-AI-Agent

# Install dependencies
uv sync

环境设置

创造 .env 将文件放在相应的目录中:

# Root directory .env (for client)
echo "CEBRAS_API_KEY=your-cerebras-api-key" > .env

# IAM server .env
echo "AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_REGION=us-east-1" > iam-mcp-server/.env

# Billing server .env
echo "AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_REGION=us-east-1" > billing-cost-management-mcp-server/.env

🖥️ 运行服务器

IAM MCP 服务器

# Start the IAM server
python run_iam_server.py

# Server will be available at: http://localhost:8051/sse/

特点:

  • 用户、角色、组和策略管理
  • 访问密钥管理
  • 政策模拟与验证
  • 内联策略的创建、读取、更新和删除(CRUD)操作
  • 实施安全最佳实践

计费与成本管理MCP服务器

# Start the billing server
python run_billing_server.py

# Server will be available at: http://localhost:8050/sse/

特点:

  • 成本探索器见解与分析
  • 预算监控与提醒
  • 成本优化建议
  • 预留实例和节省计划分析
  • 免费层级使用情况监控
  • S3 存储镜像分析
  • 成本异常检测

使用智能客户端🤖

智能客户端使用三级分层选择系统,自动将您的查询路由到相应的MCP服务器:

  1. 服务器选择 - 在IAM服务器或计费服务器之间进行选择
  2. 工具组选择 - 选择适当的工具类别
  3. 工具选择 - 选择特定的工具来执行

运行客户端

cd llm_client_server
python client.py

客户端组件

  • client.py - 主客户端,具备智能路由功能
  • server_selector.py - 处理服务器选择逻辑
  • unified_hierarchical_agent.py - 管理工具组和工具选择
  • hierarchical_agent.py - 遗留层级代理(向后兼容)
  • server.py - 本地服务器实现

示例用法

from llm_client_server.client import MCPCerebrasClient

# Initialize client
client = MCPCerebrasClient()

# Connect to servers
await client.connect_to_server("http://localhost:8051/sse/")  # IAM
await client.connect_to_server("http://localhost:8050/sse/")  # Billing

# Query examples
await client.query("List all IAM users in my account")
await client.query("Show me my AWS costs for the last month")
await client.query("What are my cost optimization opportunities?")

📁 项目结构

Cloud-MCP-AI-Agent/
├── README.md                          # This file
├── pyproject.toml                     # Project configuration
├── run_iam_server.py                  # IAM server launcher
├── run_billing_server.py              # Billing server launcher
├── .gitignore                         # Git ignore rules
│
├── iam-mcp-server/                    # AWS IAM MCP Server
│   ├── README.md                      # IAM server documentation
│   ├── pyproject.toml                 # IAM server config
│   ├── awslabs/iam_mcp_server/        # Server implementation
│   └── tests/                         # IAM server tests
│
├── billing-cost-management-mcp-server/ # AWS Billing MCP Server
│   ├── README.md                      # Billing server documentation
│   ├── pyproject.toml                 # Billing server config
│   ├── awslabs/billing_cost_management_mcp_server/ # Server implementation
│   └── tests/                         # Billing server tests
│
└── llm_client_server/                 # Intelligent MCP Client
    ├── client.py                      # Main client implementation
    ├── server_selector.py             # Server selection logic
    ├── unified_hierarchical_agent.py  # Tool selection logic
    ├── hierarchical_agent.py          # Legacy agent
    ├── server.py                      # Local server
    └── data/                          # Client data files

🔧 配置

服务器配置

两台MCP服务器均支持多种配置选项:

IAM 服务器:

  • --read-only - 以只读模式运行(不进行修改)
  • --region - AWS 区域(默认:us-east-1)

计费服务器:

  • --region - AWS 区域(默认:us-east-1)
  • 针对复杂查询的自定义SQL会话管理

客户端配置

客户端可以通过环境变量进行配置:

# Cerebras API settings
CEBRAS_API_KEY=your-api-key

# Server endpoints (if different from defaults)
IAM_SERVER_URL=http://localhost:8051/sse/
BILLING_SERVER_URL=http://localhost:8050/sse/

🛡️ 安全

最佳实践

  1. 环境变量 - 所有敏感数据均从环境变量中加载
  2. AWS 凭据 - 使用 IAM 角色或配置文件,而不是硬编码的密钥
  3. 只读模式 - 为安全起见,以只读模式运行服务器
  4. 最小特权原则 - 授予AWS所需的最小权限

所需的AWS权限

对于IAM服务器:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "iam:List*",
                "iam:Get*",
                "iam:Create*",
                "iam:Delete*",
                "iam:Attach*",
                "iam:Detach*",
                "iam:Put*",
                "iam:Simulate*"
            ],
            "Resource": "*"
        }
    ]
}

对于计费服务器:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ce:*",
                "budgets:View*",
                "compute-optimizer:Get*",
                "compute-optimizer:Describe*",
                "cost-optimization-hub:Get*",
                "cost-optimization-hub:List*",
                "s3:GetStorageLensConfiguration*",
                "freetier:GetFreeTierUsage"
            ],
            "Resource": "*"
        }
    ]
}

🧪 测试

运行测试

# Test IAM server
cd iam-mcp-server
python -m pytest tests/

# Test Billing server
cd billing-cost-management-mcp-server
python -m pytest tests/

# Test client components
cd llm_client_server
python -m pytest

手动测试

# Test server connectivity
curl http://localhost:8051/sse/  # IAM server
curl http://localhost:8050/sse/  # Billing server

📚 文档

🤝 贡献

  1. 为仓库创建分支(或“克隆仓库”)
  2. 创建一个特性分支
  3. 进行你的更改
  4. 为新功能添加测试
  5. 提交一个拉取请求

📄 许可证

此项目采用MIT许可证授权——请参阅各个服务器目录中的具体许可证文件。

🆘 故障排除

常见问题

  1. 服务器无法启动:

- 检查AWS凭据是否已配置 - 验证端口8050和8051是否可用 - 检查Python版本(需要3.10+)

  1. 客户端连接失败:

- 确保服务器正在运行 - 验证CEBRAS_API_KEY是否已设置 - 检查服务器URL是否正确

  1. AWS 权限错误:

- 验证IAM权限是否符合要求 - 检查AWS区域配置 - 确保凭据具有必要的访问权限

调试模式

启用调试日志记录:

export MCP_DEBUG=1
python run_iam_server.py

🔄 更新

更新项目:

git pull origin main
uv sync  # Update dependencies

______________________________________________________________________

注: 此项目提供了强大的AWS管理功能。在生产环境中使用前,请务必在开发环境中进行测试,并遵循AWS安全最佳实践。

目录标签

目录标签

成本优化PythonAI代理AWS管理本地部署IAM服务自动化路由

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP