@modelbay/mcp 0.1.3 → 0.2.1

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @modelbay/mcp
2
2
 
3
- MCP tool generator and per-platform stdio servers for [Modelbay](../../README.md). MIT licensed.
3
+ MCP tool generator and per-platform stdio servers for [Modelbay](https://github.com/hoobnn/modelbay#readme). MIT licensed.
4
4
 
5
5
  `@modelbay/mcp` derives MCP tools from `ModelDeclaration` data and `@modelbay/core` schemas, and
6
6
  serves them over a minimal stdio JSON-RPC transport. It does **not** depend on
@@ -91,7 +91,7 @@ server's `env_vars` list in `~/.codex/config.toml`.
91
91
  - Shared capabilities use the same tool name on every platform (`generate_image`,
92
92
  `text_to_speech`, `clone_voice`, `design_voice`, `get_job`, ...).
93
93
 
94
- Details (in Chinese): [`docs/mcp.md`](../../docs/mcp.md).
94
+ Details (in Chinese): [`docs/mcp.md`](https://github.com/hoobnn/modelbay/blob/main/docs/mcp.md).
95
95
 
96
96
  ## JSON-RPC methods
97
97
 
package/dist/generate.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { deriveAnnotations, deriveDefaultNote, deriveInputSchema, deriveToolDescription } from "./derive.mjs";
2
2
  import { EXTRA_TOOL_NAMES, deriveMeta } from "./tool-meta.mjs";
3
- import { findPlatform } from "modelbay";
3
+ import { findPlatform, isSelectable } from "modelbay";
4
4
  // src/generate.ts
5
5
  /** 去掉内部字段,得到 MCP tools/list 的公开工具形状。 */
6
6
  function toMCPTool(tool) {
@@ -21,7 +21,8 @@ function listTools(set, groups) {
21
21
  function generateTools(target, options = {}) {
22
22
  const platform = typeof target === "string" ? findPlatform(target) : target;
23
23
  if (!platform?.mcp) throw new Error(`平台「${String(target)}」没有 MCP 工具目录`);
24
- const models = options.models ?? options.adapter?.models ?? [];
24
+ const declared = options.models ?? options.adapter?.models ?? [];
25
+ const models = declared.filter(isSelectable);
25
26
  const nodeOnly = new Set(options.adapter?.nodeOnly ?? []);
26
27
  const defaultCapability = models.flatMap((model) => model.capabilities)[0] ?? "text.chat";
27
28
  const entries = platform.mcp.tools.map(({ mapArguments, ...rest }) => ({
@@ -29,7 +30,11 @@ function generateTools(target, options = {}) {
29
30
  ...mapArguments ? { mapArguments } : {}
30
31
  }));
31
32
  const all = [];
32
- for (const entry of entries) all.push(buildTool(entry, options.channel ?? platform.primaryChannel, models, defaultCapability, nodeOnly));
33
+ for (const entry of entries) {
34
+ const tool = buildTool(entry, options.channel ?? platform.primaryChannel, models, defaultCapability, nodeOnly);
35
+ if (tool.route.kind === "submit" && archivedOnly(declared, models, tool.route.capability)) continue;
36
+ all.push(tool);
37
+ }
33
38
  for (const name of EXTRA_TOOL_NAMES) all.push(buildExtraTool(name));
34
39
  const routes = /* @__PURE__ */ new Map();
35
40
  const byName = /* @__PURE__ */ new Map();
@@ -44,6 +49,10 @@ function generateTools(target, options = {}) {
44
49
  byName
45
50
  };
46
51
  }
52
+ function archivedOnly(declared, selectable, capability) {
53
+ const has = (list) => list.some((model) => model.capabilities.includes(capability));
54
+ return has(declared) && !has(selectable);
55
+ }
47
56
  function buildTool(entry, channel, models, defaultCapability, nodeOnly) {
48
57
  const convention = deriveMeta(entry.name);
49
58
  const meta = {
package/dist/routing.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { listTools } from "./generate.mjs";
2
2
  import { normalizeArguments } from "./arguments.mjs";
3
3
  import { JobRegistry, deliver, deliveredIntact, outputDirectory, pollUntil, settle, waitSeconds } from "./jobs.mjs";
4
- import { lifecycleNotice, missingSecrets, selectDefaultModel, toBase64 } from "modelbay";
4
+ import { isSelectable, lifecycleNotice, missingSecrets, resolveModel, selectDefaultModel, toBase64 } from "modelbay";
5
5
  // src/routing.ts
6
6
  /**
7
7
  * 把 tools/list 与 tools/call 接到生成器结果、PlatformAdapter 与 AdapterContext。
@@ -286,6 +286,8 @@ function createHandlers(options) {
286
286
  return result(await target.submit(request, context));
287
287
  }
288
288
  const givenModel = typeof args.model === "string" ? args.model.trim() : "";
289
+ const archived = givenModel ? resolveModel(models, givenModel) : null;
290
+ if (archived && !isSelectable(archived.declaration)) return errorResult(`模型 ${givenModel} 已归档(官方已下线),不再支持调用。`);
289
291
  const chosen = (givenModel ? adapterFor(givenModel) : target) ?? target;
290
292
  const model = modelFor(args, route.capability, chosen, chosen.channels[0]);
291
293
  const outDir = outputDirectory(given) ?? defaultOutDir;
package/package.json CHANGED
@@ -1,7 +1,32 @@
1
1
  {
2
2
  "name": "@modelbay/mcp",
3
- "version": "0.1.3",
4
- "description": "MCP tool generator and per-platform servers",
3
+ "version": "0.2.1",
4
+ "description": "MCP server for Volcengine Ark, Alibaba Bailian, MiniMax, Doubao Speech and OpenAI: image, video, speech, music and chat tools for Claude Code, Codex, Cursor and Claude Desktop",
5
+ "keywords": [
6
+ "mcp",
7
+ "mcp-server",
8
+ "model-context-protocol",
9
+ "claude-code",
10
+ "codex",
11
+ "cursor",
12
+ "volcengine",
13
+ "ark",
14
+ "doubao",
15
+ "seedream",
16
+ "seedance",
17
+ "bailian",
18
+ "dashscope",
19
+ "qwen",
20
+ "wan",
21
+ "minimax",
22
+ "openai",
23
+ "ai",
24
+ "llm",
25
+ "image-generation",
26
+ "video-generation",
27
+ "text-to-speech",
28
+ "typescript"
29
+ ],
5
30
  "license": "MIT",
6
31
  "repository": {
7
32
  "type": "git",
@@ -30,7 +55,7 @@
30
55
  "zod": "^4.6"
31
56
  },
32
57
  "dependencies": {
33
- "modelbay": "0.1.3"
58
+ "modelbay": "0.2.1"
34
59
  },
35
60
  "devDependencies": {
36
61
  "@modelbay/ark": "0.1.0",