radeon-cloud-mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. radeon_cloud_mcp-0.1.0/.gitignore +11 -0
  2. radeon_cloud_mcp-0.1.0/DESIGN.md +246 -0
  3. radeon_cloud_mcp-0.1.0/LICENSE +202 -0
  4. radeon_cloud_mcp-0.1.0/PKG-INFO +99 -0
  5. radeon_cloud_mcp-0.1.0/README.md +81 -0
  6. radeon_cloud_mcp-0.1.0/docs/community-blog-draft.md +152 -0
  7. radeon_cloud_mcp-0.1.0/docs/modelscope-deploy.md +91 -0
  8. radeon_cloud_mcp-0.1.0/modelscope/service-config.json +14 -0
  9. radeon_cloud_mcp-0.1.0/pyproject.toml +33 -0
  10. radeon_cloud_mcp-0.1.0/scripts/smoke_instance.py +47 -0
  11. radeon_cloud_mcp-0.1.0/scripts/smoke_live.py +97 -0
  12. radeon_cloud_mcp-0.1.0/scripts/smoke_stdio.py +80 -0
  13. radeon_cloud_mcp-0.1.0/src/radeon_cloud_mcp/__init__.py +3 -0
  14. radeon_cloud_mcp-0.1.0/src/radeon_cloud_mcp/__main__.py +4 -0
  15. radeon_cloud_mcp-0.1.0/src/radeon_cloud_mcp/client.py +316 -0
  16. radeon_cloud_mcp-0.1.0/src/radeon_cloud_mcp/config.py +93 -0
  17. radeon_cloud_mcp-0.1.0/src/radeon_cloud_mcp/errors.py +109 -0
  18. radeon_cloud_mcp-0.1.0/src/radeon_cloud_mcp/files.py +92 -0
  19. radeon_cloud_mcp-0.1.0/src/radeon_cloud_mcp/model_matrix.py +174 -0
  20. radeon_cloud_mcp-0.1.0/src/radeon_cloud_mcp/server.py +110 -0
  21. radeon_cloud_mcp-0.1.0/src/radeon_cloud_mcp/ssh.py +233 -0
  22. radeon_cloud_mcp-0.1.0/src/radeon_cloud_mcp/tools_instance.py +328 -0
  23. radeon_cloud_mcp-0.1.0/src/radeon_cloud_mcp/tools_tf.py +358 -0
  24. radeon_cloud_mcp-0.1.0/tests/conftest.py +96 -0
  25. radeon_cloud_mcp-0.1.0/tests/test_client.py +151 -0
  26. radeon_cloud_mcp-0.1.0/tests/test_errors.py +43 -0
  27. radeon_cloud_mcp-0.1.0/tests/test_files.py +71 -0
  28. radeon_cloud_mcp-0.1.0/tests/test_matrix.py +74 -0
  29. radeon_cloud_mcp-0.1.0/tests/test_server.py +65 -0
  30. radeon_cloud_mcp-0.1.0/tests/test_ssh.py +234 -0
  31. radeon_cloud_mcp-0.1.0/tests/test_tools_instance.py +255 -0
  32. radeon_cloud_mcp-0.1.0/tests/test_tools_tf.py +230 -0
@@ -0,0 +1,11 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .pytest_cache/
5
+ *.egg-info/
6
+ build/
7
+ dist/
8
+ radeon-output/
9
+ auth.json
10
+ .env
11
+ *.key
@@ -0,0 +1,246 @@
1
+ # Radeon Cloud MCP 服务 — 开发方案(定稿)
2
+
3
+ > 依据:**[Radeon Cloud 中文文档](https://amd-aim.github.io/radeon-cloud-docs/zh-cn/api/overview/)(首要参考)** 与[英文站](https://amd-aim.github.io/radeon-cloud-docs/)(同构,65 个文件一一对应);源码克隆于 `tmp/radeon-cloud-docs/`,文档更新至 2026-12-01。
4
+ > 目标:把 AMD Radeon Cloud 平台能力封装为 MCP 服务 `radeon-cloud-mcp`,**核心是 GPU Notebook 实例的部署、管理、操作与训练**(rcc CLI 生命周期 + asyncssh 远程执行/后台训练任务/SFTP 传输),附带 Token Factory 免费推理工具;**部署到 ModelScope MCP 广场(可托管部署)**,发布社区后按「AMD GPU × 魔搭联合激励计划 2.0」申请开发者积分;同时支持本地 stdio 接入 DSH。
5
+ >
6
+ > 已确认决策:范围 = Phase 1(Token Factory)+ Phase 2(GPU 实例管理);技术栈 = 参考 ModelScope 托管 MCP 的通行实现(Python + FastMCP,uvx/stdio 托管,env 注入凭证);暂无 rc- key,先 mock 开发与单测。
7
+ >
8
+ > 连通性已验证(2026-12-01,本机):`GET https://developer.amd.com.cn/radeon/api/v1/models` 无凭证 → `401 {"detail":"Login required"}`,与文档错误形状一致。
9
+
10
+ ---
11
+
12
+ ## 1. 平台调研结论
13
+
14
+ ### 1.1 平台组成(四块 API,凭证互不通用)
15
+
16
+ | 部分 | 能力 | 凭证 | Base URL |
17
+ |---|---|---|---|
18
+ | **Token Factory** | 平台托管模型推理,免费、免开机、按日配额(pts 点数) | `rc-` + 48 hex(Bearer 或 `x-api-key`) | `https://developer.amd.com.cn/radeon/api/v1`(**仅中国站**) |
19
+ | **Model service** | 自己实例上的 vLLM(Deploy type: Model API),请求原样透传 | 实例卡片上的 `sk-` key(每次启动新生成) | 实例卡片给出,形如 `https://jupyter.anruicloud.com/inference/<instance-id>/v1` |
20
+ | **Platform API** | 控制台后端:实例 / 模板 / 账户 | **仅浏览器 session cookie**,脚本拿不到 | `https://developer.amd.com.cn/radeon` 或 `https://radeon-global.anruicloud.com` |
21
+ | **Radeon Cloud CLI** | 实例全生命周期、积分、资源目录、SSH key | `rcc_` token(`rcc auth login` 浏览器设备授权;外部注入用 `RCC_TOKEN` env) | CLI 内部调用 `/api/cli/...` |
22
+
23
+ 关键结论:
24
+ - **推理类工具走 Token Factory HTTP API**(`rc-` key),这是唯一对脚本友好的推理入口。
25
+ - **实例管理不能走 Platform API**(只认浏览器 session);官方指定的脚本化途径是 **`rcc` CLI**(pip 包 `amd-oneclick-sdk`,PyPI 现有 1.1.1),支持 `--output json`、明确退出码(0/1/2/5/130)、`--idempotency-key` 幂等重试。MCP 封装实例管理 = 子进程调用 `rcc` 并解析 JSON。
26
+ - 每账户**同时只能有 1 个实例**,实例命令都不带 instance ID。
27
+ - 实例按小时消耗 credits(1 credit/GPU/小时,ready 后 1–2 分钟内扣首小时);Token Factory 消耗独立的每日 pts 配额(00:00 北京时间重置),二者无关。
28
+ - 控制台入口:<https://developer.amd.com.cn/radeon/>(中国站,AMD AI 开发者计划账号,可用魔搭账号登录)。
29
+
30
+ ### 1.2 Token Factory 端点清单
31
+
32
+ | 端点 | 说明 |
33
+ |---|---|
34
+ | `GET /v1/models` | 模型目录(id、模态、context_length、supported_parameters、pricing、json_output 等)。**不是** OpenAI 的 model 对象(无 `object`/`owned_by`)。目录会变动,须运行时解析,建议缓存几分钟 |
35
+ | `GET /v1/models/utilization[/{model}]` | 模型负载 0–100 / state(idle/busy/full/unknown)。仅中国站有数据;约 10s 刷新、5s 缓存;负载仅供展示,不代表会不会被限流 |
36
+ | `POST /v1/chat/completions` | OpenAI 兼容聊天。网关按白名单重建请求体:**未列参数被静默丢弃**(`stop`/`seed`/`logprobs`/`top_k`/`min_p` 等);`thinking`/`reasoning.enabled` 直接 400 |
37
+ | `POST /v1/messages` | Anthropic Messages 兼容(`max_tokens` 必填;`thinking.budget_tokens` 被拒,用 `output_config.effort`) |
38
+ | `POST /v1/messages/count_tokens` | token 估算(网关自己的 tokenizer,仅供 sizing) |
39
+ | `GET /v1/usage` | 配额与用量:rpm_limit、daily_cost_*(字段名带 `_usd` 但实为 pts)、today/last_30_days/all_time/by_model;`?include_recent=true` 带明细 |
40
+ | `POST /v1/ocr` | **MinerU2.5-Pro** 文档 OCR:PDF/图片(URL 或 data: URL)→ 逐页 Markdown;按页计费;整篇解析完才返回,需长超时 |
41
+ | `POST /v1/audio/speech` | **OmniVoice** TTS:文本 ≤4096 字符 → 音频字节(wav/mp3/opus/flac/pcm,24kHz 单声道);支持预设音色 / 文字描述 / `ref_audio` 克隆(≤30s,配 `ref_text`);请求体 <5MB;**权重 CC-BY-NC 非商用**,需署名 |
42
+ | `POST /v1/systemone` | **Clef / d3 / d3-flash** 决策模型:`state`(文本或 JSON)+ `questions`(choice/noul/score 三型)→ 每个选项的概率;可带图片/视频(data: URL,体 <5MB,单题 ≤32768 token);不生成文本 |
43
+
44
+ 所有路径 `/api/v1/...` 与 `/v1/...` 等价。
45
+
46
+ ### 1.3 必须内建的模型差异(网关/模板坑)
47
+
48
+ - **system 消息**:全模型通吃的形状 = 单条 `system` 置于 index 0。`developer` 角色仅部分模型接受(Qwen3.8-27B、GLM-5.3-Flash、MiniCPM5-2B 会报错)→ 客户端默认归一化 `developer`→`system` 并前置。
49
+ - **reasoning_effort 档位不通用**:`high` 在 Qwen3.8-27B 上 400,`xhigh` 在 GLM-5.3-Flash 上 422;**`low`/`medium` 是已验证模型的交集**。Qwen3.8-27B 只收 `low/medium/xhigh`,GLM-5.3-Flash 只收 `low/medium/high`。
50
+ - **默认思考行为不一**:Qwen3.8-27B / Qwen3.8-Flash-Next / Inkling-2-Mini / GLM-5.3-Flash / MiMo-V2.6-Flash 不传参数也思考,且思考消耗同一 `max_tokens` 预算(预算小会返回空 content);MiMo 无法关闭思考。MiniCPM-V-4.7 系列与 Gemma-4-31B-IT 用 `chat_template_kwargs.enable_thinking` 开启。
51
+ - **思考文本**在 `choices[0].message.reasoning`(不是 `reasoning_content`);思考 token 数读 `usage.completion_tokens_details.reasoning_tokens`(Qwen3.8-27B 旧部署缺该对象、MiMo 恒 0)。
52
+ - **图像输入**仅部分模型支持(DeepSeek-V4.1-Flash、Qwen3.8-27B、Inkling-2-Mini、MiMo、MiniCPM-V 系列、Gemma-4-31B-IT),`content` 数组放 `image_url` part(可 data: URL)。
53
+ - 全模型支持 `response_format: json_object` 与 `tools`/`tool_choice`。
54
+ - 模型 ID ≠ 卡片标题 ≠ `name`(如 `Gemma-4-31B-IT` vs "Gemma 4 31B"),以 `GET /v1/models` 的 `id` 为准。
55
+
56
+ ### 1.4 限流 / 错误 / 超时
57
+
58
+ - 限流双层:平台准入(每 key RPM≈30、并发≈8、每模型/进程/全局并发)+ 网关计量(每账户 RPM≈20 滑动窗、每日 pts 上限)。**数值因账户而异,从 `/v1/usage` 与响应头读取,不要硬编码。**
59
+ - 每个成功响应带 `X-RateLimit-*` 头(剩余 RPM、每日配额、重置时间)。
60
+ - `429` 带 `Retry-After`(并发限约 15–22s;长 prompt 并发限 30s:Qwen3.8-Flash-Next ≥128K、Inkling-2-Mini ≥64K 每 key/账户同时只跑 1 条)。**按状态码 429 分支并遵守 Retry-After,不要只信 code**;两层限流器 code 不同、body 嵌套不同。
61
+ - 错误体三种形状:OpenAI `{"error":{...}}`;平台包裹 `{"detail":{"error":{...}}}` 或 `{"detail":"文本"}`;`/v1/messages` 用 Anthropic `{"type":"error","error":{...}}`。解析顺序:`body.error` → `body.detail.error` → `body.detail`。
62
+ - 重试策略:仅 429/502/503 重试,遵守 Retry-After + 指数退避抖动;其余 4xx 不重试。客户端并发用信号量(≤8)主动约束。
63
+ - 超时:非流式约 10 分钟被平台掐断;流式总时长可达约 30 分钟(10 分钟是 chunk 间隔上限)→ **长生成内部用 stream 聚合**。OCR 长文档同样需要大超时。
64
+ - 未知模型名 → 400 `Requested model <name> not supported`(不是 404)。
65
+
66
+ ### 1.5 条款约束
67
+
68
+ Token Factory 是**免费试用/开发服务,禁止生产用途与转售**;OmniVoice 音频**非商用**且需附 Boson/Meta 署名。README 与相关工具描述中必须写明。
69
+
70
+ ---
71
+
72
+ ## 2. MCP 服务设计(定稿)
73
+
74
+ ### 2.1 技术栈与形态(对齐 ModelScope 托管 MCP 通行实现)
75
+
76
+ 参考 ModelScope MCP 广场托管服务的实现方式(FastMCP 案例:[train-ticket-mcp](https://pypi.org/project/train-ticket-mcp/)、[thiter-mcp](https://pypi.org/project/thiter-mcp/);官方教程:[使用FastMCP自主创建MCP并部署至魔搭MCP广场](https://developer.aliyun.com/article/1666892);平台说明:[MCP广场简介](https://www.modelscope.cn/docs/mcp/intro)):
77
+
78
+ - **Python + 官方 `mcp` SDK 2.x(MCPServer,原 FastMCP)+ httpx + asyncssh**;`pyproject.toml` 打包,console script `radeon-cloud-mcp`。
79
+ - **双传输**:`stdio`(默认;ModelScope 托管经 `uvx` 拉起、DSH 本地直连)+ `streamable-http`(自托管/本地联调,`--transport http --port 8000`)。
80
+ - **配置全走环境变量**(ModelScope 服务详情页注入,令牌不落代码):
81
+
82
+ | env | 必填 | 说明 |
83
+ |---|---|---|
84
+ | `RADEON_API_KEY` | Phase 1 必填 | `rc-` key,Token Factory 全部工具 |
85
+ | `RADEON_BASE_URL` | 否 | 默认 `https://developer.amd.com.cn/radeon/api/v1` |
86
+ | `RCC_TOKEN` | Phase 2 托管模式必填 | `rcc_` token;本地模式可改用 `rcc auth login` 的登录态 |
87
+ | `RADEON_OUTPUT_DIR` | 否 | 音频/OCR 图片落盘目录(默认 `./radeon-output`;托管容器内为临时盘) |
88
+ | `RADEON_MCP_AUTH_FILE` | 否 | 本地 JSON 凭证文件(600),env 优先;仿 colab-mcp |
89
+
90
+ - 依赖:`mcp>=1.2`、`httpx`;`amd-oneclick-sdk`(提供 `rcc`,Phase 2 子进程封装)。
91
+
92
+ ### 2.2 工具清单
93
+
94
+ #### Phase 1:Token Factory(serverName: `radeon`)
95
+
96
+ | 工具 | 映射 | 输入要点 | 输出要点 |
97
+ |---|---|---|---|
98
+ | `list_models` | `GET /v1/models` | 可选过滤:名称子串/vision/free | 精简目录(id、context、模态、思考默认、档位、价格 pts)+ 矩阵提示;缓存 5 min |
99
+ | `model_load` | `GET /v1/models/utilization[/{model}]` | 可选 model | utilization/state/partial/sampled_at;注明"负载≠限流" |
100
+ | `chat` | `POST /v1/chat/completions` | model、messages 或 prompt+system 便捷形、temperature、max_tokens、reasoning_effort、response_format、tools、images(路径/URL/data URL) | content 与 reasoning 分离、finish_reason、usage 明细、剩余配额头、归一化警告;**内部 stream 聚合**防 10 min 掐断;自动 developer→system 前置、档位预校验 |
101
+ | `usage` | `GET /v1/usage` | include_recent | 配额/用量/重置时间;明确 pts 非货币 |
102
+ | `ocr` | `POST /v1/ocr` | document:URL/本地路径(→data URL)、pages、include_image_base64 | 逐页 Markdown + pages_processed;图片可选落盘/内联 |
103
+ | `speech` | `POST /v1/audio/speech` | input ≤4096 字符、voice/instructions/ref_audio+ref_text、response_format(默认 mp3 省体积)、speed、language、seed、return_base64 | 音频落盘返回路径;远程客户端可 `return_base64=true` 取 data URL;描述注明非商用与署名 |
104
+ | `decide` | `POST /v1/systemone` | model(Clef/d3/d3-flash)、state(str/JSON)、questions(choice/noul/score)、images/videos | answers(选项+概率+confidence)、usage;体 <5MB 预检;提示"用概率而非仅 top 答案" |
105
+
106
+ #### Phase 2:实例部署/管理/操作/训练(核心)
107
+
108
+ 生命周期封装 `rcc --output json`(退出码 0/1/2/5/130 语义化);实例内操作经 **asyncssh**(纯 Python,托管容器无需系统 ssh)。
109
+
110
+ | 工具 | 映射 | 备注 |
111
+ |---|---|---|
112
+ | `credits_status` | `rcc status` | 账户+积分+实例一览 |
113
+ | `catalog_list` | `rcc catalog list [--kind]` | environment/resource_pool/resource_template;"可列出≠有空闲 GPU" |
114
+ | `instance_create` | `rcc instance create --env --pod-type --resource-template [--use-pvc] [--no-wait] [--no-ssh]` | 自动 `--idempotency-key`;默认等待 ready 且 **ssh=true**;exit 5(本地等待超时)不取消创建→转 status 跟进;**按小时扣 credits** 醒目警示 |
115
+ | `instance_status` | `rcc instance status` | exit 0 ≠ 健康,读 JSON 状态;含 ssh_host/port/username |
116
+ | `instance_logs` | `rcc instance logs` | 启动事件+容器日志 |
117
+ | `instance_delete` | `rcc instance delete --yes` | **破坏性**:要求显式 `confirm=true`;临时 workspace 随实例删除,持久 /workspace 保留 |
118
+ | `instance_connect` | `rcc instance open --print` / `ssh --print` | Jupyter 一次性短时效链接=敏感信息;返回文本,远程可用 |
119
+ | `instance_add_key` | `rcc instance add-key [--identity-file]` | 上传公钥(仅本地模式有意义);**公钥只对上传后创建的实例生效** |
120
+ | `cli_health` | `rcc doctor` + `rcc auth status` | 诊断安装/登录/连通;托管模式验证 RCC_TOKEN 首选 |
121
+ | `instance_exec` | SSH `conn.run` / `setsid sh -c … &` | **实例内执行命令**;`background=true` 脱离会话跑训练等长任务,写 pid/exit/log 文件;前台超时上限 600s;输出截断 100K 字符 |
122
+ | `instance_job` | SSH kill -0 / tail / kill -TERM→-KILL(进程组) | 后台任务 status(运行态+退出码)/ logs(tail)/ stop |
123
+ | `instance_transfer` | SFTP put/get(递归) | 训练脚本/数据上传、checkpoint 下载;托管模式 local 为容器路径 |
124
+ | `instance_gpu_status` | SSH `rocm-smi` | 利用率/显存/温度/功耗 |
125
+
126
+ SSH 凭证:本地 `RADEON_SSH_IDENTITY`(默认尝试 ~/.ssh/id_ed25519 等);托管 `SSH_PRIVATE_KEY`(内容注入→600 临时文件)。主机密钥校验默认关闭(实例 host/port 随启动变化),`RADEON_SSH_KNOWN_HOSTS` 可启用。
127
+
128
+ ### 2.3 架构
129
+
130
+ ```
131
+ radeon-cloud-mcp/
132
+ ├── DESIGN.md / README.md / .gitignore
133
+ ├── pyproject.toml # mcp>=2.3、httpx、amd-oneclick-sdk、asyncssh;[project.scripts]
134
+ ├── src/radeon_cloud_mcp/
135
+ │ ├── server.py # MCPServer 入口;--transport stdio|http;RadeonError→ToolError
136
+ │ ├── config.py # env > auth.json(600);站点/输出目录/SSH 凭证
137
+ │ ├── errors.py # 错误体归一化(error / detail.error / detail / Anthropic)
138
+ │ ├── client.py # httpx 异步:信号量8 + RPM pacing + Retry-After退避 + 配额头 + SSE聚合
139
+ │ ├── model_matrix.py # 模型差异矩阵 + chat 请求归一化(system/developer/档位)
140
+ │ ├── files.py # 路径→data URL、5MB 预检、产出落盘
141
+ │ ├── ssh.py # asyncssh:连接/前台执行/setsid后台任务/SFTP/rocm-smi
142
+ │ ├── tools_tf.py # Phase 1(7 工具)
143
+ │ └── tools_instance.py # Phase 2(13 工具:rcc 生命周期 + SSH 操作/训练)
144
+ ├── tests/ # pytest + httpx.MockTransport + 子进程/SSH mock + MCPServer 直调(70 项)
145
+ ├── scripts/smoke_live.py # 真实冒烟(已配 key,Phase 1 已通过)
146
+ ├── scripts/smoke_stdio.py # stdio JSON-RPC 端到端冒烟(已通过)
147
+ ├── docs/modelscope-deploy.md # 托管部署指南(PyPI+uvx / GitHub 快速创建)+ 积分申请清单
148
+ └── modelscope/service-config.json # 创建服务时的 mcpServers 配置示例
149
+ ```
150
+
151
+ 横切设计:
152
+ - **凭证**:env 优先,其次 `~/.config/radeon-cloud-mcp/auth.json`(600);绝不写入日志/返回体。
153
+ - **限流自治**:并发信号量 8;RPM 从 `/v1/usage` 动态读取(缓存 60s)并 pacing;429/502/503 按 Retry-After+抖动退避(≤4 次重试);其余 4xx 直接结构化报错。
154
+ - **长任务**:chat 内部 `stream:true` 聚合;OCR/speech 大超时(默认 600s);DSH 侧 `toolCallTimeoutMs≈660000`。
155
+ - **文件进出(托管模式适配)**:输入支持 URL/data URL/本地路径(路径仅本地模式有效);产出音频默认落盘返回路径,`return_base64=true` 时返回 data URL 供远程客户端使用(推荐 mp3 控制体积);OCR 图片默认不内联。
156
+ - **无 key 行为**:工具返回结构化 setup 提示(仿 colab-mcp),不崩溃;工具列表始终可加载。
157
+ - **站点**:默认中国站;Global 站无 Token Factory(utilization 恒 503,不重试)。
158
+
159
+ ### 2.4 错误与结果规范
160
+
161
+ - 工具失败返回 MCP `isError` + 结构化文本:HTTP status、归一化 code/message、Retry-After、建议动作("模型已下架→重新 list_models"、"配额耗尽→等待 daily_reset_at"、"401→检查 RADEON_API_KEY")。
162
+ - chat 成功结果附带 finish_reason、usage 明细、响应头剩余配额(让 agent 自主节流)。
163
+ - rcc 退出码语义:0=命令完成(仍需读 JSON 状态)、1=服务/网络错误、2=用法/认证错误、5=本地等待超时(服务端仍在创建)、130=用户中断。
164
+
165
+ ### 2.5 ModelScope 托管部署(主发布形态)
166
+
167
+ 平台机制([MCP广场简介](https://www.modelscope.cn/docs/mcp/intro)):托管服务运行于**用户级隔离环境**;使用者在服务详情页填入 env(KEY/TOKEN)后获得**专属 SSE URL(敏感,勿泄漏)**;可在详情页"工具测试"与 [MCP 实验场](https://modelscope.cn/mcp/playground) 联调。
168
+
169
+ 两条创建路径(参考 [train-ticket-mcp](https://pypi.org/project/train-ticket-mcp/)、[thiter-mcp](https://pypi.org/project/thiter-mcp/)):
170
+ 1. **GitHub 快速创建**:仓库推 GitHub → modelscope.cn/mcp「创建 MCP」→ 来源填仓库 URL → 托管类型「可托管部署」→ 平台生成 `https://mcp.api-inference.modelscope.net/<id>/sse` 或 `/mcp`。
171
+ 2. **自定义创建(PyPI + uvx,推荐)**:`uv build` + `uv publish` 发布到 PyPI → 创建页选「自定义创建」+「可托管部署」→ 服务配置填:
172
+
173
+ ```json
174
+ {
175
+ "mcpServers": {
176
+ "radeon": {
177
+ "command": "uvx",
178
+ "args": ["radeon-cloud-mcp"],
179
+ "env": {
180
+ "RADEON_API_KEY": "rc-你的key",
181
+ "RCC_TOKEN": "rcc_你的token(可选,启用实例管理)"
182
+ }
183
+ }
184
+ }
185
+ }
186
+ ```
187
+
188
+ 托管模式注意:
189
+ - **RCC_TOKEN 必须与 RCC_URL 成对**(SDK 源码 `rcc_config.resolve_connection_info` 强制:env token 无匹配 URL 时拒绝"猜测发送目标")。`RCC_URL=https://developer.amd.com.cn/radeon`;本服务在注入 RCC_TOKEN 时自动补全 RCC_URL(从 RADEON_BASE_URL 推导)。
190
+ - **RCC_TOKEN 获取**:本地 `pip install amd-oneclick-sdk && rcc auth login`(无浏览器机器 `--no-browser`,把打印的一次性链接在可信设备打开授权)后,读 `~/.radeon-cloud/config.json` 当前账户的 `token` 字段。token 是否绑定设备/IP 需实测(`cli_health` 验证)。
191
+ - **SSH 私钥**:托管容器无本地密钥 → `SSH_PRIVATE_KEY` 注入私钥内容(600 临时文件);公钥须提前上传且**先于实例创建**。容器文件系统为临时盘:落盘音频仅经 `return_base64` 才有远程意义;asyncssh 纯 Python 实现,不依赖系统 ssh。
192
+ - 每用户隔离环境各自注入自己的 key → 配额/积分各算各的,符合平台"使用权与责任归属用户个人"的规则。
193
+
194
+ ### 2.6 DSH 本地接入
195
+
196
+ 以 configuration-only bundle 插入 `@deepseek-ai/dsh-mcp-client`:`serverName: radeon`、`transport: stdio`、`command` 指向本仓库虚拟环境中的 `radeon-cloud-mcp` 入口,`toolCallTimeoutMs` 建议 660000。凭证经 env 或 auth.json 注入,不写入 patch。启用后调用 `mcp__radeon__list_models` 验证。
197
+
198
+ ### 2.7 验证计划
199
+
200
+ 1. 单测(mock,无需 key):错误体归一化、429/502/503 退避、system/developer 归一化、档位预校验、data URL 转换与 5MB 预检、rcc 退出码映射与幂等键、MCP 内存客户端端到端 tools/list + tools/call。
201
+ 2. 无 key 冒烟:stdio 启动、工具列表完整、缺 key 时返回 setup 提示。
202
+ 3. 真实冒烟(待用户配 key):`scripts/smoke_live.py`:list_models → usage → chat(low 档)→ model_load;Phase 2 先 `cli_health`。
203
+
204
+ ### 2.8 社区发布与开发者积分申请清单(激励计划 2.0)
205
+
206
+ 规则来源:[AMD GPU x 魔搭联合激励计划 2.0(知乎镜像)](https://zhuanlan.zhihu.com/p/2088690610823812756)、[魔搭活动页](https://modelscope.cn/events/247/)(微信原文有验证码,未能直接抓取):
207
+
208
+ - [ ] 注册 AMD AI 开发者计划(可用魔搭账号登录 <https://developer.amd.com.cn/>),完善信息领 100 积分;申请加入「AMD开发者中心」组织时**附 AMD 开发者账号 ID**。
209
+ - [ ] MCP 服务发布到魔搭 MCP 广场(可托管部署),详情页写清用法、env 配置、工具说明。
210
+ - [ ] 发布配套**原创实践 blog 或 notebook**(围绕 AMD GPU / Radeon Cloud / 本 MCP 的使用),携带标签 **「AMD GPU激励计划」**。
211
+ - [ ] 过审后每篇 **125 积分**,每个魔搭 ID 最多 3 篇(累计 375);同一内容不得重复申领/同时领 GPU 时长与积分。
212
+ - [ ] 积分兑换:<https://developer.amd.com.cn/points/redeem>(1 积分=1 小时,每日≤20 积分)→ 得长券串 → Radeon Cloud「Credits & Usage → Redeem credits」兑换(券 30 天内有效,credits 90 天有效)。
213
+ - [ ] 合规:Token Factory 免费试用/开发用途、禁转售;OmniVoice 非商用+署名;托管 SSE URL 与 key 不外泄。
214
+
215
+ ### 2.9 实测记录(2026-12-01,真实 key)
216
+
217
+ - 单测 70 项全过(mock HTTP/子进程/SSH);stdio 与 streamable-http 双传输端到端冒烟通过(initialize/tools/list 20 工具/tools/call/isError 结构化提示)。
218
+ - `list_models`:**15 个模型**,含文档矩阵未收录的 `Hy4-flash`(未知模型走保守归一化,验证"运行时目录为准"策略);MiniCPM-V-4.7-1B 实测 ctx=200000(文档 262144,以运行时为准)。
219
+ - `usage`:该账户 `rpm_limit=60`(≠文档典型 20/30,验证"从响应头动态学习"策略);每日配额仅 **5 pts**;chat 一次约 2e-5 pts。
220
+ - `chat`(DeepSeek-V4-Flash, reasoning_effort=low):内部流式聚合正常,content/reasoning 分离,`usage.completion_tokens_details.reasoning_tokens=30`,配额头采集正常。
221
+ - `model_load`:正常返回 idle/busy/full(实测 DeepSeek-V4.1-Flash 与 GLM-5.3-Flash 为 full)。
222
+ - 无凭证探测:`GET /v1/models` → `401 {"detail":"Login required"}`(平台包裹形状,归一化已覆盖)。
223
+ - rcc SDK 源码核实:状态目录 `~/.radeon-cloud/config.json`(`RCC_CONFIG_DIR` 可覆写);`RCC_TOKEN` 须配 `RCC_URL`(或 legacy `AMD_ONECLICK_TOKEN/URL`);显式 `-A` 账户忽略 env token。
224
+ - **Phase 2 只读实测通过**(2026-12-01,用户授权 rcc 登录后):`cli_health` doctor 全绿(service HTTP 200、token valid、instance_create/status/logs/delete 能力齐备,API v1 契约);`credits_status` credits=4、无当前实例;`catalog_list` 资源池 `one-click`、规格 `resource-16c55g1u`(1GPU·16C·55G)、Base 镜像 ROCm 7.2.4/Python 3.12/PyTorch 2.10.0;账户 `ssh_configured=false`(需先 add-key)。
225
+ - **打包与托管路径验证**:`python -m build` 产出 wheel+sdist;`uvx --from <wheel> radeon-cloud-mcp` 隔离环境启动、MCP initialize 握手通过;uvx 环境内 `rcc --version`=1.1.1(托管依赖链成立)。
226
+ - **用户决策(2026-12-01)**:暂不创建测试实例(保留 4 credits);创建→exec→训练→传输→销毁全链路留待用户日后自行验证(单测已覆盖,scripts/smoke_instance.py 提供只读检查)。
227
+ - 待验证:RCC_TOKEN 跨设备(托管容器)有效性;实例全链路真实输出(社区文章草稿中留「待补」位)。
228
+
229
+ ### 2.10 风险与对策
230
+
231
+ | 风险 | 对策 |
232
+ |---|---|
233
+ | 模型目录/档位随时间变动 | 运行时解析目录;矩阵仅作提示,400/422 透传后端原文并建议重查 |
234
+ | 无 key 无法实测 | mock 单测 + 无 key 冒烟先行;交付 smoke_live.py 待配 key |
235
+ | RCC_TOKEN 在托管容器的有效性未验证 | cli_health 诊断工具 + 部署指南标注"待实测";失败时 Phase 2 降级为仅本地模式 |
236
+ | rcc CLI 行为随版本变化 | 锁定 `--output json` 契约;依赖版本下限约束 |
237
+ | 实例操作扣费/破坏性 | create/delete 描述醒目警示;delete 强制 confirm;不做自动销毁 |
238
+ | Python 3.14 依赖兼容 | venv 实测安装;必要时放宽 requires-python |
239
+
240
+ ## 3. 参考
241
+
242
+ - 文档站(首要参考):<https://amd-aim.github.io/radeon-cloud-docs/zh-cn/api/overview/>;英文站:<https://amd-aim.github.io/radeon-cloud-docs/>;源码:<https://github.com/AMD-AIM/radeon-cloud-docs>(本地 `tmp/radeon-cloud-docs/`,含 zh-cn)
243
+ - 控制台:<https://developer.amd.com.cn/radeon/>
244
+ - ModelScope:[MCP广场简介](https://www.modelscope.cn/docs/mcp/intro)、[MCP 广场](https://modelscope.cn/mcp)、[FastMCP 部署教程](https://developer.aliyun.com/article/1666892)、[train-ticket-mcp](https://pypi.org/project/train-ticket-mcp/)、[thiter-mcp](https://pypi.org/project/thiter-mcp/)
245
+ - 激励计划:[知乎镜像](https://zhuanlan.zhihu.com/p/2088690610823812756)、[魔搭活动页](https://modelscope.cn/events/247/)、[开发者计划文档](https://amd-aim.github.io/radeon-cloud-docs/guides/developer-program/)
246
+ - 既有接入范例:`colab-mcp/`(DSH stdio MCP bundle 模式)
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,99 @@
1
+ Metadata-Version: 2.5
2
+ Name: radeon-cloud-mcp
3
+ Version: 0.1.0
4
+ Summary: MCP server for AMD Radeon Cloud: Token Factory inference (chat/OCR/TTS/decision) + GPU instance management via rcc CLI
5
+ Author: wangfan
6
+ License: Apache-2.0
7
+ License-File: LICENSE
8
+ Keywords: amd,gpu,mcp,modelscope,radeon,rocm
9
+ Requires-Python: >=3.10
10
+ Requires-Dist: amd-oneclick-sdk>=1.1.1
11
+ Requires-Dist: asyncssh>=2.14
12
+ Requires-Dist: httpx>=0.27
13
+ Requires-Dist: mcp<3,>=2.3
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
16
+ Requires-Dist: pytest>=8; extra == 'dev'
17
+ Description-Content-Type: text/markdown
18
+
19
+ # AMD Radeon MCP
20
+
21
+ 把 [AMD Radeon Cloud](https://developer.amd.com.cn/radeon/) 接入任意 MCP 客户端:在对话里部署和管理 GPU Notebook 实例、在实例内执行命令与训练任务,并免费调用平台托管的 Token Factory 模型(chat / OCR / TTS / 决策)。
22
+
23
+ Python 实现(MCP SDK 2.x + httpx + asyncssh),支持 stdio 与 streamable-http,可托管部署到 [ModelScope MCP 广场](https://modelscope.cn/mcp)。
24
+
25
+ ## 安装
26
+
27
+ ```bash
28
+ python3 -m venv .venv
29
+ .venv/bin/pip install -e .
30
+ ```
31
+
32
+ ## 配置
33
+
34
+ | 变量 | 用途 |
35
+ |---|---|
36
+ | `RADEON_API_KEY` | Token Factory 推理(`rc-` 开头,[控制台 Token Factory 页](https://developer.amd.com.cn/radeon/tokenfactory)复制) |
37
+ | `RCC_TOKEN` + `RCC_URL` | 实例管理(`rcc_` 令牌,**两者必须成对**;`RCC_URL=https://developer.amd.com.cn/radeon`) |
38
+ | `RADEON_SSH_IDENTITY` 或 `SSH_PRIVATE_KEY` | 实例内操作/训练的 SSH 私钥(路径或内容) |
39
+
40
+ 也可以写入 `~/.config/radeon-cloud-mcp/auth.json`(chmod 600):
41
+
42
+ ```json
43
+ {"api_key": "rc-...", "rcc_token": "rcc_...", "ssh_identity": "~/.ssh/id_ed25519"}
44
+ ```
45
+
46
+ 实例管理也可以不用 `RCC_TOKEN`:本地执行 `rcc auth login`(`rcc` 已随本包安装),CLI 登录态直接可用。首次用 SSH 前执行 `rcc instance add-key` 上传公钥——**公钥只对之后创建的实例生效**。
47
+
48
+ 其他可选变量:`RADEON_BASE_URL`、`RADEON_OUTPUT_DIR`(音频/OCR 图片落盘目录)、`RADEON_SSH_KNOWN_HOSTS`、`RADEON_REQUEST_TIMEOUT`、`RADEON_MAX_CONCURRENCY`。
49
+
50
+ ## 运行
51
+
52
+ ```bash
53
+ .venv/bin/radeon-cloud-mcp # stdio,由 MCP 客户端拉起
54
+ .venv/bin/radeon-cloud-mcp --transport http --port 8000 # HTTP,端点 /mcp
55
+ ```
56
+
57
+ ## 工具(20 个)
58
+
59
+ **GPU 实例**:`credits_status` `catalog_list` `instance_create` `instance_status` `instance_logs` `instance_delete` `instance_connect` `instance_add_key` `cli_health` `instance_exec` `instance_job` `instance_transfer` `instance_gpu_status`
60
+
61
+ **Token Factory**:`list_models` `model_load` `chat` `usage` `ocr` `speech` `decide`
62
+
63
+ ## 示例:部署并训练
64
+
65
+ ```text
66
+ catalog_list
67
+ instance_create(env="Base", pod_type="one-click", resource_template="resource-16c55g1u", use_pvc=true)
68
+ instance_transfer("upload", "train.py", "/workspace/train.py")
69
+ instance_exec("python /workspace/train.py", background=true) → {pid, log_file}
70
+ instance_job("logs", pid=..., log_file=...) → 训练进度
71
+ instance_transfer("download", "/workspace/model.pt", "./model.pt")
72
+ instance_delete(confirm=true)
73
+ ```
74
+
75
+ 实例按小时扣 credits(1 credit/GPU/小时),不用就销毁;`instance_delete` 需要 `confirm=true`。持久数据放 `/workspace`(`use_pvc=true`),临时目录随实例删除。
76
+
77
+ ## ModelScope 托管部署
78
+
79
+ 见 [docs/modelscope-deploy.md](docs/modelscope-deploy.md):推送 GitHub 后在魔搭「从Github仓库快速创建」,或发布 PyPI 后用 uvx 配置(示例 [modelscope/service-config.json](modelscope/service-config.json))。
80
+
81
+ ## 开发
82
+
83
+ ```bash
84
+ .venv/bin/pip install -e ".[dev]"
85
+ .venv/bin/python -m pytest tests/ -q
86
+ .venv/bin/python scripts/smoke_live.py # 真实 API 冒烟(需 key)
87
+ .venv/bin/python scripts/smoke_stdio.py # stdio 端到端
88
+ .venv/bin/python scripts/smoke_instance.py # 实例链路只读检查(需 rcc 登录)
89
+ ```
90
+
91
+ ## 文档
92
+
93
+ - [Radeon Cloud 官方文档](https://amd-aim.github.io/radeon-cloud-docs/zh-cn/api/overview/)
94
+ - [DESIGN.md](DESIGN.md):平台调研、架构与实测记录
95
+ - [docs/community-blog-draft.md](docs/community-blog-draft.md):社区实践文章草稿
96
+
97
+ ## 许可
98
+
99
+ Apache-2.0,见 [LICENSE](LICENSE)。