Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
6dde3b1
feat(mcp): add native agent registration for Bailian MCP servers
XXPermanentXX Sep 8, 2026
7d8dcb1
Merge branch 'main' of github.com:modelstudioai/cli into feat/native-…
duck-bubi-ya Sep 11, 2026
96eb327
Merge branch main of github.com:modelstudioai/cli into feat/native-mc…
duck-bubi-ya Sep 11, 2026
abfb69b
docs(cli): sync npm README with root native MCP copy
duck-bubi-ya Sep 11, 2026
c957e2e
feat(mcp): add Cursor, Qoder, Qoder Work, and QwenWork native MCP tar…
duck-bubi-ya Sep 14, 2026
f4e7fd4
feat(mcp): add OpenCode, OpenClaw, DSH, ZCode, and WorkBuddy native M…
duck-bubi-ya Sep 14, 2026
02d4e97
Merge branch main of github.com:modelstudioai/cli into feat/native-mc…
duck-bubi-ya Sep 18, 2026
b0ac8ce
fix(mcp): write QwenWork config to ~/.qwenworkcn/mcp.json
duck-bubi-ya Sep 18, 2026
81488d8
Merge branch 'main' into feat/native-mcp-agent-registration
duck-bubi-ya Sep 18, 2026
72c28fc
chore(deps): upgrade Vite+ toolchain to 0.3.3
XXPermanentXX Sep 20, 2026
ec4f1a0
merge feat/native-mcp-agent-registration into header ident branch
duck-bubi-ya Sep 21, 2026
21170ce
Merge branch 'feat/native-mcp-agent-registration' of github.com:model…
duck-bubi-ya Sep 21, 2026
d1c107d
fix(toolchain): drop obsolete pack.dts.generator after Vite+ 0.3.3
duck-bubi-ya Sep 21, 2026
a941b3e
feat(mcp): tag DashScope requests with X-Dashscope-Service=bailian-cli
duck-bubi-ya Sep 21, 2026
c4b2636
Merge branch 'main' of github.com:modelstudioai/cli into feat/native-…
duck-bubi-ya Sep 21, 2026
fae38ca
Merge branch 'feat/native-mcp-agent-registration' of github.com:model…
duck-bubi-ya Sep 21, 2026
17ecb3a
Merge branch 'feat/mcp-connect-header-ident' of github.com:modelstudi…
duck-bubi-ya Sep 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Developer guide for `bailian-cli` — the official CLI for Aliyun Model Studio (

## Prerequisites

- Node.js 22.12 (required for developing this repo)
- Node.js ^22.18 or >=24.11 (required for developing this repo)
- End users installing the published CLI only need Node.js >= 18.17
- pnpm 10.33.2 (`npm i -g pnpm@10.33.2`)
- A DashScope API key for running e2e tests
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## 环境要求

- 参与本仓库开发:Node.js 22.12
- 参与本仓库开发:Node.js ^22.18 或 >=24.11
- 仅安装/使用已发布的 CLI:Node.js >= 18.17
- pnpm 10.33.2(`npm i -g pnpm@10.33.2`)
- 跑 e2e 需要一个百炼 API Key
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ _Built for AI Agents. Every command works as a structured tool call._
- **Model generation** — Full-modality generation across text, image, video, and speech, with editing and reference-based generation
- **Asset understanding** — Parse and ask questions about images, documents, audio, and long videos
- **App orchestration** — Call Managed Agents, agents, and workflows published on Aliyun Model Studio, wired to knowledge bases, memory, web search, and MCP tools
- **Native MCP setup** — Register Bailian MCP servers in Codex, Claude Code, Cursor, Qoder, Qoder Work, QwenWork (千问办公), Qwen Code, or Gemini CLI with channel attribution preserved
- **Training & deployment** — Validate and upload datasets, fine-tune models, deploy dedicated models as endpoints
- **Account operations** — Login, UI-based configuration, model marketplace, usage and quota, rate-limit increases, team seat management
- **Plan onboarding** — Connect subscription plans such as Token Plan to the CLI and common coding agents in one step

> **Note:** App orchestration, training & deployment, account operations, and plan onboarding are currently available only to China site (aliyun.com) account holders and are not yet supported for international / global site accounts.
> **Note:** App orchestration, native MCP setup, training & deployment, account operations, and plan onboarding are currently available only to China site (aliyun.com) account holders and are not yet supported for international / global site accounts.

## Showcase 1: A Cinematic Short Film from One Sentence

Expand Down
3 changes: 2 additions & 1 deletion README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_
- **模型生成** — 文本、图像、视频、语音全模态生成,支持编辑与参考生成
- **素材理解** — 图像、文档、音频、长视频的解析与问答
- **应用编排** — 调用百炼已发布的 Managed Agent、智能体和工作流,接入知识库、记忆库、联网搜索与 MCP 工具
- **原生 MCP 接入** — 将百炼 MCP 服务注册到 Codex、Claude Code、Cursor、Qoder、Qoder Work、千问办公(QwenWork)、Qwen Code 或 Gemini CLI,并保留渠道归因
- **模型训推** — 数据集校验上传、模型精调、专属模型部署上线
- **账号运维** — 授权登录、界面化配置、模型市场、用量与额度、限流提额、团队席位管理
- **套餐接入** — 支持 Token Plan 等订阅计划一键接到 CLI 和常见 Coding Agent

> **注意:** 应用编排、模型训推、账号运维和套餐接入目前仅支持中国站(aliyun.com)账号,暂不支持国际站 / 全球站账号。
> **注意:** 应用编排、原生 MCP 接入、模型训推、账号运维和套餐接入目前仅支持中国站(aliyun.com)账号,暂不支持国际站 / 全球站账号。

## 示例 1:一句话生成一部电影短片

Expand Down
2 changes: 1 addition & 1 deletion docs/agents/lint-toolchain.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

### A. 版本一致性

- [ ] 发布包(`cli` 等)的 `engines.node` 与 README 的 Node.js 徽章一致;根/e2e 开发要求(`>=22.12`)与 CONTRIBUTING 一致
- [ ] 发布包(`cli` 等)的 `engines.node` 与 README 的 Node.js 徽章一致;根/e2e 开发要求(`^22.18 || >=24.11`)与 CONTRIBUTING 一致
- [ ] `pnpm-lock.yaml` 同步生成(运行 `pnpm install`)
- [ ] 各源码包 `tsconfig.json`(根 + core + runtime + commands + cli + kscli)的 target / module 设置一致

Expand Down
17 changes: 9 additions & 8 deletions docs/agents/telemetry-change.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@

### 1. 三套鉴权与埋点标识

| 命令声明 | 凭证 / 请求域 | 主要请求出口 | 后端埋点标识 | 前端埋点标识(AEM) |
| ----------------- | --------------------------------------------------- | ------------------------------------------------------------------------------------- | --------------------------------------------- | ------------------------------------------------ |
| `auth: "apiKey"` | API Key;DashScope / OpenAI-compatible 模型域 | `Client.request/requestJson`、`McpClient`、Managed Agent instrumented fetch、上传策略 | 有:`User-Agent`、`x-dashscope-source-config` | 有:`pid=bailian-cli-node`、`authMethod=apiKey` |
| `auth: "console"` | Console access token;Bailian Console Gateway | `callConsoleGateway()` → `/cli/api.json` | 有:Console Gateway 后端直接标识 | 有:`pid=bailian-cli-node`、`authMethod=console` |
| `auth: "openapi"` | AccessKey ID/Secret,可选 STS token;阿里云 OpenAPI | `Client.openApiJson()` | 有:`x-dashscope-source-config` | 有:`pid=bailian-cli-node`、`authMethod=openapi` |
| `auth: "none"` | 无凭证域 | 本地逻辑或命令自行管理的登录/配置流程 | 无 | 有:`pid=bailian-cli-node`、`authMethod=none` |
| 命令声明 | 凭证 / 请求域 | 主要请求出口 | 后端埋点标识 | 前端埋点标识(AEM) |
| ----------------- | --------------------------------------------------- | ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------ |
| `auth: "apiKey"` | API Key;DashScope / OpenAI-compatible 模型域 | `Client.request/requestJson`、`McpClient`、Managed Agent instrumented fetch、上传策略 | 有:`User-Agent`、`x-dashscope-source-config`、`X-Dashscope-Service: bailian-cli` | 有:`pid=bailian-cli-node`、`authMethod=apiKey` |
| `auth: "console"` | Console access token;Bailian Console Gateway | `callConsoleGateway()` → `/cli/api.json` | 有:Console Gateway 后端直接标识 | 有:`pid=bailian-cli-node`、`authMethod=console` |
| `auth: "openapi"` | AccessKey ID/Secret,可选 STS token;阿里云 OpenAPI | `Client.openApiJson()` | 有:`x-dashscope-source-config`、`X-Dashscope-Service: bailian-cli` | 有:`pid=bailian-cli-node`、`authMethod=openapi` |
| `auth: "none"` | 无凭证域 | 本地逻辑或命令自行管理的登录/配置流程 | 无 | 有:`pid=bailian-cli-node`、`authMethod=none` |

`authMethod` 记录的是命令声明的鉴权域,不是凭证来源。它不会区分 API Key 来自 flag、env 还是 config。
鉴权域是命令的准入门槛和主请求域,不保证命令内部只有一种网络出口;例如部分 `apiKey` 命令也可能读取匿名 Console 公共目录,Managed Agent 还可能访问其他 provider。

表中的后端埋点按该鉴权域的主要业务请求填写:

- Managed Agent 的 `User-Agent` 对所有 SDK 请求注入;`x-dashscope-source-config` 仅对阿里云 host 注入
- DashScope 上传策略 `getPolicy` 只有 `x-dashscope-source-config`,没有显式 CLI `User-Agent`
- Managed Agent 的 `User-Agent` 对所有 SDK 请求注入;`x-dashscope-source-config` 与 `X-Dashscope-Service` 仅对阿里云 host 注入
- DashScope 上传策略 `getPolicy` 走 `trackingHeaders()`(含 source-config 与 `X-Dashscope-Service`),没有显式 CLI `User-Agent`
- Console Gateway 用户数据由后端直接区分,不依赖 `x-dashscope-source-config`;AEM 的 `authMethod=console` 是独立的命令侧统计
- OpenAPI 的 ACS 签名头,以及 Console Gateway 的 `product`、`action`、`api` 是鉴权或路由字段,不计为埋点标识

Expand All @@ -63,6 +63,7 @@
- `t3` 取产品 `identity.version`,由产品入口的 `package.json` 注入
- `channel` 与 `t1` 是当前固定口径
- `User-Agent` 是独立标识:`bl` 为 `bailian-cli/<version>`,`kscli` 为 `knowledge-studio-cli/<version>`
- `X-Dashscope-Service: bailian-cli` 与 source-config 一起由 `trackingHeaders()` 注入;凡走该函数的百炼 / DashScope 请求(含 MCP 注册与 JSON-RPC)都会带上。OSS、结果文件下载、npm / Skill 仍不发送。

source-config 只用于百炼 / DashScope API 侧消费,不发送到通用网络传输:

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"vite-plus": "catalog:"
},
"engines": {
"node": ">=22.12.0"
"node": "^22.18.0 || >=24.11.0"
},
"packageManager": "pnpm@10.33.2"
}
3 changes: 2 additions & 1 deletion packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ _Built for AI Agents. Every command works as a structured tool call._
- **Model generation** — Full-modality generation across text, image, video, and speech, with editing and reference-based generation
- **Asset understanding** — Parse and ask questions about images, documents, audio, and long videos
- **App orchestration** — Call Managed Agents, agents, and workflows published on Aliyun Model Studio, wired to knowledge bases, memory, web search, and MCP tools
- **Native MCP setup** — Register Bailian MCP servers in Codex, Claude Code, Cursor, Qoder, Qoder Work, QwenWork (千问办公), Qwen Code, or Gemini CLI with channel attribution preserved
- **Training & deployment** — Validate and upload datasets, fine-tune models, deploy dedicated models as endpoints
- **Account operations** — Login, UI-based configuration, model marketplace, usage and quota, rate-limit increases, team seat management
- **Plan onboarding** — Connect subscription plans such as Token Plan to the CLI and common coding agents in one step

> **Note:** App orchestration, training & deployment, account operations, and plan onboarding are currently available only to China site (aliyun.com) account holders and are not yet supported for international / global site accounts.
> **Note:** App orchestration, native MCP setup, training & deployment, account operations, and plan onboarding are currently available only to China site (aliyun.com) account holders and are not yet supported for international / global site accounts.

## Showcase 1: A Cinematic Short Film from One Sentence

Expand Down
3 changes: 2 additions & 1 deletion packages/cli/README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_
- **模型生成** — 文本、图像、视频、语音全模态生成,支持编辑与参考生成
- **素材理解** — 图像、文档、音频、长视频的解析与问答
- **应用编排** — 调用百炼已发布的 Managed Agent、智能体和工作流,接入知识库、记忆库、联网搜索与 MCP 工具
- **原生 MCP 接入** — 将百炼 MCP 服务注册到 Codex、Claude Code、Cursor、Qoder、Qoder Work、千问办公(QwenWork)、Qwen Code 或 Gemini CLI,并保留渠道归因
- **模型训推** — 数据集校验上传、模型精调、专属模型部署上线
- **账号运维** — 授权登录、界面化配置、模型市场、用量与额度、限流提额、团队席位管理
- **套餐接入** — 支持 Token Plan 等订阅计划一键接到 CLI 和常见 Coding Agent

> **注意:** 应用编排、模型训推、账号运维和套餐接入目前仅支持中国站(aliyun.com)账号,暂不支持国际站 / 全球站账号。
> **注意:** 应用编排、原生 MCP 接入、模型训推、账号运维和套餐接入目前仅支持中国站(aliyun.com)账号,暂不支持国际站 / 全球站账号。

## 示例 1:一句话生成一部电影短片

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"e2e": "workspace:*",
"typescript": "^6.0.2",
"undici": "catalog:",
"vite-plus": "0.1.22",
"vite-plus": "catalog:",
"yaml": "catalog:"
},
"engines": {
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ import {
knowledgeCollectionGet,
knowledgeDocImportOss,
mcpCall,
mcpConnect,
mcpDisconnect,
mcpList,
mcpTools,
searchWeb,
Expand Down Expand Up @@ -339,6 +341,8 @@ export const commands: Record<string, AnyCommand> = {
"knowledge file get": knowledgeFileGet,
"knowledge file delete": knowledgeFileDelete,
"mcp call": mcpCall,
"mcp connect": mcpConnect,
"mcp disconnect": mcpDisconnect,
"mcp list": mcpList,
"mcp tools": mcpTools,
"search web": searchWeb,
Expand Down
4 changes: 1 addition & 3 deletions packages/cli/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ export default defineConfig({
outputOptions: {
codeSplitting: false,
},
dts: {
tsgo: true,
},
dts: true,
exports: true,
},
lint: {
Expand Down
4 changes: 2 additions & 2 deletions packages/commands/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
"./package.json": "./package.json"
},
"publishConfig": {
"access": "public",
"exports": {
".": "./dist/index.mjs",
"./package.json": "./package.json"
},
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"scripts": {
Expand All @@ -53,7 +53,7 @@
"@typescript/native-preview": "7.0.0-dev.20260328.1",
"e2e": "workspace:*",
"typescript": "^6.0.2",
"vite-plus": "0.1.22"
"vite-plus": "catalog:"
},
"engines": {
"node": ">=18.17.0"
Expand Down
Loading
Loading