Huawei Cloud MCP Servers
Provides tools for searching and retrieving audit events from Huawei Cloud CTS, including listing traces and viewing full request/response details.
Provides tools for managing Huawei Cloud ECS instances (list, get, power actions, delete, resize), CodeArts pipelines (list, get, run, update, set status), and CTS audit logs (search, get detail).
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Huawei Cloud MCP Serverslist my ECS instances"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Huawei Cloud MCP Servers — Monorepo
A uv workspace monorepo containing three Huawei Cloud MCP (Model Context Protocol) servers and a unified ASGI gateway that mounts them on a single port with JWT authentication.
https://example.com/ecs/sse ← ECS 云主机生命周期管理
https://example.com/pipeline/sse ← CodeArts 流水线管理
https://example.com/cts/sse ← CTS 审计日志检索
https://example.com/healthz ← 网关探活(免鉴权)项目结构
mcp-servers/
├── start.sh ← 启动入口(加载 .env + 启动网关)
├── .env ← 统一环境变量(AK/SK + JWT + 各服务配置)
├── .env.example ← 全量模板
├── manifest.yaml ← 服务拓扑(挂载谁、路径、RBAC)
├── pyproject.toml ← uv workspace 声明
│
├── ecs-mcp-server/ ← ECS 云主机 MCP Server
│ └── src/ecs_mcp_server/
│
├── codearts-pipeline-mcp-server/ ← CodeArts 流水线 MCP Server
│ └── src/pipeline_mcp_server/
│
├── cts-mcp-server/ ← CTS 审计日志 MCP Server
│ └── src/cts_mcp_server/
│
├── mcp-auth-common/ ← 共享鉴权库(Identity / AutoAuth / require_role)
│ └── src/mcp_auth_common/
│
└── mcp-gateway/ ← ASGI 网关(Starlette Mount + JWT 中间件)
├── src/mcp_gateway/
├── tests/ ← 70 个测试,全部通过
├── deploy/ ← systemd + Nginx 配置
└── README.md ← 网关详细文档Related MCP server: MCP Gateway
MCP Server 一览
ECS Server — 云主机生命周期管理
工具 | 说明 | 最低角色 |
| 列出云主机(支持过滤/分页) | readonly |
| 查看单台云主机详情/状态 | readonly |
| 列出可用规格 | readonly |
| 查询异步任务状态 | readonly |
| 批量开机 | operator |
| 批量关机/重启 | admin |
| ⚠ 删除云主机 | admin |
| ⚠ 变更规格 | admin |
Pipeline Server — CodeArts 流水线管理
工具 | 说明 | 最低角色 |
| 列出流水线 | readonly |
| 查看流水线配置详情 | readonly |
| 触发流水线执行 | operator |
| ⚠ 修改流水线配置 | admin |
| ⚠ 启用/禁用流水线 | admin |
CTS Server — 审计日志检索
工具 | 说明 | 最低角色 |
| 按时间+条件搜索审计事件 | readonly |
| 查看单条事件完整请求/响应体 | readonly |
角色层级:admin ⊃ operator ⊃ readonly
网关架构
┌──────────────────────────────────────┐
│ MCP Gateway (port 8080) │
│ │
Client ──Bearer JWT──▶ │ GatewayAuthMiddleware │
│ ├─ JWT verify (RS256) │
│ ├─ Path RBAC (coarse) │
│ └─ Inject identity → scope │
│ │
│ Starlette Mount-based routing: │
│ /ecs → ecs_mcp_server │
│ /pipeline → pipeline_mcp_server │
│ /cts → cts_mcp_server │
└──────────────────────────────────────┘
│
┌───────────────┼───────────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ ECS MCP │ │Pipeline │ │ CTS MCP │
│ Server │ │ MCP Svr │ │ Server │
│──────────│ │──────────│ │──────────│
│ AutoAuth │ │ AutoAuth │ │ AutoAuth │
│ tool RBAC│ │ tool RBAC│ │ tool RBAC│
└──────────┘ └──────────┘ └──────────┘鉴权分层
层级 | 职责 | 粒度 | 示例 |
网关中间件 | 验签 JWT → 解析 Identity → 路径 RBAC → 注入 scope |
| 无 ecs 权限 → 403 |
MCP Server | 从 scope 读 Identity → 按 tool 名做角色判断 |
| 非 admin 调 delete → ToolError |
Server 侧鉴权:自动检测,零配置
每个 MCP Server 使用 AutoAuth 策略,无需配置任何环境变量:
场景 | 行为 | 说明 |
在网关后面 |
| 网关已验签,Identity 可信 |
独立启动(stdio / SSE) | 无 gateway identity → 合成 dev Identity + ⚠ WARN 日志 | 本地开发,自动放行 |
启动时日志会醒目提示:
⚠ No gateway identity found. Synthesising dev identity sub=dev-local
roles=['admin']. This means the server is NOT behind the MCP gateway
with JWT auth. If this is a production server, it is running WITHOUT
authentication. If this is local development, this is expected and safe.不再需要 MCP_AUTH_MODE 环境变量。 鉴权模式由运行环境自动决定。
网关鉴权模式
模式 | 环境变量 | 行为 | 场景 |
|
| 完整 JWT 验签 + 路径 RBAC | 生产 |
|
| 跳过 JWT,loopback 调用者合成 admin Identity | 本地开发 |
|
| 跳过所有鉴权 | 隔离测试 |
快速开始
前置条件
Python 3.10+
uv(推荐)或 pip
华为云 AK/SK
1. 安装依赖
# 使用 uv(推荐)
uv sync
# 或使用 pip
pip install -e ./mcp-auth-common
pip install -e ./ecs-mcp-server
pip install -e ./codearts-pipeline-mcp-server
pip install -e ./cts-mcp-server
pip install -e ./mcp-gateway2. 配置环境变量
编辑根目录 .env:
# 华为云凭证(三个 MCP Server 共用)
HUAWEICLOUD_ACCESS_KEY_ID=your-ak
HUAWEICLOUD_SECRET_ACCESS_KEY=your-sk
HUAWEICLOUD_PROJECT_ID=your-project-id
# 各服务 Region
HUAWEICLOUD_REGION=cn-north-4
CODEARTS_REGION=cn-north-4
CODEARTS_DEFAULT_PROJECT_ID=your-codearts-project-id
# 网关鉴权模式(本地开发用 dev,生产用 jwt)
MCP_GATEWAY_AUTH_MODE=dev
MCP_GATEWAY_HOST=127.0.0.13. 启动网关
# 启动所有 manifest.yaml 中 enabled=true 的服务
./start.sh
# 只启动 ecs 和 pipeline
./start.sh ecs,pipeline
# 自定义端口
./start.sh --port 9000
# 组合使用
./start.sh ecs --port 9000 --log-level debug4. 验证
# 探活
curl http://127.0.0.1:8080/healthz
# 连接 ECS(用 MCP 客户端或 curl)
curl http://127.0.0.1:8080/ecs/sse独立启动单个 MCP Server
每个 MCP Server 可以脱离网关独立运行,无需任何鉴权配置:
# stdio 模式(Hermes / Claude Desktop 本地调用)
ecs-mcp-server
# SSE 模式(本地浏览器/Postman 调试)
./ecs-mcp-server/scripts/run-sse-local.sh
# 带环境变量
./ecs-mcp-server/scripts/run-with-env.sh启动时会打印 ⚠ 警告日志,提示当前未经过网关鉴权。这是预期行为——本地开发不需要 JWT。
生产部署
生成 JWT 密钥对
openssl genrsa -out jwt-private.pem 2048
openssl rsa -in jwt-private.pem -pubout -out jwt-public.pem在 .env 中设置:
MCP_GATEWAY_AUTH_MODE=jwt
MCP_GATEWAY_HOST=0.0.0.0
MCP_JWT_PUBLIC_KEY=file:/etc/mcp-gateway/jwt-public.pem
MCP_JWT_ISSUER=mcp-gateway下游 MCP Server 会自动检测到网关注入的 Identity,无需额外配置。
systemd
参见 mcp-gateway/deploy/mcp-gateway.service:
[Service]
WorkingDirectory=/opt/mcp-servers
EnvironmentFile=/etc/mcp-gateway/.env
ExecStart=/opt/mcp-servers/start.sh \
--manifest /opt/mcp-servers/manifest.yamlNginx(仅 TLS 终结)
参见 mcp-gateway/deploy/nginx.conf.example。关键属性:一条 location / 规则。新增/移除 MCP Server 不需要改 Nginx。
选择性启动
通过三层覆盖控制本次启动哪些服务(优先级从低到高):
层级 | 来源 | 示例 |
1 |
|
|
2 |
|
|
3 | CLI |
|
启动日志明确打印"已挂载/已跳过"服务及跳过原因。
添加第 4 个 MCP Server
创建 Server 包,内嵌 AutoAuth(参考现有 Server 的
tools/*.py)在根
pyproject.toml的[tool.uv.workspace] members中添加目录在
manifest.yaml中添加一条服务记录在
.env/.env.example中添加该服务所需的环境变量重启网关
不需要改 Nginx,不需要改网关代码。
共享鉴权库(mcp-auth-common)
所有 MCP Server 和网关共用,包含:
组件 | 说明 |
| pydantic v2 模型: |
| 自动检测鉴权策略:有 gateway identity → 使用;否则合成 dev Identity + WARN |
| 抽象基类 |
| 角色校验,支持 admin ⊃ operator ⊃ readonly 层级 |
| contextvar 管道,让工具函数无需 |
测试
cd mcp-gateway
python3 -m pytest tests/ -v70 个测试,全部通过,覆盖:
类别 | 数量 | 验证内容 |
SSE 挂载前缀(Pitfall #1) | 6 |
|
组合 lifespan(Pitfall #2) | 4 | 多 FastMCP 实例正确挂载 |
网关鉴权中间件 | 9 | JWT 验签 + RBAC + Identity 注入 |
AutoAuth 自动检测 | 6 | 网关模式读 scope / 独立模式合成 dev Identity + WARN |
StandaloneAuth(网关内部) | 6 | JWT 自验签 / 过期拒绝 |
网关 dev 模式 | 7 | 免 JWT / loopback 放行 / disabled 模式 |
工具级 RBAC | 14 | 角色层级 + 三服务授权矩阵 |
manifest 覆盖优先级 | 9 | 三层覆盖 + 跳过原因 + 重复检测 |
SSE 前缀回归 | 6 | 传输层 endpoint 路径正确 |
环境变量速查
变量 | 必需 | 说明 |
| ✅ | 华为云 AK(三服务共用) |
| ✅ | 华为云 SK(三服务共用) |
| ✅ | IAM 项目 ID(ECS/CTS 使用) |
| ✅ | ECS/CTS 区域 |
| ✅ | CodeArts Pipeline 区域(≠ HUAWEICLOUD_REGION) |
| 推荐 | CodeArts 项目 UUID |
| ✅ | 网关鉴权模式: |
| ✅ | 监听地址(dev 模式建议 |
| 推荐 | 监听端口,默认 |
| jwt 模式必需 | RS256 公钥( |
| 推荐 | JWT 签发者,默认 |
| 可选 | 启用服务白名单(逗号分隔) |
完整列表见根目录 .env.example。
许可证
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/lexcodee/huaweicloud-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server