GeezerVison is showing github.com — Feat/mcp skill by VIISEVEN27 · Pull Request #353 · modelstudioai/cli
Feat/mcp skill
#353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement . We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Uh oh!
There was an error while loading. Please reload this page.
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter
Filter by extension
.md
(2)
.ts
(5)
All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Hide whitespace
Diff view
Hide whitespace
Merge upstream/main into feat/mcp-skill
Loading branch information
Uh oh!
There was an error while loading. Please reload this page.
wangmingxiang
committed
Nov 27, 2026
commit 95070ba11cc01091eb9b082c32fb6fc81d5518e2
There are no files selected for viewing
Original file line number
Diff line number
Diff line change
Expand Up
@@ -65,12 +65,10 @@ export default defineCommand({
const { serverCode, toolName } = parseTarget(flags.target);
const toolArgs = toolArguments(flags, ctx.localize);
const previewUrl = flags.url || ctx.client.url(bailianMcpPath(serverCode));
if (settings.dryRun) {
ctx.output.result({
server: serverCode,
url: previewUrl ,
url: flags.url || ctx.client.baseUrl + bailianMcpPath(serverCode) ,
tool: toolName,
arguments: toolArgs,
});
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -34,10 +34,9 @@ export default defineCommand({
const { settings, flags } = ctx;
const code = flags.server;
const previewUrl = flags.url || ctx.client.url(bailianMcpPath(code));
if (settings.dryRun) {
ctx.output.result({ server: code, url: previewUrl, action: "tools/list" });
const url = flags.url || ctx.client.baseUrl + bailianMcpPath(code);
ctx.output.result({ server: code, url, action: "tools/list" });
return;
}
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -197,6 +197,7 @@ export class Client {
if (!baseUrl || baseUrl === this.baseUrl) return this;
return new Client({
...this.deps,
requestSignals: this.requestSignals,
baseUrl,
baseUrlIsDefault: false,
apiCred: this.deps.apiCred && { ...this.deps.apiCred, baseUrl },
Expand Down
Expand Up
@@ -302,12 +303,19 @@ export class Client {
urlOverride?: string,
serviceSource?: string,
): ReturnType<typeof connectBailianMcpWithFallback> {
this.requireApi();
const { baseUrl, token } = this.requireApi();
const httpUrl = baseUrl + bailianMcpPath(serverCode);
if (urlOverride) {
// A user-supplied path can resemble a different Bailian product's API.
if (URL.canParse(urlOverride)) this.recordRequest(new URL(urlOverride).origin);
} else {
this.recordRequest(httpUrl);
}
return connectBailianMcpWithFallback({
deps: this.http,
authToken: this.deps.apiCred?. token,
httpUrl: this.url(bailianMcpPath(serverCode)) ,
sseUrl: this.url( bailianMcpSsePath(serverCode) ),
authToken: token,
httpUrl,
sseUrl: baseUrl + bailianMcpSsePath(serverCode),
serverCode,
urlOverride,
serviceSource,
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -31,7 +31,7 @@ export interface ServicePlane {
/** Stable identifier; consumed by the coverage guard test and the telemetry docs. */
key: string;
site: PlaneSite;
/** Request pathname prefixes, matched longest-first. */
/** Path-segment prefixes, matched longest-first. A trailing slash matches descendants . */
prefixes: readonly string[];
}
Expand Down
Expand Up
@@ -67,6 +67,16 @@ export const SERVICE_PLANES: readonly ServicePlane[] = [
site: "follow",
prefixes: ["/api/v1/agentstudio/"],
},
{
key: "mcp",
site: "follow",
prefixes: ["/api/v1/mcp/servers", "/api/v1/mcps/"],
},
{
key: "cloud-skill",
site: "follow",
prefixes: ["/api/v1/skills"],
},
{
key: "custom-model-import",
// `CUSTOM_MODEL_IMPORT_ENDPOINT` hardcodes the public mainland DashScope
Expand All
@@ -80,7 +90,11 @@ export const SERVICE_PLANES: readonly ServicePlane[] = [
// Longest prefix first so a specific namespace wins over a broader one.
const PREFIX_ENTRIES = SERVICE_PLANES.flatMap((plane) =>
plane.prefixes.map((prefix) => ({ prefix, plane })),
plane.prefixes.map((prefix) => ({
prefix,
descendants: prefix.endsWith("/") ? prefix : prefix + "/",
plane,
})),
).sort((left, right) => right.prefix.length - left.prefix.length);
/**
Expand All
@@ -96,7 +110,9 @@ export function classifyServicePlane(requestUrl: string): ServicePlane | undefin
} catch {
return undefined;
}
return PREFIX_ENTRIES.find((entry) => pathname.startsWith(entry.prefix))?.plane;
return PREFIX_ENTRIES.find(
({ prefix, descendants }) => pathname === prefix || pathname.startsWith(descendants),
)?.plane;
}
/**
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -3,13 +3,17 @@ import {
RAG_PATHS,
SANDBOX_PATHS,
agentStudioHost,
bailianMcpPath,
bailianMcpSsePath,
chatPath,
classifyServicePlane,
classifyModelHost,
createRequestSignals,
httpTransport,
knowledgeChatEndpoint,
knowledgeSearchEndpoint,
mcpBaseUrl,
mcpServersPath,
memoryAddAsyncPath,
memoryEndpoint,
memoryEventPath,
Expand All
@@ -25,6 +29,8 @@ import {
sandboxEndpoint,
securityOverviewEndpoint,
SERVICE_PLANES,
skillBaseUrl,
skillsPath,
userProfilePath,
Client,
type Identity,
Expand All
@@ -38,6 +44,7 @@ import {
customModelImportJobEndpoint,
} from "../src/client/endpoints.ts";
import { resolveTelemetrySite } from "../src/telemetry/site.ts";
import { SdkMcpAdapter } from "../src/client/mcp-sdk.ts";
afterEach(() => vi.restoreAllMocks());
Expand Down
Expand Up
@@ -118,7 +125,21 @@ test("overridable planes carry no product verdict", () => {
expect(classifyServicePlane(securityOverviewEndpoint(agentStudioHost(workspaceId)))?.key).toBe(
"agentstudio",
);
for (const key of ["parsex", "agentstudio"]) {
const mcpOrigin = mcpBaseUrl(workspaceId);
for (const path of [
mcpServersPath(),
mcpServersPath("example"),
bailianMcpPath("example"),
bailianMcpSsePath("example"),
]) {
expect(classifyServicePlane(mcpOrigin + path)?.key, path).toBe("mcp");
}
const skillOrigin = skillBaseUrl(workspaceId);
for (const path of [skillsPath(), skillsPath("example")]) {
expect(classifyServicePlane(skillOrigin + path)?.key, path).toBe("cloud-skill");
}
expect(classifyServicePlane(skillOrigin + skillsPath() + "-other")).toBeUndefined();
for (const key of ["parsex", "agentstudio", "mcp", "cloud-skill"]) {
expect(SERVICE_PLANES.find((plane) => plane.key === key)?.site).toBe("follow");
}
});
Expand Down
Expand Up
@@ -273,3 +294,30 @@ test("a run-level record is shared with derived Clients", () => {
// derived Client made instead of falling back to the shared base URL.
expect(client.lastResolvedOrigin).toBe(`https://${workspaceId}.cn-beijing.maas.aliyuncs.com`);
});
test("a workspace client shares its parent's private request record", () => {
const client = new Client({
identity,
settings: { telemetry: true, timeout: 30 } as Settings,
baseUrl: "https://dashscope.aliyuncs.com",
baseUrlIsDefault: true,
});
const workspaceOrigin = `https://${workspaceId}.cn-beijing.maas.aliyuncs.com`;
const workspaceClient = client.withDefaultBaseUrl(() => workspaceOrigin);
workspaceClient.url("/api/v1/indices/rag/index/list");
expect(client.lastResolvedOrigin).toBe(workspaceOrigin);
expect(client.productSite).toBe("domestic");
});
test("an explicit MCP URL records the actual host even if its path resembles another service", async () => {
const client = makeClient("https://dashscope.aliyuncs.com");
const overrideOrigin = "https://dashscope-intl.aliyuncs.com";
vi.spyOn(SdkMcpAdapter.prototype, "initialize").mockResolvedValue(undefined);
await client.connectBailianMcp("example", overrideOrigin + "/api/v1/indices/custom");
expect(client.lastResolvedOrigin).toBe(overrideOrigin);
expect(client.productSite).toBeUndefined();
});
Original file line number
Diff line number
Diff line change
Expand Up
@@ -72,6 +72,7 @@ Use this table only after the decision table in [`bailian-protocol`](../bailian-
| User intent | Command | Notes |
| ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Explicit Bailian model chat / text execution | `bl text chat` | Default `qwen3.8-max` |
| Dedicated text translation (Qwen-MT) | `bl text translate --target-lang <English name>` | Default `qwen-mt-flash`; language names are English full names (`Chinese`/`English`), not `zh`/`en`; only user messages; see `reference/text.md` |
| 百炼异步文件批量推理 / CSV 转换 | `bl batch convert` / `create` / `list` / `get` / `cancel` / `download` | CSV → JSONL → 异步任务 → 原始结果,可额外导出 CSV;格式样例见 `reference/batch.md` |
| 百炼单次同步 Batch Chat | `bl text chat --batch` | 等待单次响应,不创建任务 ID;messages-file 是同一请求的对话上下文,边界见 `reference/text.md` |
| Typed decision model inference | `bl decision` | Workspace endpoint; returns `choice` / `noul` / `score` values and probabilities, not generated text |
Expand Down
Expand Up
@@ -110,6 +111,9 @@ Use this table only after the decision table in [`bailian-protocol`](../bailian-
| Switch CLI Help / Quick Start language | `bl config set --key language --value zh-CN` | Use `en-US` to switch back; follows the active config profile |
| Image / video / speech / omni / vision | → skill `bailian-gen` | Fallback: `bl image\|video\|speech\|omni\|vision --help` |
| Training dataset / fine-tune / deploy | → skill `bailian-finetune` | Fallback: `bl dataset\|finetune\|deploy --help` |
| 百炼模型智能路由 / smart routing / model routing | → skill `bailian-finetune` | 独立于精调流程;fallback: `bl deploy router --help`。 |
| 吞吐预留(PTU)/ ModelCode 容量购买与扩缩容 | → skill `bailian-finetune` | 独立于精调流程;包括容量查询、购买、扩缩容、续费、释放、退订与溢出策略;fallback: `bl deploy --help`。 |
| Guided end-to-end OPD distillation workflow | → skill `bailian-opd` | Authorize → validate → preflight → consent → submit → wait; fallback: `bl finetune opd --help` |
| agents.yaml IaC / managed-agent sessions | → skill `bailian-managed-agent` | Fallback: `bl managed-agent --help`; `apply`/`destroy` need `--yes` after `plan` |
| Bailian Sandbox instance / template lifecycle | → skill `bailian-sandbox` | Fallback: `bl sandbox --help` |
| Web search (mode-aware routing) | → skill `bailian-web-search` | Default model mode vs explicit `--mode mcp` + fallback; fallback: `bl search web --help` |
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -132,6 +132,7 @@ Use this index for the skill-scoped quick index and global flags.
| `bl skill search` | API Key | Search cloud skills and show their local installations | [skill.md](skill.md) |
| `bl skill update` | API Key when required by source | Update installed skills to the latest registry versions | [skill.md](skill.md) |
| `bl text chat` | API Key | Send a text model request (OpenAI compatible, DashScope) | [text.md](text.md) |
| `bl text translate` | API Key | Translate text with Qwen-MT (Chat Completions translation_options) | [text.md](text.md) |
| `bl token-plan add-member` | AK/SK | Add a member to a Token Plan organization | [token-plan.md](token-plan.md) |
| `bl token-plan assign-seats` | AK/SK | Batch assign Token Plan seats to members | [token-plan.md](token-plan.md) |
| `bl token-plan create-key` | AK/SK | Create a Token Plan API key for a seat | [token-plan.md](token-plan.md) |
Expand Down
Expand Up
@@ -174,7 +175,7 @@ Use this index for the skill-scoped quick index and global flags.
| `quota` | `check`, `delete`, `history`, `list`, `update` | [quota.md](quota.md) |
| `search` | `web` | [search.md](search.md) |
| `skill` | `add`, `get`, `init`, `list`, `remove`, `search`, `update` | [skill.md](skill.md) |
| `text` | `chat` | [text.md](text.md) |
| `text` | `chat`, `translate` | [text.md](text.md) |
| `token-plan` | `add-member`, `assign-seats`, `create-key`, `harness-quota`, `list-seats` | [token-plan.md](token-plan.md) |
| `update` | `(root)` | [update.md](update.md) |
| `usage` | `coding-plan`, `free`, `freetier`, `stats`, `summary`, `token-plan` | [usage.md](usage.md) |
Expand Down
You are viewing a condensed version of this merge commit. You can view the
full changes here .
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.