@zuplo/cli 7.9.4 → 7.9.6
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/node_modules/@modelcontextprotocol/client/dist/{index-D_CiY-T3.d.cts → index-B-4n9P0J.d.mts} +3 -4
- package/node_modules/@modelcontextprotocol/client/dist/index-B-4n9P0J.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/{index-D_QDtbiv.d.mts → index-J2FaQ-KY.d.cts} +6 -1
- package/node_modules/@modelcontextprotocol/client/dist/index-J2FaQ-KY.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.cjs +76 -22
- package/node_modules/@modelcontextprotocol/client/dist/index.cjs.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.d.cts +58 -6
- package/node_modules/@modelcontextprotocol/client/dist/index.d.cts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.d.mts +58 -6
- package/node_modules/@modelcontextprotocol/client/dist/index.d.mts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.mjs +76 -22
- package/node_modules/@modelcontextprotocol/client/dist/index.mjs.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/{src-oZBjf3U1.cjs → src-DpAS0jfg.cjs} +105 -8
- package/node_modules/@modelcontextprotocol/client/dist/src-DpAS0jfg.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/{src-xKF0PJN-.mjs → src-WCy6ifGf.mjs} +88 -9
- package/node_modules/@modelcontextprotocol/client/dist/src-WCy6ifGf.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.d.cts +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.d.mts +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/package.json +5 -5
- package/node_modules/@modelcontextprotocol/core/package.json +2 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.js +9 -7
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.d.ts +13 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.js +17 -4
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.d.ts +13 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.js +23 -10
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationFormExample.js +63 -20
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationFormExample.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationUrlExample.js +71 -29
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationUrlExample.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/jsonResponseStreamableHttp.js +45 -6
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/jsonResponseStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleStreamableHttp.js +71 -31
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleTaskInteractive.js +61 -18
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleTaskInteractive.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js +57 -19
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/ssePollingExample.js +64 -17
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/ssePollingExample.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.js +61 -13
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/interfaces.d.ts +4 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/interfaces.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/interfaces.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.d.ts +17 -8
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.js +31 -14
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.d.ts +9 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.js +17 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.d.ts +12 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js +46 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.js +39 -9
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.d.ts +10 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.js +77 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js +9 -7
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.d.ts +13 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js +18 -5
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.d.ts +13 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js +24 -11
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationFormExample.js +63 -20
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationFormExample.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationUrlExample.js +71 -29
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationUrlExample.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/jsonResponseStreamableHttp.js +45 -6
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/jsonResponseStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleStreamableHttp.js +71 -31
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleTaskInteractive.js +61 -18
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleTaskInteractive.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js +57 -19
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/ssePollingExample.js +64 -17
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/ssePollingExample.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.js +61 -13
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts +4 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts +17 -8
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js +31 -14
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.d.ts +9 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.js +17 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts +12 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +46 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +39 -9
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts +10 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js +72 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/package.json +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/{createMcpHandler-CfX6zgs1.d.mts → createMcpHandler-D4NN8WsG.d.mts} +33 -13
- package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-D4NN8WsG.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/{createMcpHandler-LSKhyqpU.d.cts → createMcpHandler-DZmmlN8e.d.cts} +33 -13
- package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-DZmmlN8e.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/index.cjs +29 -4
- package/node_modules/@modelcontextprotocol/server/dist/index.cjs.map +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/index.d.cts +41 -5
- package/node_modules/@modelcontextprotocol/server/dist/index.d.cts.map +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/index.d.mts +41 -5
- package/node_modules/@modelcontextprotocol/server/dist/index.d.mts.map +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/index.mjs +29 -4
- package/node_modules/@modelcontextprotocol/server/dist/index.mjs.map +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/{mcp-TfXCpFsH.cjs → mcp-BumlNux0.cjs} +69 -23
- package/node_modules/@modelcontextprotocol/server/dist/mcp-BumlNux0.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/{mcp-DYuW2ZSs.mjs → mcp-DIH4cS6P.mjs} +69 -23
- package/node_modules/@modelcontextprotocol/server/dist/mcp-DIH4cS6P.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.cjs +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.mjs +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/{src-BtQ5YSyq.cjs → src-BhnGYybN.cjs} +22 -8
- package/node_modules/@modelcontextprotocol/server/dist/src-BhnGYybN.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/{src-BHSMhZ_W.mjs → src-Cqbh3MYc.mjs} +22 -8
- package/node_modules/@modelcontextprotocol/server/dist/src-Cqbh3MYc.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/stdio.cjs +2 -2
- package/node_modules/@modelcontextprotocol/server/dist/stdio.d.cts +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/stdio.d.mts +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/stdio.mjs +2 -2
- package/node_modules/@modelcontextprotocol/server/package.json +4 -4
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-KDVEFWZE.js → chunk-233GXONP.js} +97 -97
- package/node_modules/@zuplo/runtime/out/esm/chunk-233GXONP.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/package.json +11 -11
- package/node_modules/@modelcontextprotocol/client/dist/index-D_CiY-T3.d.cts.map +0 -1
- package/node_modules/@modelcontextprotocol/client/dist/index-D_QDtbiv.d.mts.map +0 -1
- package/node_modules/@modelcontextprotocol/client/dist/src-oZBjf3U1.cjs.map +0 -1
- package/node_modules/@modelcontextprotocol/client/dist/src-xKF0PJN-.mjs.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-CfX6zgs1.d.mts.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-LSKhyqpU.d.cts.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/mcp-DYuW2ZSs.mjs.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/mcp-TfXCpFsH.cjs.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/src-BHSMhZ_W.mjs.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/src-BtQ5YSyq.cjs.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-KDVEFWZE.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-KDVEFWZE.js.LEGAL.txt → chunk-233GXONP.js.LEGAL.txt} +0 -0
package/node_modules/@modelcontextprotocol/server/dist/{mcp-TfXCpFsH.cjs → mcp-BumlNux0.cjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-Bnu9O96Y.cjs');
|
|
2
|
-
const require_src = require('./src-
|
|
2
|
+
const require_src = require('./src-BhnGYybN.cjs');
|
|
3
3
|
let _modelcontextprotocol_server__shims = require("@modelcontextprotocol/server/_shims");
|
|
4
4
|
let _modelcontextprotocol_core_internal = require("@modelcontextprotocol/core/internal");
|
|
5
5
|
|
|
@@ -355,7 +355,7 @@ var StdioListenRouter = class {
|
|
|
355
355
|
_serverCapabilities;
|
|
356
356
|
/**
|
|
357
357
|
* The serving instance's identity, stamped onto the graceful-close
|
|
358
|
-
* results' `_meta` (the spec's `
|
|
358
|
+
* results' `_meta` (the spec's `SubscriptionsListenResultMetaObject` extends
|
|
359
359
|
* `ResultMetaObject`). Handed over together with the capabilities.
|
|
360
360
|
*/
|
|
361
361
|
_serverInfo;
|
|
@@ -482,6 +482,15 @@ function notificationToServerEvent(method, uri) {
|
|
|
482
482
|
|
|
483
483
|
//#endregion
|
|
484
484
|
//#region src/server/middleware/bearerAuth.ts
|
|
485
|
+
function comparableResource(value) {
|
|
486
|
+
const text = String(value);
|
|
487
|
+
const hash = text.indexOf("#");
|
|
488
|
+
return (hash === -1 ? text : text.slice(0, hash)).replace(/\/$/, "");
|
|
489
|
+
}
|
|
490
|
+
function sameResource(reported, expected) {
|
|
491
|
+
if (!reported) return false;
|
|
492
|
+
return comparableResource(reported) === comparableResource(expected);
|
|
493
|
+
}
|
|
485
494
|
function headerQuotedValue(value) {
|
|
486
495
|
return value.replaceAll(/[\\"]/g, String.raw`\$&`).replaceAll(/[^\u0020-\u007E]/g, " ");
|
|
487
496
|
}
|
|
@@ -505,7 +514,8 @@ function buildWwwAuthenticateHeader(errorCode, description, requiredScopes, reso
|
|
|
505
514
|
* the verified {@link AuthInfo}.
|
|
506
515
|
*
|
|
507
516
|
* The runtime-neutral core of Bearer authentication: it parses the header,
|
|
508
|
-
* runs the verifier,
|
|
517
|
+
* runs the verifier, compares the token's resource with `expectedResource`,
|
|
518
|
+
* enforces `requiredScopes`, and rejects tokens without an
|
|
509
519
|
* expiration or past it. On any failure it throws an {@link OAuthError} —
|
|
510
520
|
* pass that to {@link bearerAuthChallengeResponse} for the matching HTTP
|
|
511
521
|
* answer, or use {@link requireBearerAuth} to get both steps as one call.
|
|
@@ -514,11 +524,12 @@ function buildWwwAuthenticateHeader(errorCode, description, requiredScopes, reso
|
|
|
514
524
|
* `@modelcontextprotocol/express` feeds it `req.headers.authorization`.
|
|
515
525
|
*/
|
|
516
526
|
async function verifyBearerToken(authorizationHeader, options) {
|
|
517
|
-
const { verifier, requiredScopes = [] } = options;
|
|
527
|
+
const { verifier, requiredScopes = [], expectedResource } = options;
|
|
518
528
|
if (!authorizationHeader) throw new require_src.OAuthError(require_src.OAuthErrorCode.InvalidToken, "Missing Authorization header");
|
|
519
529
|
const [type, token] = authorizationHeader.split(" ");
|
|
520
530
|
if (type?.toLowerCase() !== "bearer" || !token) throw new require_src.OAuthError(require_src.OAuthErrorCode.InvalidToken, "Invalid Authorization header format, expected 'Bearer TOKEN'");
|
|
521
531
|
const authInfo = await verifier.verifyAccessToken(token);
|
|
532
|
+
if (expectedResource !== void 0 && !sameResource(authInfo.resource, expectedResource)) throw new require_src.OAuthError(require_src.OAuthErrorCode.InvalidToken, "Token was not issued for this resource");
|
|
522
533
|
if (requiredScopes.length > 0) {
|
|
523
534
|
if (!requiredScopes.every((scope) => authInfo.scopes.includes(scope))) throw new require_src.OAuthError(require_src.OAuthErrorCode.InsufficientScope, "Insufficient scope");
|
|
524
535
|
}
|
|
@@ -586,11 +597,12 @@ function bearerAuthChallengeResponse(error, options) {
|
|
|
586
597
|
* ```
|
|
587
598
|
*/
|
|
588
599
|
function requireBearerAuth(options) {
|
|
589
|
-
const { verifier, requiredScopes = [], resourceMetadataUrl } = options;
|
|
600
|
+
const { verifier, requiredScopes = [], resourceMetadataUrl, expectedResource } = options;
|
|
590
601
|
const resolved = {
|
|
591
602
|
verifier,
|
|
592
603
|
requiredScopes,
|
|
593
|
-
resourceMetadataUrl
|
|
604
|
+
resourceMetadataUrl,
|
|
605
|
+
expectedResource
|
|
594
606
|
};
|
|
595
607
|
return async (request) => {
|
|
596
608
|
const [authorizationHeader] = (request.headers.get("authorization") ?? "").split(",");
|
|
@@ -972,7 +984,7 @@ function installModernOnlyHandlers(server, servedModernVersions) {
|
|
|
972
984
|
* Package-internal: the instance's implementation identity, for the serving
|
|
973
985
|
* entries to stamp onto entry-built results (the `subscriptions/listen`
|
|
974
986
|
* graceful-close result — built outside the encode seam, but the spec's
|
|
975
|
-
* `
|
|
987
|
+
* `SubscriptionsListenResultMetaObject` extends `ResultMetaObject`, so it carries
|
|
976
988
|
* the serverInfo SHOULD like every other result). Not public API.
|
|
977
989
|
*/
|
|
978
990
|
function serverIdentityOf(server) {
|
|
@@ -1043,6 +1055,11 @@ var Server = class extends require_src.Protocol {
|
|
|
1043
1055
|
if (require_src.modernProtocolVersions(this._supportedProtocolVersions).length > 0) this.setRequestHandler("server/discover", () => this._ondiscover());
|
|
1044
1056
|
if (this._capabilities.logging) this._registerLoggingHandler();
|
|
1045
1057
|
}
|
|
1058
|
+
/** Attaches to the given transport; rejects while this instance is connected to another one. */
|
|
1059
|
+
async connect(transport) {
|
|
1060
|
+
if (this.transport !== void 0) throw new require_src.SdkError(require_src.SdkErrorCode.AlreadyConnected, "Use a separate Server instance per connection: this instance is already connected to a transport. To connect it to a new transport, call close() first.");
|
|
1061
|
+
await super.connect(transport);
|
|
1062
|
+
}
|
|
1046
1063
|
/**
|
|
1047
1064
|
* Registers the built-in `logging/setLevel` request handler.
|
|
1048
1065
|
*
|
|
@@ -1604,6 +1621,30 @@ function discoverAdvertisedCapabilities(capabilities) {
|
|
|
1604
1621
|
|
|
1605
1622
|
//#endregion
|
|
1606
1623
|
//#region src/server/mcp.ts
|
|
1624
|
+
function toolInputElementCount(value, max) {
|
|
1625
|
+
let count = 0;
|
|
1626
|
+
const stack = [value];
|
|
1627
|
+
while (stack.length > 0) {
|
|
1628
|
+
const node = stack.pop();
|
|
1629
|
+
if (node === null || typeof node !== "object") continue;
|
|
1630
|
+
if (Array.isArray(node)) for (const child of node) {
|
|
1631
|
+
if (++count > max) return count;
|
|
1632
|
+
if (child !== null && typeof child === "object") stack.push(child);
|
|
1633
|
+
}
|
|
1634
|
+
else for (const key in node) {
|
|
1635
|
+
if (!Object.prototype.hasOwnProperty.call(node, key)) continue;
|
|
1636
|
+
if (++count > max) return count;
|
|
1637
|
+
const child = node[key];
|
|
1638
|
+
if (child !== null && typeof child === "object") stack.push(child);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
return count;
|
|
1642
|
+
}
|
|
1643
|
+
function resolveMaxToolInputElements(value) {
|
|
1644
|
+
if (value === void 0 || value === Infinity) return void 0;
|
|
1645
|
+
if (typeof value !== "number" || Number.isNaN(value) || value < 1) throw new RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(value)}`);
|
|
1646
|
+
return value;
|
|
1647
|
+
}
|
|
1607
1648
|
/**
|
|
1608
1649
|
* High-level MCP server that provides a simpler API for working with resources, tools, and prompts.
|
|
1609
1650
|
* For advanced usage (like sending notifications or setting custom request handlers), use the underlying
|
|
@@ -1622,16 +1663,12 @@ var McpServer = class {
|
|
|
1622
1663
|
* The underlying {@linkcode Server} instance, useful for advanced operations like sending notifications.
|
|
1623
1664
|
*/
|
|
1624
1665
|
server;
|
|
1666
|
+
_maxToolInputElements;
|
|
1625
1667
|
_registeredResources = {};
|
|
1626
1668
|
_registeredResourceTemplates = {};
|
|
1627
1669
|
_registeredTools = {};
|
|
1628
1670
|
_registeredPrompts = {};
|
|
1629
|
-
/**
|
|
1630
|
-
* Per-tool JSON-converted `inputSchema`, memoized so the SEP-2243
|
|
1631
|
-
* registration-time scan and the pre-dispatch validation step share one
|
|
1632
|
-
* conversion instead of paying it twice per request under the
|
|
1633
|
-
* per-request-factory `createMcpHandler` model.
|
|
1634
|
-
*/
|
|
1671
|
+
/** Per-tool JSON-converted `inputSchema`, filled on first use by `toolInputSchemaJson()`. */
|
|
1635
1672
|
_toolInputSchemaJson = {};
|
|
1636
1673
|
/**
|
|
1637
1674
|
* The JSON-serialized `inputSchema` of a registered tool, or `undefined`
|
|
@@ -1656,6 +1693,7 @@ var McpServer = class {
|
|
|
1656
1693
|
}
|
|
1657
1694
|
constructor(serverInfo, options) {
|
|
1658
1695
|
this.server = new Server(serverInfo, options);
|
|
1696
|
+
this._maxToolInputElements = resolveMaxToolInputElements(options?.maxToolInputElements);
|
|
1659
1697
|
if (options?.capabilities?.tools) this.setToolRequestHandlers();
|
|
1660
1698
|
if (options?.capabilities?.resources) this.setResourceRequestHandlers();
|
|
1661
1699
|
if (options?.capabilities?.prompts) this.setPromptRequestHandlers();
|
|
@@ -1727,7 +1765,7 @@ var McpServer = class {
|
|
|
1727
1765
|
name,
|
|
1728
1766
|
title: tool.title,
|
|
1729
1767
|
description: tool.description,
|
|
1730
|
-
inputSchema: tool.inputSchema ?
|
|
1768
|
+
inputSchema: tool.inputSchema ? convertListedInputSchema(name, tool.inputSchema) : EMPTY_OBJECT_JSON_SCHEMA,
|
|
1731
1769
|
annotations: tool.annotations,
|
|
1732
1770
|
icons: tool.icons,
|
|
1733
1771
|
execution: tool.execution,
|
|
@@ -1772,6 +1810,7 @@ var McpServer = class {
|
|
|
1772
1810
|
* Validates tool input arguments against the tool's input schema.
|
|
1773
1811
|
*/
|
|
1774
1812
|
async validateToolInput(tool, args, toolName) {
|
|
1813
|
+
if (this._maxToolInputElements !== void 0 && toolInputElementCount(args, this._maxToolInputElements) > this._maxToolInputElements) throw new require_src.ProtocolError(require_src.ProtocolErrorCode.InvalidParams, `Invalid arguments for tool ${toolName}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);
|
|
1775
1814
|
if (!tool.inputSchema) return;
|
|
1776
1815
|
const parseResult = await require_src.validateStandardSchema(tool.inputSchema, args ?? {});
|
|
1777
1816
|
if (!parseResult.success) throw new require_src.ProtocolError(require_src.ProtocolErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${parseResult.error}`);
|
|
@@ -2045,19 +2084,19 @@ var McpServer = class {
|
|
|
2045
2084
|
}
|
|
2046
2085
|
_createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, icons, execution, scopeChallenge, _meta, handler) {
|
|
2047
2086
|
require_src.validateAndWarnToolName(name);
|
|
2048
|
-
if (inputSchema !== void 0) try {
|
|
2049
|
-
const json = require_src.standardSchemaToJsonSchema(inputSchema, "input");
|
|
2050
|
-
this._toolInputSchemaJson[name] = json;
|
|
2051
|
-
const scan = require_src.scanXMcpHeaderDeclarations(json);
|
|
2052
|
-
if (!scan.valid) console.warn(`[mcp-sdk] tool '${name}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${scan.reason}`);
|
|
2053
|
-
} catch {}
|
|
2054
2087
|
let currentHandler = handler;
|
|
2088
|
+
let outputSchemaJson;
|
|
2055
2089
|
const registeredTool = {
|
|
2056
2090
|
title,
|
|
2057
2091
|
description,
|
|
2058
2092
|
inputSchema,
|
|
2059
2093
|
outputSchema,
|
|
2060
|
-
outputSchemaJson
|
|
2094
|
+
get outputSchemaJson() {
|
|
2095
|
+
return outputSchemaJson ??= convertOutputSchemaJson(registeredTool.outputSchema);
|
|
2096
|
+
},
|
|
2097
|
+
set outputSchemaJson(value) {
|
|
2098
|
+
outputSchemaJson = value;
|
|
2099
|
+
},
|
|
2061
2100
|
annotations,
|
|
2062
2101
|
icons,
|
|
2063
2102
|
execution,
|
|
@@ -2218,6 +2257,13 @@ const EMPTY_OBJECT_JSON_SCHEMA = {
|
|
|
2218
2257
|
type: "object",
|
|
2219
2258
|
properties: {}
|
|
2220
2259
|
};
|
|
2260
|
+
/** Converts a tool's `inputSchema` for `tools/list` and warns on an invalid SEP-2243 `x-mcp-header` declaration. */
|
|
2261
|
+
function convertListedInputSchema(name, inputSchema) {
|
|
2262
|
+
const json = require_src.standardSchemaToJsonSchema(inputSchema, "input");
|
|
2263
|
+
const scan = require_src.scanXMcpHeaderDeclarations(json);
|
|
2264
|
+
if (!scan.valid) console.warn(`[mcp-sdk] tool '${name}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${scan.reason}`);
|
|
2265
|
+
return json;
|
|
2266
|
+
}
|
|
2221
2267
|
/**
|
|
2222
2268
|
* Convert a registered `outputSchema` to JSON Schema, memoised on {@link RegisteredTool.outputSchemaJson}
|
|
2223
2269
|
* so `tools/call` passes the SAME advertised schema to the wire codec's `projectCallToolResult` that
|
|
@@ -2240,7 +2286,7 @@ function createPromptHandler(name, argsSchema, callback) {
|
|
|
2240
2286
|
if (argsSchema) {
|
|
2241
2287
|
const typedCallback = callback;
|
|
2242
2288
|
return async (args, ctx) => {
|
|
2243
|
-
const parseResult = await require_src.validateStandardSchema(argsSchema, args);
|
|
2289
|
+
const parseResult = await require_src.validateStandardSchema(argsSchema, args ?? {});
|
|
2244
2290
|
if (!parseResult.success) throw new require_src.ProtocolError(require_src.ProtocolErrorCode.InvalidParams, `Invalid arguments for prompt ${name}: ${parseResult.error}`);
|
|
2245
2291
|
return typedCallback(parseResult.data, ctx);
|
|
2246
2292
|
};
|
|
@@ -2428,4 +2474,4 @@ Object.defineProperty(exports, 'verifyBearerToken', {
|
|
|
2428
2474
|
return verifyBearerToken;
|
|
2429
2475
|
}
|
|
2430
2476
|
});
|
|
2431
|
-
//# sourceMappingURL=mcp-
|
|
2477
|
+
//# sourceMappingURL=mcp-BumlNux0.cjs.map
|