@tokenlabai/mcp-server 0.6.0 → 0.6.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 +2 -2
- package/contract/mcp-overlay.json +13 -0
- package/contract/openapi.json +156 -13
- package/generated/public-contract.json +16 -3
- package/generated/tools.json +4 -14
- package/package.json +2 -1
- package/scripts/generate-contract.mjs +12 -0
- package/src/index.js +13 -5
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ 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.1 generates 76 endpoint tools; two composite discovery tools are registered at runtime.
|
|
14
14
|
|
|
15
15
|
| Profile | Endpoint tools | Coverage |
|
|
16
16
|
| --- | ---: | --- |
|
|
@@ -126,7 +126,7 @@ This repository includes `server.json` for the official MCP Registry.
|
|
|
126
126
|
|
|
127
127
|
Release metadata:
|
|
128
128
|
|
|
129
|
-
- npm package: `@tokenlabai/mcp-server@0.6.
|
|
129
|
+
- npm package: `@tokenlabai/mcp-server@0.6.1`
|
|
130
130
|
- MCP registry name: `io.github.hedging8563/tokenlab`
|
|
131
131
|
- `package.json.mcpName`: `io.github.hedging8563/tokenlab`
|
|
132
132
|
|
|
@@ -69,6 +69,19 @@
|
|
|
69
69
|
"landing_url": "https://tokenlab.sh/mcp",
|
|
70
70
|
"docs_url": "https://docs.tokenlab.sh/integrations/tokenlab-mcp-server",
|
|
71
71
|
"recommended_client_name": "tokenlab",
|
|
72
|
+
"live_model_contract": {
|
|
73
|
+
"tool": "get_model",
|
|
74
|
+
"endpoint": "/v1/models/{model}",
|
|
75
|
+
"fields": [
|
|
76
|
+
"supported_operations",
|
|
77
|
+
"supported_parameters",
|
|
78
|
+
"request_endpoint",
|
|
79
|
+
"request_endpoint_by_operation",
|
|
80
|
+
"request_shape_mode",
|
|
81
|
+
"operation_constraints",
|
|
82
|
+
"recommended_request"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
72
85
|
"composite_tools": [
|
|
73
86
|
{
|
|
74
87
|
"name": "compare_models",
|
package/contract/openapi.json
CHANGED
|
@@ -1714,7 +1714,7 @@
|
|
|
1714
1714
|
"Models"
|
|
1715
1715
|
],
|
|
1716
1716
|
"summary": "Get model",
|
|
1717
|
-
"description": "Retrieves
|
|
1717
|
+
"description": "Retrieves current model details, including supported operations, request parameters, request endpoints, selector limits, and pricing when available. Non-chat integrations should read these current model-specific request details before creating a request.",
|
|
1718
1718
|
"operationId": "getModel",
|
|
1719
1719
|
"parameters": [
|
|
1720
1720
|
{
|
|
@@ -7267,21 +7267,11 @@
|
|
|
7267
7267
|
},
|
|
7268
7268
|
"size": {
|
|
7269
7269
|
"type": "string",
|
|
7270
|
-
"
|
|
7271
|
-
"description": "Image size. For gpt-image-2, use auto or WIDTHxHEIGHT; custom dimensions must both be multiples of 16, longest edge <= 3840px, long/short ratio <= 3:1, and total pixels between 655,360 and 8,294,400."
|
|
7270
|
+
"description": "Image size. Defaults are model-specific. For gpt-image-2, omit this field or use auto for automatic sizing, or send WIDTHxHEIGHT; custom dimensions must both be multiples of 16, longest edge <= 3840px, long/short ratio <= 3:1, and total pixels between 655,360 and 8,294,400."
|
|
7272
7271
|
},
|
|
7273
7272
|
"quality": {
|
|
7274
7273
|
"type": "string",
|
|
7275
|
-
"
|
|
7276
|
-
"standard",
|
|
7277
|
-
"hd",
|
|
7278
|
-
"auto",
|
|
7279
|
-
"low",
|
|
7280
|
-
"medium",
|
|
7281
|
-
"high"
|
|
7282
|
-
],
|
|
7283
|
-
"default": "standard",
|
|
7284
|
-
"description": "Image quality. GPT Image models such as gpt-image-2 use auto/low/medium/high. Other image families may use provider-specific values."
|
|
7274
|
+
"description": "Image quality. Defaults and accepted values are model-specific. For gpt-image-2, omit this field or use auto for automatic quality, or send low, medium, or high. Other image families may use provider-specific values."
|
|
7285
7275
|
},
|
|
7286
7276
|
"style": {
|
|
7287
7277
|
"type": "string",
|
|
@@ -11891,6 +11881,81 @@
|
|
|
11891
11881
|
},
|
|
11892
11882
|
"additionalProperties": false
|
|
11893
11883
|
},
|
|
11884
|
+
"NonChatOperationConstraint": {
|
|
11885
|
+
"type": "object",
|
|
11886
|
+
"properties": {
|
|
11887
|
+
"operation": {
|
|
11888
|
+
"type": "string"
|
|
11889
|
+
},
|
|
11890
|
+
"request_endpoint": {
|
|
11891
|
+
"type": [
|
|
11892
|
+
"string",
|
|
11893
|
+
"null"
|
|
11894
|
+
]
|
|
11895
|
+
},
|
|
11896
|
+
"request_shape_mode": {
|
|
11897
|
+
"type": [
|
|
11898
|
+
"string",
|
|
11899
|
+
"null"
|
|
11900
|
+
]
|
|
11901
|
+
},
|
|
11902
|
+
"status_mode": {
|
|
11903
|
+
"type": [
|
|
11904
|
+
"string",
|
|
11905
|
+
"null"
|
|
11906
|
+
]
|
|
11907
|
+
},
|
|
11908
|
+
"supported_parameters": {
|
|
11909
|
+
"type": "array",
|
|
11910
|
+
"items": {
|
|
11911
|
+
"type": "string"
|
|
11912
|
+
}
|
|
11913
|
+
},
|
|
11914
|
+
"required_selectors": {
|
|
11915
|
+
"type": "array",
|
|
11916
|
+
"items": {
|
|
11917
|
+
"type": "string"
|
|
11918
|
+
}
|
|
11919
|
+
},
|
|
11920
|
+
"optional_selectors": {
|
|
11921
|
+
"type": "array",
|
|
11922
|
+
"items": {
|
|
11923
|
+
"type": "string"
|
|
11924
|
+
}
|
|
11925
|
+
},
|
|
11926
|
+
"documented_inputs": {
|
|
11927
|
+
"type": "array",
|
|
11928
|
+
"items": {
|
|
11929
|
+
"type": "string"
|
|
11930
|
+
}
|
|
11931
|
+
},
|
|
11932
|
+
"allowed_resolutions": {
|
|
11933
|
+
"type": "array",
|
|
11934
|
+
"items": {
|
|
11935
|
+
"type": "string"
|
|
11936
|
+
}
|
|
11937
|
+
},
|
|
11938
|
+
"allowed_durations": {
|
|
11939
|
+
"type": "array",
|
|
11940
|
+
"items": {
|
|
11941
|
+
"type": "string"
|
|
11942
|
+
}
|
|
11943
|
+
},
|
|
11944
|
+
"allowed_aspect_ratios": {
|
|
11945
|
+
"type": "array",
|
|
11946
|
+
"items": {
|
|
11947
|
+
"type": "string"
|
|
11948
|
+
}
|
|
11949
|
+
},
|
|
11950
|
+
"notes": {
|
|
11951
|
+
"type": "array",
|
|
11952
|
+
"items": {
|
|
11953
|
+
"type": "string"
|
|
11954
|
+
}
|
|
11955
|
+
}
|
|
11956
|
+
},
|
|
11957
|
+
"additionalProperties": false
|
|
11958
|
+
},
|
|
11894
11959
|
"NonChatRequestFormatSummary": {
|
|
11895
11960
|
"type": [
|
|
11896
11961
|
"object",
|
|
@@ -11909,6 +11974,54 @@
|
|
|
11909
11974
|
"type": "string"
|
|
11910
11975
|
}
|
|
11911
11976
|
},
|
|
11977
|
+
"feature_flags": {
|
|
11978
|
+
"type": "object",
|
|
11979
|
+
"additionalProperties": {
|
|
11980
|
+
"type": "boolean"
|
|
11981
|
+
}
|
|
11982
|
+
},
|
|
11983
|
+
"output_formats": {
|
|
11984
|
+
"type": "array",
|
|
11985
|
+
"items": {
|
|
11986
|
+
"type": "string"
|
|
11987
|
+
}
|
|
11988
|
+
},
|
|
11989
|
+
"service_limits": {
|
|
11990
|
+
"type": [
|
|
11991
|
+
"object",
|
|
11992
|
+
"null"
|
|
11993
|
+
],
|
|
11994
|
+
"properties": {
|
|
11995
|
+
"online_rpm": {
|
|
11996
|
+
"type": [
|
|
11997
|
+
"number",
|
|
11998
|
+
"null"
|
|
11999
|
+
]
|
|
12000
|
+
},
|
|
12001
|
+
"concurrency": {
|
|
12002
|
+
"type": [
|
|
12003
|
+
"number",
|
|
12004
|
+
"null"
|
|
12005
|
+
]
|
|
12006
|
+
},
|
|
12007
|
+
"offline_inference": {
|
|
12008
|
+
"type": "boolean"
|
|
12009
|
+
},
|
|
12010
|
+
"offline_tpd": {
|
|
12011
|
+
"type": [
|
|
12012
|
+
"string",
|
|
12013
|
+
"null"
|
|
12014
|
+
]
|
|
12015
|
+
},
|
|
12016
|
+
"prompt_max_characters": {
|
|
12017
|
+
"type": [
|
|
12018
|
+
"number",
|
|
12019
|
+
"null"
|
|
12020
|
+
]
|
|
12021
|
+
}
|
|
12022
|
+
},
|
|
12023
|
+
"additionalProperties": false
|
|
12024
|
+
},
|
|
11912
12025
|
"required_selectors": {
|
|
11913
12026
|
"type": "array",
|
|
11914
12027
|
"items": {
|
|
@@ -11927,18 +12040,36 @@
|
|
|
11927
12040
|
"type": "string"
|
|
11928
12041
|
}
|
|
11929
12042
|
},
|
|
12043
|
+
"resolutions_label": {
|
|
12044
|
+
"type": [
|
|
12045
|
+
"string",
|
|
12046
|
+
"null"
|
|
12047
|
+
]
|
|
12048
|
+
},
|
|
11930
12049
|
"durations": {
|
|
11931
12050
|
"type": "array",
|
|
11932
12051
|
"items": {
|
|
11933
12052
|
"type": "string"
|
|
11934
12053
|
}
|
|
11935
12054
|
},
|
|
12055
|
+
"durations_label": {
|
|
12056
|
+
"type": [
|
|
12057
|
+
"string",
|
|
12058
|
+
"null"
|
|
12059
|
+
]
|
|
12060
|
+
},
|
|
11936
12061
|
"aspect_ratios": {
|
|
11937
12062
|
"type": "array",
|
|
11938
12063
|
"items": {
|
|
11939
12064
|
"type": "string"
|
|
11940
12065
|
}
|
|
11941
12066
|
},
|
|
12067
|
+
"aspect_ratios_label": {
|
|
12068
|
+
"type": [
|
|
12069
|
+
"string",
|
|
12070
|
+
"null"
|
|
12071
|
+
]
|
|
12072
|
+
},
|
|
11942
12073
|
"request_endpoint": {
|
|
11943
12074
|
"type": [
|
|
11944
12075
|
"string",
|
|
@@ -11951,6 +12082,12 @@
|
|
|
11951
12082
|
"null"
|
|
11952
12083
|
]
|
|
11953
12084
|
},
|
|
12085
|
+
"request_shape_mode": {
|
|
12086
|
+
"type": [
|
|
12087
|
+
"string",
|
|
12088
|
+
"null"
|
|
12089
|
+
]
|
|
12090
|
+
},
|
|
11954
12091
|
"recommended_request_summary": {
|
|
11955
12092
|
"type": [
|
|
11956
12093
|
"object",
|
|
@@ -11966,6 +12103,12 @@
|
|
|
11966
12103
|
"null"
|
|
11967
12104
|
]
|
|
11968
12105
|
}
|
|
12106
|
+
},
|
|
12107
|
+
"operation_constraints": {
|
|
12108
|
+
"type": "array",
|
|
12109
|
+
"items": {
|
|
12110
|
+
"$ref": "#/components/schemas/NonChatOperationConstraint"
|
|
12111
|
+
}
|
|
11969
12112
|
}
|
|
11970
12113
|
},
|
|
11971
12114
|
"additionalProperties": true
|
|
@@ -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.1",
|
|
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",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"openapi": "3.0.3",
|
|
26
26
|
"title": "TokenLab AI Gateway",
|
|
27
27
|
"version": "1.0.0",
|
|
28
|
-
"sha256": "
|
|
29
|
-
"tool_manifest_sha256": "
|
|
28
|
+
"sha256": "1b60d2976d994b4007a17984d9aa4ad4c11d791fb4e8096e1f86144bcee366f1",
|
|
29
|
+
"tool_manifest_sha256": "6647f8fbec7a80e4588640d9582a2931ba5fd675b3c01589ae6e833c0fdf6d69"
|
|
30
30
|
},
|
|
31
31
|
"profiles": {
|
|
32
32
|
"catalog": {
|
|
@@ -242,6 +242,19 @@
|
|
|
242
242
|
"features": {
|
|
243
243
|
"structured_content": true,
|
|
244
244
|
"tool_annotations": true,
|
|
245
|
+
"live_model_contract": {
|
|
246
|
+
"tool": "get_model",
|
|
247
|
+
"endpoint": "/v1/models/{model}",
|
|
248
|
+
"fields": [
|
|
249
|
+
"supported_operations",
|
|
250
|
+
"supported_parameters",
|
|
251
|
+
"request_endpoint",
|
|
252
|
+
"request_endpoint_by_operation",
|
|
253
|
+
"request_shape_mode",
|
|
254
|
+
"operation_constraints",
|
|
255
|
+
"recommended_request"
|
|
256
|
+
]
|
|
257
|
+
},
|
|
245
258
|
"composite_tools": [
|
|
246
259
|
{
|
|
247
260
|
"name": "compare_models",
|
package/generated/tools.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"openapi": "3.0.3",
|
|
7
7
|
"title": "TokenLab AI Gateway",
|
|
8
8
|
"version": "1.0.0",
|
|
9
|
-
"sha256": "
|
|
9
|
+
"sha256": "1b60d2976d994b4007a17984d9aa4ad4c11d791fb4e8096e1f86144bcee366f1"
|
|
10
10
|
},
|
|
11
11
|
"default_profile": "core",
|
|
12
12
|
"profiles": [
|
|
@@ -2255,21 +2255,11 @@
|
|
|
2255
2255
|
},
|
|
2256
2256
|
"size": {
|
|
2257
2257
|
"type": "string",
|
|
2258
|
-
"
|
|
2259
|
-
"description": "Image size. For gpt-image-2, use auto or WIDTHxHEIGHT; custom dimensions must both be multiples of 16, longest edge <= 3840px, long/short ratio <= 3:1, and total pixels between 655,360 and 8,294,400."
|
|
2258
|
+
"description": "Image size. Defaults are model-specific. For gpt-image-2, omit this field or use auto for automatic sizing, or send WIDTHxHEIGHT; custom dimensions must both be multiples of 16, longest edge <= 3840px, long/short ratio <= 3:1, and total pixels between 655,360 and 8,294,400."
|
|
2260
2259
|
},
|
|
2261
2260
|
"quality": {
|
|
2262
2261
|
"type": "string",
|
|
2263
|
-
"
|
|
2264
|
-
"standard",
|
|
2265
|
-
"hd",
|
|
2266
|
-
"auto",
|
|
2267
|
-
"low",
|
|
2268
|
-
"medium",
|
|
2269
|
-
"high"
|
|
2270
|
-
],
|
|
2271
|
-
"default": "standard",
|
|
2272
|
-
"description": "Image quality. GPT Image models such as gpt-image-2 use auto/low/medium/high. Other image families may use provider-specific values."
|
|
2262
|
+
"description": "Image quality. Defaults and accepted values are model-specific. For gpt-image-2, omit this field or use auto for automatic quality, or send low, medium, or high. Other image families may use provider-specific values."
|
|
2273
2263
|
},
|
|
2274
2264
|
"style": {
|
|
2275
2265
|
"type": "string",
|
|
@@ -5283,7 +5273,7 @@
|
|
|
5283
5273
|
"core",
|
|
5284
5274
|
"full"
|
|
5285
5275
|
],
|
|
5286
|
-
"description": "Get model Retrieves
|
|
5276
|
+
"description": "Get model Retrieves current model details, including supported operations, request parameters, request endpoints, selector limits, and pricing when available. Non-chat integrations should read these current model-specific request details before creating a request.",
|
|
5287
5277
|
"input_schema": {
|
|
5288
5278
|
"type": "object",
|
|
5289
5279
|
"properties": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenlabai/mcp-server",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "OpenAPI-generated TokenLab MCP server with catalog, native AI, multimodal, resource, prompt, and async task support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"contract:generate": "node ./scripts/generate-contract.mjs",
|
|
26
26
|
"contract:check": "node ./scripts/generate-contract.mjs --check",
|
|
27
27
|
"contract:sync": "node ./scripts/sync-contract.mjs",
|
|
28
|
+
"version": "node ./scripts/sync-version.mjs && npm run contract:generate",
|
|
28
29
|
"test": "node --check ./src/index.js && node --check ./scripts/generate-contract.mjs && npm run contract:check && node --test"
|
|
29
30
|
},
|
|
30
31
|
"keywords": [
|
|
@@ -314,6 +314,17 @@ for (const tool of compositeTools) {
|
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
+
const liveModelContract = publicConfig.live_model_contract;
|
|
318
|
+
if (!liveModelContract || liveModelContract.tool !== "get_model" || liveModelContract.endpoint !== "/v1/models/{model}") {
|
|
319
|
+
throw new Error("MCP public contract must use get_model as its live model-contract source");
|
|
320
|
+
}
|
|
321
|
+
if (!Array.isArray(liveModelContract.fields) || liveModelContract.fields.length === 0) {
|
|
322
|
+
throw new Error("MCP live model contract must list its public fields");
|
|
323
|
+
}
|
|
324
|
+
if (new Set(liveModelContract.fields).size !== liveModelContract.fields.length) {
|
|
325
|
+
throw new Error("MCP live model contract fields contain duplicates");
|
|
326
|
+
}
|
|
327
|
+
|
|
317
328
|
const profiles = Object.fromEntries(profileEntries.map(([profileName]) => {
|
|
318
329
|
const endpointTools = tools.filter((tool) => tool.profiles.includes(profileName)).map((tool) => tool.name);
|
|
319
330
|
const composite = compositeTools.filter((tool) => tool.profiles.includes(profileName)).map((tool) => tool.name);
|
|
@@ -373,6 +384,7 @@ const publicContract = {
|
|
|
373
384
|
features: {
|
|
374
385
|
structured_content: true,
|
|
375
386
|
tool_annotations: true,
|
|
387
|
+
live_model_contract: liveModelContract,
|
|
376
388
|
composite_tools: compositeTools,
|
|
377
389
|
async_delivery_tools: tools.filter((tool) => tool.task).map((tool) => tool.name),
|
|
378
390
|
resources: publicConfig.resources || [],
|
package/src/index.js
CHANGED
|
@@ -293,13 +293,21 @@ server.registerTool(
|
|
|
293
293
|
executePublicJson(`/v1/models/${encoded}/pricing`).catch((error) => ({ error: error.message }))
|
|
294
294
|
]);
|
|
295
295
|
if (include_raw) return { model, details, pricing };
|
|
296
|
+
const tokenlab = details?.tokenlab && typeof details.tokenlab === "object" ? details.tokenlab : {};
|
|
297
|
+
const requestContract = tokenlab.request_format_details
|
|
298
|
+
|| tokenlab.request_format_summary
|
|
299
|
+
|| tokenlab.public_contract
|
|
300
|
+
|| tokenlab.public_contract_summary
|
|
301
|
+
|| {};
|
|
296
302
|
return {
|
|
297
303
|
id: details.id || details.model || model,
|
|
298
|
-
request_endpoint:
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
304
|
+
request_endpoint: requestContract.request_endpoint,
|
|
305
|
+
request_endpoint_by_operation: requestContract.request_endpoint_by_operation,
|
|
306
|
+
request_shape_mode: requestContract.request_shape_mode,
|
|
307
|
+
supported_operations: tokenlab.supported_operations || requestContract.public_operations,
|
|
308
|
+
supported_parameters: requestContract.supported_parameters,
|
|
309
|
+
operation_constraints: requestContract.operation_constraints,
|
|
310
|
+
recommended_request: requestContract.recommended_request || requestContract.recommended_request_summary,
|
|
303
311
|
pricing
|
|
304
312
|
};
|
|
305
313
|
}));
|