@modelbay/mcp 0.3.0 → 0.5.0

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
@@ -14,19 +14,24 @@ One command serves every platform that ships MCP tools; the platform is the firs
14
14
  npx -y @modelbay/mcp ark # or: modelbay-mcp ark
15
15
  ```
16
16
 
17
- | Platform | Argument | Required keys (any one row) |
18
- | --------------- | --------------- | ------------------------------------------------------------ |
19
- | Volcengine Ark | `ark` | `ARK_API_KEY`, or `ARK_AGENT_PLAN_API_KEY` |
20
- | MiniMax | `minimax` | `MINIMAX_API_KEY` |
21
- | Alibaba Bailian | `bailian` | `BAILIAN_API_KEY` (alias `DASHSCOPE_API_KEY`) |
22
- | Doubao Speech | `doubao-speech` | `DOUBAO_API_KEY`, or `DOUBAO_APP_ID` + `DOUBAO_ACCESS_TOKEN` |
23
- | OpenAI | `openai` | `OPENAI_API_KEY` |
17
+ | Platform | Argument | Required keys (any one row) |
18
+ | --------------- | --------------- | ------------------------------------------------------------------------------ |
19
+ | Volcengine Ark | `ark` | `ARK_API_KEY`, or `ARK_AGENT_PLAN_API_KEY` |
20
+ | MiniMax | `minimax` | `MINIMAX_API_KEY` |
21
+ | Alibaba Bailian | `bailian` | `BAILIAN_API_KEY` (alias `DASHSCOPE_API_KEY`), or `BAILIAN_TOKEN_PLAN_API_KEY` |
22
+ | Doubao Speech | `doubao-speech` | `DOUBAO_API_KEY`, or `DOUBAO_APP_ID` + `DOUBAO_ACCESS_TOKEN` |
23
+ | OpenAI | `openai` | `OPENAI_API_KEY` |
24
24
 
25
25
  Ark has two billing channels. Prefix the model with `ark-plan:` to use the Agent Plan
26
26
  (`ARK_AGENT_PLAN_API_KEY`, `/api/plan/v3`) and `ark:` for pay-per-use (`ARK_API_KEY`). A model
27
27
  without a prefix goes to the channel it is declared in, preferring pay-per-use when both keys are
28
28
  set; with only the plan key configured, calls without a model use the plan.
29
29
 
30
+ Bailian works the same way for text chat: `bailian-plan:` (or a model only offered in the Token
31
+ Plan, such as `qwen4-max-preview`) uses `BAILIAN_TOKEN_PLAN_API_KEY` and the Token Plan endpoint.
32
+ Token Plan keys are for interactive use inside coding and agent tools only, so plan models are
33
+ marked `agentOnly`.
34
+
30
35
  The platform list, key names and aliases come from each platform package's `PlatformDescriptor`;
31
36
  running `modelbay-mcp` without an argument prints the available platforms. Keys are supplied by the
32
37
  host through environment variables and never stored. When a key is missing, `tools/list` still
package/dist/derive.mjs CHANGED
@@ -61,9 +61,18 @@ function collectModelIds(model) {
61
61
  for (const alias of model.aliases.short ?? []) push(alias);
62
62
  return ids;
63
63
  }
64
- /** 声明里参与这项能力的模型(按声明顺序)。 */
65
- function modelsForCapability(models, capability) {
66
- return models.filter((model) => model.capabilities.includes(capability));
64
+ /**
65
+ * 声明里参与这项能力的模型(按声明顺序)。
66
+ *
67
+ * native 工具(重排序、文件转写、音频生成……):有声明了该操作的专用模型时只列这些;
68
+ * 没有时排除标了其他 native 操作的模型(如 speech_to_text 不列文件转写模型)。
69
+ * 通用能力工具不筛:有的模型既能按能力调用,又带一个附加的 native 操作(如 MiniMax-H3-Image)。
70
+ */
71
+ function modelsForCapability(models, capability, nativeOp) {
72
+ const scoped = models.filter((model) => model.capabilities.includes(capability));
73
+ if (!nativeOp) return scoped;
74
+ const dedicated = scoped.filter((model) => model.native?.includes(nativeOp));
75
+ return dedicated.length ? dedicated : scoped.filter((model) => !model.native?.length);
67
76
  }
68
77
  /**
69
78
  * 用 core 的 schema 函数从声明派生模型参数部分:
@@ -79,7 +88,7 @@ function deriveModelParameterPart(models, capability, channel, nativeOp) {
79
88
  const notices = [];
80
89
  const details = [];
81
90
  const optionProperties = {};
82
- const scoped = modelsForCapability(models, capability);
91
+ const scoped = modelsForCapability(models, capability, nativeOp);
83
92
  for (const model of scoped) {
84
93
  for (const id of collectModelIds(model)) if (!ids.includes(id)) ids.push(id);
85
94
  const notice = lifecycleNotice(model);
@@ -140,8 +149,8 @@ function deriveParamProperties(models, capability, modelParams, channel) {
140
149
  * 生成工具说明里的模型清单:每个模型一行,写它的上限和生命周期提示。
141
150
  * 内容全部来自声明,改声明这段文字就跟着变。
142
151
  */
143
- function deriveModelDetails(models, capability) {
144
- const scoped = modelsForCapability(models, capability);
152
+ function deriveModelDetails(models, capability, nativeOp) {
153
+ const scoped = modelsForCapability(models, capability, nativeOp);
145
154
  if (!scoped.length) return "";
146
155
  return scoped.map((model) => {
147
156
  const limits = modelLimitsText(model);
@@ -172,8 +181,8 @@ function deriveDefaultNote(entry, models, capability, channel, nativeOp) {
172
181
  * 工具的完整说明 = 目录里手写的平台说明 + 运行时派生的模型清单。
173
182
  * 模型清单里每个模型一行,带它的上限与生命周期提示。
174
183
  */
175
- function deriveToolDescription(base, models, capability) {
176
- const details = deriveModelDetails(models, capability);
184
+ function deriveToolDescription(base, models, capability, nativeOp) {
185
+ const details = deriveModelDetails(models, capability, nativeOp);
177
186
  if (!details) return base;
178
187
  return `${base}\n可用模型(由声明派生):\n${details}\n`;
179
188
  }
package/dist/generate.mjs CHANGED
@@ -67,7 +67,7 @@ function buildTool(entry, channel, models, defaultCapability, nodeOnly) {
67
67
  const inputSchema = deriveInputSchema(entry, models, capability, channel, nativeOp);
68
68
  const annotations = deriveAnnotations(meta.nature);
69
69
  const note = deriveDefaultNote(entry, models, capability, channel, nativeOp);
70
- const description = `${deriveToolDescription(entry.description, models, capability)}${note ? `\n${note}\n` : ""}`;
70
+ const description = `${deriveToolDescription(entry.description, models, capability, nativeOp)}${note ? `\n${note}\n` : ""}`;
71
71
  return {
72
72
  name: entry.name,
73
73
  description,
package/dist/routing.mjs CHANGED
@@ -162,7 +162,7 @@ function createHandlers(options) {
162
162
  if (byPrefix) return byPrefix;
163
163
  }
164
164
  const fallback = defaultAdapter();
165
- const declared = models.find((item) => item.id === model || item.canonicalId === model || item.channels.some((entry) => entry.id === model));
165
+ const declared = models.find((item) => item.id === model) ?? resolveModel(models, model)?.declaration;
166
166
  if (!declared) return fallback;
167
167
  const candidates = pool.filter((item) => declared.channels.some((entry) => item.channels.includes(entry.channel)));
168
168
  return candidates.find((item) => item === fallback) ?? candidates.find(usable) ?? candidates[0] ?? fallback;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelbay/mcp",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
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
5
  "keywords": [
6
6
  "mcp",
@@ -55,7 +55,7 @@
55
55
  "zod": "^4.6"
56
56
  },
57
57
  "dependencies": {
58
- "modelbay": "0.3.0"
58
+ "modelbay": "0.5.0"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@modelbay/ark": "0.1.0",