@tokenlabai/mcp-server 0.6.13 → 0.6.15
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 +15 -11
- package/contract/mcp-overlay.json +41 -25
- package/contract/openapi.json +34 -2
- package/generated/public-contract.json +14 -4
- package/generated/tools.json +153 -47
- package/llms-install.md +1 -1
- package/package.json +7 -3
- package/scripts/generate-contract.mjs +70 -3
- package/src/index.js +187 -69
- package/src/tool-schema.js +217 -0
package/README.md
CHANGED
|
@@ -10,24 +10,27 @@ It exposes public catalog tools for agents that need to choose models, inspect s
|
|
|
10
10
|
|
|
11
11
|
## Generated Tool Profiles
|
|
12
12
|
|
|
13
|
-
The checked-in `generated/tools.json` manifest is generated from TokenLab's public OpenAPI document plus the small MCP-only overlay in `contract/mcp-overlay.json`. Version 0.6.
|
|
13
|
+
The checked-in `generated/tools.json` manifest is generated from TokenLab's public OpenAPI document plus the small MCP-only overlay in `contract/mcp-overlay.json`. Version 0.6.15 generates 78 endpoint tools; two composite discovery tools are registered at runtime.
|
|
14
14
|
|
|
15
|
-
| Profile | Endpoint tools | Coverage |
|
|
16
|
-
| --- | ---: | --- |
|
|
17
|
-
| `catalog` | 4 | Public model discovery and pricing only; no API key required |
|
|
18
|
-
| `core` (default) | 29 | Catalog and pricing; Chat Completions, Responses, Anthropic Messages, Gemini generateContent; images, video, music, 3D, speech and transcription; async tasks; files; embeddings, rerank, and translation |
|
|
19
|
-
| `full` | 78 | Every allowlisted developer API operation in the checked-in OpenAPI snapshot, including core plus response lifecycle, batches, worlds, and native model discovery |
|
|
15
|
+
| Profile | Endpoint tools | Model-facing schema | Coverage |
|
|
16
|
+
| --- | ---: | --- | --- |
|
|
17
|
+
| `catalog` | 4 | Exact | Public model discovery and pricing only; no API key required |
|
|
18
|
+
| `core` (default) | 29 | Portable | Catalog and pricing; Chat Completions, Responses, Anthropic Messages, Gemini generateContent; images, video, music, 3D, speech and transcription; async tasks; files; embeddings, rerank, and translation |
|
|
19
|
+
| `full` | 78 | Portable | Every allowlisted developer API operation in the checked-in OpenAPI snapshot, including core plus response lifecycle, batches, worlds, and native model discovery |
|
|
20
20
|
|
|
21
|
-
All profiles also include `compare_models` and `get_api_overview`, producing totals of 6, 31, and 80 tools. Realtime and streaming-only operations are excluded because stdio MCP tool calls return one final result. API operations that accept `stream`
|
|
21
|
+
All profiles also include `compare_models` and `get_api_overview`, producing totals of 6, 31, and 80 tools. Realtime and streaming-only operations are excluded because stdio MCP tool calls return one final result. API operations that accept `stream` fix it internally to `false` without exposing a boolean `const` to provider adapters, and the Gemini query-string API key is intentionally hidden from tool arguments.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
The portable projection keeps every top-level argument but bounds deeply nested model-facing shapes. The server still validates calls against the complete generated OpenAPI schema before issuing an API request. Compatibility budgets keep `core` at no more than 60 KB and depth 8, and `full` at no more than 100 KB and depth 8 for the complete `tools/list` response. Tests also run the full profile through the Google AI SDK version used by the observed OpenCode/Gemini failure.
|
|
24
|
+
|
|
25
|
+
Set `TOKENLAB_MCP_TOOL_PROFILE=catalog` for the smallest public-only tool list or `TOKENLAB_MCP_TOOL_PROFILE=full` for the broad developer API. Set `TOKENLAB_MCP_SCHEMA_MODE=exact` only when a client needs the complete nested JSON Schema and can accept its larger/deeper tool payload. Use `strict` for providers that require every property to be listed in `required` and every object to set `additionalProperties: false`; complex top-level arguments are represented as JSON-encoded strings and decoded before canonical validation. Canonical tool names, descriptions, input JSON Schemas, HTTP bindings, content types, auth requirements, and task behavior can be inspected in [`generated/tools.json`](./generated/tools.json).
|
|
24
26
|
|
|
25
27
|
The smaller [`generated/public-contract.json`](./generated/public-contract.json) is the machine-readable projection used by TokenLab's website and other public consumers. It contains package identity, profile counts, core tool layers, resources, prompts, and source hashes without copying all endpoint schemas.
|
|
26
28
|
|
|
27
29
|
## Native MCP Features
|
|
28
30
|
|
|
29
31
|
- JSON tool responses include `structuredContent` while retaining serialized text for older clients.
|
|
30
|
-
- Generated tools expose human-readable titles, standard read-only/destructive/idempotent/open-world annotations,
|
|
32
|
+
- Generated tools expose human-readable titles, standard read-only/destructive/idempotent/open-world annotations, and response request IDs when available.
|
|
33
|
+
- Tool schemas are published and validated directly as JSON Schema. The runtime does not round-trip generated tool schemas through Zod; `exact` mode is byte-shape equivalent to the generated canonical schema.
|
|
31
34
|
- Three resources expose the live API overview, the package's OpenAPI snapshot, and the compact MCP public contract.
|
|
32
35
|
- `choose_tokenlab_model` and `build_tokenlab_request` prompts guide agents to use live model truth and preserve native endpoint shapes.
|
|
33
36
|
- Server instructions tell clients to confirm billable or destructive operations and treat external model/API output as untrusted content.
|
|
@@ -103,6 +106,7 @@ Use `delivery.mode` instead of assuming all image requests are synchronous. For
|
|
|
103
106
|
- `TOKENLAB_API_BASE`: optional, defaults to `https://api.tokenlab.sh`
|
|
104
107
|
- `TOKENLAB_API_KEY`: optional; required for text inference, multimodal generation, async task, embedding, rerank, and translation tools
|
|
105
108
|
- `TOKENLAB_MCP_TOOL_PROFILE`: optional, `catalog`, `core` (default), or `full`
|
|
109
|
+
- `TOKENLAB_MCP_SCHEMA_MODE`: optional, `portable`, `exact`, or `strict`; defaults to the selected profile's tested mode
|
|
106
110
|
- `TOKENLAB_REQUEST_TIMEOUT_MS`: optional request timeout in milliseconds, defaults to `120000`
|
|
107
111
|
- `TOKENLAB_MCP_MAX_FILE_BYTES`: optional maximum local upload size per file, defaults to `104857600` (100 MiB)
|
|
108
112
|
- `TOKENLAB_MCP_INLINE_BYTES`: optional maximum binary/JSON response size returned inline, defaults to `2097152` (2 MiB)
|
|
@@ -118,7 +122,7 @@ The public OpenAPI document is the API contract source. The overlay contains onl
|
|
|
118
122
|
npm run contract:source-check # compare the snapshot with the live canonical OpenAPI (read-only)
|
|
119
123
|
npm run contract:check # check generated output against the checked-in snapshot (offline)
|
|
120
124
|
npm run contract:sync # fetch OpenAPI and regenerate; refuses dirty outputs or a stale branch
|
|
121
|
-
npm test # compile profiles and test routing, tasks, files, and binary output
|
|
125
|
+
npm test # compile profiles and test exact/portable/strict schemas, provider conversion, routing, tasks, files, and binary output
|
|
122
126
|
```
|
|
123
127
|
|
|
124
128
|
Always run `git pull --ff-only` before a manual contract sync. `contract:check` proves internal consistency only; `contract:source-check` proves freshness against the canonical source. The scheduled `Sync TokenLab OpenAPI contract` workflow runs the full write sequence and commits only the verified OpenAPI snapshot and generated manifest to `main`. A failed fetch, stale local branch, dirty generated output, generation error, schema compilation error, or test leaves the tracked contract unchanged.
|
|
@@ -129,7 +133,7 @@ This repository includes `server.json` for the official MCP Registry.
|
|
|
129
133
|
|
|
130
134
|
Release metadata:
|
|
131
135
|
|
|
132
|
-
- npm package: `@tokenlabai/mcp-server@0.6.
|
|
136
|
+
- npm package: `@tokenlabai/mcp-server@0.6.15`
|
|
133
137
|
- MCP registry name: `io.github.hedging8563/tokenlab`
|
|
134
138
|
- `package.json.mcpName`: `io.github.hedging8563/tokenlab`
|
|
135
139
|
|
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
"default_profile": "core",
|
|
5
5
|
"profiles": {
|
|
6
6
|
"catalog": {
|
|
7
|
+
"schema_mode": "exact",
|
|
8
|
+
"compatibility_budget": {
|
|
9
|
+
"max_endpoint_tools": 4,
|
|
10
|
+
"max_input_schema_bytes": 2000,
|
|
11
|
+
"max_input_schema_depth": 4,
|
|
12
|
+
"max_tools_list_bytes": 6000
|
|
13
|
+
},
|
|
7
14
|
"operations": [
|
|
8
15
|
"listModels",
|
|
9
16
|
"getModel",
|
|
@@ -12,6 +19,13 @@
|
|
|
12
19
|
]
|
|
13
20
|
},
|
|
14
21
|
"core": {
|
|
22
|
+
"schema_mode": "portable",
|
|
23
|
+
"compatibility_budget": {
|
|
24
|
+
"max_endpoint_tools": 29,
|
|
25
|
+
"max_input_schema_bytes": 48000,
|
|
26
|
+
"max_input_schema_depth": 8,
|
|
27
|
+
"max_tools_list_bytes": 60000
|
|
28
|
+
},
|
|
15
29
|
"operations": [
|
|
16
30
|
"listModels",
|
|
17
31
|
"getModel",
|
|
@@ -43,6 +57,13 @@
|
|
|
43
57
|
]
|
|
44
58
|
},
|
|
45
59
|
"full": {
|
|
60
|
+
"schema_mode": "portable",
|
|
61
|
+
"compatibility_budget": {
|
|
62
|
+
"max_endpoint_tools": 78,
|
|
63
|
+
"max_input_schema_bytes": 72000,
|
|
64
|
+
"max_input_schema_depth": 8,
|
|
65
|
+
"max_tools_list_bytes": 100000
|
|
66
|
+
},
|
|
46
67
|
"include_tags": [
|
|
47
68
|
"Chat",
|
|
48
69
|
"Embeddings",
|
|
@@ -229,13 +250,15 @@
|
|
|
229
250
|
"openWorldHint": true
|
|
230
251
|
}
|
|
231
252
|
},
|
|
253
|
+
"compactResponse": {
|
|
254
|
+
"fixed_arguments": {
|
|
255
|
+
"stream": false
|
|
256
|
+
}
|
|
257
|
+
},
|
|
232
258
|
"createAnthropicMessage": {
|
|
233
259
|
"tool_name": "create_anthropic_message",
|
|
234
|
-
"
|
|
235
|
-
"stream":
|
|
236
|
-
"const": false,
|
|
237
|
-
"description": "MCP tool calls return one final result; omit stream or set it to false."
|
|
238
|
-
}
|
|
260
|
+
"fixed_arguments": {
|
|
261
|
+
"stream": false
|
|
239
262
|
}
|
|
240
263
|
},
|
|
241
264
|
"geminiGenerateContent": {
|
|
@@ -244,19 +267,18 @@
|
|
|
244
267
|
},
|
|
245
268
|
"createChatCompletion": {
|
|
246
269
|
"description": "Create an OpenAI-compatible chat completion. For inline image_url data URLs, declare the byte-accurate image MIME type. The MCP boundary corrects recognized PNG, JPEG, WebP, and GIF payloads declared as application/octet-stream and rejects unrecognized generic binary image payloads before sending a billable request.",
|
|
247
|
-
"
|
|
248
|
-
"stream":
|
|
249
|
-
"const": false,
|
|
250
|
-
"description": "MCP tool calls return one final result; omit stream or set it to false."
|
|
251
|
-
}
|
|
270
|
+
"fixed_arguments": {
|
|
271
|
+
"stream": false
|
|
252
272
|
}
|
|
253
273
|
},
|
|
254
274
|
"createResponse": {
|
|
255
|
-
"
|
|
256
|
-
"stream":
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
275
|
+
"fixed_arguments": {
|
|
276
|
+
"stream": false
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
"retrieveResponse": {
|
|
280
|
+
"fixed_arguments": {
|
|
281
|
+
"stream": false
|
|
260
282
|
}
|
|
261
283
|
},
|
|
262
284
|
"getAsyncTask": {
|
|
@@ -294,11 +316,8 @@
|
|
|
294
316
|
"application/json": "create_image",
|
|
295
317
|
"multipart/form-data": "create_image_file"
|
|
296
318
|
},
|
|
297
|
-
"
|
|
298
|
-
"stream":
|
|
299
|
-
"const": false,
|
|
300
|
-
"description": "Image streaming is not exposed through MCP tool calls; omit stream or set it to false."
|
|
301
|
-
}
|
|
319
|
+
"fixed_arguments": {
|
|
320
|
+
"stream": false
|
|
302
321
|
},
|
|
303
322
|
"task": {
|
|
304
323
|
"mode": "hybrid",
|
|
@@ -314,11 +333,8 @@
|
|
|
314
333
|
"application/json": "edit_image",
|
|
315
334
|
"multipart/form-data": "edit_image_file"
|
|
316
335
|
},
|
|
317
|
-
"
|
|
318
|
-
"stream":
|
|
319
|
-
"const": false,
|
|
320
|
-
"description": "Image streaming is not exposed through MCP tool calls; omit stream or set it to false."
|
|
321
|
-
}
|
|
336
|
+
"fixed_arguments": {
|
|
337
|
+
"stream": false
|
|
322
338
|
},
|
|
323
339
|
"task": {
|
|
324
340
|
"mode": "hybrid",
|
package/contract/openapi.json
CHANGED
|
@@ -832,7 +832,7 @@
|
|
|
832
832
|
"Video"
|
|
833
833
|
],
|
|
834
834
|
"summary": "Create Seedance material asset",
|
|
835
|
-
"description": "Uploads one Seedance material asset URL into a TokenLab material group. Real-person assets require the group_id mapped from Result.GroupId returned by GetVisualValidateResult.",
|
|
835
|
+
"description": "Uploads one Seedance material asset URL into a TokenLab material group. Image materials must use supported dimensions; an invalid source is rejected with 400 seedance_material_source_invalid instead of remaining in PROCESSING. Real-person assets require the group_id mapped from Result.GroupId returned by GetVisualValidateResult.",
|
|
836
836
|
"operationId": "createSeedanceMaterialAsset",
|
|
837
837
|
"requestBody": {
|
|
838
838
|
"required": true,
|
|
@@ -1195,8 +1195,39 @@
|
|
|
1195
1195
|
"404": {
|
|
1196
1196
|
"$ref": "#/components/responses/NotFound"
|
|
1197
1197
|
},
|
|
1198
|
+
"409": {
|
|
1199
|
+
"description": "Material asset is still processing or has failed without an active replica",
|
|
1200
|
+
"content": {
|
|
1201
|
+
"application/json": {
|
|
1202
|
+
"schema": {
|
|
1203
|
+
"$ref": "#/components/schemas/ApiError"
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
},
|
|
1208
|
+
"422": {
|
|
1209
|
+
"description": "The stored material source failed permanent validation",
|
|
1210
|
+
"content": {
|
|
1211
|
+
"application/json": {
|
|
1212
|
+
"schema": {
|
|
1213
|
+
"$ref": "#/components/schemas/ApiError"
|
|
1214
|
+
},
|
|
1215
|
+
"example": {
|
|
1216
|
+
"error": {
|
|
1217
|
+
"message": "Image width must be between 300px and 6000px.",
|
|
1218
|
+
"type": "invalid_request_error",
|
|
1219
|
+
"code": "seedance_material_source_invalid",
|
|
1220
|
+
"param": "asset_url"
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
},
|
|
1198
1226
|
"500": {
|
|
1199
1227
|
"$ref": "#/components/responses/InternalServerError"
|
|
1228
|
+
},
|
|
1229
|
+
"503": {
|
|
1230
|
+
"$ref": "#/components/responses/MaterialLibraryUnavailable"
|
|
1200
1231
|
}
|
|
1201
1232
|
},
|
|
1202
1233
|
"security": [
|
|
@@ -8801,7 +8832,8 @@
|
|
|
8801
8832
|
},
|
|
8802
8833
|
"error_message": {
|
|
8803
8834
|
"type": "string",
|
|
8804
|
-
"nullable": true
|
|
8835
|
+
"nullable": true,
|
|
8836
|
+
"description": "Public-safe terminal processing error. Permanent source validation failures include the rejected dimension constraint."
|
|
8805
8837
|
},
|
|
8806
8838
|
"metadata": {
|
|
8807
8839
|
"type": "object",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"id": "tokenlab-mcp-server",
|
|
6
6
|
"name": "@tokenlabai/mcp-server",
|
|
7
7
|
"title": "TokenLab MCP Server",
|
|
8
|
-
"version": "0.6.
|
|
8
|
+
"version": "0.6.15",
|
|
9
9
|
"registry_name": "io.github.hedging8563/tokenlab",
|
|
10
10
|
"source_url": "https://github.com/hedging8563/tokenlab-mcp-server",
|
|
11
11
|
"landing_url": "https://tokenlab.sh/mcp",
|
|
@@ -18,22 +18,26 @@
|
|
|
18
18
|
"@tokenlabai/mcp-server"
|
|
19
19
|
],
|
|
20
20
|
"api_key_environment_variable": "TOKENLAB_API_KEY",
|
|
21
|
-
"tool_profile_environment_variable": "TOKENLAB_MCP_TOOL_PROFILE"
|
|
21
|
+
"tool_profile_environment_variable": "TOKENLAB_MCP_TOOL_PROFILE",
|
|
22
|
+
"tool_schema_mode_environment_variable": "TOKENLAB_MCP_SCHEMA_MODE"
|
|
22
23
|
},
|
|
23
24
|
"source": {
|
|
24
25
|
"url": "https://docs.tokenlab.sh/openapi.json",
|
|
25
26
|
"openapi": "3.0.3",
|
|
26
27
|
"title": "TokenLab AI Gateway",
|
|
27
28
|
"version": "1.0.0",
|
|
28
|
-
"sha256": "
|
|
29
|
-
"tool_manifest_sha256": "
|
|
29
|
+
"sha256": "85963db54cafb169aaf6e9c28bf200cc217f59a9d457ed61fe80ba7047d1d511",
|
|
30
|
+
"tool_manifest_sha256": "77536f77ea5ec73b1dba72758be2374f2d7ad1943b5cf066c246269aeeeb54b5"
|
|
30
31
|
},
|
|
31
32
|
"profiles": {
|
|
32
33
|
"catalog": {
|
|
33
34
|
"is_default": false,
|
|
35
|
+
"schema_mode": "exact",
|
|
34
36
|
"endpoint_tools": 4,
|
|
35
37
|
"composite_tools": 2,
|
|
36
38
|
"total_tools": 6,
|
|
39
|
+
"input_schema_bytes": 1553,
|
|
40
|
+
"max_input_schema_depth": 4,
|
|
37
41
|
"tool_names": [
|
|
38
42
|
"compare_models",
|
|
39
43
|
"get_api_overview",
|
|
@@ -45,9 +49,12 @@
|
|
|
45
49
|
},
|
|
46
50
|
"core": {
|
|
47
51
|
"is_default": true,
|
|
52
|
+
"schema_mode": "portable",
|
|
48
53
|
"endpoint_tools": 29,
|
|
49
54
|
"composite_tools": 2,
|
|
50
55
|
"total_tools": 31,
|
|
56
|
+
"input_schema_bytes": 44738,
|
|
57
|
+
"max_input_schema_depth": 8,
|
|
51
58
|
"tool_names": [
|
|
52
59
|
"cancel_task",
|
|
53
60
|
"compare_models",
|
|
@@ -84,9 +91,12 @@
|
|
|
84
91
|
},
|
|
85
92
|
"full": {
|
|
86
93
|
"is_default": false,
|
|
94
|
+
"schema_mode": "portable",
|
|
87
95
|
"endpoint_tools": 78,
|
|
88
96
|
"composite_tools": 2,
|
|
89
97
|
"total_tools": 80,
|
|
98
|
+
"input_schema_bytes": 69847,
|
|
99
|
+
"max_input_schema_depth": 8,
|
|
90
100
|
"tool_names": [
|
|
91
101
|
"cancel_anthropic_message_batch",
|
|
92
102
|
"cancel_batch",
|