About Ecs FastMCP
Ecs FastMCP is an MCP server in the Cloud category: a mcp server powered by fastmcp.
Install
git clone https://github.com/secret-deus/ecs-FastMCPThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Ask AI
Ask AI about Ecs FastMCP
Powered by Claude · Grounded in docs
Security checks
- ✓README presentThe repository ships documentation.
5 checks have not been run yet.
README
ECS MCP (FastMCP Edition)
使用 FastMCP 实现的 ECS 只读巡检服务器与客户端。
工具
ecs_list_instancesecs_describe_instance_monitor_dataecs_inspect
安装
cd ecs-fastmcp
poetry install
配置变量(仓库根目录 .env)
在仓库根目录创建 .env:
ALIBABA_CLOUD_ACCESS_KEY_ID=你的AK
ALIBABA_CLOUD_ACCESS_KEY_SECRET=你的SK
# 可选
ALIBABA_CLOUD_SECURITY_TOKEN=
ALIBABA_CLOUD_ECS_REGION_ID=cn-hangzhou
(已移除模拟数据逻辑,必须配置真实 AK/SK 才能调用。)
说明:程序会优先加载仓库根目录 .env/config.env,并兼容常见变量名自动映射:
ALIYUN_ACCESS_KEY_ID/SECRET、ALICLOUD_ACCESS_KEY_ID/SECRET、ACCESS_KEY_ID/SECRET 等。
启动后可在 app.log 中看到:
Loaded env files: [...](应包含仓库根.env)Env presence -> AK:True SK:True
启动服务端
poetry run serve
# 或
poetry run python start_fastmcp_server.py
默认监听 0.0.0.0:8012,日志输出到仓库根的 app.log,同时保留控制台日志。
运行客户端示例
poetry run ecs-mcp-fastmcp-client
# 或
poetry run python start_fastmcp_client.py
客户端/脚本通过 SSE 连接,默认地址为
http://127.0.0.1:8012/sse。 也可通过环境变量覆盖:ECS_MCP_BASE=http://HOST:PORT/sse。
快速对比脚本(Average vs Maximum)
运行脚本对同一实例在 1h 窗口下对比 CPU 统计口径:
poetry run python scripts/compare_cpu.py i-xxxxxxxxxxxxxxxxx
# 或显式指定 SSE 地址
ECS_MCP_BASE=http://127.0.0.1:8012/sse poetry run python scripts/compare_cpu.py i-xxxxxxxxxxxxxxxxx
ecs_describe_instance_monitor_data 还支持参数 statistic(Average|Maximum|Minimum,默认 Average)。
接口参数要点(简)
ecs_describe_instance_monitor_data(instance_id, relative_range='1h', period=None, metrics=None, statistic='Average', region_id=None)- 返回
summary.cpu_avg/cpu_p95/cpu_max(百分比 0–100,不需要再乘 100)。
- 返回
常见问题排查
- 502/连不上:
- 确认连接的是
/sse:curl -N http://127.0.0.1:8012/sse | head -n 2 - 端口被占用:
lsof -nP -iTCP:8012 -sTCP:LISTEN -t | xargs -r kill
- 确认连接的是
- AK/SK 未命中:
app.log顶部Env presence -> AK:False SK:False,检查.env变量名或放在仓库根。
- CPU 与控制台曲线不一致:
- 控制台是“平均值”口径,脚本可传
statistic='Average';最大值请用Maximum。
- 控制台是“平均值”口径,脚本可传
参考: FastMCP Python SDK 文档 fastmcp.wiki/zh/python-sdk
README copy captured when this server was indexed; it may lag the repository. The original is authoritative.