@tokenlabai/mcp-server 0.6.0 → 0.6.2

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
@@ -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.0 generates 76 endpoint tools; two composite discovery tools are registered at runtime.
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.2 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.0`
129
+ - npm package: `@tokenlabai/mcp-server@0.6.2`
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",
@@ -1714,7 +1714,7 @@
1714
1714
  "Models"
1715
1715
  ],
1716
1716
  "summary": "Get model",
1717
- "description": "Retrieves a model instance, providing basic information about the model.",
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
  {
@@ -11891,6 +11891,81 @@
11891
11891
  },
11892
11892
  "additionalProperties": false
11893
11893
  },
11894
+ "NonChatOperationConstraint": {
11895
+ "type": "object",
11896
+ "properties": {
11897
+ "operation": {
11898
+ "type": "string"
11899
+ },
11900
+ "request_endpoint": {
11901
+ "type": [
11902
+ "string",
11903
+ "null"
11904
+ ]
11905
+ },
11906
+ "request_shape_mode": {
11907
+ "type": [
11908
+ "string",
11909
+ "null"
11910
+ ]
11911
+ },
11912
+ "status_mode": {
11913
+ "type": [
11914
+ "string",
11915
+ "null"
11916
+ ]
11917
+ },
11918
+ "supported_parameters": {
11919
+ "type": "array",
11920
+ "items": {
11921
+ "type": "string"
11922
+ }
11923
+ },
11924
+ "required_selectors": {
11925
+ "type": "array",
11926
+ "items": {
11927
+ "type": "string"
11928
+ }
11929
+ },
11930
+ "optional_selectors": {
11931
+ "type": "array",
11932
+ "items": {
11933
+ "type": "string"
11934
+ }
11935
+ },
11936
+ "documented_inputs": {
11937
+ "type": "array",
11938
+ "items": {
11939
+ "type": "string"
11940
+ }
11941
+ },
11942
+ "allowed_resolutions": {
11943
+ "type": "array",
11944
+ "items": {
11945
+ "type": "string"
11946
+ }
11947
+ },
11948
+ "allowed_durations": {
11949
+ "type": "array",
11950
+ "items": {
11951
+ "type": "string"
11952
+ }
11953
+ },
11954
+ "allowed_aspect_ratios": {
11955
+ "type": "array",
11956
+ "items": {
11957
+ "type": "string"
11958
+ }
11959
+ },
11960
+ "notes": {
11961
+ "type": "array",
11962
+ "items": {
11963
+ "type": "string"
11964
+ }
11965
+ }
11966
+ },
11967
+ "additionalProperties": false
11968
+ },
11894
11969
  "NonChatRequestFormatSummary": {
11895
11970
  "type": [
11896
11971
  "object",
@@ -11909,6 +11984,54 @@
11909
11984
  "type": "string"
11910
11985
  }
11911
11986
  },
11987
+ "feature_flags": {
11988
+ "type": "object",
11989
+ "additionalProperties": {
11990
+ "type": "boolean"
11991
+ }
11992
+ },
11993
+ "output_formats": {
11994
+ "type": "array",
11995
+ "items": {
11996
+ "type": "string"
11997
+ }
11998
+ },
11999
+ "service_limits": {
12000
+ "type": [
12001
+ "object",
12002
+ "null"
12003
+ ],
12004
+ "properties": {
12005
+ "online_rpm": {
12006
+ "type": [
12007
+ "number",
12008
+ "null"
12009
+ ]
12010
+ },
12011
+ "concurrency": {
12012
+ "type": [
12013
+ "number",
12014
+ "null"
12015
+ ]
12016
+ },
12017
+ "offline_inference": {
12018
+ "type": "boolean"
12019
+ },
12020
+ "offline_tpd": {
12021
+ "type": [
12022
+ "string",
12023
+ "null"
12024
+ ]
12025
+ },
12026
+ "prompt_max_characters": {
12027
+ "type": [
12028
+ "number",
12029
+ "null"
12030
+ ]
12031
+ }
12032
+ },
12033
+ "additionalProperties": false
12034
+ },
11912
12035
  "required_selectors": {
11913
12036
  "type": "array",
11914
12037
  "items": {
@@ -11927,18 +12050,36 @@
11927
12050
  "type": "string"
11928
12051
  }
11929
12052
  },
12053
+ "resolutions_label": {
12054
+ "type": [
12055
+ "string",
12056
+ "null"
12057
+ ]
12058
+ },
11930
12059
  "durations": {
11931
12060
  "type": "array",
11932
12061
  "items": {
11933
12062
  "type": "string"
11934
12063
  }
11935
12064
  },
12065
+ "durations_label": {
12066
+ "type": [
12067
+ "string",
12068
+ "null"
12069
+ ]
12070
+ },
11936
12071
  "aspect_ratios": {
11937
12072
  "type": "array",
11938
12073
  "items": {
11939
12074
  "type": "string"
11940
12075
  }
11941
12076
  },
12077
+ "aspect_ratios_label": {
12078
+ "type": [
12079
+ "string",
12080
+ "null"
12081
+ ]
12082
+ },
11942
12083
  "request_endpoint": {
11943
12084
  "type": [
11944
12085
  "string",
@@ -11951,6 +12092,12 @@
11951
12092
  "null"
11952
12093
  ]
11953
12094
  },
12095
+ "request_shape_mode": {
12096
+ "type": [
12097
+ "string",
12098
+ "null"
12099
+ ]
12100
+ },
11954
12101
  "recommended_request_summary": {
11955
12102
  "type": [
11956
12103
  "object",
@@ -11966,6 +12113,12 @@
11966
12113
  "null"
11967
12114
  ]
11968
12115
  }
12116
+ },
12117
+ "operation_constraints": {
12118
+ "type": "array",
12119
+ "items": {
12120
+ "$ref": "#/components/schemas/NonChatOperationConstraint"
12121
+ }
11969
12122
  }
11970
12123
  },
11971
12124
  "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.0",
8
+ "version": "0.6.2",
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": "586c32a9e47c4557977b92d73183518e986e70666f6530e2718ef5b7293a1706",
29
- "tool_manifest_sha256": "e38134c2fa2489313f79dbefae73808ff8222d7009f1eb81c0c958f09d2c8677"
28
+ "sha256": "45f249430146044e32ab8c51faa72d3c63eedcb760f4769b4b75dd3b85910302",
29
+ "tool_manifest_sha256": "0fbf0a44b1f0da863a9937223e468b1e67a2d1244b4bd4f53c2d8988fca929e3"
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",
@@ -6,7 +6,7 @@
6
6
  "openapi": "3.0.3",
7
7
  "title": "TokenLab AI Gateway",
8
8
  "version": "1.0.0",
9
- "sha256": "586c32a9e47c4557977b92d73183518e986e70666f6530e2718ef5b7293a1706"
9
+ "sha256": "45f249430146044e32ab8c51faa72d3c63eedcb760f4769b4b75dd3b85910302"
10
10
  },
11
11
  "default_profile": "core",
12
12
  "profiles": [
@@ -5283,7 +5283,7 @@
5283
5283
  "core",
5284
5284
  "full"
5285
5285
  ],
5286
- "description": "Get model Retrieves a model instance, providing basic information about the model.",
5286
+ "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
5287
  "input_schema": {
5288
5288
  "type": "object",
5289
5289
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenlabai/mcp-server",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
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: details.request_endpoint,
299
- request_shape_mode: details.request_shape_mode,
300
- supported_operations: details.supported_operations,
301
- supported_parameters: details.supported_parameters,
302
- recommended_request: details.recommended_request,
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
  }));