@softure-ai/mcp-access 0.6.0 → 0.7.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/CHANGELOG.md +9 -0
- package/README.md +29 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/messages/en.d.ts +4 -0
- package/dist/messages/en.d.ts.map +1 -1
- package/dist/messages/en.js +4 -0
- package/dist/messages/en.js.map +1 -1
- package/dist/messages/index.d.ts +4 -0
- package/dist/messages/index.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/server-factory.d.ts +2 -1
- package/dist/server/server-factory.d.ts.map +1 -1
- package/dist/server/server-factory.js +16 -10
- package/dist/server/server-factory.js.map +1 -1
- package/dist/server/server-info.d.ts +30 -2
- package/dist/server/server-info.d.ts.map +1 -1
- package/dist/server/server-info.js +28 -6
- package/dist/server/server-info.js.map +1 -1
- package/dist/server/tool-list.d.ts +2 -0
- package/dist/server/tool-list.d.ts.map +1 -1
- package/dist/server/tool-list.js +6 -2
- package/dist/server/tool-list.js.map +1 -1
- package/module.json +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/messages/en.ts +6 -0
- package/src/server/index.ts +2 -0
- package/src/server/server-factory.ts +32 -12
- package/src/server/server-info.ts +60 -8
- package/src/server/tool-list.ts +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@ Newest first. Each version lists what changed for an app that uses `@softure-ai/
|
|
|
4
4
|
production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
|
|
5
5
|
"Definition of done"). Versions before the first one below are described in their GitHub Releases (`mcp-access@x.y.z`).
|
|
6
6
|
|
|
7
|
+
## 0.7.0
|
|
8
|
+
|
|
9
|
+
- The served tool contract in `get_server_info` (#1078): `serverInfoTool: { tools: true }` makes the tool answer each
|
|
10
|
+
served tool's `name`, `description` and `inputSchema` for the caller's access level, exactly as `tools/list` answers
|
|
11
|
+
them (the measured list the version comes from), with a `toolsHint` that the server's copy is current. An optional
|
|
12
|
+
`name` input narrows it to one tool; an unknown name answers `toolNames`. A hosted client never caches a tool result,
|
|
13
|
+
so a model on a stale tool list reads the current one in-band. `registerServerInfoTool` takes `tools` with
|
|
14
|
+
`servedTools` for a hand-built server. Migrate: nothing (off by default; turning it on changes the version once).
|
|
15
|
+
|
|
7
16
|
## 0.6.0
|
|
8
17
|
|
|
9
18
|
- Request diagnostics (#1066): `createMcpEndpoint({ diagnostics })` (and so `createMcpRoute`), off by default. `true`
|
package/README.md
CHANGED
|
@@ -258,6 +258,11 @@ still parsed) so a stale schema degrades instead of failing. Renaming the server
|
|
|
258
258
|
entry, at the cost of every user reconnecting, so it is a last resort. Tell users after a release that changed a tool
|
|
259
259
|
schema: start a new conversation, and if the old tools are still shown, remove and re-add the connector.
|
|
260
260
|
|
|
261
|
+
What the app can rely on: with `serverInfoTool: { tools: true }` the model can always read the current contract
|
|
262
|
+
in-band, since a tool result is never cached. `get_server_info` answers every served tool's description and input
|
|
263
|
+
schema with a hint that the server's copy wins, so a model on a stale list can build its calls from it without the
|
|
264
|
+
user doing anything.
|
|
265
|
+
|
|
261
266
|
### Strict tool input
|
|
262
267
|
|
|
263
268
|
zod objects strip unknown keys, so a call with a misspelt field (`notes` for `note`) or a field of a newer tool list
|
|
@@ -327,6 +332,28 @@ export const createServer = createMcpServerFactory({
|
|
|
327
332
|
- A hand-built server registers it with `registerServerInfoTool(server, { buildInfo, server: { name, version } })`,
|
|
328
333
|
passing the name and version it serves.
|
|
329
334
|
|
|
335
|
+
#### The served tool contract: `tools: true`
|
|
336
|
+
|
|
337
|
+
A hosted client can keep a stale tool list for good (see "What hosted clients do with a changed tool list"), but it
|
|
338
|
+
never caches a tool result. `serverInfoTool: { buildInfo, tools: true }` makes `get_server_info` answer the contract the
|
|
339
|
+
caller's `tools/list` answers right now, so the model reads the current schemas in-band:
|
|
340
|
+
|
|
341
|
+
```json
|
|
342
|
+
{ "server": { "name": "acme", "version": "1.0.0-tools-3f9a0c41d2e7" }, "release": "v1.4.0", "...": "...",
|
|
343
|
+
"toolsHint": "If your copy of a tool's schema or description differs from `tools` here, the server's is current: build calls from it.",
|
|
344
|
+
"tools": [{ "name": "search_notes", "description": "Finds notes.", "inputSchema": { "type": "object", "...": "..." } }] }
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
- `tools` lists each served tool's `name`, `description` and `inputSchema` for the caller's access level, taken from
|
|
348
|
+
the same measured listing the version is computed from (strict input included), so the two never disagree.
|
|
349
|
+
- An optional `name` input narrows the answer to one tool; a name no served tool has answers `tools: []` with
|
|
350
|
+
`toolNames`. A call with no input still works.
|
|
351
|
+
- The hint is in the answer, not only in the description, since a stale copy carries the old description too.
|
|
352
|
+
- No token, identity or user data is in the answer: only what `tools/list` already shows the caller.
|
|
353
|
+
- Turning it on changes the tool's input schema and default description, so the version changes once.
|
|
354
|
+
- A hand-built server passes `tools: true` with `servedTools: () => listServedTools(createServer)` for the caller's
|
|
355
|
+
access level.
|
|
356
|
+
|
|
330
357
|
### Writing tools
|
|
331
358
|
|
|
332
359
|
`/server` answers tools safely, so a failure never hands the assistant a query or an error's text:
|
|
@@ -972,7 +999,8 @@ to `@softure-ai/privacy` (`privacy` flags on):
|
|
|
972
999
|
- Only `S256` PKCE and the `authorization_code` and `refresh_token` grants.
|
|
973
1000
|
- Write access is per token, not per tool; finer scopes would be a new option.
|
|
974
1001
|
- A hosted client's own tool list cache cannot be refreshed from the server (see "What hosted clients do with a
|
|
975
|
-
changed tool list"); the version and the session renewal help only clients that re-list.
|
|
1002
|
+
changed tool list"); the version and the session renewal help only clients that re-list. `get_server_info` with
|
|
1003
|
+
`tools: true` gives the model the current contract in-band instead.
|
|
976
1004
|
- The MCP endpoint's rate limit is per client address, not per token (API tokens are counted per token as well).
|
|
977
1005
|
- One API token kind per app (one prefix); the `kind` column takes more kinds without a migration of the rows.
|
|
978
1006
|
- `responseMode: "json"` drops mid-call notifications; a streaming tool would need a different mode. Long work is an
|
package/dist/index.d.ts
CHANGED
|
@@ -185,6 +185,10 @@ export declare const mcpAccess: import("@softure-ai/core").ModuleFactory<{
|
|
|
185
185
|
};
|
|
186
186
|
serverInfoTool: {
|
|
187
187
|
description: string;
|
|
188
|
+
descriptionWithTools: string;
|
|
189
|
+
nameInputDescription: string;
|
|
190
|
+
toolsHint: string;
|
|
191
|
+
unknownToolHint: string;
|
|
188
192
|
};
|
|
189
193
|
operations: {
|
|
190
194
|
statusToolDescription: string;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,SAAS,eAAe,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,8BAA8B,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;IAEjC;;;;OAIG;;;;;;CAE8D,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;CAG0B,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,SAAS,eAAe,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,8BAA8B,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;IAEjC;;;;OAIG;;;;;;CAE8D,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;CAG0B,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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M,cAAc,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,KAAK,4BAA4B,EAAE,MAAM,aAAa,CAAC;AACvJ,OAAO,EAAE,oBAAoB,EAAE,KAAK,wBAAwB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -45,7 +45,7 @@ export const API_TOKEN_RATE_LIMIT_BUCKETS = {
|
|
|
45
45
|
export const mcpAccess = defineModule({
|
|
46
46
|
manifest: {
|
|
47
47
|
id: MODULE_ID,
|
|
48
|
-
version: "0.
|
|
48
|
+
version: "0.7.0",
|
|
49
49
|
dependsOn: { security: "^0.2.0", auth: "^0.2.0", jobs: "^0.1.1?", ops: "^0.2.0?" },
|
|
50
50
|
dbSchema: "mcp",
|
|
51
51
|
tables: ["access_tokens", "oauth_clients", "oauth_authorization_codes", "oauth_grants", "oauth_registration_window", "used_confirmations", "operation_tasks"],
|
package/dist/messages/en.d.ts
CHANGED
|
@@ -128,6 +128,10 @@ export declare const en: {
|
|
|
128
128
|
};
|
|
129
129
|
serverInfoTool: {
|
|
130
130
|
description: string;
|
|
131
|
+
descriptionWithTools: string;
|
|
132
|
+
nameInputDescription: string;
|
|
133
|
+
toolsHint: string;
|
|
134
|
+
unknownToolHint: string;
|
|
131
135
|
};
|
|
132
136
|
operations: {
|
|
133
137
|
statusToolDescription: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAuJX,mFAAmF;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BtF,CAAC"}
|
package/dist/messages/en.js
CHANGED
|
@@ -128,6 +128,10 @@ export const en = {
|
|
|
128
128
|
},
|
|
129
129
|
serverInfoTool: {
|
|
130
130
|
description: "Tells which build of this server answers: its name and version (the version changes whenever a tool changes), the release, the commit, when it was built and started, and the changelog when the app publishes one. Use it to check that a change is live.",
|
|
131
|
+
descriptionWithTools: "Tells which build of this server answers (its name and version, the release, the commit, when it was built and started, the changelog when the app publishes one) and the current description and input schema of every tool it serves you. Use it to check that a change is live, and read a tool's contract here when a call is refused or your copy may be out of date.",
|
|
132
|
+
nameInputDescription: "Optional: one tool's name, to answer only that tool's current description and input schema.",
|
|
133
|
+
toolsHint: "If your copy of a tool's schema or description differs from `tools` here, the server's is current: build calls from it.",
|
|
134
|
+
unknownToolHint: "No served tool has that name; `toolNames` lists every tool this server serves to you.",
|
|
131
135
|
},
|
|
132
136
|
operations: {
|
|
133
137
|
statusToolDescription: "Tells how a long operation started by another tool is going: queued, running (with its progress), succeeded (with its result), failed (with an error code) or cancelled. Call it again after pollAfterSeconds while the operation runs.",
|
package/dist/messages/en.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,IAAI,EAAE;QACJ,KAAK,EAAE,qBAAqB;QAC5B,IAAI,EAAE,uIAAuI;KAC9I;IACD,KAAK,EAAE;QACL,KAAK,EAAE,0BAA0B;QACjC,KAAK,EAAE,6BAA6B;QACpC,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,cAAc;QACrB,gBAAgB,EAAE,uCAAuC;KAC1D;IACD,KAAK,EAAE;QACL,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,MAAM;QACZ,QAAQ,E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,8BAA8B;QACzC,QAAQ,EAAE,oDAAoD;QAC9D,QAAQ,EAAE,6DAA6D;QACvE,mFAAmF;QACnF,UAAU,EAAE,oCAAoC;QAChD,WAAW,EAAE,2BAA2B;QACxC,mBAAmB,EAAE,uDAAuD;KAC7E;IACD,MAAM,EAAE;QACN,YAAY,EAAE;YACZ,aAAa,EAAE,4DAA4D;YAC3E,aAAa,EAAE,uBAAuB;YACtC,mBAAmB,EAAE,sFAAsF;YAC3G,eAAe,EAAE,gEAAgE;YACjF,eAAe,EAAE,kCAAkC;YACnD,aAAa,EAAE,8CAA8C;YAC7D,aAAa,EAAE,wFAAwF;YACvG,YAAY,EAAE,gDAAgD;YAC9D,cAAc,EAAE,mCAAmC;YACnD,aAAa,EAAE,qEAAqE;SACrF;QACD,IAAI,EAAE;YACJ,eAAe,EAAE,uCAAuC;SACzD;QACD,IAAI,EAAE;YACJ,eAAe,EAAE,0DAA0D;YAC3E,UAAU,EAAE,0DAA0D;SACvE;KACF;CACF,CAAC"}
|
package/dist/messages/index.d.ts
CHANGED
|
@@ -132,6 +132,10 @@ export declare const mcpAccessMessages: {
|
|
|
132
132
|
};
|
|
133
133
|
serverInfoTool: {
|
|
134
134
|
description: string;
|
|
135
|
+
descriptionWithTools: string;
|
|
136
|
+
nameInputDescription: string;
|
|
137
|
+
toolsHint: string;
|
|
138
|
+
unknownToolHint: string;
|
|
135
139
|
};
|
|
136
140
|
operations: {
|
|
137
141
|
statusToolDescription: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,0GAA0G;AAC1G,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,0GAA0G;AAC1G,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAS,CAAC;AAExC,MAAM,MAAM,iBAAiB,GAAG,OAAO,EAAE,CAAC;AAE1C,4EAA4E;AAC5E,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAOlG"}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export { deleteMcpAccessUserData, exportMcpAccessUserData, mcpAccessPrivacyContr
|
|
|
18
18
|
export { ACCESS_TOKEN_PREFIX, hashAccessToken, isAccessTokenShape, issueAccessToken, listAccessTokens, pruneAccessTokens, findTokenClientName, revokeAccessToken, verifyAccessToken, type IssueAccessTokenInput, type IssueAccessTokenResult, type IssuedAccessToken, type McpAccessContext, type RevokeAccessTokenInput, type VerifiedAccessToken, } from "./tokens.js";
|
|
19
19
|
export { API_RATE_LIMIT_BUCKET, API_TOKEN_RATE_LIMIT_BUCKET, apiTokenErrorResponse, getApiTokenOptions, isApiTokenShape, issueApiToken, requireApiToken, verifyApiToken, type IssueApiTokenInput, type IssueApiTokenResult, type IssuedApiToken, type RequireApiTokenOptions, type VerifiedApiToken, } from "./api-tokens.js";
|
|
20
20
|
export { createMcpServerFactory, type McpServerFactoryOptions } from "./server-factory.js";
|
|
21
|
-
export { registerServerInfoTool, SERVER_INFO_TOOL_NAME, type McpBuildInfo, type RegisterServerInfoToolOptions, type ServedServerInfo, type ServerInfoAnswer, type ServerInfoToolOptions, } from "./server-info.js";
|
|
21
|
+
export { registerServerInfoTool, SERVER_INFO_TOOL_NAME, type McpBuildInfo, type RegisterServerInfoToolOptions, type ServedServerInfo, type ServerInfoAnswer, type ServerInfoToolsAnswer, type ServedToolContract, type ServerInfoToolOptions, } from "./server-info.js";
|
|
22
22
|
export { toStrictToolInput, withStrictToolInput, type RenamedFields, type StrictToolInputMessages, type StrictToolInputOptions } from "./strict-input.js";
|
|
23
23
|
export { DEFAULT_TOOL_LIST_RELEASE, describeToolList, fingerprintToolList, listServedTools, measureToolList, type MeasureToolListOptions, type RegisterTools, type ServedTool, type ToolListMeasurement, } from "./tool-list.js";
|
|
24
24
|
export { createToolListSessionId, isToolListSessionCurrent, MCP_SESSION_ID_HEADER, readToolListSessionVersion, } from "./tool-list-session.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,GAC/B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1G,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,gCAAgC,EAChC,8BAA8B,EAC9B,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,GAC7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,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kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,6BAA6B,EAClC,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,KAAK,uBAAuB,EAAE,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC1J,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACvH,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,YAAY,CAAC"}
|
package/dist/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,+FAA+F;AAC/F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B,EAAE,iBAAiB,EAAwB,MAAM,cAAc,CAAC;AACtI,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAA+B,MAAM,YAAY,CAAC;AAC9F,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,GAE5B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,GAOlB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,GAMf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAgC,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GAQtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAiF,MAAM,mBAAmB,CAAC;AAC1J,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,eAAe,GAKhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAA+E,MAAM,0BAA0B,CAAC;AACvH,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,GAOf,MAAM,YAAY,CAAC"}
|
|
@@ -22,7 +22,8 @@ export interface McpServerFactoryOptions {
|
|
|
22
22
|
readonly strictToolInput?: boolean | StrictToolInputOptions;
|
|
23
23
|
/**
|
|
24
24
|
* Adds the read-only `get_server_info` tool for every access level: the build info (pass `readBuildInfo` of
|
|
25
|
-
* `@softure-ai/ops/server`) with the served name and version. Off by default.
|
|
25
|
+
* `@softure-ai/ops/server`) with the served name and version. Off by default. With `tools: true` it also answers the
|
|
26
|
+
* served tool contract of the caller's access level, taken from the measured list (#1078).
|
|
26
27
|
*/
|
|
27
28
|
readonly serverInfoTool?: ServerInfoToolOptions;
|
|
28
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-factory.d.ts","sourceRoot":"","sources":["../../src/server/server-factory.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAuB,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAA0B,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGtF,MAAM,WAAW,uBAAuB;IACtC,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,gEAAgE;IAChE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,CAAC,EAAE,gBAAgB,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,KAAK,OAAO,CAAC;IACpF,yGAAyG;IACzG,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,sBAAsB,CAAC;IAC5D
|
|
1
|
+
{"version":3,"file":"server-factory.d.ts","sourceRoot":"","sources":["../../src/server/server-factory.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAuB,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAA0B,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGtF,MAAM,WAAW,uBAAuB;IACtC,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,gEAAgE;IAChE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,CAAC,EAAE,gBAAgB,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,KAAK,OAAO,CAAC;IACpF,yGAAyG;IACzG,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,sBAAsB,CAAC;IAC5D;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,qBAAqB,CAAC;CACjD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,yBAAyB,CA4ClG"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
12
12
|
import { withStrictToolInput } from "./strict-input.js";
|
|
13
13
|
import { registerServerInfoTool } from "./server-info.js";
|
|
14
|
-
import {
|
|
14
|
+
import { describeToolList, listRecordedTools } from "./tool-list.js";
|
|
15
15
|
/**
|
|
16
16
|
* An `McpServerFactory` whose servers carry the tool list's version for the identity's access level. Its
|
|
17
17
|
* `toolListVersion(identity)` reads that version without building a server, so `createMcpEndpoint` ties each session
|
|
@@ -19,13 +19,18 @@ import { measureToolList } from "./tool-list.js";
|
|
|
19
19
|
*/
|
|
20
20
|
export function createMcpServerFactory(options) {
|
|
21
21
|
const strictOptions = options.strictToolInput === true ? {} : options.strictToolInput === false ? undefined : options.strictToolInput;
|
|
22
|
-
// The served version
|
|
23
|
-
// its handler never runs there and
|
|
24
|
-
const registerTools = async (server, identity,
|
|
22
|
+
// The served version and the measured tools reach `get_server_info` here; the recording server registers it with a
|
|
23
|
+
// placeholder version and no tools, since its handler never runs there and neither is part of the listed tool.
|
|
24
|
+
const registerTools = async (server, identity, served) => {
|
|
25
25
|
const target = strictOptions === undefined ? server : withStrictToolInput(server, strictOptions);
|
|
26
26
|
await options.registerTools(target, identity);
|
|
27
|
-
if (options.serverInfoTool !== undefined)
|
|
28
|
-
registerServerInfoTool(target, {
|
|
27
|
+
if (options.serverInfoTool !== undefined) {
|
|
28
|
+
registerServerInfoTool(target, {
|
|
29
|
+
...options.serverInfoTool,
|
|
30
|
+
server: { name: options.name, version: served?.version ?? "" },
|
|
31
|
+
servedTools: async () => (served === undefined ? [] : (await served.measure()).tools),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
29
34
|
};
|
|
30
35
|
const measurements = new Map();
|
|
31
36
|
// The promise is cached, so parallel first requests measure once; a failed measurement is dropped so
|
|
@@ -34,11 +39,12 @@ export function createMcpServerFactory(options) {
|
|
|
34
39
|
const cached = measurements.get(identity.canWrite);
|
|
35
40
|
if (cached !== undefined)
|
|
36
41
|
return cached;
|
|
37
|
-
const
|
|
38
|
-
|
|
42
|
+
const release = options.release;
|
|
43
|
+
const measurement = listRecordedTools((server) => registerTools(server, identity), {
|
|
44
|
+
...(release === undefined ? {} : { release }),
|
|
39
45
|
name: options.name,
|
|
40
46
|
...(options.serverOptions === undefined ? {} : { serverOptions: options.serverOptions }),
|
|
41
|
-
});
|
|
47
|
+
}).then((tools) => ({ ...describeToolList(tools, release), tools }));
|
|
42
48
|
measurements.set(identity.canWrite, measurement);
|
|
43
49
|
void measurement.catch(() => measurements.delete(identity.canWrite));
|
|
44
50
|
return measurement;
|
|
@@ -47,7 +53,7 @@ export function createMcpServerFactory(options) {
|
|
|
47
53
|
const factory = async (identity) => {
|
|
48
54
|
const version = await toolListVersion(identity);
|
|
49
55
|
const server = new McpServer({ name: options.name, version, ...(options.title === undefined ? {} : { title: options.title }) }, options.serverOptions);
|
|
50
|
-
await registerTools(server, identity, version);
|
|
56
|
+
await registerTools(server, identity, { version, measure: () => measure(identity) });
|
|
51
57
|
return server;
|
|
52
58
|
};
|
|
53
59
|
return Object.assign(factory, { toolListVersion });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-factory.js","sourceRoot":"","sources":["../../src/server/server-factory.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,kGAAkG;AAClG,mGAAmG;AACnG,qGAAqG;AACrG,6CAA6C;AAC7C,EAAE;AACF,yDAAyD;AACzD,oBAAoB;AACpB,gFAAgF;AAChF,QAAQ;AACR,OAAO,EAAE,SAAS,EAAyB,MAAM,8BAA8B,CAAC;AAGhF,OAAO,EAAE,mBAAmB,EAA+B,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAA8B,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"server-factory.js","sourceRoot":"","sources":["../../src/server/server-factory.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,kGAAkG;AAClG,mGAAmG;AACnG,qGAAqG;AACrG,6CAA6C;AAC7C,EAAE;AACF,yDAAyD;AACzD,oBAAoB;AACpB,gFAAgF;AAChF,QAAQ;AACR,OAAO,EAAE,SAAS,EAAyB,MAAM,8BAA8B,CAAC;AAGhF,OAAO,EAAE,mBAAmB,EAA+B,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAA8B,MAAM,kBAAkB,CAAC;AACtF,OAAO,EA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IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,EACjG,OAAO,CAAC,aAAa,CACtB,CAAC;QACF,MAAM,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACrF,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,eAAe,EAAE,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { McpServer } from "@modelcontextprotocol/server";
|
|
2
|
+
import type { ServedTool } from "./tool-list.js";
|
|
2
3
|
export declare const SERVER_INFO_TOOL_NAME = "get_server_info";
|
|
3
4
|
/** The build info of `@softure-ai/ops` (`readBuildInfo()`), typed by shape so mcp-access does not import ops. */
|
|
4
5
|
export interface McpBuildInfo {
|
|
@@ -12,9 +13,20 @@ export interface ServerInfoToolOptions {
|
|
|
12
13
|
readonly buildInfo: () => McpBuildInfo | Promise<McpBuildInfo>;
|
|
13
14
|
/** The changelog the build info route answers, when the app passes one there. Only what is public. */
|
|
14
15
|
readonly changelog?: () => unknown;
|
|
16
|
+
/**
|
|
17
|
+
* Also answers the served tool contract (`tools`), with an optional `name` input that narrows it to one tool. Turning
|
|
18
|
+
* it on changes the tool's input schema, so the version changes once. Default: off.
|
|
19
|
+
*/
|
|
20
|
+
readonly tools?: boolean;
|
|
15
21
|
/** Default: `serverInfoTool.description` of the module dictionary. */
|
|
16
22
|
readonly description?: string;
|
|
17
23
|
}
|
|
24
|
+
/** One served tool's contract, exactly as `tools/list` answers it. */
|
|
25
|
+
export interface ServedToolContract {
|
|
26
|
+
readonly name: string;
|
|
27
|
+
readonly description?: unknown;
|
|
28
|
+
readonly inputSchema: unknown;
|
|
29
|
+
}
|
|
18
30
|
/** What `initialize` answers as `serverInfo`. */
|
|
19
31
|
export interface ServedServerInfo {
|
|
20
32
|
readonly name: string;
|
|
@@ -23,12 +35,28 @@ export interface ServedServerInfo {
|
|
|
23
35
|
export interface RegisterServerInfoToolOptions extends ServerInfoToolOptions {
|
|
24
36
|
/** The name and version the server answers at `initialize`; `createMcpServerFactory` passes them in. */
|
|
25
37
|
readonly server: ServedServerInfo;
|
|
38
|
+
/**
|
|
39
|
+
* The tools the caller's `tools/list` answers, read when `tools` is on. `createMcpServerFactory` passes its measured
|
|
40
|
+
* list; a hand-built server passes `() => listServedTools(createServer)` for the caller's access level.
|
|
41
|
+
*/
|
|
42
|
+
readonly servedTools?: () => readonly ServedTool[] | Promise<readonly ServedTool[]>;
|
|
43
|
+
}
|
|
44
|
+
/** The contract part of the answer, with `tools` on. */
|
|
45
|
+
export interface ServerInfoToolsAnswer {
|
|
46
|
+
/** Tells the model that the server's contract wins over its own copy. */
|
|
47
|
+
readonly toolsHint: string;
|
|
48
|
+
readonly tools: readonly ServedToolContract[];
|
|
49
|
+
/** Every served tool's name, when `name` matched none. */
|
|
50
|
+
readonly toolNames?: readonly string[];
|
|
26
51
|
}
|
|
27
52
|
/** The tool's answer: the served name and version, the build info and, with a provider, the changelog. */
|
|
28
53
|
export type ServerInfoAnswer = McpBuildInfo & {
|
|
29
54
|
readonly server: ServedServerInfo;
|
|
30
55
|
readonly changelog?: unknown;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
56
|
+
} & Partial<ServerInfoToolsAnswer>;
|
|
57
|
+
/**
|
|
58
|
+
* Registers `get_server_info`, read only: no input fields, or an optional `name` with `tools` on. A failing `buildInfo`
|
|
59
|
+
* reaches the SDK, which answers a tool error.
|
|
60
|
+
*/
|
|
33
61
|
export declare function registerServerInfoTool(server: McpServer, options: RegisterServerInfoToolOptions): void;
|
|
34
62
|
//# sourceMappingURL=server-info.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-info.d.ts","sourceRoot":"","sources":["../../src/server/server-info.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server-info.d.ts","sourceRoot":"","sources":["../../src/server/server-info.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAI9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,iHAAiH;AACjH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,2GAA2G;IAC3G,QAAQ,CAAC,SAAS,EAAE,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/D,sGAAsG;IACtG,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,sEAAsE;AACtE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,6BAA8B,SAAQ,qBAAqB;IAC1E,wGAAwG;IACxG,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,SAAS,UAAU,EAAE,GAAG,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAAC;CACrF;AAED,wDAAwD;AACxD,MAAM,WAAW,qBAAqB;IACpC,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC9C,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED,0GAA0G;AAC1G,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEnJ;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,6BAA6B,GAAG,IAAI,CAoBtG"}
|
|
@@ -3,20 +3,42 @@ import { z } from "zod";
|
|
|
3
3
|
import { en } from "../messages/en.js";
|
|
4
4
|
import { toolResult } from "./tools.js";
|
|
5
5
|
export const SERVER_INFO_TOOL_NAME = "get_server_info";
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Registers `get_server_info`, read only: no input fields, or an optional `name` with `tools` on. A failing `buildInfo`
|
|
8
|
+
* reaches the SDK, which answers a tool error.
|
|
9
|
+
*/
|
|
7
10
|
export function registerServerInfoTool(server, options) {
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
const annotations = { readOnlyHint: true, idempotentHint: true, openWorldHint: false };
|
|
12
|
+
const description = options.description ?? (options.tools === true ? en.serverInfoTool.descriptionWithTools : en.serverInfoTool.description);
|
|
13
|
+
if (options.tools !== true) {
|
|
10
14
|
// An empty object rather than no schema, so strict input refuses a field sent to it.
|
|
11
|
-
inputSchema: z.object({}),
|
|
12
|
-
|
|
13
|
-
}
|
|
15
|
+
server.registerTool(SERVER_INFO_TOOL_NAME, { description, inputSchema: z.object({}), annotations }, async () => toolResult(await readServerInfo(options)));
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const readServedTools = options.servedTools;
|
|
19
|
+
if (readServedTools === undefined) {
|
|
20
|
+
throw new Error("@softure-ai/mcp-access: get_server_info with tools: true needs servedTools, e.g. () => listServedTools(createServer)");
|
|
21
|
+
}
|
|
22
|
+
server.registerTool(SERVER_INFO_TOOL_NAME, { description, inputSchema: z.object({ name: z.string().optional().describe(en.serverInfoTool.nameInputDescription) }), annotations }, async ({ name }) => {
|
|
23
|
+
const answer = await readServerInfo(options);
|
|
24
|
+
return toolResult({ ...answer, ...describeToolContract(await readServedTools(), name) });
|
|
25
|
+
});
|
|
14
26
|
}
|
|
15
27
|
async function readServerInfo(options) {
|
|
16
28
|
const { release, commit, builtAt, startedAt } = await options.buildInfo();
|
|
17
29
|
const answer = { server: { name: options.server.name, version: options.server.version }, release, commit, builtAt, startedAt };
|
|
18
30
|
return options.changelog === undefined ? answer : { ...answer, changelog: await readChangelog(options.changelog) };
|
|
19
31
|
}
|
|
32
|
+
/** The contract of every served tool, or of the one named; an unknown name answers no tool and every name. */
|
|
33
|
+
function describeToolContract(served, name) {
|
|
34
|
+
const tools = served.map((tool) => ({ name: tool.name, description: tool.description, inputSchema: tool.inputSchema }));
|
|
35
|
+
if (name === undefined)
|
|
36
|
+
return { toolsHint: en.serverInfoTool.toolsHint, tools };
|
|
37
|
+
const named = tools.filter((tool) => tool.name === name);
|
|
38
|
+
if (named.length > 0)
|
|
39
|
+
return { toolsHint: en.serverInfoTool.toolsHint, tools: named };
|
|
40
|
+
return { toolsHint: en.serverInfoTool.unknownToolHint, tools: [], toolNames: tools.map((tool) => tool.name).sort() };
|
|
41
|
+
}
|
|
20
42
|
/** As the build info route: a failing provider answers `null` and logs the error class, so the build info still answers. */
|
|
21
43
|
async function readChangelog(provider) {
|
|
22
44
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-info.js","sourceRoot":"","sources":["../../src/server/server-info.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server-info.js","sourceRoot":"","sources":["../../src/server/server-info.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AA2DvD;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAiB,EAAE,OAAsC;IAC9F,MAAM,WAAW,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IACvF,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAC7I,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QAC3B,qFAAqF;QACrF,MAAM,CAAC,YAAY,CAAC,qBAAqB,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,KAAK,IAAI,EAAE,CAAC,UAA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|
|
@@ -26,6 +26,8 @@ export interface MeasureToolListOptions {
|
|
|
26
26
|
* description, annotations or input or output schema changes the version; the order of registration does not.
|
|
27
27
|
*/
|
|
28
28
|
export declare function measureToolList(registerTools: RegisterTools, options?: MeasureToolListOptions): Promise<ToolListMeasurement>;
|
|
29
|
+
/** The tools as `tools/list` answers them, registered on a recording server shaped like the served one. */
|
|
30
|
+
export declare function listRecordedTools(registerTools: RegisterTools, options?: MeasureToolListOptions): Promise<ServedTool[]>;
|
|
29
31
|
/** The version and count for a listed tool set. */
|
|
30
32
|
export declare function describeToolList(tools: readonly ServedTool[], release?: string): ToolListMeasurement;
|
|
31
33
|
/** The first 12 hex digits of a sha256 over the tools in name order, each as canonical JSON (keys sorted at every level). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-list.d.ts","sourceRoot":"","sources":["../../src/server/tool-list.ts"],"names":[],"mappings":"AAMA,OAAO,EAAoB,SAAS,EAAoB,KAAK,gBAAgB,EAAE,KAAK,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEjI,2CAA2C;AAC3C,eAAO,MAAM,yBAAyB,UAAU,CAAC;AAMjD,0EAA0E;AAC1E,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvF,MAAM,WAAW,mBAAmB;IAClC,4DAA4D;IAC5D,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,mHAAmH;AACnH,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,OAAO,CAAC;AAE3D,MAAM,WAAW,sBAAsB;IACrC,kEAAkE;IAClE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,iGAAiG;IACjG,QAAQ,CAAC,IAAI,C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EAAE,aAAa,EAAE,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAIjI;AAED,mDAAmD;AACnD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,EAAE,OAAO,GAAE,MAAkC,GAAG,mBAAmB,CAG/H;AAED,6HAA6H;AAC7H,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,CAGxE;AAED,wJAAwJ;AACxJ,wBAAsB,eAAe,CAAC,YAAY,EAAE,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAgBjI"}
|
package/dist/server/tool-list.js
CHANGED
|
@@ -18,9 +18,13 @@ const RELEASE_PATTERN = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
|
18
18
|
export async function measureToolList(registerTools, options = {}) {
|
|
19
19
|
const release = options.release ?? DEFAULT_TOOL_LIST_RELEASE;
|
|
20
20
|
assertRelease(release);
|
|
21
|
-
|
|
21
|
+
return describeToolList(await listRecordedTools(registerTools, options), release);
|
|
22
|
+
}
|
|
23
|
+
/** The tools as `tools/list` answers them, registered on a recording server shaped like the served one. */
|
|
24
|
+
export async function listRecordedTools(registerTools, options = {}) {
|
|
25
|
+
const server = new McpServer({ name: options.name ?? "tool-list", version: options.release ?? DEFAULT_TOOL_LIST_RELEASE }, options.serverOptions);
|
|
22
26
|
await registerTools(server);
|
|
23
|
-
return
|
|
27
|
+
return listServedTools(() => server);
|
|
24
28
|
}
|
|
25
29
|
/** The version and count for a listed tool set. */
|
|
26
30
|
export function describeToolList(tools, release = DEFAULT_TOOL_LIST_RELEASE) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-list.js","sourceRoot":"","sources":["../../src/server/tool-list.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,q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,IAAI,KAAK,CAAC,iFAAiF,OAAO,GAAG,CAAC,CAAC;IAC/G,CAAC;AACH,CAAC"}
|
package/module.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "mcp-access",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"dependsOn": { "security": "^0.2.0", "auth": "^0.2.0", "jobs": "^0.1.1?", "ops": "^0.2.0?" },
|
|
5
5
|
"dbSchema": "mcp",
|
|
6
6
|
"tables": ["access_tokens", "oauth_clients", "oauth_authorization_codes", "oauth_grants", "oauth_registration_window", "used_confirmations", "operation_tasks"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softure-ai/mcp-access",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "SOFTURE AI MCP access module: hashed, scoped, expiring access tokens, a rate-limited Bearer endpoint around the app's MCP server factory, and a token page with client setup instructions for Next.js; tool result helpers with a safe error boundary, a stdio entry, a catalog parity check and the softure-mcp prune command.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/index.ts
CHANGED
|
@@ -51,7 +51,7 @@ export const API_TOKEN_RATE_LIMIT_BUCKETS = {
|
|
|
51
51
|
export const mcpAccess = defineModule({
|
|
52
52
|
manifest: {
|
|
53
53
|
id: MODULE_ID,
|
|
54
|
-
version: "0.
|
|
54
|
+
version: "0.7.0",
|
|
55
55
|
dependsOn: { security: "^0.2.0", auth: "^0.2.0", jobs: "^0.1.1?", ops: "^0.2.0?" },
|
|
56
56
|
dbSchema: "mcp",
|
|
57
57
|
tables: ["access_tokens", "oauth_clients", "oauth_authorization_codes", "oauth_grants", "oauth_registration_window", "used_confirmations", "operation_tasks"],
|
package/src/messages/en.ts
CHANGED
|
@@ -129,6 +129,12 @@ export const en = {
|
|
|
129
129
|
serverInfoTool: {
|
|
130
130
|
description:
|
|
131
131
|
"Tells which build of this server answers: its name and version (the version changes whenever a tool changes), the release, the commit, when it was built and started, and the changelog when the app publishes one. Use it to check that a change is live.",
|
|
132
|
+
descriptionWithTools:
|
|
133
|
+
"Tells which build of this server answers (its name and version, the release, the commit, when it was built and started, the changelog when the app publishes one) and the current description and input schema of every tool it serves you. Use it to check that a change is live, and read a tool's contract here when a call is refused or your copy may be out of date.",
|
|
134
|
+
nameInputDescription: "Optional: one tool's name, to answer only that tool's current description and input schema.",
|
|
135
|
+
toolsHint:
|
|
136
|
+
"If your copy of a tool's schema or description differs from `tools` here, the server's is current: build calls from it.",
|
|
137
|
+
unknownToolHint: "No served tool has that name; `toolNames` lists every tool this server serves to you.",
|
|
132
138
|
},
|
|
133
139
|
operations: {
|
|
134
140
|
statusToolDescription:
|
package/src/server/index.ts
CHANGED
|
@@ -143,6 +143,8 @@ export {
|
|
|
143
143
|
type RegisterServerInfoToolOptions,
|
|
144
144
|
type ServedServerInfo,
|
|
145
145
|
type ServerInfoAnswer,
|
|
146
|
+
type ServerInfoToolsAnswer,
|
|
147
|
+
type ServedToolContract,
|
|
146
148
|
type ServerInfoToolOptions,
|
|
147
149
|
} from "./server-info.js";
|
|
148
150
|
export { toStrictToolInput, withStrictToolInput, type RenamedFields, type StrictToolInputMessages, type StrictToolInputOptions } from "./strict-input.js";
|
|
@@ -13,7 +13,7 @@ import type { McpServerIdentity } from "../contract.js";
|
|
|
13
13
|
import type { VersionedMcpServerFactory } from "./endpoint.js";
|
|
14
14
|
import { withStrictToolInput, type StrictToolInputOptions } from "./strict-input.js";
|
|
15
15
|
import { registerServerInfoTool, type ServerInfoToolOptions } from "./server-info.js";
|
|
16
|
-
import {
|
|
16
|
+
import { describeToolList, listRecordedTools, type ServedTool, type ToolListMeasurement } from "./tool-list.js";
|
|
17
17
|
|
|
18
18
|
export interface McpServerFactoryOptions {
|
|
19
19
|
/** `serverInfo.name`. */
|
|
@@ -34,7 +34,8 @@ export interface McpServerFactoryOptions {
|
|
|
34
34
|
readonly strictToolInput?: boolean | StrictToolInputOptions;
|
|
35
35
|
/**
|
|
36
36
|
* Adds the read-only `get_server_info` tool for every access level: the build info (pass `readBuildInfo` of
|
|
37
|
-
* `@softure-ai/ops/server`) with the served name and version. Off by default.
|
|
37
|
+
* `@softure-ai/ops/server`) with the served name and version. Off by default. With `tools: true` it also answers the
|
|
38
|
+
* served tool contract of the caller's access level, taken from the measured list (#1078).
|
|
38
39
|
*/
|
|
39
40
|
readonly serverInfoTool?: ServerInfoToolOptions;
|
|
40
41
|
}
|
|
@@ -46,25 +47,32 @@ export interface McpServerFactoryOptions {
|
|
|
46
47
|
*/
|
|
47
48
|
export function createMcpServerFactory(options: McpServerFactoryOptions): VersionedMcpServerFactory {
|
|
48
49
|
const strictOptions = options.strictToolInput === true ? {} : options.strictToolInput === false ? undefined : options.strictToolInput;
|
|
49
|
-
// The served version
|
|
50
|
-
// its handler never runs there and
|
|
51
|
-
const registerTools = async (server: McpServer, identity: McpServerIdentity,
|
|
50
|
+
// The served version and the measured tools reach `get_server_info` here; the recording server registers it with a
|
|
51
|
+
// placeholder version and no tools, since its handler never runs there and neither is part of the listed tool.
|
|
52
|
+
const registerTools = async (server: McpServer, identity: McpServerIdentity, served?: ServedToolList): Promise<void> => {
|
|
52
53
|
const target = strictOptions === undefined ? server : withStrictToolInput(server, strictOptions);
|
|
53
54
|
await options.registerTools(target, identity);
|
|
54
|
-
if (options.serverInfoTool !== undefined)
|
|
55
|
+
if (options.serverInfoTool !== undefined) {
|
|
56
|
+
registerServerInfoTool(target, {
|
|
57
|
+
...options.serverInfoTool,
|
|
58
|
+
server: { name: options.name, version: served?.version ?? "" },
|
|
59
|
+
servedTools: async () => (served === undefined ? [] : (await served.measure()).tools),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
55
62
|
};
|
|
56
|
-
const measurements = new Map<boolean, Promise<
|
|
63
|
+
const measurements = new Map<boolean, Promise<MeasuredToolList>>();
|
|
57
64
|
|
|
58
65
|
// The promise is cached, so parallel first requests measure once; a failed measurement is dropped so
|
|
59
66
|
// the next request tries again instead of failing for good.
|
|
60
|
-
const measure = (identity: McpServerIdentity): Promise<
|
|
67
|
+
const measure = (identity: McpServerIdentity): Promise<MeasuredToolList> => {
|
|
61
68
|
const cached = measurements.get(identity.canWrite);
|
|
62
69
|
if (cached !== undefined) return cached;
|
|
63
|
-
const
|
|
64
|
-
|
|
70
|
+
const release = options.release;
|
|
71
|
+
const measurement = listRecordedTools((server) => registerTools(server, identity), {
|
|
72
|
+
...(release === undefined ? {} : { release }),
|
|
65
73
|
name: options.name,
|
|
66
74
|
...(options.serverOptions === undefined ? {} : { serverOptions: options.serverOptions }),
|
|
67
|
-
});
|
|
75
|
+
}).then((tools) => ({ ...describeToolList(tools, release), tools }));
|
|
68
76
|
measurements.set(identity.canWrite, measurement);
|
|
69
77
|
void measurement.catch(() => measurements.delete(identity.canWrite));
|
|
70
78
|
return measurement;
|
|
@@ -77,8 +85,20 @@ export function createMcpServerFactory(options: McpServerFactoryOptions): Versio
|
|
|
77
85
|
{ name: options.name, version, ...(options.title === undefined ? {} : { title: options.title }) },
|
|
78
86
|
options.serverOptions,
|
|
79
87
|
);
|
|
80
|
-
await registerTools(server, identity, version);
|
|
88
|
+
await registerTools(server, identity, { version, measure: () => measure(identity) });
|
|
81
89
|
return server;
|
|
82
90
|
};
|
|
83
91
|
return Object.assign(factory, { toolListVersion });
|
|
84
92
|
}
|
|
93
|
+
|
|
94
|
+
/** The measured version with the tools it was computed from, as `tools/list` answers them. */
|
|
95
|
+
interface MeasuredToolList extends ToolListMeasurement {
|
|
96
|
+
readonly tools: readonly ServedTool[];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** What a served server's `get_server_info` reads: its version and its access level's measurement. */
|
|
100
|
+
interface ServedToolList {
|
|
101
|
+
readonly version: string;
|
|
102
|
+
/** Read only when the tool answers the contract, so a fixed version still measures nothing otherwise. */
|
|
103
|
+
readonly measure: () => Promise<MeasuredToolList>;
|
|
104
|
+
}
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
// public facts of the ops build info route (release, commit, build and start times, the optional changelog) and the
|
|
3
3
|
// name and version the server answered at `initialize`, which follows the tool list. It reads no user data.
|
|
4
4
|
//
|
|
5
|
+
// With `tools: true` (#1078) it also answers the served tool contract: each tool's name, description and input schema
|
|
6
|
+
// as `tools/list` answers them for the caller's access level. A hosted client may keep a stale tool list for good, but
|
|
7
|
+
// it never caches a tool result, so the model can always read the current contract in-band.
|
|
8
|
+
//
|
|
5
9
|
// The app passes the build info reader, so `/server` never loads `@softure-ai/ops` (an optional peer):
|
|
6
10
|
//
|
|
7
11
|
// import { readBuildInfo } from "@softure-ai/ops/server";
|
|
@@ -10,6 +14,7 @@ import type { McpServer } from "@modelcontextprotocol/server";
|
|
|
10
14
|
import { errorLogLabel } from "@softure-ai/core";
|
|
11
15
|
import { z } from "zod";
|
|
12
16
|
import { en } from "../messages/en.js";
|
|
17
|
+
import type { ServedTool } from "./tool-list.js";
|
|
13
18
|
import { toolResult } from "./tools.js";
|
|
14
19
|
|
|
15
20
|
export const SERVER_INFO_TOOL_NAME = "get_server_info";
|
|
@@ -27,10 +32,22 @@ export interface ServerInfoToolOptions {
|
|
|
27
32
|
readonly buildInfo: () => McpBuildInfo | Promise<McpBuildInfo>;
|
|
28
33
|
/** The changelog the build info route answers, when the app passes one there. Only what is public. */
|
|
29
34
|
readonly changelog?: () => unknown;
|
|
35
|
+
/**
|
|
36
|
+
* Also answers the served tool contract (`tools`), with an optional `name` input that narrows it to one tool. Turning
|
|
37
|
+
* it on changes the tool's input schema, so the version changes once. Default: off.
|
|
38
|
+
*/
|
|
39
|
+
readonly tools?: boolean;
|
|
30
40
|
/** Default: `serverInfoTool.description` of the module dictionary. */
|
|
31
41
|
readonly description?: string;
|
|
32
42
|
}
|
|
33
43
|
|
|
44
|
+
/** One served tool's contract, exactly as `tools/list` answers it. */
|
|
45
|
+
export interface ServedToolContract {
|
|
46
|
+
readonly name: string;
|
|
47
|
+
readonly description?: unknown;
|
|
48
|
+
readonly inputSchema: unknown;
|
|
49
|
+
}
|
|
50
|
+
|
|
34
51
|
/** What `initialize` answers as `serverInfo`. */
|
|
35
52
|
export interface ServedServerInfo {
|
|
36
53
|
readonly name: string;
|
|
@@ -40,22 +57,48 @@ export interface ServedServerInfo {
|
|
|
40
57
|
export interface RegisterServerInfoToolOptions extends ServerInfoToolOptions {
|
|
41
58
|
/** The name and version the server answers at `initialize`; `createMcpServerFactory` passes them in. */
|
|
42
59
|
readonly server: ServedServerInfo;
|
|
60
|
+
/**
|
|
61
|
+
* The tools the caller's `tools/list` answers, read when `tools` is on. `createMcpServerFactory` passes its measured
|
|
62
|
+
* list; a hand-built server passes `() => listServedTools(createServer)` for the caller's access level.
|
|
63
|
+
*/
|
|
64
|
+
readonly servedTools?: () => readonly ServedTool[] | Promise<readonly ServedTool[]>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The contract part of the answer, with `tools` on. */
|
|
68
|
+
export interface ServerInfoToolsAnswer {
|
|
69
|
+
/** Tells the model that the server's contract wins over its own copy. */
|
|
70
|
+
readonly toolsHint: string;
|
|
71
|
+
readonly tools: readonly ServedToolContract[];
|
|
72
|
+
/** Every served tool's name, when `name` matched none. */
|
|
73
|
+
readonly toolNames?: readonly string[];
|
|
43
74
|
}
|
|
44
75
|
|
|
45
76
|
/** The tool's answer: the served name and version, the build info and, with a provider, the changelog. */
|
|
46
|
-
export type ServerInfoAnswer = McpBuildInfo & { readonly server: ServedServerInfo; readonly changelog?: unknown }
|
|
77
|
+
export type ServerInfoAnswer = McpBuildInfo & { readonly server: ServedServerInfo; readonly changelog?: unknown } & Partial<ServerInfoToolsAnswer>;
|
|
47
78
|
|
|
48
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Registers `get_server_info`, read only: no input fields, or an optional `name` with `tools` on. A failing `buildInfo`
|
|
81
|
+
* reaches the SDK, which answers a tool error.
|
|
82
|
+
*/
|
|
49
83
|
export function registerServerInfoTool(server: McpServer, options: RegisterServerInfoToolOptions): void {
|
|
84
|
+
const annotations = { readOnlyHint: true, idempotentHint: true, openWorldHint: false };
|
|
85
|
+
const description = options.description ?? (options.tools === true ? en.serverInfoTool.descriptionWithTools : en.serverInfoTool.description);
|
|
86
|
+
if (options.tools !== true) {
|
|
87
|
+
// An empty object rather than no schema, so strict input refuses a field sent to it.
|
|
88
|
+
server.registerTool(SERVER_INFO_TOOL_NAME, { description, inputSchema: z.object({}), annotations }, async () => toolResult(await readServerInfo(options)));
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const readServedTools = options.servedTools;
|
|
92
|
+
if (readServedTools === undefined) {
|
|
93
|
+
throw new Error("@softure-ai/mcp-access: get_server_info with tools: true needs servedTools, e.g. () => listServedTools(createServer)");
|
|
94
|
+
}
|
|
50
95
|
server.registerTool(
|
|
51
96
|
SERVER_INFO_TOOL_NAME,
|
|
52
|
-
{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
|
|
97
|
+
{ description, inputSchema: z.object({ name: z.string().optional().describe(en.serverInfoTool.nameInputDescription) }), annotations },
|
|
98
|
+
async ({ name }) => {
|
|
99
|
+
const answer = await readServerInfo(options);
|
|
100
|
+
return toolResult({ ...answer, ...describeToolContract(await readServedTools(), name) });
|
|
57
101
|
},
|
|
58
|
-
async () => toolResult(await readServerInfo(options)),
|
|
59
102
|
);
|
|
60
103
|
}
|
|
61
104
|
|
|
@@ -65,6 +108,15 @@ async function readServerInfo(options: RegisterServerInfoToolOptions): Promise<S
|
|
|
65
108
|
return options.changelog === undefined ? answer : { ...answer, changelog: await readChangelog(options.changelog) };
|
|
66
109
|
}
|
|
67
110
|
|
|
111
|
+
/** The contract of every served tool, or of the one named; an unknown name answers no tool and every name. */
|
|
112
|
+
function describeToolContract(served: readonly ServedTool[], name: string | undefined): ServerInfoToolsAnswer {
|
|
113
|
+
const tools = served.map((tool): ServedToolContract => ({ name: tool.name, description: tool.description, inputSchema: tool.inputSchema }));
|
|
114
|
+
if (name === undefined) return { toolsHint: en.serverInfoTool.toolsHint, tools };
|
|
115
|
+
const named = tools.filter((tool) => tool.name === name);
|
|
116
|
+
if (named.length > 0) return { toolsHint: en.serverInfoTool.toolsHint, tools: named };
|
|
117
|
+
return { toolsHint: en.serverInfoTool.unknownToolHint, tools: [], toolNames: tools.map((tool) => tool.name).sort() };
|
|
118
|
+
}
|
|
119
|
+
|
|
68
120
|
/** As the build info route: a failing provider answers `null` and logs the error class, so the build info still answers. */
|
|
69
121
|
async function readChangelog(provider: () => unknown): Promise<unknown> {
|
|
70
122
|
try {
|
package/src/server/tool-list.ts
CHANGED
|
@@ -42,9 +42,14 @@ export interface MeasureToolListOptions {
|
|
|
42
42
|
export async function measureToolList(registerTools: RegisterTools, options: MeasureToolListOptions = {}): Promise<ToolListMeasurement> {
|
|
43
43
|
const release = options.release ?? DEFAULT_TOOL_LIST_RELEASE;
|
|
44
44
|
assertRelease(release);
|
|
45
|
-
|
|
45
|
+
return describeToolList(await listRecordedTools(registerTools, options), release);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The tools as `tools/list` answers them, registered on a recording server shaped like the served one. */
|
|
49
|
+
export async function listRecordedTools(registerTools: RegisterTools, options: MeasureToolListOptions = {}): Promise<ServedTool[]> {
|
|
50
|
+
const server = new McpServer({ name: options.name ?? "tool-list", version: options.release ?? DEFAULT_TOOL_LIST_RELEASE }, options.serverOptions);
|
|
46
51
|
await registerTools(server);
|
|
47
|
-
return
|
|
52
|
+
return listServedTools(() => server);
|
|
48
53
|
}
|
|
49
54
|
|
|
50
55
|
/** The version and count for a listed tool set. */
|