mcp-use 2.0.0-beta.2 → 2.0.0-beta.21
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/dist/.tsbuildinfo +1 -1
- package/dist/bin/args.d.ts +10 -0
- package/dist/bin/args.d.ts.map +1 -1
- package/dist/bin/main.d.ts +8 -0
- package/dist/bin/main.d.ts.map +1 -1
- package/dist/bin/start.d.ts.map +1 -1
- package/dist/bin.js +22 -6
- package/dist/bin.js.map +1 -1
- package/dist/branding.d.ts +82 -0
- package/dist/branding.d.ts.map +1 -0
- package/dist/chunk-22Y3WIJP.js +62 -0
- package/dist/chunk-22Y3WIJP.js.map +1 -0
- package/dist/chunk-EAPJUSK7.js +98 -0
- package/dist/chunk-EAPJUSK7.js.map +1 -0
- package/dist/chunk-FC2Z2VFO.js +99 -0
- package/dist/chunk-FC2Z2VFO.js.map +1 -0
- package/dist/{public-route-7IK5D7V7.js → chunk-G62AMJHS.js} +17 -12
- package/dist/chunk-G62AMJHS.js.map +1 -0
- package/dist/{chunk-UDLRVMML.js → chunk-IGVT7UV6.js} +94 -23
- package/dist/chunk-IGVT7UV6.js.map +1 -0
- package/dist/chunk-KIZ72TIK.js +38 -0
- package/dist/chunk-KIZ72TIK.js.map +1 -0
- package/dist/{chunk-Q4PUTBMV.js → chunk-QBAJXPRQ.js} +21 -1
- package/dist/chunk-QBAJXPRQ.js.map +1 -0
- package/dist/{chunk-SFI2T6TE.js → chunk-QUUANIE4.js} +34 -80
- package/dist/chunk-QUUANIE4.js.map +1 -0
- package/dist/{chunk-RQRT27Q3.js → chunk-RHITI5QM.js} +190 -16
- package/dist/chunk-RHITI5QM.js.map +1 -0
- package/dist/chunk-Z326HADF.js +82 -0
- package/dist/chunk-Z326HADF.js.map +1 -0
- package/dist/chunk-ZJJD33SF.js +741 -0
- package/dist/chunk-ZJJD33SF.js.map +1 -0
- package/dist/cli/build.d.ts +21 -15
- package/dist/cli/build.d.ts.map +1 -1
- package/dist/cli/dev.d.ts +4 -0
- package/dist/cli/dev.d.ts.map +1 -1
- package/dist/cli/entry.d.ts +1 -1
- package/dist/cli/entry.d.ts.map +1 -1
- package/dist/cli/mcp-env-declaration.d.ts +20 -0
- package/dist/cli/mcp-env-declaration.d.ts.map +1 -0
- package/dist/cli/next-compat.d.ts +21 -0
- package/dist/cli/next-compat.d.ts.map +1 -0
- package/dist/cli/next-server-shims.d.ts +52 -0
- package/dist/cli/next-server-shims.d.ts.map +1 -0
- package/dist/cli/port.d.ts.map +1 -1
- package/dist/cli/tunnel.d.ts.map +1 -1
- package/dist/cli/views-bindings.d.ts +9 -0
- package/dist/cli/views-bindings.d.ts.map +1 -1
- package/dist/cli/views-plugin.d.ts.map +1 -1
- package/dist/cli/views.d.ts +23 -8
- package/dist/cli/views.d.ts.map +1 -1
- package/dist/cli/workspace.d.ts +4 -9
- package/dist/cli/workspace.d.ts.map +1 -1
- package/dist/commands/build.js +171 -34
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/client.d.ts.map +1 -1
- package/dist/commands/client.js +1 -1
- package/dist/commands/dev.js +145 -40
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/load-client.d.ts +9 -2
- package/dist/commands/load-client.d.ts.map +1 -1
- package/dist/commands/screenshot.js +1 -1
- package/dist/commands/start.js +5 -1
- package/dist/commands/start.js.map +1 -1
- package/dist/completable.d.ts +9 -0
- package/dist/completable.d.ts.map +1 -1
- package/dist/config.d.ts +125 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/fetch-app.d.ts +43 -0
- package/dist/fetch-app.d.ts.map +1 -1
- package/dist/index.d.ts +20 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1318 -251
- package/dist/index.js.map +1 -1
- package/dist/inspector-shell.d.ts +19 -6
- package/dist/inspector-shell.d.ts.map +1 -1
- package/dist/internal/resource-completion.js +7 -0
- package/dist/internal/resource-completion.js.map +1 -0
- package/dist/landing-handler-WE66NIGB.js +37 -0
- package/dist/landing-handler-WE66NIGB.js.map +1 -0
- package/dist/landing-handler.d.ts +24 -0
- package/dist/landing-handler.d.ts.map +1 -0
- package/dist/landing.d.ts +67 -0
- package/dist/landing.d.ts.map +1 -0
- package/dist/landing.js +7 -0
- package/dist/landing.js.map +1 -0
- package/dist/mcp-proxy-5YQJJ4RT.js +282 -0
- package/dist/mcp-proxy-5YQJJ4RT.js.map +1 -0
- package/dist/mcp-proxy.d.ts +153 -0
- package/dist/mcp-proxy.d.ts.map +1 -0
- package/dist/middleware/cors.d.ts +11 -0
- package/dist/middleware/cors.d.ts.map +1 -0
- package/dist/middleware/mcp-middleware.d.ts +179 -0
- package/dist/middleware/mcp-middleware.d.ts.map +1 -0
- package/dist/mount-mcp.d.ts +0 -4
- package/dist/mount-mcp.d.ts.map +1 -1
- package/dist/next/config.d.ts +39 -0
- package/dist/next/config.d.ts.map +1 -0
- package/dist/next/handler.d.ts +17 -0
- package/dist/next/handler.d.ts.map +1 -0
- package/dist/next/index.d.ts +5 -0
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +172 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next-server-shims.js +108 -0
- package/dist/next-server-shims.js.map +1 -0
- package/dist/oauth/better-auth.d.ts +29 -0
- package/dist/oauth/better-auth.d.ts.map +1 -0
- package/dist/oauth/better-auth.js +76 -0
- package/dist/oauth/better-auth.js.map +1 -0
- package/dist/oauth/index.js +2 -1
- package/dist/public-route-RWJVJQTX.js +9 -0
- package/dist/public-route-RWJVJQTX.js.map +1 -0
- package/dist/react/components/theme-provider.d.ts +3 -0
- package/dist/react/components/theme-provider.d.ts.map +1 -1
- package/dist/react/hooks/use-files.d.ts +25 -0
- package/dist/react/hooks/use-files.d.ts.map +1 -0
- package/dist/react/hooks/use-host-context.d.ts +5 -0
- package/dist/react/hooks/use-host-context.d.ts.map +1 -1
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +124 -3
- package/dist/react/index.js.map +1 -1
- package/dist/react/runtime/view-runtime.d.ts +23 -0
- package/dist/react/runtime/view-runtime.d.ts.map +1 -1
- package/dist/react/types/file-types.d.ts +16 -0
- package/dist/react/types/file-types.d.ts.map +1 -0
- package/dist/react/types/register.d.ts +1 -1
- package/dist/react/types/register.d.ts.map +1 -1
- package/dist/resource-completion.d.ts +12 -0
- package/dist/resource-completion.d.ts.map +1 -0
- package/dist/resources.d.ts +59 -4
- package/dist/resources.d.ts.map +1 -1
- package/dist/server.d.ts +120 -7
- package/dist/server.d.ts.map +1 -1
- package/dist/tools.d.ts +21 -10
- package/dist/tools.d.ts.map +1 -1
- package/dist/views/constants.d.ts +1 -1
- package/dist/views/csp-env.d.ts +37 -0
- package/dist/views/csp-env.d.ts.map +1 -0
- package/dist/views/document.d.ts +30 -13
- package/dist/views/document.d.ts.map +1 -1
- package/dist/views/index.d.ts +4 -3
- package/dist/views/index.d.ts.map +1 -1
- package/dist/views/origin.d.ts +37 -9
- package/dist/views/origin.d.ts.map +1 -1
- package/dist/views/public-route.d.ts +10 -4
- package/dist/views/public-route.d.ts.map +1 -1
- package/dist/views/register.d.ts +1 -1
- package/dist/views/routes.d.ts +20 -1
- package/dist/views/routes.d.ts.map +1 -1
- package/dist/views/types.d.ts +23 -14
- package/dist/views/types.d.ts.map +1 -1
- package/dist/views/wire.d.ts +26 -36
- package/dist/views/wire.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/LICENSE +216 -0
- package/node_modules/@modelcontextprotocol/client/README.md +26 -0
- package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-Asx17_Co.mjs +7069 -0
- package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-Asx17_Co.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-B7GnTXYx.d.mts +1054 -0
- package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-B7GnTXYx.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-B_4czhCS.d.cts +1054 -0
- package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-B_4czhCS.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-DNzBrkxq.cjs +7086 -0
- package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-DNzBrkxq.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-D9GAttn8.d.cts +59 -0
- package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-D9GAttn8.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-DbU8BxXO.mjs +970 -0
- package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-DbU8BxXO.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-Djgwc46-.cjs +976 -0
- package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-Djgwc46-.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-Xtj52JOa.d.mts +59 -0
- package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-Xtj52JOa.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/chunk-Bnu9O96Y.cjs +60 -0
- package/node_modules/@modelcontextprotocol/client/dist/chunk-Br0eD_fh.mjs +42 -0
- package/node_modules/@modelcontextprotocol/client/dist/index-ZagFkUbt.d.mts +2675 -0
- package/node_modules/@modelcontextprotocol/client/dist/index-ZagFkUbt.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index-gN3EXmil.d.cts +2678 -0
- package/node_modules/@modelcontextprotocol/client/dist/index-gN3EXmil.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.cjs +5427 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.d.cts +3196 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.d.mts +3196 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.mjs +5224 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.cjs +14 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.d.cts +13 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.d.mts +13 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.mjs +13 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsNode.cjs +14 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsNode.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsNode.d.cts +13 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsNode.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsNode.d.mts +13 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsNode.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsNode.mjs +13 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsNode.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs +21 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.d.cts +13 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.d.mts +13 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs +20 -0
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/src-BzzZSQyL.cjs +7331 -0
- package/node_modules/@modelcontextprotocol/client/dist/src-BzzZSQyL.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/src-DGeA9On3.mjs +6963 -0
- package/node_modules/@modelcontextprotocol/client/dist/src-DGeA9On3.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs +181 -0
- package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/stdio.d.cts +87 -0
- package/node_modules/@modelcontextprotocol/client/dist/stdio.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/stdio.d.mts +87 -0
- package/node_modules/@modelcontextprotocol/client/dist/stdio.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs +176 -0
- package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/types-BDNQEPSs.d.mts +1099 -0
- package/node_modules/@modelcontextprotocol/client/dist/types-BDNQEPSs.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/types-DsbMXNFL.d.cts +1099 -0
- package/node_modules/@modelcontextprotocol/client/dist/types-DsbMXNFL.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/validators/ajv.cjs +5 -0
- package/node_modules/@modelcontextprotocol/client/dist/validators/ajv.d.cts +2 -0
- package/node_modules/@modelcontextprotocol/client/dist/validators/ajv.d.mts +2 -0
- package/node_modules/@modelcontextprotocol/client/dist/validators/ajv.mjs +3 -0
- package/node_modules/@modelcontextprotocol/client/dist/validators/cfWorker.cjs +3 -0
- package/node_modules/@modelcontextprotocol/client/dist/validators/cfWorker.d.cts +2 -0
- package/node_modules/@modelcontextprotocol/client/dist/validators/cfWorker.d.mts +2 -0
- package/node_modules/@modelcontextprotocol/client/dist/validators/cfWorker.mjs +3 -0
- package/node_modules/@modelcontextprotocol/client/package.json +166 -0
- package/node_modules/@modelcontextprotocol/core/LICENSE +216 -0
- package/node_modules/@modelcontextprotocol/core/README.md +40 -0
- package/node_modules/@modelcontextprotocol/core/dist/auth-BUWfrB3C.d.cts +8198 -0
- package/node_modules/@modelcontextprotocol/core/dist/auth-BUWfrB3C.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/core/dist/auth-CEFpHq32.cjs +2862 -0
- package/node_modules/@modelcontextprotocol/core/dist/auth-CEFpHq32.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/core/dist/auth-CNbu4K4a.d.mts +8198 -0
- package/node_modules/@modelcontextprotocol/core/dist/auth-CNbu4K4a.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/core/dist/auth-DFgbUATV.mjs +1653 -0
- package/node_modules/@modelcontextprotocol/core/dist/auth-DFgbUATV.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/core/dist/index.cjs +174 -0
- package/node_modules/@modelcontextprotocol/core/dist/index.d.cts +2 -0
- package/node_modules/@modelcontextprotocol/core/dist/index.d.mts +2 -0
- package/node_modules/@modelcontextprotocol/core/dist/index.mjs +3 -0
- package/node_modules/@modelcontextprotocol/core/dist/internal.cjs +199 -0
- package/node_modules/@modelcontextprotocol/core/dist/internal.d.cts +87 -0
- package/node_modules/@modelcontextprotocol/core/dist/internal.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/core/dist/internal.d.mts +87 -0
- package/node_modules/@modelcontextprotocol/core/dist/internal.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/core/dist/internal.mjs +3 -0
- package/node_modules/@modelcontextprotocol/core/package.json +85 -0
- package/node_modules/jose/LICENSE.md +21 -0
- package/node_modules/jose/README.md +153 -0
- package/node_modules/jose/dist/types/index.d.ts +55 -0
- package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +31 -0
- package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +65 -0
- package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +31 -0
- package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +83 -0
- package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +31 -0
- package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +74 -0
- package/node_modules/jose/dist/types/jwk/embedded.d.ts +17 -0
- package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +32 -0
- package/node_modules/jose/dist/types/jwks/local.d.ts +29 -0
- package/node_modules/jose/dist/types/jwks/remote.d.ts +237 -0
- package/node_modules/jose/dist/types/jws/compact/sign.d.ts +36 -0
- package/node_modules/jose/dist/types/jws/compact/verify.d.ts +33 -0
- package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +42 -0
- package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +33 -0
- package/node_modules/jose/dist/types/jws/general/sign.d.ts +53 -0
- package/node_modules/jose/dist/types/jws/general/verify.d.ts +33 -0
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +35 -0
- package/node_modules/jose/dist/types/jwt/encrypt.d.ts +91 -0
- package/node_modules/jose/dist/types/jwt/sign.d.ts +43 -0
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +43 -0
- package/node_modules/jose/dist/types/jwt/verify.d.ts +37 -0
- package/node_modules/jose/dist/types/key/export.d.ts +33 -0
- package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +47 -0
- package/node_modules/jose/dist/types/key/generate_secret.d.ts +35 -0
- package/node_modules/jose/dist/types/key/import.d.ts +83 -0
- package/node_modules/jose/dist/types/types.d.ts +841 -0
- package/node_modules/jose/dist/types/util/base64url.d.ts +9 -0
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +18 -0
- package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +17 -0
- package/node_modules/jose/dist/types/util/errors.d.ts +213 -0
- package/node_modules/jose/dist/webapi/index.js +32 -0
- package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +27 -0
- package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +27 -0
- package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +165 -0
- package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +169 -0
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +31 -0
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +187 -0
- package/node_modules/jose/dist/webapi/jwk/embedded.js +17 -0
- package/node_modules/jose/dist/webapi/jwk/thumbprint.js +68 -0
- package/node_modules/jose/dist/webapi/jwks/local.js +119 -0
- package/node_modules/jose/dist/webapi/jwks/remote.js +179 -0
- package/node_modules/jose/dist/webapi/jws/compact/sign.js +18 -0
- package/node_modules/jose/dist/webapi/jws/compact/verify.js +21 -0
- package/node_modules/jose/dist/webapi/jws/flattened/sign.js +92 -0
- package/node_modules/jose/dist/webapi/jws/flattened/verify.js +120 -0
- package/node_modules/jose/dist/webapi/jws/general/sign.js +73 -0
- package/node_modules/jose/dist/webapi/jws/general/verify.js +24 -0
- package/node_modules/jose/dist/webapi/jwt/decrypt.js +23 -0
- package/node_modules/jose/dist/webapi/jwt/encrypt.js +108 -0
- package/node_modules/jose/dist/webapi/jwt/sign.js +52 -0
- package/node_modules/jose/dist/webapi/jwt/unsecured.js +63 -0
- package/node_modules/jose/dist/webapi/jwt/verify.js +15 -0
- package/node_modules/jose/dist/webapi/key/export.js +11 -0
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +97 -0
- package/node_modules/jose/dist/webapi/key/generate_secret.js +40 -0
- package/node_modules/jose/dist/webapi/key/import.js +57 -0
- package/node_modules/jose/dist/webapi/lib/aesgcmkw.js +16 -0
- package/node_modules/jose/dist/webapi/lib/aeskw.js +25 -0
- package/node_modules/jose/dist/webapi/lib/asn1.js +243 -0
- package/node_modules/jose/dist/webapi/lib/base64.js +22 -0
- package/node_modules/jose/dist/webapi/lib/buffer_utils.js +43 -0
- package/node_modules/jose/dist/webapi/lib/cek.js +19 -0
- package/node_modules/jose/dist/webapi/lib/check_cek_length.js +7 -0
- package/node_modules/jose/dist/webapi/lib/check_iv_length.js +7 -0
- package/node_modules/jose/dist/webapi/lib/check_key_length.js +8 -0
- package/node_modules/jose/dist/webapi/lib/check_key_type.js +122 -0
- package/node_modules/jose/dist/webapi/lib/crypto_key.js +143 -0
- package/node_modules/jose/dist/webapi/lib/decrypt.js +106 -0
- package/node_modules/jose/dist/webapi/lib/decrypt_key_management.js +127 -0
- package/node_modules/jose/dist/webapi/lib/digest.js +4 -0
- package/node_modules/jose/dist/webapi/lib/ecdhes.js +52 -0
- package/node_modules/jose/dist/webapi/lib/encrypt.js +74 -0
- package/node_modules/jose/dist/webapi/lib/encrypt_key_management.js +92 -0
- package/node_modules/jose/dist/webapi/lib/get_sign_verify_key.js +12 -0
- package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +27 -0
- package/node_modules/jose/dist/webapi/lib/is_disjoint.js +21 -0
- package/node_modules/jose/dist/webapi/lib/is_jwk.js +6 -0
- package/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -0
- package/node_modules/jose/dist/webapi/lib/is_object.js +14 -0
- package/node_modules/jose/dist/webapi/lib/iv.js +19 -0
- package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +109 -0
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +238 -0
- package/node_modules/jose/dist/webapi/lib/key_to_jwk.js +31 -0
- package/node_modules/jose/dist/webapi/lib/normalize_key.js +176 -0
- package/node_modules/jose/dist/webapi/lib/pbes2kw.js +39 -0
- package/node_modules/jose/dist/webapi/lib/private_symbols.js +1 -0
- package/node_modules/jose/dist/webapi/lib/rsaes.js +24 -0
- package/node_modules/jose/dist/webapi/lib/sign.js +9 -0
- package/node_modules/jose/dist/webapi/lib/subtle_dsa.js +31 -0
- package/node_modules/jose/dist/webapi/lib/validate_algorithms.js +10 -0
- package/node_modules/jose/dist/webapi/lib/validate_crit.js +33 -0
- package/node_modules/jose/dist/webapi/lib/verify.js +14 -0
- package/node_modules/jose/dist/webapi/util/base64url.js +30 -0
- package/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -0
- package/node_modules/jose/dist/webapi/util/decode_protected_header.js +34 -0
- package/node_modules/jose/dist/webapi/util/errors.js +99 -0
- package/node_modules/jose/package.json +200 -0
- package/node_modules/zod/LICENSE +21 -0
- package/node_modules/zod/README.md +191 -0
- package/node_modules/zod/index.cjs +33 -0
- package/node_modules/zod/index.d.cts +4 -0
- package/node_modules/zod/index.d.ts +4 -0
- package/node_modules/zod/index.js +4 -0
- package/node_modules/zod/locales/index.cjs +17 -0
- package/node_modules/zod/locales/index.d.cts +1 -0
- package/node_modules/zod/locales/index.d.ts +1 -0
- package/node_modules/zod/locales/index.js +1 -0
- package/node_modules/zod/locales/package.json +7 -0
- package/node_modules/zod/mini/index.cjs +32 -0
- package/node_modules/zod/mini/index.d.cts +3 -0
- package/node_modules/zod/mini/index.d.ts +3 -0
- package/node_modules/zod/mini/index.js +3 -0
- package/node_modules/zod/mini/package.json +7 -0
- package/node_modules/zod/package.json +135 -0
- package/node_modules/zod/src/index.ts +4 -0
- package/node_modules/zod/src/locales/index.ts +1 -0
- package/node_modules/zod/src/mini/index.ts +3 -0
- package/node_modules/zod/src/v3/ZodError.ts +330 -0
- package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
- package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
- package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
- package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
- package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
- package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
- package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
- package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
- package/node_modules/zod/src/v3/errors.ts +13 -0
- package/node_modules/zod/src/v3/external.ts +6 -0
- package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
- package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
- package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
- package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
- package/node_modules/zod/src/v3/helpers/util.ts +224 -0
- package/node_modules/zod/src/v3/index.ts +4 -0
- package/node_modules/zod/src/v3/locales/en.ts +124 -0
- package/node_modules/zod/src/v3/standard-schema.ts +113 -0
- package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
- package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
- package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
- package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
- package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
- package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
- package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
- package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
- package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
- package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
- package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
- package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
- package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
- package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
- package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
- package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/function.test.ts +261 -0
- package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
- package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
- package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
- package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
- package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
- package/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
- package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
- package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
- package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
- package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
- package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
- package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
- package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
- package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
- package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
- package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
- package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
- package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
- package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
- package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
- package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
- package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
- package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
- package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
- package/node_modules/zod/src/v3/types.ts +5138 -0
- package/node_modules/zod/src/v4/classic/checks.ts +32 -0
- package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
- package/node_modules/zod/src/v4/classic/compat.ts +70 -0
- package/node_modules/zod/src/v4/classic/errors.ts +82 -0
- package/node_modules/zod/src/v4/classic/external.ts +52 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +659 -0
- package/node_modules/zod/src/v4/classic/index.ts +5 -0
- package/node_modules/zod/src/v4/classic/iso.ts +90 -0
- package/node_modules/zod/src/v4/classic/parse.ts +82 -0
- package/node_modules/zod/src/v4/classic/schemas.ts +2672 -0
- package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +59 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +216 -0
- package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
- package/node_modules/zod/src/v4/classic/tests/brand.test.ts +106 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +326 -0
- package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +573 -0
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +703 -0
- package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
- package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +62 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +302 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +409 -0
- package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +197 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +694 -0
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +807 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
- package/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
- package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +895 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +360 -0
- package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +939 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +60 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +198 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +46 -0
- package/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +117 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +330 -0
- package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +325 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +717 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +333 -0
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +450 -0
- package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +211 -0
- package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +74 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +351 -0
- package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +717 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +631 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +633 -0
- package/node_modules/zod/src/v4/classic/tests/registries.test.ts +243 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +181 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +134 -0
- package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +1224 -0
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +106 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +771 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +3125 -0
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +378 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +496 -0
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +273 -0
- package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
- package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
- package/node_modules/zod/src/v4/core/api.ts +1823 -0
- package/node_modules/zod/src/v4/core/checks.ts +1293 -0
- package/node_modules/zod/src/v4/core/config.ts +15 -0
- package/node_modules/zod/src/v4/core/core.ts +153 -0
- package/node_modules/zod/src/v4/core/doc.ts +44 -0
- package/node_modules/zod/src/v4/core/errors.ts +455 -0
- package/node_modules/zod/src/v4/core/index.ts +16 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +126 -0
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +666 -0
- package/node_modules/zod/src/v4/core/json-schema.ts +147 -0
- package/node_modules/zod/src/v4/core/parse.ts +195 -0
- package/node_modules/zod/src/v4/core/regexes.ts +190 -0
- package/node_modules/zod/src/v4/core/registries.ts +105 -0
- package/node_modules/zod/src/v4/core/schemas.ts +4730 -0
- package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
- package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
- package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +215 -0
- package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +181 -0
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
- package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
- package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
- package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +105 -0
- package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +125 -0
- package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +622 -0
- package/node_modules/zod/src/v4/core/util.ts +983 -0
- package/node_modules/zod/src/v4/core/versions.ts +5 -0
- package/node_modules/zod/src/v4/core/zsf.ts +323 -0
- package/node_modules/zod/src/v4/index.ts +4 -0
- package/node_modules/zod/src/v4/locales/ar.ts +115 -0
- package/node_modules/zod/src/v4/locales/az.ts +111 -0
- package/node_modules/zod/src/v4/locales/be.ts +176 -0
- package/node_modules/zod/src/v4/locales/bg.ts +128 -0
- package/node_modules/zod/src/v4/locales/ca.ts +116 -0
- package/node_modules/zod/src/v4/locales/cs.ts +118 -0
- package/node_modules/zod/src/v4/locales/da.ts +123 -0
- package/node_modules/zod/src/v4/locales/de.ts +116 -0
- package/node_modules/zod/src/v4/locales/el.ts +121 -0
- package/node_modules/zod/src/v4/locales/en.ts +123 -0
- package/node_modules/zod/src/v4/locales/eo.ts +118 -0
- package/node_modules/zod/src/v4/locales/es.ts +141 -0
- package/node_modules/zod/src/v4/locales/fa.ts +126 -0
- package/node_modules/zod/src/v4/locales/fi.ts +121 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +116 -0
- package/node_modules/zod/src/v4/locales/fr.ts +132 -0
- package/node_modules/zod/src/v4/locales/he.ts +246 -0
- package/node_modules/zod/src/v4/locales/hr.ts +131 -0
- package/node_modules/zod/src/v4/locales/hu.ts +117 -0
- package/node_modules/zod/src/v4/locales/hy.ts +164 -0
- package/node_modules/zod/src/v4/locales/id.ts +115 -0
- package/node_modules/zod/src/v4/locales/index.ts +52 -0
- package/node_modules/zod/src/v4/locales/is.ts +119 -0
- package/node_modules/zod/src/v4/locales/it.ts +116 -0
- package/node_modules/zod/src/v4/locales/ja.ts +114 -0
- package/node_modules/zod/src/v4/locales/ka.ts +123 -0
- package/node_modules/zod/src/v4/locales/kh.ts +7 -0
- package/node_modules/zod/src/v4/locales/km.ts +119 -0
- package/node_modules/zod/src/v4/locales/ko.ts +121 -0
- package/node_modules/zod/src/v4/locales/lt.ts +239 -0
- package/node_modules/zod/src/v4/locales/mk.ts +118 -0
- package/node_modules/zod/src/v4/locales/ms.ts +115 -0
- package/node_modules/zod/src/v4/locales/nl.ts +121 -0
- package/node_modules/zod/src/v4/locales/no.ts +116 -0
- package/node_modules/zod/src/v4/locales/ota.ts +117 -0
- package/node_modules/zod/src/v4/locales/pl.ts +118 -0
- package/node_modules/zod/src/v4/locales/ps.ts +126 -0
- package/node_modules/zod/src/v4/locales/pt.ts +116 -0
- package/node_modules/zod/src/v4/locales/ro.ts +129 -0
- package/node_modules/zod/src/v4/locales/ru.ts +176 -0
- package/node_modules/zod/src/v4/locales/sl.ts +118 -0
- package/node_modules/zod/src/v4/locales/sv.ts +119 -0
- package/node_modules/zod/src/v4/locales/ta.ts +118 -0
- package/node_modules/zod/src/v4/locales/th.ts +119 -0
- package/node_modules/zod/src/v4/locales/tr.ts +111 -0
- package/node_modules/zod/src/v4/locales/ua.ts +7 -0
- package/node_modules/zod/src/v4/locales/uk.ts +117 -0
- package/node_modules/zod/src/v4/locales/ur.ts +119 -0
- package/node_modules/zod/src/v4/locales/uz.ts +117 -0
- package/node_modules/zod/src/v4/locales/vi.ts +117 -0
- package/node_modules/zod/src/v4/locales/yo.ts +124 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +116 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +115 -0
- package/node_modules/zod/src/v4/mini/checks.ts +32 -0
- package/node_modules/zod/src/v4/mini/coerce.ts +27 -0
- package/node_modules/zod/src/v4/mini/external.ts +41 -0
- package/node_modules/zod/src/v4/mini/index.ts +3 -0
- package/node_modules/zod/src/v4/mini/iso.ts +66 -0
- package/node_modules/zod/src/v4/mini/parse.ts +14 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +1947 -0
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +24 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
- package/node_modules/zod/src/v4/mini/tests/brand.test.ts +94 -0
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +548 -0
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +5 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +993 -0
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +227 -0
- package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +325 -0
- package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +352 -0
- package/node_modules/zod/src/v4-mini/index.ts +3 -0
- package/node_modules/zod/v3/ZodError.cjs +138 -0
- package/node_modules/zod/v3/ZodError.d.cts +164 -0
- package/node_modules/zod/v3/ZodError.d.ts +164 -0
- package/node_modules/zod/v3/ZodError.js +133 -0
- package/node_modules/zod/v3/errors.cjs +17 -0
- package/node_modules/zod/v3/errors.d.cts +5 -0
- package/node_modules/zod/v3/errors.d.ts +5 -0
- package/node_modules/zod/v3/errors.js +9 -0
- package/node_modules/zod/v3/external.cjs +22 -0
- package/node_modules/zod/v3/external.d.cts +6 -0
- package/node_modules/zod/v3/external.d.ts +6 -0
- package/node_modules/zod/v3/external.js +6 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
- package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/node_modules/zod/v3/helpers/util.cjs +137 -0
- package/node_modules/zod/v3/helpers/util.d.cts +85 -0
- package/node_modules/zod/v3/helpers/util.d.ts +85 -0
- package/node_modules/zod/v3/helpers/util.js +133 -0
- package/node_modules/zod/v3/index.cjs +33 -0
- package/node_modules/zod/v3/index.d.cts +4 -0
- package/node_modules/zod/v3/index.d.ts +4 -0
- package/node_modules/zod/v3/index.js +4 -0
- package/node_modules/zod/v3/locales/en.cjs +112 -0
- package/node_modules/zod/v3/locales/en.d.cts +3 -0
- package/node_modules/zod/v3/locales/en.d.ts +3 -0
- package/node_modules/zod/v3/locales/en.js +109 -0
- package/node_modules/zod/v3/package.json +7 -0
- package/node_modules/zod/v3/standard-schema.cjs +2 -0
- package/node_modules/zod/v3/standard-schema.d.cts +102 -0
- package/node_modules/zod/v3/standard-schema.d.ts +102 -0
- package/node_modules/zod/v3/standard-schema.js +1 -0
- package/node_modules/zod/v3/types.cjs +3777 -0
- package/node_modules/zod/v3/types.d.cts +1034 -0
- package/node_modules/zod/v3/types.d.ts +1034 -0
- package/node_modules/zod/v3/types.js +3695 -0
- package/node_modules/zod/v4/classic/checks.cjs +33 -0
- package/node_modules/zod/v4/classic/checks.d.cts +1 -0
- package/node_modules/zod/v4/classic/checks.d.ts +1 -0
- package/node_modules/zod/v4/classic/checks.js +1 -0
- package/node_modules/zod/v4/classic/coerce.cjs +47 -0
- package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
- package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
- package/node_modules/zod/v4/classic/coerce.js +17 -0
- package/node_modules/zod/v4/classic/compat.cjs +61 -0
- package/node_modules/zod/v4/classic/compat.d.cts +50 -0
- package/node_modules/zod/v4/classic/compat.d.ts +50 -0
- package/node_modules/zod/v4/classic/compat.js +31 -0
- package/node_modules/zod/v4/classic/errors.cjs +74 -0
- package/node_modules/zod/v4/classic/errors.d.cts +30 -0
- package/node_modules/zod/v4/classic/errors.d.ts +30 -0
- package/node_modules/zod/v4/classic/errors.js +48 -0
- package/node_modules/zod/v4/classic/external.cjs +73 -0
- package/node_modules/zod/v4/classic/external.d.cts +16 -0
- package/node_modules/zod/v4/classic/external.d.ts +16 -0
- package/node_modules/zod/v4/classic/external.js +20 -0
- package/node_modules/zod/v4/classic/from-json-schema.cjs +625 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.js +599 -0
- package/node_modules/zod/v4/classic/index.cjs +33 -0
- package/node_modules/zod/v4/classic/index.d.cts +4 -0
- package/node_modules/zod/v4/classic/index.d.ts +4 -0
- package/node_modules/zod/v4/classic/index.js +4 -0
- package/node_modules/zod/v4/classic/iso.cjs +60 -0
- package/node_modules/zod/v4/classic/iso.d.cts +22 -0
- package/node_modules/zod/v4/classic/iso.d.ts +22 -0
- package/node_modules/zod/v4/classic/iso.js +30 -0
- package/node_modules/zod/v4/classic/package.json +7 -0
- package/node_modules/zod/v4/classic/parse.cjs +41 -0
- package/node_modules/zod/v4/classic/parse.d.cts +31 -0
- package/node_modules/zod/v4/classic/parse.d.ts +31 -0
- package/node_modules/zod/v4/classic/parse.js +15 -0
- package/node_modules/zod/v4/classic/schemas.cjs +1511 -0
- package/node_modules/zod/v4/classic/schemas.d.cts +767 -0
- package/node_modules/zod/v4/classic/schemas.d.ts +767 -0
- package/node_modules/zod/v4/classic/schemas.js +1395 -0
- package/node_modules/zod/v4/core/api.cjs +1227 -0
- package/node_modules/zod/v4/core/api.d.cts +325 -0
- package/node_modules/zod/v4/core/api.d.ts +325 -0
- package/node_modules/zod/v4/core/api.js +1087 -0
- package/node_modules/zod/v4/core/checks.cjs +601 -0
- package/node_modules/zod/v4/core/checks.d.cts +278 -0
- package/node_modules/zod/v4/core/checks.d.ts +278 -0
- package/node_modules/zod/v4/core/checks.js +575 -0
- package/node_modules/zod/v4/core/core.cjs +85 -0
- package/node_modules/zod/v4/core/core.d.cts +70 -0
- package/node_modules/zod/v4/core/core.d.ts +70 -0
- package/node_modules/zod/v4/core/core.js +78 -0
- package/node_modules/zod/v4/core/doc.cjs +39 -0
- package/node_modules/zod/v4/core/doc.d.cts +14 -0
- package/node_modules/zod/v4/core/doc.d.ts +14 -0
- package/node_modules/zod/v4/core/doc.js +35 -0
- package/node_modules/zod/v4/core/errors.cjs +216 -0
- package/node_modules/zod/v4/core/errors.d.cts +221 -0
- package/node_modules/zod/v4/core/errors.d.ts +221 -0
- package/node_modules/zod/v4/core/errors.js +185 -0
- package/node_modules/zod/v4/core/index.cjs +47 -0
- package/node_modules/zod/v4/core/index.d.cts +16 -0
- package/node_modules/zod/v4/core/index.d.ts +16 -0
- package/node_modules/zod/v4/core/index.js +16 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +99 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.js +95 -0
- package/node_modules/zod/v4/core/json-schema-processors.cjs +644 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +49 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +49 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +601 -0
- package/node_modules/zod/v4/core/json-schema.cjs +2 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +88 -0
- package/node_modules/zod/v4/core/json-schema.d.ts +88 -0
- package/node_modules/zod/v4/core/json-schema.js +1 -0
- package/node_modules/zod/v4/core/package.json +7 -0
- package/node_modules/zod/v4/core/parse.cjs +131 -0
- package/node_modules/zod/v4/core/parse.d.cts +49 -0
- package/node_modules/zod/v4/core/parse.d.ts +49 -0
- package/node_modules/zod/v4/core/parse.js +93 -0
- package/node_modules/zod/v4/core/regexes.cjs +172 -0
- package/node_modules/zod/v4/core/regexes.d.cts +85 -0
- package/node_modules/zod/v4/core/regexes.d.ts +85 -0
- package/node_modules/zod/v4/core/regexes.js +139 -0
- package/node_modules/zod/v4/core/registries.cjs +56 -0
- package/node_modules/zod/v4/core/registries.d.cts +35 -0
- package/node_modules/zod/v4/core/registries.d.ts +35 -0
- package/node_modules/zod/v4/core/registries.js +51 -0
- package/node_modules/zod/v4/core/schemas.cjs +2270 -0
- package/node_modules/zod/v4/core/schemas.d.cts +1184 -0
- package/node_modules/zod/v4/core/schemas.d.ts +1184 -0
- package/node_modules/zod/v4/core/schemas.js +2239 -0
- package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
- package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
- package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
- package/node_modules/zod/v4/core/standard-schema.js +1 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +457 -0
- package/node_modules/zod/v4/core/to-json-schema.d.cts +114 -0
- package/node_modules/zod/v4/core/to-json-schema.d.ts +114 -0
- package/node_modules/zod/v4/core/to-json-schema.js +448 -0
- package/node_modules/zod/v4/core/util.cjs +734 -0
- package/node_modules/zod/v4/core/util.d.cts +200 -0
- package/node_modules/zod/v4/core/util.d.ts +200 -0
- package/node_modules/zod/v4/core/util.js +674 -0
- package/node_modules/zod/v4/core/versions.cjs +8 -0
- package/node_modules/zod/v4/core/versions.d.cts +5 -0
- package/node_modules/zod/v4/core/versions.d.ts +5 -0
- package/node_modules/zod/v4/core/versions.js +5 -0
- package/node_modules/zod/v4/index.cjs +22 -0
- package/node_modules/zod/v4/index.d.cts +3 -0
- package/node_modules/zod/v4/index.d.ts +3 -0
- package/node_modules/zod/v4/index.js +3 -0
- package/node_modules/zod/v4/locales/ar.cjs +133 -0
- package/node_modules/zod/v4/locales/ar.d.cts +5 -0
- package/node_modules/zod/v4/locales/ar.d.ts +4 -0
- package/node_modules/zod/v4/locales/ar.js +106 -0
- package/node_modules/zod/v4/locales/az.cjs +132 -0
- package/node_modules/zod/v4/locales/az.d.cts +5 -0
- package/node_modules/zod/v4/locales/az.d.ts +4 -0
- package/node_modules/zod/v4/locales/az.js +105 -0
- package/node_modules/zod/v4/locales/be.cjs +183 -0
- package/node_modules/zod/v4/locales/be.d.cts +5 -0
- package/node_modules/zod/v4/locales/be.d.ts +4 -0
- package/node_modules/zod/v4/locales/be.js +156 -0
- package/node_modules/zod/v4/locales/bg.cjs +147 -0
- package/node_modules/zod/v4/locales/bg.d.cts +5 -0
- package/node_modules/zod/v4/locales/bg.d.ts +4 -0
- package/node_modules/zod/v4/locales/bg.js +120 -0
- package/node_modules/zod/v4/locales/ca.cjs +134 -0
- package/node_modules/zod/v4/locales/ca.d.cts +5 -0
- package/node_modules/zod/v4/locales/ca.d.ts +4 -0
- package/node_modules/zod/v4/locales/ca.js +107 -0
- package/node_modules/zod/v4/locales/cs.cjs +138 -0
- package/node_modules/zod/v4/locales/cs.d.cts +5 -0
- package/node_modules/zod/v4/locales/cs.d.ts +4 -0
- package/node_modules/zod/v4/locales/cs.js +111 -0
- package/node_modules/zod/v4/locales/da.cjs +142 -0
- package/node_modules/zod/v4/locales/da.d.cts +5 -0
- package/node_modules/zod/v4/locales/da.d.ts +4 -0
- package/node_modules/zod/v4/locales/da.js +115 -0
- package/node_modules/zod/v4/locales/de.cjs +135 -0
- package/node_modules/zod/v4/locales/de.d.cts +5 -0
- package/node_modules/zod/v4/locales/de.d.ts +4 -0
- package/node_modules/zod/v4/locales/de.js +108 -0
- package/node_modules/zod/v4/locales/el.cjs +136 -0
- package/node_modules/zod/v4/locales/el.d.cts +5 -0
- package/node_modules/zod/v4/locales/el.d.ts +4 -0
- package/node_modules/zod/v4/locales/el.js +109 -0
- package/node_modules/zod/v4/locales/en.cjs +140 -0
- package/node_modules/zod/v4/locales/en.d.cts +5 -0
- package/node_modules/zod/v4/locales/en.d.ts +4 -0
- package/node_modules/zod/v4/locales/en.js +113 -0
- package/node_modules/zod/v4/locales/eo.cjs +136 -0
- package/node_modules/zod/v4/locales/eo.d.cts +5 -0
- package/node_modules/zod/v4/locales/eo.d.ts +4 -0
- package/node_modules/zod/v4/locales/eo.js +109 -0
- package/node_modules/zod/v4/locales/es.cjs +159 -0
- package/node_modules/zod/v4/locales/es.d.cts +5 -0
- package/node_modules/zod/v4/locales/es.d.ts +4 -0
- package/node_modules/zod/v4/locales/es.js +132 -0
- package/node_modules/zod/v4/locales/fa.cjs +141 -0
- package/node_modules/zod/v4/locales/fa.d.cts +5 -0
- package/node_modules/zod/v4/locales/fa.d.ts +4 -0
- package/node_modules/zod/v4/locales/fa.js +114 -0
- package/node_modules/zod/v4/locales/fi.cjs +139 -0
- package/node_modules/zod/v4/locales/fi.d.cts +5 -0
- package/node_modules/zod/v4/locales/fi.d.ts +4 -0
- package/node_modules/zod/v4/locales/fi.js +112 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +134 -0
- package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.js +107 -0
- package/node_modules/zod/v4/locales/fr.cjs +152 -0
- package/node_modules/zod/v4/locales/fr.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr.js +125 -0
- package/node_modules/zod/v4/locales/he.cjs +241 -0
- package/node_modules/zod/v4/locales/he.d.cts +5 -0
- package/node_modules/zod/v4/locales/he.d.ts +4 -0
- package/node_modules/zod/v4/locales/he.js +214 -0
- package/node_modules/zod/v4/locales/hr.cjs +149 -0
- package/node_modules/zod/v4/locales/hr.d.cts +5 -0
- package/node_modules/zod/v4/locales/hr.d.ts +4 -0
- package/node_modules/zod/v4/locales/hr.js +122 -0
- package/node_modules/zod/v4/locales/hu.cjs +135 -0
- package/node_modules/zod/v4/locales/hu.d.cts +5 -0
- package/node_modules/zod/v4/locales/hu.d.ts +4 -0
- package/node_modules/zod/v4/locales/hu.js +108 -0
- package/node_modules/zod/v4/locales/hy.cjs +174 -0
- package/node_modules/zod/v4/locales/hy.d.cts +5 -0
- package/node_modules/zod/v4/locales/hy.d.ts +4 -0
- package/node_modules/zod/v4/locales/hy.js +147 -0
- package/node_modules/zod/v4/locales/id.cjs +133 -0
- package/node_modules/zod/v4/locales/id.d.cts +5 -0
- package/node_modules/zod/v4/locales/id.d.ts +4 -0
- package/node_modules/zod/v4/locales/id.js +106 -0
- package/node_modules/zod/v4/locales/index.cjs +111 -0
- package/node_modules/zod/v4/locales/index.d.cts +52 -0
- package/node_modules/zod/v4/locales/index.d.ts +52 -0
- package/node_modules/zod/v4/locales/index.js +52 -0
- package/node_modules/zod/v4/locales/is.cjs +136 -0
- package/node_modules/zod/v4/locales/is.d.cts +5 -0
- package/node_modules/zod/v4/locales/is.d.ts +4 -0
- package/node_modules/zod/v4/locales/is.js +109 -0
- package/node_modules/zod/v4/locales/it.cjs +135 -0
- package/node_modules/zod/v4/locales/it.d.cts +5 -0
- package/node_modules/zod/v4/locales/it.d.ts +4 -0
- package/node_modules/zod/v4/locales/it.js +108 -0
- package/node_modules/zod/v4/locales/ja.cjs +134 -0
- package/node_modules/zod/v4/locales/ja.d.cts +5 -0
- package/node_modules/zod/v4/locales/ja.d.ts +4 -0
- package/node_modules/zod/v4/locales/ja.js +107 -0
- package/node_modules/zod/v4/locales/ka.cjs +139 -0
- package/node_modules/zod/v4/locales/ka.d.cts +5 -0
- package/node_modules/zod/v4/locales/ka.d.ts +4 -0
- package/node_modules/zod/v4/locales/ka.js +112 -0
- package/node_modules/zod/v4/locales/kh.cjs +12 -0
- package/node_modules/zod/v4/locales/kh.d.cts +5 -0
- package/node_modules/zod/v4/locales/kh.d.ts +5 -0
- package/node_modules/zod/v4/locales/kh.js +5 -0
- package/node_modules/zod/v4/locales/km.cjs +137 -0
- package/node_modules/zod/v4/locales/km.d.cts +5 -0
- package/node_modules/zod/v4/locales/km.d.ts +4 -0
- package/node_modules/zod/v4/locales/km.js +110 -0
- package/node_modules/zod/v4/locales/ko.cjs +138 -0
- package/node_modules/zod/v4/locales/ko.d.cts +5 -0
- package/node_modules/zod/v4/locales/ko.d.ts +4 -0
- package/node_modules/zod/v4/locales/ko.js +111 -0
- package/node_modules/zod/v4/locales/lt.cjs +230 -0
- package/node_modules/zod/v4/locales/lt.d.cts +5 -0
- package/node_modules/zod/v4/locales/lt.d.ts +4 -0
- package/node_modules/zod/v4/locales/lt.js +203 -0
- package/node_modules/zod/v4/locales/mk.cjs +136 -0
- package/node_modules/zod/v4/locales/mk.d.cts +5 -0
- package/node_modules/zod/v4/locales/mk.d.ts +4 -0
- package/node_modules/zod/v4/locales/mk.js +109 -0
- package/node_modules/zod/v4/locales/ms.cjs +134 -0
- package/node_modules/zod/v4/locales/ms.d.cts +5 -0
- package/node_modules/zod/v4/locales/ms.d.ts +4 -0
- package/node_modules/zod/v4/locales/ms.js +107 -0
- package/node_modules/zod/v4/locales/nl.cjs +137 -0
- package/node_modules/zod/v4/locales/nl.d.cts +5 -0
- package/node_modules/zod/v4/locales/nl.d.ts +4 -0
- package/node_modules/zod/v4/locales/nl.js +110 -0
- package/node_modules/zod/v4/locales/no.cjs +135 -0
- package/node_modules/zod/v4/locales/no.d.cts +5 -0
- package/node_modules/zod/v4/locales/no.d.ts +4 -0
- package/node_modules/zod/v4/locales/no.js +108 -0
- package/node_modules/zod/v4/locales/ota.cjs +136 -0
- package/node_modules/zod/v4/locales/ota.d.cts +5 -0
- package/node_modules/zod/v4/locales/ota.d.ts +4 -0
- package/node_modules/zod/v4/locales/ota.js +109 -0
- package/node_modules/zod/v4/locales/package.json +7 -0
- package/node_modules/zod/v4/locales/pl.cjs +136 -0
- package/node_modules/zod/v4/locales/pl.d.cts +5 -0
- package/node_modules/zod/v4/locales/pl.d.ts +4 -0
- package/node_modules/zod/v4/locales/pl.js +109 -0
- package/node_modules/zod/v4/locales/ps.cjs +141 -0
- package/node_modules/zod/v4/locales/ps.d.cts +5 -0
- package/node_modules/zod/v4/locales/ps.d.ts +4 -0
- package/node_modules/zod/v4/locales/ps.js +114 -0
- package/node_modules/zod/v4/locales/pt.cjs +135 -0
- package/node_modules/zod/v4/locales/pt.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt.js +108 -0
- package/node_modules/zod/v4/locales/ro.cjs +146 -0
- package/node_modules/zod/v4/locales/ro.d.cts +5 -0
- package/node_modules/zod/v4/locales/ro.d.ts +4 -0
- package/node_modules/zod/v4/locales/ro.js +119 -0
- package/node_modules/zod/v4/locales/ru.cjs +183 -0
- package/node_modules/zod/v4/locales/ru.d.cts +5 -0
- package/node_modules/zod/v4/locales/ru.d.ts +4 -0
- package/node_modules/zod/v4/locales/ru.js +156 -0
- package/node_modules/zod/v4/locales/sl.cjs +136 -0
- package/node_modules/zod/v4/locales/sl.d.cts +5 -0
- package/node_modules/zod/v4/locales/sl.d.ts +4 -0
- package/node_modules/zod/v4/locales/sl.js +109 -0
- package/node_modules/zod/v4/locales/sv.cjs +137 -0
- package/node_modules/zod/v4/locales/sv.d.cts +5 -0
- package/node_modules/zod/v4/locales/sv.d.ts +4 -0
- package/node_modules/zod/v4/locales/sv.js +110 -0
- package/node_modules/zod/v4/locales/ta.cjs +137 -0
- package/node_modules/zod/v4/locales/ta.d.cts +5 -0
- package/node_modules/zod/v4/locales/ta.d.ts +4 -0
- package/node_modules/zod/v4/locales/ta.js +110 -0
- package/node_modules/zod/v4/locales/th.cjs +137 -0
- package/node_modules/zod/v4/locales/th.d.cts +5 -0
- package/node_modules/zod/v4/locales/th.d.ts +4 -0
- package/node_modules/zod/v4/locales/th.js +110 -0
- package/node_modules/zod/v4/locales/tr.cjs +132 -0
- package/node_modules/zod/v4/locales/tr.d.cts +5 -0
- package/node_modules/zod/v4/locales/tr.d.ts +4 -0
- package/node_modules/zod/v4/locales/tr.js +105 -0
- package/node_modules/zod/v4/locales/ua.cjs +12 -0
- package/node_modules/zod/v4/locales/ua.d.cts +5 -0
- package/node_modules/zod/v4/locales/ua.d.ts +5 -0
- package/node_modules/zod/v4/locales/ua.js +5 -0
- package/node_modules/zod/v4/locales/uk.cjs +135 -0
- package/node_modules/zod/v4/locales/uk.d.cts +5 -0
- package/node_modules/zod/v4/locales/uk.d.ts +4 -0
- package/node_modules/zod/v4/locales/uk.js +108 -0
- package/node_modules/zod/v4/locales/ur.cjs +137 -0
- package/node_modules/zod/v4/locales/ur.d.cts +5 -0
- package/node_modules/zod/v4/locales/ur.d.ts +4 -0
- package/node_modules/zod/v4/locales/ur.js +110 -0
- package/node_modules/zod/v4/locales/uz.cjs +137 -0
- package/node_modules/zod/v4/locales/uz.d.cts +5 -0
- package/node_modules/zod/v4/locales/uz.d.ts +4 -0
- package/node_modules/zod/v4/locales/uz.js +110 -0
- package/node_modules/zod/v4/locales/vi.cjs +135 -0
- package/node_modules/zod/v4/locales/vi.d.cts +5 -0
- package/node_modules/zod/v4/locales/vi.d.ts +4 -0
- package/node_modules/zod/v4/locales/vi.js +108 -0
- package/node_modules/zod/v4/locales/yo.cjs +134 -0
- package/node_modules/zod/v4/locales/yo.d.cts +5 -0
- package/node_modules/zod/v4/locales/yo.d.ts +4 -0
- package/node_modules/zod/v4/locales/yo.js +107 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +136 -0
- package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.js +109 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +134 -0
- package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.js +107 -0
- package/node_modules/zod/v4/mini/checks.cjs +34 -0
- package/node_modules/zod/v4/mini/checks.d.cts +1 -0
- package/node_modules/zod/v4/mini/checks.d.ts +1 -0
- package/node_modules/zod/v4/mini/checks.js +1 -0
- package/node_modules/zod/v4/mini/coerce.cjs +52 -0
- package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
- package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
- package/node_modules/zod/v4/mini/coerce.js +22 -0
- package/node_modules/zod/v4/mini/external.cjs +63 -0
- package/node_modules/zod/v4/mini/external.d.cts +13 -0
- package/node_modules/zod/v4/mini/external.d.ts +13 -0
- package/node_modules/zod/v4/mini/external.js +14 -0
- package/node_modules/zod/v4/mini/index.cjs +32 -0
- package/node_modules/zod/v4/mini/index.d.cts +3 -0
- package/node_modules/zod/v4/mini/index.d.ts +3 -0
- package/node_modules/zod/v4/mini/index.js +3 -0
- package/node_modules/zod/v4/mini/iso.cjs +64 -0
- package/node_modules/zod/v4/mini/iso.d.cts +22 -0
- package/node_modules/zod/v4/mini/iso.d.ts +22 -0
- package/node_modules/zod/v4/mini/iso.js +34 -0
- package/node_modules/zod/v4/mini/package.json +7 -0
- package/node_modules/zod/v4/mini/parse.cjs +16 -0
- package/node_modules/zod/v4/mini/parse.d.cts +1 -0
- package/node_modules/zod/v4/mini/parse.d.ts +1 -0
- package/node_modules/zod/v4/mini/parse.js +1 -0
- package/node_modules/zod/v4/mini/schemas.cjs +1083 -0
- package/node_modules/zod/v4/mini/schemas.d.cts +445 -0
- package/node_modules/zod/v4/mini/schemas.d.ts +445 -0
- package/node_modules/zod/v4/mini/schemas.js +961 -0
- package/node_modules/zod/v4/package.json +7 -0
- package/node_modules/zod/v4-mini/index.cjs +32 -0
- package/node_modules/zod/v4-mini/index.d.cts +3 -0
- package/node_modules/zod/v4-mini/index.d.ts +3 -0
- package/node_modules/zod/v4-mini/index.js +3 -0
- package/node_modules/zod/v4-mini/package.json +7 -0
- package/package.json +26 -10
- package/dist/chunk-Q4PUTBMV.js.map +0 -1
- package/dist/chunk-RQRT27Q3.js.map +0 -1
- package/dist/chunk-SFI2T6TE.js.map +0 -1
- package/dist/chunk-UDLRVMML.js.map +0 -1
- package/dist/public-route-7IK5D7V7.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,27 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolvePublicFilePath,
|
|
3
|
+
servePublicFile
|
|
4
|
+
} from "./chunk-G62AMJHS.js";
|
|
5
|
+
import {
|
|
6
|
+
synthesizeViewDocument
|
|
7
|
+
} from "./chunk-EAPJUSK7.js";
|
|
8
|
+
import {
|
|
9
|
+
hasExplicitAssetsBase,
|
|
10
|
+
originFromAssetsBase,
|
|
11
|
+
resolveAssetsBase,
|
|
12
|
+
resolveServerOrigin
|
|
13
|
+
} from "./chunk-FC2Z2VFO.js";
|
|
14
|
+
import {
|
|
15
|
+
registerOpenAPITools
|
|
16
|
+
} from "./chunk-AATFAERC.js";
|
|
17
|
+
import {
|
|
18
|
+
completable,
|
|
19
|
+
normalizeCompletions
|
|
20
|
+
} from "./chunk-KIZ72TIK.js";
|
|
1
21
|
import {
|
|
2
22
|
authInfoFromRequest,
|
|
3
|
-
composeFetch,
|
|
4
23
|
getOAuthProtectedResourceMetadataUrl,
|
|
24
|
+
oauthMetadata,
|
|
25
|
+
requireBearerAuth
|
|
26
|
+
} from "./chunk-Z326HADF.js";
|
|
27
|
+
import {
|
|
28
|
+
composeFetch,
|
|
5
29
|
getRequestBag,
|
|
6
30
|
hostValidationMiddleware,
|
|
31
|
+
isHtmlNavigationRequest,
|
|
7
32
|
jsonBodyMiddleware,
|
|
8
33
|
matchesPath,
|
|
9
34
|
matchesPathPrefix,
|
|
10
|
-
oauthMetadata,
|
|
11
35
|
originValidationMiddleware,
|
|
36
|
+
pathUnderBase,
|
|
12
37
|
pathnameOf,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from "./chunk-
|
|
38
|
+
routeFetch,
|
|
39
|
+
toFrameworkHandler
|
|
40
|
+
} from "./chunk-QUUANIE4.js";
|
|
16
41
|
import {
|
|
17
42
|
getOAuthProviderOptions,
|
|
18
43
|
resolveConfiguredOAuthResource,
|
|
19
44
|
resolveLocalOAuthResource,
|
|
20
45
|
wrapOAuthTokenVerifier
|
|
21
46
|
} from "./chunk-DPL7OEXC.js";
|
|
22
|
-
import {
|
|
23
|
-
registerOpenAPITools
|
|
24
|
-
} from "./chunk-AATFAERC.js";
|
|
25
47
|
|
|
26
48
|
// src/server.ts
|
|
27
49
|
import {
|
|
@@ -29,9 +51,236 @@ import {
|
|
|
29
51
|
localhostAllowedOrigins,
|
|
30
52
|
McpServer as SdkMcpServer,
|
|
31
53
|
ResourceTemplate,
|
|
32
|
-
isInputRequiredResult
|
|
54
|
+
isInputRequiredResult as isInputRequiredResult2
|
|
33
55
|
} from "@modelcontextprotocol/server";
|
|
34
56
|
|
|
57
|
+
// src/branding.ts
|
|
58
|
+
var FAVICON_CACHE_CONTROL = "public, max-age=31536000, immutable";
|
|
59
|
+
var FAVICON_REDIRECT_CACHE_CONTROL = "public, max-age=300";
|
|
60
|
+
function protocolOf(value) {
|
|
61
|
+
const match = /^([a-z][a-z\d+.-]*):/i.exec(value);
|
|
62
|
+
return match?.[1]?.toLowerCase();
|
|
63
|
+
}
|
|
64
|
+
function publicAssetPath(basePath, source) {
|
|
65
|
+
const prefix = basePath === "/" ? "" : basePath;
|
|
66
|
+
return `${prefix}/_mcp-use/public/${source.split("/").map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
67
|
+
}
|
|
68
|
+
function isLocalPublicSource(source) {
|
|
69
|
+
return protocolOf(source) === void 0;
|
|
70
|
+
}
|
|
71
|
+
function selectFaviconFromIcons(icons) {
|
|
72
|
+
return icons[0];
|
|
73
|
+
}
|
|
74
|
+
function assertLocalPublicSource(source, field) {
|
|
75
|
+
if (source.startsWith("/") || source.includes("\\") || source.includes("?") || source.includes("#") || source.split("/").some((segment) => segment === "" || segment === "..")) {
|
|
76
|
+
throw new TypeError(
|
|
77
|
+
`${field} must be an http(s) URL, image data URL, or safe path relative to public/`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function parseDataImage(source, field) {
|
|
82
|
+
const comma = source.indexOf(",");
|
|
83
|
+
if (comma < 0) {
|
|
84
|
+
throw new TypeError(`${field} must be a valid image data URL`);
|
|
85
|
+
}
|
|
86
|
+
const metadata = source.slice(5, comma);
|
|
87
|
+
const payload = source.slice(comma + 1);
|
|
88
|
+
const parts = metadata.split(";");
|
|
89
|
+
const mimeType = parts[0]?.toLowerCase() ?? "";
|
|
90
|
+
if (!mimeType.startsWith("image/")) {
|
|
91
|
+
throw new TypeError(`${field} data URL must use an image MIME type`);
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
if (parts.includes("base64")) {
|
|
95
|
+
const binary = atob(payload);
|
|
96
|
+
return {
|
|
97
|
+
mimeType,
|
|
98
|
+
bytes: Uint8Array.from(binary, (character) => character.charCodeAt(0))
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
mimeType,
|
|
103
|
+
bytes: new TextEncoder().encode(decodeURIComponent(payload))
|
|
104
|
+
};
|
|
105
|
+
} catch {
|
|
106
|
+
throw new TypeError(`${field} must be a valid image data URL`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function assertBrandingSource(source, field) {
|
|
110
|
+
if (typeof source !== "string" || source.length === 0) {
|
|
111
|
+
throw new TypeError(`${field} must be a non-empty string`);
|
|
112
|
+
}
|
|
113
|
+
const protocol = protocolOf(source);
|
|
114
|
+
if (protocol === void 0) {
|
|
115
|
+
assertLocalPublicSource(source, field);
|
|
116
|
+
return source;
|
|
117
|
+
}
|
|
118
|
+
if (protocol === "data") {
|
|
119
|
+
parseDataImage(source, field);
|
|
120
|
+
return source;
|
|
121
|
+
}
|
|
122
|
+
if (protocol !== "http" && protocol !== "https") {
|
|
123
|
+
throw new TypeError(
|
|
124
|
+
`${field} must be an http(s) URL, image data URL, or safe path relative to public/`
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
try {
|
|
128
|
+
new URL(source);
|
|
129
|
+
} catch {
|
|
130
|
+
throw new TypeError(`${field} must be a valid absolute http(s) URL`);
|
|
131
|
+
}
|
|
132
|
+
return source;
|
|
133
|
+
}
|
|
134
|
+
function normalizeServerBranding(config) {
|
|
135
|
+
let websiteUrl;
|
|
136
|
+
if (config.websiteUrl !== void 0) {
|
|
137
|
+
if (typeof config.websiteUrl !== "string" || config.websiteUrl.length === 0) {
|
|
138
|
+
throw new TypeError(
|
|
139
|
+
"websiteUrl must be a non-empty absolute http(s) URL"
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
let parsed;
|
|
143
|
+
try {
|
|
144
|
+
parsed = new URL(config.websiteUrl);
|
|
145
|
+
} catch {
|
|
146
|
+
throw new TypeError(
|
|
147
|
+
"websiteUrl must be a non-empty absolute http(s) URL"
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
151
|
+
throw new TypeError(
|
|
152
|
+
"websiteUrl must be a non-empty absolute http(s) URL"
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
websiteUrl = config.websiteUrl;
|
|
156
|
+
}
|
|
157
|
+
let icons;
|
|
158
|
+
if (config.icons !== void 0) {
|
|
159
|
+
if (!Array.isArray(config.icons)) {
|
|
160
|
+
throw new TypeError("icons must be an array of MCP Icon objects");
|
|
161
|
+
}
|
|
162
|
+
icons = Object.freeze(
|
|
163
|
+
config.icons.map((value, index) => {
|
|
164
|
+
if (typeof value !== "object" || value === null) {
|
|
165
|
+
throw new TypeError(`icons[${index}] must be an MCP Icon object`);
|
|
166
|
+
}
|
|
167
|
+
const icon = value;
|
|
168
|
+
const src = assertBrandingSource(icon["src"], `icons[${index}].src`);
|
|
169
|
+
const mimeType = icon["mimeType"];
|
|
170
|
+
if (mimeType !== void 0 && (typeof mimeType !== "string" || !mimeType.toLowerCase().startsWith("image/"))) {
|
|
171
|
+
throw new TypeError(
|
|
172
|
+
`icons[${index}].mimeType must be an image MIME type when provided`
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
const sizes = icon["sizes"];
|
|
176
|
+
if (sizes !== void 0 && (!Array.isArray(sizes) || sizes.some((size) => typeof size !== "string" || size.length === 0))) {
|
|
177
|
+
throw new TypeError(
|
|
178
|
+
`icons[${index}].sizes must be an array of non-empty strings when provided`
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
const normalizedSizes = sizes === void 0 ? void 0 : sizes.map((size) => size);
|
|
182
|
+
const theme = icon["theme"];
|
|
183
|
+
if (theme !== void 0 && theme !== "light" && theme !== "dark") {
|
|
184
|
+
throw new TypeError(
|
|
185
|
+
`icons[${index}].theme must be "light" or "dark" when provided`
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
return Object.freeze({
|
|
189
|
+
src,
|
|
190
|
+
...mimeType !== void 0 && { mimeType },
|
|
191
|
+
...normalizedSizes !== void 0 && {
|
|
192
|
+
sizes: Object.freeze(normalizedSizes)
|
|
193
|
+
},
|
|
194
|
+
...theme !== void 0 && { theme }
|
|
195
|
+
});
|
|
196
|
+
})
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
const explicitFavicon = config.favicon === void 0 ? void 0 : assertBrandingSource(config.favicon, "favicon");
|
|
200
|
+
const inferred = explicitFavicon === void 0 ? selectFaviconFromIcons(icons ?? []) : void 0;
|
|
201
|
+
const favicon = explicitFavicon ?? inferred?.src;
|
|
202
|
+
const faviconMimeType = inferred?.mimeType ?? icons?.find((icon) => icon.src === explicitFavicon)?.mimeType;
|
|
203
|
+
return Object.freeze({
|
|
204
|
+
...favicon !== void 0 && { favicon },
|
|
205
|
+
...faviconMimeType !== void 0 && { faviconMimeType },
|
|
206
|
+
...icons !== void 0 && { icons },
|
|
207
|
+
...websiteUrl !== void 0 && { websiteUrl }
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
function resolveImplementationIcons(icons, request, basePath) {
|
|
211
|
+
if (icons === void 0) {
|
|
212
|
+
return void 0;
|
|
213
|
+
}
|
|
214
|
+
return icons.map((icon) => ({
|
|
215
|
+
...icon,
|
|
216
|
+
src: request !== void 0 && isLocalPublicSource(icon.src) ? `${resolveAssetsBase(request)}${publicAssetPath(basePath, icon.src)}` : icon.src,
|
|
217
|
+
...icon.sizes !== void 0 && { sizes: [...icon.sizes] }
|
|
218
|
+
}));
|
|
219
|
+
}
|
|
220
|
+
function hasLocalBrandingAsset(branding) {
|
|
221
|
+
return branding.favicon !== void 0 && isLocalPublicSource(branding.favicon) || branding.icons?.some((icon) => isLocalPublicSource(icon.src)) === true;
|
|
222
|
+
}
|
|
223
|
+
function createFaviconHandler(branding, options) {
|
|
224
|
+
const source = branding.favicon;
|
|
225
|
+
if (source === void 0) {
|
|
226
|
+
return void 0;
|
|
227
|
+
}
|
|
228
|
+
return async (request) => {
|
|
229
|
+
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
230
|
+
return new Response("Method Not Allowed", {
|
|
231
|
+
status: 405,
|
|
232
|
+
headers: { Allow: "GET, HEAD" }
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
if (new URL(request.url).pathname !== "/favicon.ico") {
|
|
236
|
+
return new Response("Not Found", { status: 404 });
|
|
237
|
+
}
|
|
238
|
+
const protocol = protocolOf(source);
|
|
239
|
+
if (protocol === "http" || protocol === "https") {
|
|
240
|
+
return new Response(null, {
|
|
241
|
+
status: 307,
|
|
242
|
+
headers: {
|
|
243
|
+
Location: source,
|
|
244
|
+
"Cache-Control": FAVICON_REDIRECT_CACHE_CONTROL
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
if (protocol === "data") {
|
|
249
|
+
const data = parseDataImage(source, "favicon");
|
|
250
|
+
return new Response(
|
|
251
|
+
request.method === "HEAD" ? null : data.bytes.buffer,
|
|
252
|
+
{
|
|
253
|
+
status: 200,
|
|
254
|
+
headers: {
|
|
255
|
+
"Content-Type": branding.faviconMimeType ?? data.mimeType,
|
|
256
|
+
"Cache-Control": FAVICON_CACHE_CONTROL,
|
|
257
|
+
"X-Content-Type-Options": "nosniff"
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
const { join } = await import("path");
|
|
263
|
+
const publicRoot = options.dev ? join(options.projectRoot, "public") : join(options.projectRoot, ".mcp-use/build/views/public");
|
|
264
|
+
const diskPath = await resolvePublicFilePath(publicRoot, source);
|
|
265
|
+
if (diskPath === null) {
|
|
266
|
+
return new Response("Not Found", {
|
|
267
|
+
status: 404,
|
|
268
|
+
headers: { "Cache-Control": "no-store" }
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
const response = await servePublicFile(diskPath, {
|
|
272
|
+
...options.deferCors === true && { deferCors: true },
|
|
273
|
+
...request.method === "HEAD" && { head: true }
|
|
274
|
+
});
|
|
275
|
+
response.headers.set("Cache-Control", FAVICON_CACHE_CONTROL);
|
|
276
|
+
response.headers.set("X-Content-Type-Options", "nosniff");
|
|
277
|
+
if (branding.faviconMimeType !== void 0) {
|
|
278
|
+
response.headers.set("Content-Type", branding.faviconMimeType);
|
|
279
|
+
}
|
|
280
|
+
return response;
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
35
284
|
// src/config.ts
|
|
36
285
|
function assertServerConfig(config) {
|
|
37
286
|
if (config.basePath !== void 0) {
|
|
@@ -222,12 +471,318 @@ function toAuthenticatedRequestContext(ctx) {
|
|
|
222
471
|
};
|
|
223
472
|
}
|
|
224
473
|
|
|
474
|
+
// src/middleware/cors.ts
|
|
475
|
+
var DEFAULT_METHODS = ["GET", "HEAD", "POST", "OPTIONS"];
|
|
476
|
+
var DEFAULT_ALLOWED_HEADERS = [
|
|
477
|
+
"Content-Type",
|
|
478
|
+
"Authorization",
|
|
479
|
+
"mcp-protocol-version",
|
|
480
|
+
"mcp-method",
|
|
481
|
+
"mcp-name"
|
|
482
|
+
];
|
|
483
|
+
function resolveAllowedOrigin(origin, requestOrigin) {
|
|
484
|
+
if (origin === void 0) {
|
|
485
|
+
return requestOrigin;
|
|
486
|
+
}
|
|
487
|
+
if (typeof origin === "function") {
|
|
488
|
+
return origin(requestOrigin);
|
|
489
|
+
}
|
|
490
|
+
if (origin === "*") {
|
|
491
|
+
return "*";
|
|
492
|
+
}
|
|
493
|
+
if (Array.isArray(origin)) {
|
|
494
|
+
if (requestOrigin !== null && origin.includes(requestOrigin)) {
|
|
495
|
+
return requestOrigin;
|
|
496
|
+
}
|
|
497
|
+
return null;
|
|
498
|
+
}
|
|
499
|
+
return origin;
|
|
500
|
+
}
|
|
501
|
+
function corsHeaders(options, request) {
|
|
502
|
+
if (request.headers.has("Access-Control-Allow-Origin")) {
|
|
503
|
+
return void 0;
|
|
504
|
+
}
|
|
505
|
+
const requestOrigin = request.headers.get("Origin");
|
|
506
|
+
const allowedOrigin = resolveAllowedOrigin(options.origin, requestOrigin);
|
|
507
|
+
if (allowedOrigin === null) {
|
|
508
|
+
return void 0;
|
|
509
|
+
}
|
|
510
|
+
const headers = {
|
|
511
|
+
"Access-Control-Allow-Origin": allowedOrigin,
|
|
512
|
+
"Access-Control-Allow-Methods": options.methods.join(", "),
|
|
513
|
+
"Access-Control-Allow-Headers": options.allowedHeaders.join(", ")
|
|
514
|
+
};
|
|
515
|
+
if (options.credentials) {
|
|
516
|
+
headers["Access-Control-Allow-Credentials"] = "true";
|
|
517
|
+
}
|
|
518
|
+
if (allowedOrigin !== "*") {
|
|
519
|
+
headers.Vary = "Origin";
|
|
520
|
+
}
|
|
521
|
+
return headers;
|
|
522
|
+
}
|
|
523
|
+
function mergeCorsHeaders(response, headers) {
|
|
524
|
+
if (response.headers.has("Access-Control-Allow-Origin")) {
|
|
525
|
+
return response;
|
|
526
|
+
}
|
|
527
|
+
const merged = new Headers(response.headers);
|
|
528
|
+
const corsHeaders2 = new Headers(headers);
|
|
529
|
+
corsHeaders2.forEach((value, key) => {
|
|
530
|
+
merged.set(key, value);
|
|
531
|
+
});
|
|
532
|
+
return new Response(response.body, {
|
|
533
|
+
status: response.status,
|
|
534
|
+
statusText: response.statusText,
|
|
535
|
+
headers: merged
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
function corsFetchMiddleware(options) {
|
|
539
|
+
const enabled = options.enabled !== false;
|
|
540
|
+
if (!enabled) {
|
|
541
|
+
return async (_request, next) => next();
|
|
542
|
+
}
|
|
543
|
+
const resolved = {
|
|
544
|
+
...options.origin !== void 0 && { origin: options.origin },
|
|
545
|
+
methods: options.methods ?? DEFAULT_METHODS,
|
|
546
|
+
allowedHeaders: options.allowedHeaders ?? DEFAULT_ALLOWED_HEADERS,
|
|
547
|
+
credentials: options.credentials ?? false
|
|
548
|
+
};
|
|
549
|
+
return async (request, next) => {
|
|
550
|
+
const headers = corsHeaders(resolved, request);
|
|
551
|
+
if (headers === void 0) {
|
|
552
|
+
return next();
|
|
553
|
+
}
|
|
554
|
+
if (request.method === "OPTIONS") {
|
|
555
|
+
return new Response(null, { status: 204, headers });
|
|
556
|
+
}
|
|
557
|
+
const response = await next();
|
|
558
|
+
return mergeCorsHeaders(response, headers);
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
function isGlobalCorsEnabled(cors) {
|
|
562
|
+
return cors !== void 0 && cors.enabled !== false;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// src/middleware/mcp-middleware.ts
|
|
566
|
+
import {
|
|
567
|
+
CallToolResultSchema,
|
|
568
|
+
GetPromptResultSchema,
|
|
569
|
+
ListPromptsResultSchema,
|
|
570
|
+
ListResourcesResultSchema,
|
|
571
|
+
ListToolsResultSchema,
|
|
572
|
+
ReadResourceResultSchema
|
|
573
|
+
} from "@modelcontextprotocol/core";
|
|
574
|
+
import { isInputRequiredResult } from "@modelcontextprotocol/server";
|
|
575
|
+
var MCP_MIDDLEWARE_METHODS = [
|
|
576
|
+
"tools/call",
|
|
577
|
+
"tools/list",
|
|
578
|
+
"resources/read",
|
|
579
|
+
"resources/list",
|
|
580
|
+
"prompts/get",
|
|
581
|
+
"prompts/list"
|
|
582
|
+
];
|
|
583
|
+
function withMcpMiddlewareParams(request, params) {
|
|
584
|
+
if (typeof request !== "object" || request === null || Array.isArray(request)) {
|
|
585
|
+
throw new TypeError(
|
|
586
|
+
"[mcp-use] MCP middleware received an invalid downstream request"
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
return { ...request, params };
|
|
590
|
+
}
|
|
591
|
+
function createMcpMiddlewareEntry(pattern, handler) {
|
|
592
|
+
const normalizedPattern = normalizeMcpMiddlewarePattern(pattern);
|
|
593
|
+
const invoke = handler;
|
|
594
|
+
if (normalizedPattern !== "*" && !isMcpMiddlewareMethod(normalizedPattern)) {
|
|
595
|
+
throw new TypeError(
|
|
596
|
+
`Unsupported MCP middleware pattern "${pattern}". Use an exact MCP method or "mcp:*".`
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
if (normalizedPattern === "*") {
|
|
600
|
+
return {
|
|
601
|
+
pattern: normalizedPattern,
|
|
602
|
+
handler: async (ctx, next) => {
|
|
603
|
+
let downstreamCalled = false;
|
|
604
|
+
let downstreamResult;
|
|
605
|
+
await invoke(ctx, async () => {
|
|
606
|
+
downstreamResult = await next();
|
|
607
|
+
downstreamCalled = true;
|
|
608
|
+
});
|
|
609
|
+
if (!downstreamCalled) {
|
|
610
|
+
throw new Error(
|
|
611
|
+
`Wildcard MCP middleware "${normalizedPattern}" must call next()`
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
return downstreamResult;
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
return {
|
|
619
|
+
pattern: normalizedPattern,
|
|
620
|
+
handler: (ctx, next) => invoke(ctx, next)
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
function createMcpEventListenerEntry(pattern, handler) {
|
|
624
|
+
const { pattern: normalizedPattern, phase } = parseMcpPattern(pattern);
|
|
625
|
+
const invoke = handler;
|
|
626
|
+
return {
|
|
627
|
+
pattern: normalizedPattern,
|
|
628
|
+
phase,
|
|
629
|
+
handler: (ctx, result) => invoke(ctx, result)
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
function matchesPattern(pattern, method) {
|
|
633
|
+
if (pattern === "*") return true;
|
|
634
|
+
if (pattern.endsWith("/*")) {
|
|
635
|
+
const prefix = pattern.slice(0, -1);
|
|
636
|
+
return method.startsWith(prefix);
|
|
637
|
+
}
|
|
638
|
+
return pattern === method;
|
|
639
|
+
}
|
|
640
|
+
function isMcpMiddlewareMethod(value) {
|
|
641
|
+
return MCP_MIDDLEWARE_METHODS.some((method) => method === value);
|
|
642
|
+
}
|
|
643
|
+
function composeMiddleware(entries, method, innerFn) {
|
|
644
|
+
const matching = entries.filter(
|
|
645
|
+
(entry) => matchesPattern(entry.pattern, method)
|
|
646
|
+
);
|
|
647
|
+
if (matching.length === 0) {
|
|
648
|
+
return (_ctx) => innerFn();
|
|
649
|
+
}
|
|
650
|
+
return (ctx) => {
|
|
651
|
+
let index = -1;
|
|
652
|
+
const dispatch = (i) => {
|
|
653
|
+
if (i <= index) {
|
|
654
|
+
return Promise.reject(new Error("next() called multiple times"));
|
|
655
|
+
}
|
|
656
|
+
index = i;
|
|
657
|
+
if (i === matching.length) {
|
|
658
|
+
return innerFn();
|
|
659
|
+
}
|
|
660
|
+
const entry = matching[i];
|
|
661
|
+
return entry.handler(ctx, () => dispatch(i + 1));
|
|
662
|
+
};
|
|
663
|
+
return dispatch(0);
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
function freezeMiddlewareContext(ctx) {
|
|
667
|
+
return Object.freeze({
|
|
668
|
+
method: ctx.method,
|
|
669
|
+
params: Object.freeze({ ...ctx.params }),
|
|
670
|
+
...ctx.request !== void 0 && { request: ctx.request },
|
|
671
|
+
...ctx.session !== void 0 && {
|
|
672
|
+
session: Object.freeze({ ...ctx.session })
|
|
673
|
+
},
|
|
674
|
+
...ctx.auth !== void 0 && { auth: ctx.auth },
|
|
675
|
+
state: new Map(ctx.state)
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
async function runMcpOperation(middlewares, events, method, ctx, innerFn) {
|
|
679
|
+
dispatchMcpEvents(events, method, "before", ctx);
|
|
680
|
+
const chained = composeMiddleware(middlewares, method, innerFn);
|
|
681
|
+
const result = await chained(ctx);
|
|
682
|
+
assertValidMiddlewareResult(method, result);
|
|
683
|
+
dispatchMcpEvents(events, method, "complete", ctx, result);
|
|
684
|
+
return result;
|
|
685
|
+
}
|
|
686
|
+
function assertValidMiddlewareResult(method, result) {
|
|
687
|
+
if ((method === "tools/call" || method === "resources/read" || method === "prompts/get") && isInputRequiredResult(result)) {
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
const validation = (() => {
|
|
691
|
+
switch (method) {
|
|
692
|
+
case "tools/call":
|
|
693
|
+
assertArrayProperty(method, result, "content");
|
|
694
|
+
return CallToolResultSchema.safeParse(result);
|
|
695
|
+
case "tools/list":
|
|
696
|
+
assertArrayResult(method, result);
|
|
697
|
+
return ListToolsResultSchema.safeParse({ tools: result });
|
|
698
|
+
case "resources/read":
|
|
699
|
+
assertArrayProperty(method, result, "contents");
|
|
700
|
+
return ReadResourceResultSchema.safeParse(result);
|
|
701
|
+
case "resources/list":
|
|
702
|
+
assertArrayResult(method, result);
|
|
703
|
+
return ListResourcesResultSchema.safeParse({ resources: result });
|
|
704
|
+
case "prompts/get":
|
|
705
|
+
assertArrayProperty(method, result, "messages");
|
|
706
|
+
return GetPromptResultSchema.safeParse(result);
|
|
707
|
+
case "prompts/list":
|
|
708
|
+
assertArrayResult(method, result);
|
|
709
|
+
return ListPromptsResultSchema.safeParse({ prompts: result });
|
|
710
|
+
default:
|
|
711
|
+
throw new TypeError(`Unsupported MCP middleware method "${method}"`);
|
|
712
|
+
}
|
|
713
|
+
})();
|
|
714
|
+
if (!validation.success) {
|
|
715
|
+
throw new TypeError(
|
|
716
|
+
`[mcp-use] ${method} middleware returned an invalid result: ${validation.error.message}`
|
|
717
|
+
);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
function assertArrayResult(method, result) {
|
|
721
|
+
if (!Array.isArray(result)) {
|
|
722
|
+
throw new TypeError(
|
|
723
|
+
`[mcp-use] ${method} middleware returned an invalid result: expected an array`
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
function assertArrayProperty(method, result, property) {
|
|
728
|
+
if (typeof result !== "object" || result === null || !Array.isArray(result[property])) {
|
|
729
|
+
throw new TypeError(
|
|
730
|
+
`[mcp-use] ${method} middleware returned an invalid result: expected a ${property} array`
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
function dispatchMcpEvents(events, method, phase, ctx, result) {
|
|
735
|
+
const frozen = freezeMiddlewareContext(ctx);
|
|
736
|
+
for (const entry of events) {
|
|
737
|
+
if (entry.phase !== phase || !matchesPattern(entry.pattern, method)) {
|
|
738
|
+
continue;
|
|
739
|
+
}
|
|
740
|
+
try {
|
|
741
|
+
entry.handler(frozen, result);
|
|
742
|
+
} catch (error) {
|
|
743
|
+
console.error(
|
|
744
|
+
`[mcp-use] MCP event listener for "${entry.pattern}" (${phase}) threw:`,
|
|
745
|
+
error
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
function parseMcpPattern(raw) {
|
|
751
|
+
const pattern = raw.startsWith("mcp:") ? raw.slice(4) : raw;
|
|
752
|
+
if (pattern.endsWith(":complete")) {
|
|
753
|
+
return {
|
|
754
|
+
pattern: pattern.slice(0, -":complete".length),
|
|
755
|
+
phase: "complete"
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
return { pattern, phase: "before" };
|
|
759
|
+
}
|
|
760
|
+
function normalizeMcpMiddlewarePattern(raw) {
|
|
761
|
+
return raw.startsWith("mcp:") ? raw.slice(4) : raw;
|
|
762
|
+
}
|
|
763
|
+
|
|
225
764
|
// src/inspector-shell.ts
|
|
226
765
|
var INSPECTOR_TAG = "beta";
|
|
227
766
|
var DEFAULT_INSPECTOR_ASSETS_URL = `https://cdn.jsdelivr.net/npm/@mcp-use/inspector@${INSPECTOR_TAG}/dist/cdn/inspector.js`;
|
|
228
767
|
function inspectorStylesUrl(assetsUrl) {
|
|
229
768
|
return assetsUrl.replace(/\.js(?=$|[?#])/, ".css");
|
|
230
769
|
}
|
|
770
|
+
function isDefaultJsdelivrInspectorUrl(url) {
|
|
771
|
+
return url.startsWith("https://cdn.jsdelivr.net/npm/@mcp-use/inspector@");
|
|
772
|
+
}
|
|
773
|
+
function withInspectorCacheBust(assetsUrl) {
|
|
774
|
+
if (!isDefaultJsdelivrInspectorUrl(assetsUrl)) return assetsUrl;
|
|
775
|
+
const sep = assetsUrl.includes("?") ? "&" : "?";
|
|
776
|
+
return `${assetsUrl}${sep}cb=${crypto.randomUUID()}`;
|
|
777
|
+
}
|
|
778
|
+
function matchesInspectorShellPath(pathname, basePath) {
|
|
779
|
+
const prefix = pathUnderBase(basePath, "inspector");
|
|
780
|
+
if (pathname !== prefix && !pathname.startsWith(`${prefix}/`)) {
|
|
781
|
+
return false;
|
|
782
|
+
}
|
|
783
|
+
const suffix = pathname.slice(prefix.length);
|
|
784
|
+
return suffix !== "/api" && !suffix.startsWith("/api/");
|
|
785
|
+
}
|
|
231
786
|
function escapeHtml(value) {
|
|
232
787
|
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
233
788
|
}
|
|
@@ -235,10 +790,18 @@ function serializeForInlineScript(value) {
|
|
|
235
790
|
return JSON.stringify(value).replaceAll("<", "\\u003c");
|
|
236
791
|
}
|
|
237
792
|
function renderInspectorShell(options) {
|
|
238
|
-
const {
|
|
793
|
+
const {
|
|
794
|
+
serverName,
|
|
795
|
+
basePath,
|
|
796
|
+
faviconHref,
|
|
797
|
+
faviconType,
|
|
798
|
+
assetsUrl,
|
|
799
|
+
manufactChatUrl
|
|
800
|
+
} = options;
|
|
239
801
|
const serializedBasePath = serializeForInlineScript(basePath);
|
|
240
802
|
const serializedManufactChatUrl = manufactChatUrl ? serializeForInlineScript(manufactChatUrl) : null;
|
|
241
|
-
const
|
|
803
|
+
const rawUrl = assetsUrl ?? DEFAULT_INSPECTOR_ASSETS_URL;
|
|
804
|
+
const bundleUrl = withInspectorCacheBust(rawUrl);
|
|
242
805
|
const scriptSrc = escapeHtml(bundleUrl);
|
|
243
806
|
const stylesHref = escapeHtml(inspectorStylesUrl(bundleUrl));
|
|
244
807
|
return `<!doctype html>
|
|
@@ -247,6 +810,7 @@ function renderInspectorShell(options) {
|
|
|
247
810
|
<meta charset="utf-8" />
|
|
248
811
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
249
812
|
<title>${escapeHtml(serverName)} \u2014 MCP Inspector</title>
|
|
813
|
+
${faviconHref !== void 0 ? `<link rel="icon"${faviconType !== void 0 ? ` type="${escapeHtml(faviconType)}"` : ""} href="${escapeHtml(faviconHref)}" />` : ""}
|
|
250
814
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
251
815
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
252
816
|
<link
|
|
@@ -257,10 +821,65 @@ function renderInspectorShell(options) {
|
|
|
257
821
|
<style>
|
|
258
822
|
:root { color-scheme: light dark; }
|
|
259
823
|
html, body { height: 100%; margin: 0; background-color: #f3f3f3; }
|
|
824
|
+
#root { height: 100%; }
|
|
825
|
+
.mcp-boot {
|
|
826
|
+
display: flex;
|
|
827
|
+
height: 100%;
|
|
828
|
+
align-items: center;
|
|
829
|
+
justify-content: center;
|
|
830
|
+
background-color: #f3f3f3;
|
|
831
|
+
}
|
|
832
|
+
.mcp-boot-inner {
|
|
833
|
+
display: flex;
|
|
834
|
+
flex-direction: column;
|
|
835
|
+
align-items: center;
|
|
836
|
+
gap: 16px;
|
|
837
|
+
}
|
|
838
|
+
.mcp-boot-spinner {
|
|
839
|
+
width: 32px;
|
|
840
|
+
height: 32px;
|
|
841
|
+
color: #52525b;
|
|
842
|
+
animation: mcp-boot-spin 1s linear infinite;
|
|
843
|
+
}
|
|
844
|
+
.mcp-boot-label {
|
|
845
|
+
margin: 0;
|
|
846
|
+
font-family: Ubuntu, sans-serif;
|
|
847
|
+
font-size: 0.875rem;
|
|
848
|
+
line-height: 1.25rem;
|
|
849
|
+
color: #52525b;
|
|
850
|
+
}
|
|
851
|
+
@keyframes mcp-boot-spin {
|
|
852
|
+
to { transform: rotate(360deg); }
|
|
853
|
+
}
|
|
854
|
+
@media (prefers-color-scheme: dark) {
|
|
855
|
+
html, body { background-color: #000; }
|
|
856
|
+
.mcp-boot { background-color: #000; }
|
|
857
|
+
.mcp-boot-spinner, .mcp-boot-label { color: #a1a1aa; }
|
|
858
|
+
}
|
|
260
859
|
</style>
|
|
261
860
|
</head>
|
|
262
861
|
<body>
|
|
263
|
-
<div id="root"
|
|
862
|
+
<div id="root">
|
|
863
|
+
<div class="mcp-boot">
|
|
864
|
+
<div class="mcp-boot-inner">
|
|
865
|
+
<svg
|
|
866
|
+
class="mcp-boot-spinner"
|
|
867
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
868
|
+
viewBox="0 0 24 24"
|
|
869
|
+
fill="none"
|
|
870
|
+
stroke="currentColor"
|
|
871
|
+
stroke-width="2"
|
|
872
|
+
stroke-linecap="round"
|
|
873
|
+
stroke-linejoin="round"
|
|
874
|
+
role="status"
|
|
875
|
+
aria-label="Loading"
|
|
876
|
+
>
|
|
877
|
+
<path d="M21 12a9 9 0 1 1-6.219-8.56" />
|
|
878
|
+
</svg>
|
|
879
|
+
<p class="mcp-boot-label">Connecting to MCP server...</p>
|
|
880
|
+
</div>
|
|
881
|
+
</div>
|
|
882
|
+
</div>
|
|
264
883
|
<script>
|
|
265
884
|
(function () {
|
|
266
885
|
var basePath = ${serializedBasePath};
|
|
@@ -272,6 +891,7 @@ function renderInspectorShell(options) {
|
|
|
272
891
|
};
|
|
273
892
|
// Read by the current inspector bundle to derive its own URLs.
|
|
274
893
|
window.__MCP_BASE_PATH__ = basePath;
|
|
894
|
+
${process.env.MCP_USE_DEV_CLI === "1" ? "window.__MCP_DEV_CLI__ = true;" : ""}
|
|
275
895
|
${serializedManufactChatUrl ? `window.__MANUFACT_CHAT_URL__ = ${serializedManufactChatUrl};` : ""}
|
|
276
896
|
// The bundle carries Node-flavored dependencies that touch \`process\`
|
|
277
897
|
// at module scope; give them the same browser polyfill the v1
|
|
@@ -304,22 +924,27 @@ function createInspectorHandler(inspector, options) {
|
|
|
304
924
|
const { assetsUrl: configAssetsUrl, manufactChatUrl: configManufactChatUrl } = inspector ?? {};
|
|
305
925
|
const assetsUrl = configAssetsUrl ?? process.env["MCP_USE_INSPECTOR_ASSETS_URL"] ?? void 0;
|
|
306
926
|
const manufactChatUrl = configManufactChatUrl ?? process.env["MANUFACT_CHAT_URL"] ?? void 0;
|
|
307
|
-
const
|
|
927
|
+
const shellOptions = {
|
|
308
928
|
serverName: options.serverName,
|
|
309
929
|
basePath: options.basePath,
|
|
930
|
+
...options.faviconHref !== void 0 && {
|
|
931
|
+
faviconHref: options.faviconHref
|
|
932
|
+
},
|
|
933
|
+
...options.faviconType !== void 0 && {
|
|
934
|
+
faviconType: options.faviconType
|
|
935
|
+
},
|
|
310
936
|
assetsUrl,
|
|
311
937
|
manufactChatUrl
|
|
312
|
-
}
|
|
313
|
-
const path = `${options.basePath}/inspector`;
|
|
314
|
-
const slashPath = `${path}/`;
|
|
938
|
+
};
|
|
315
939
|
return async (request) => {
|
|
316
940
|
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
317
941
|
return new Response("Method Not Allowed", { status: 405 });
|
|
318
942
|
}
|
|
319
943
|
const pathname = new URL(request.url).pathname;
|
|
320
|
-
if (pathname
|
|
944
|
+
if (!matchesInspectorShellPath(pathname, options.basePath)) {
|
|
321
945
|
return new Response("Not Found", { status: 404 });
|
|
322
946
|
}
|
|
947
|
+
const html = renderInspectorShell(shellOptions);
|
|
323
948
|
return new Response(request.method === "HEAD" ? null : html, {
|
|
324
949
|
status: 200,
|
|
325
950
|
headers: { "content-type": "text/html; charset=utf-8" }
|
|
@@ -709,9 +1334,6 @@ function createMcpMount(factory, options = {}) {
|
|
|
709
1334
|
};
|
|
710
1335
|
return { handler, fetch };
|
|
711
1336
|
}
|
|
712
|
-
function mountMcp(factory, options = {}) {
|
|
713
|
-
return createMcpMount(factory, options);
|
|
714
|
-
}
|
|
715
1337
|
|
|
716
1338
|
// src/tools.ts
|
|
717
1339
|
function resolveToolInputSchema(definition) {
|
|
@@ -721,117 +1343,148 @@ function resolveToolInputSchema(definition) {
|
|
|
721
1343
|
// src/views/register.ts
|
|
722
1344
|
var registerViews = /* @__PURE__ */ Symbol("mcp-use/registerViews");
|
|
723
1345
|
|
|
724
|
-
// src/views/
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
1346
|
+
// src/views/csp-env.ts
|
|
1347
|
+
var CATEGORY_ENV = {
|
|
1348
|
+
connectDomains: "CSP_CONNECT_DOMAINS",
|
|
1349
|
+
resourceDomains: "CSP_RESOURCE_DOMAINS",
|
|
1350
|
+
frameDomains: "CSP_FRAME_DOMAINS",
|
|
1351
|
+
baseUriDomains: "CSP_BASE_URI_DOMAINS"
|
|
1352
|
+
};
|
|
1353
|
+
function parseDomainList(raw) {
|
|
1354
|
+
if (raw === void 0 || raw.trim() === "") {
|
|
1355
|
+
return [];
|
|
730
1356
|
}
|
|
731
|
-
return
|
|
732
|
-
}
|
|
733
|
-
function resolvePublicBase(origin, basePath) {
|
|
734
|
-
return `${origin}${basePath}/_mcp-use/public/`;
|
|
1357
|
+
return raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
735
1358
|
}
|
|
736
|
-
function
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
1359
|
+
function readEnvDomains(name) {
|
|
1360
|
+
if (typeof process === "undefined") {
|
|
1361
|
+
return void 0;
|
|
1362
|
+
}
|
|
1363
|
+
const raw = process.env[name];
|
|
1364
|
+
if (raw === void 0 || raw.trim() === "") {
|
|
1365
|
+
return void 0;
|
|
1366
|
+
}
|
|
1367
|
+
return parseDomainList(raw);
|
|
741
1368
|
}
|
|
742
|
-
function
|
|
743
|
-
return
|
|
1369
|
+
function readCspUrlsShortcut() {
|
|
1370
|
+
return readEnvDomains("CSP_URLS") ?? [];
|
|
744
1371
|
}
|
|
745
|
-
function
|
|
746
|
-
const
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
const styleTag = entry.css.length > 0 ? `<style>${escapeInlineStyle(entry.css)}</style>` : "";
|
|
752
|
-
const moduleScript = `<script type="module">${escapeInlineScript(entry.js)}</script>`;
|
|
753
|
-
return `<!doctype html>
|
|
754
|
-
<html>
|
|
755
|
-
<head>
|
|
756
|
-
<meta charset="utf-8">
|
|
757
|
-
${configScript}
|
|
758
|
-
${styleTag}
|
|
759
|
-
</head>
|
|
760
|
-
<body>
|
|
761
|
-
<div id="root"></div>
|
|
762
|
-
${moduleScript}
|
|
763
|
-
</body>
|
|
764
|
-
</html>`;
|
|
765
|
-
}
|
|
766
|
-
const cssLinks = entry.css.map(
|
|
767
|
-
(path) => `<link rel="stylesheet" href="${escapeHtml2(resolveAssetUrl(path, origin))}">`
|
|
768
|
-
).join("\n");
|
|
769
|
-
const scriptTags = (entry.scripts ?? []).map(
|
|
770
|
-
(path) => `<script type="module" src="${escapeHtml2(resolveAssetUrl(path, origin))}"></script>`
|
|
771
|
-
).join("\n");
|
|
772
|
-
const entryUrl = resolveAssetUrl(entry.entry, origin);
|
|
773
|
-
return `<!doctype html>
|
|
774
|
-
<html>
|
|
775
|
-
<head>
|
|
776
|
-
<meta charset="utf-8">
|
|
777
|
-
${configScript}
|
|
778
|
-
${cssLinks}
|
|
779
|
-
</head>
|
|
780
|
-
<body>
|
|
781
|
-
<div id="root"></div>
|
|
782
|
-
${scriptTags}
|
|
783
|
-
<script type="module" src="${escapeHtml2(entryUrl)}"></script>
|
|
784
|
-
</body>
|
|
785
|
-
</html>`;
|
|
1372
|
+
function readEnvDomainsForCategory(category) {
|
|
1373
|
+
const perCategory = readEnvDomains(CATEGORY_ENV[category]);
|
|
1374
|
+
if (perCategory !== void 0) {
|
|
1375
|
+
return perCategory;
|
|
1376
|
+
}
|
|
1377
|
+
return readCspUrlsShortcut();
|
|
786
1378
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
const
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
const proto = request.headers.get("x-forwarded-proto");
|
|
798
|
-
const host = request.headers.get("x-forwarded-host");
|
|
799
|
-
if (proto !== null && host !== null) {
|
|
800
|
-
const firstHost = host.split(",")[0]?.trim();
|
|
801
|
-
const firstProto = proto.split(",")[0]?.trim();
|
|
802
|
-
if (firstHost !== void 0 && firstProto !== void 0 && firstHost !== "") {
|
|
803
|
-
return `${firstProto}://${firstHost}`;
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
return new URL(request.url).origin;
|
|
807
|
-
}
|
|
808
|
-
function parseForwardedHeader(header) {
|
|
809
|
-
for (const part of header.split(",")) {
|
|
810
|
-
const params = /* @__PURE__ */ new Map();
|
|
811
|
-
for (const token of part.split(";")) {
|
|
812
|
-
const [key, ...rest] = token.trim().split("=");
|
|
813
|
-
if (key === void 0 || rest.length === 0) {
|
|
814
|
-
continue;
|
|
1379
|
+
function mergeDomainLists(...segments) {
|
|
1380
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1381
|
+
const out = [];
|
|
1382
|
+
for (const segment of segments) {
|
|
1383
|
+
for (const domain of segment) {
|
|
1384
|
+
if (!seen.has(domain)) {
|
|
1385
|
+
seen.add(domain);
|
|
1386
|
+
out.push(domain);
|
|
815
1387
|
}
|
|
816
|
-
params.set(key.toLowerCase(), rest.join("=").replace(/^"|"$/g, ""));
|
|
817
1388
|
}
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
1389
|
+
}
|
|
1390
|
+
return out;
|
|
1391
|
+
}
|
|
1392
|
+
function toWebSocketOrigin(serverOrigin) {
|
|
1393
|
+
if (serverOrigin.startsWith("https://")) {
|
|
1394
|
+
return `wss://${serverOrigin.slice("https://".length)}`;
|
|
1395
|
+
}
|
|
1396
|
+
if (serverOrigin.startsWith("http://")) {
|
|
1397
|
+
return `ws://${serverOrigin.slice("http://".length)}`;
|
|
1398
|
+
}
|
|
1399
|
+
return serverOrigin;
|
|
1400
|
+
}
|
|
1401
|
+
function buildMergedResourceCsp(authorFacts, options) {
|
|
1402
|
+
const author = authorFacts?.csp;
|
|
1403
|
+
const mcpConnectAuto = [];
|
|
1404
|
+
if (options.serverOrigin !== "") {
|
|
1405
|
+
mcpConnectAuto.push(options.serverOrigin);
|
|
1406
|
+
if (options.hmrWs === true) {
|
|
1407
|
+
mcpConnectAuto.push(toWebSocketOrigin(options.serverOrigin));
|
|
822
1408
|
}
|
|
823
1409
|
}
|
|
824
|
-
|
|
1410
|
+
const mcpResourceAuto = [];
|
|
1411
|
+
const resourceOrigin = options.explicitAssetsBase ? options.assetsOrigin : options.serverOrigin;
|
|
1412
|
+
if (resourceOrigin !== "") {
|
|
1413
|
+
mcpResourceAuto.push(resourceOrigin);
|
|
1414
|
+
}
|
|
1415
|
+
const connectDomains = mergeDomainLists(
|
|
1416
|
+
author?.connectDomains ?? [],
|
|
1417
|
+
readEnvDomainsForCategory("connectDomains"),
|
|
1418
|
+
mcpConnectAuto
|
|
1419
|
+
);
|
|
1420
|
+
const resourceDomains = mergeDomainLists(
|
|
1421
|
+
author?.resourceDomains ?? [],
|
|
1422
|
+
readEnvDomainsForCategory("resourceDomains"),
|
|
1423
|
+
mcpResourceAuto
|
|
1424
|
+
);
|
|
1425
|
+
const frameDomains = mergeDomainLists(
|
|
1426
|
+
author?.frameDomains ?? [],
|
|
1427
|
+
readEnvDomainsForCategory("frameDomains")
|
|
1428
|
+
);
|
|
1429
|
+
const baseUriDomains = mergeDomainLists(
|
|
1430
|
+
author?.baseUriDomains ?? [],
|
|
1431
|
+
readEnvDomainsForCategory("baseUriDomains")
|
|
1432
|
+
);
|
|
1433
|
+
return {
|
|
1434
|
+
...author,
|
|
1435
|
+
connectDomains,
|
|
1436
|
+
resourceDomains,
|
|
1437
|
+
frameDomains,
|
|
1438
|
+
baseUriDomains
|
|
1439
|
+
};
|
|
825
1440
|
}
|
|
826
1441
|
|
|
827
1442
|
// src/views/routes.ts
|
|
828
1443
|
var PUBLIC_BUILD_DIR = ".mcp-use/build/views/public";
|
|
829
1444
|
var PUBLIC_DEV_DIR = "public";
|
|
830
|
-
|
|
1445
|
+
var VIEW_ASSETS_BUILD_ROOT = ".mcp-use/build/views";
|
|
1446
|
+
function createViewAssetsHandler(basePath, views, options) {
|
|
831
1447
|
if (views.size === 0) {
|
|
832
1448
|
return void 0;
|
|
833
1449
|
}
|
|
834
|
-
const
|
|
1450
|
+
const assetsPrefix = pathUnderBase(basePath, "_mcp-use/views");
|
|
1451
|
+
const projectRoot = options?.projectRoot ?? process.cwd();
|
|
1452
|
+
return async (request) => {
|
|
1453
|
+
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
1454
|
+
return new Response("Method Not Allowed", { status: 405 });
|
|
1455
|
+
}
|
|
1456
|
+
if (!matchesPathPrefix(request, assetsPrefix)) {
|
|
1457
|
+
return new Response("Not Found", { status: 404 });
|
|
1458
|
+
}
|
|
1459
|
+
const pathname = pathnameOf(request);
|
|
1460
|
+
const remainder = pathname.slice(assetsPrefix.length + 1);
|
|
1461
|
+
const slash = remainder.indexOf("/");
|
|
1462
|
+
if (slash <= 0 || slash === remainder.length - 1) {
|
|
1463
|
+
return new Response("Not Found", { status: 404 });
|
|
1464
|
+
}
|
|
1465
|
+
const viewName = remainder.slice(0, slash);
|
|
1466
|
+
const subpath = remainder.slice(slash + 1);
|
|
1467
|
+
const entry = views.get(viewName);
|
|
1468
|
+
if (entry === void 0 || entry.kind !== "external") {
|
|
1469
|
+
return new Response("Not Found", { status: 404 });
|
|
1470
|
+
}
|
|
1471
|
+
const [{ join }, { resolvePublicFilePath: resolvePublicFilePath2, servePublicFile: servePublicFile2 }] = await Promise.all([import("path"), import("./public-route-RWJVJQTX.js")]);
|
|
1472
|
+
const viewRoot = join(projectRoot, VIEW_ASSETS_BUILD_ROOT, viewName);
|
|
1473
|
+
const diskPath = await resolvePublicFilePath2(viewRoot, subpath);
|
|
1474
|
+
if (diskPath === null) {
|
|
1475
|
+
return new Response("Not Found", { status: 404 });
|
|
1476
|
+
}
|
|
1477
|
+
return await servePublicFile2(diskPath, {
|
|
1478
|
+
...options?.deferCors === true && { deferCors: true },
|
|
1479
|
+
...request.method === "HEAD" && { head: true }
|
|
1480
|
+
});
|
|
1481
|
+
};
|
|
1482
|
+
}
|
|
1483
|
+
function createViewPublicHandler(basePath, views, options) {
|
|
1484
|
+
if (views.size === 0 && options?.enabled !== true) {
|
|
1485
|
+
return void 0;
|
|
1486
|
+
}
|
|
1487
|
+
const publicPrefix = pathUnderBase(basePath, "_mcp-use/public");
|
|
835
1488
|
const subdir = options?.dev === true ? PUBLIC_DEV_DIR : PUBLIC_BUILD_DIR;
|
|
836
1489
|
const projectRoot = options?.projectRoot ?? process.cwd();
|
|
837
1490
|
return async (request) => {
|
|
@@ -842,34 +1495,53 @@ function createViewPublicHandler(basePath, views, options) {
|
|
|
842
1495
|
return new Response("Not Found", { status: 404 });
|
|
843
1496
|
}
|
|
844
1497
|
const pathname = pathnameOf(request);
|
|
845
|
-
const
|
|
1498
|
+
const encodedSubpath = pathname.slice(publicPrefix.length + 1);
|
|
1499
|
+
let subpath;
|
|
1500
|
+
try {
|
|
1501
|
+
subpath = decodeURIComponent(encodedSubpath);
|
|
1502
|
+
} catch {
|
|
1503
|
+
return new Response("Not Found", { status: 404 });
|
|
1504
|
+
}
|
|
846
1505
|
if (subpath.length === 0) {
|
|
847
1506
|
return new Response("Not Found", { status: 404 });
|
|
848
1507
|
}
|
|
849
|
-
const [{ join }, { resolvePublicFilePath, servePublicFile }] = await Promise.all([import("path"), import("./public-route-
|
|
1508
|
+
const [{ join }, { resolvePublicFilePath: resolvePublicFilePath2, servePublicFile: servePublicFile2 }] = await Promise.all([import("path"), import("./public-route-RWJVJQTX.js")]);
|
|
850
1509
|
const publicRoot = join(projectRoot, subdir);
|
|
851
|
-
const diskPath = await
|
|
1510
|
+
const diskPath = await resolvePublicFilePath2(publicRoot, subpath);
|
|
852
1511
|
if (diskPath === null) {
|
|
853
1512
|
return new Response("Not Found", { status: 404 });
|
|
854
1513
|
}
|
|
855
|
-
return await
|
|
1514
|
+
return await servePublicFile2(diskPath, {
|
|
1515
|
+
...options?.deferCors === true && { deferCors: true },
|
|
1516
|
+
...request.method === "HEAD" && { head: true }
|
|
1517
|
+
});
|
|
856
1518
|
};
|
|
857
1519
|
}
|
|
858
1520
|
|
|
859
1521
|
// src/views/wire.ts
|
|
860
|
-
function buildToolUiMeta(viewName, visibility) {
|
|
861
|
-
if (viewName === void 0 && visibility === void 0) {
|
|
1522
|
+
function buildToolUiMeta(viewName, visibility, existingMetadata) {
|
|
1523
|
+
if (viewName === void 0 && visibility === void 0 && existingMetadata === void 0) {
|
|
862
1524
|
return void 0;
|
|
863
1525
|
}
|
|
864
|
-
const
|
|
865
|
-
const
|
|
1526
|
+
const meta = { ...existingMetadata };
|
|
1527
|
+
const existingUi = existingMetadata?.[UI_META_KEY];
|
|
1528
|
+
const existingUiIsObject = typeof existingUi === "object" && existingUi !== null && !Array.isArray(existingUi);
|
|
1529
|
+
const ui = existingUiIsObject ? { ...existingUi } : {};
|
|
866
1530
|
if (viewName !== void 0) {
|
|
867
1531
|
const resourceUri = viewResourceUri(viewName);
|
|
868
1532
|
ui["resourceUri"] = resourceUri;
|
|
869
1533
|
meta[UI_RESOURCE_URI_META_KEY] = resourceUri;
|
|
1534
|
+
} else {
|
|
1535
|
+
delete ui["resourceUri"];
|
|
1536
|
+
delete meta[UI_RESOURCE_URI_META_KEY];
|
|
870
1537
|
}
|
|
871
1538
|
if (visibility !== void 0) {
|
|
872
1539
|
ui["visibility"] = [visibility];
|
|
1540
|
+
} else {
|
|
1541
|
+
delete ui["visibility"];
|
|
1542
|
+
}
|
|
1543
|
+
if (viewName !== void 0 || visibility !== void 0 || existingUiIsObject) {
|
|
1544
|
+
meta[UI_META_KEY] = ui;
|
|
873
1545
|
}
|
|
874
1546
|
return meta;
|
|
875
1547
|
}
|
|
@@ -880,36 +1552,20 @@ function buildToolResultUiMeta(viewName) {
|
|
|
880
1552
|
[UI_RESOURCE_URI_META_KEY]: resourceUri
|
|
881
1553
|
};
|
|
882
1554
|
}
|
|
883
|
-
function
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
}
|
|
892
|
-
function buildResourceUiMeta(authorFacts, servingOrigin, options) {
|
|
893
|
-
const authorResourceDomains = authorFacts?.csp?.resourceDomains ?? [];
|
|
894
|
-
const resourceDomains = [
|
|
895
|
-
...authorResourceDomains,
|
|
896
|
-
...servingOrigin !== "" ? [servingOrigin] : []
|
|
897
|
-
];
|
|
898
|
-
const authorConnectDomains = authorFacts?.csp?.connectDomains ?? [];
|
|
899
|
-
const connectDomains = [...authorConnectDomains];
|
|
900
|
-
if (options?.hmrWs === true && servingOrigin !== "") {
|
|
901
|
-
const wsOrigin = toWebSocketOrigin(servingOrigin);
|
|
902
|
-
if (!connectDomains.includes(wsOrigin)) {
|
|
903
|
-
connectDomains.push(wsOrigin);
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
const ui = {
|
|
907
|
-
csp: {
|
|
908
|
-
...authorFacts?.csp,
|
|
909
|
-
connectDomains,
|
|
910
|
-
resourceDomains
|
|
911
|
-
}
|
|
1555
|
+
function resolveCspOptions(options) {
|
|
1556
|
+
const request = options?.request;
|
|
1557
|
+
const serverOrigin = options?.serverOrigin ?? (request !== void 0 ? resolveServerOrigin(request) : "");
|
|
1558
|
+
const assetsBase = options?.assetsBase ?? (request !== void 0 ? resolveAssetsBase(request) : serverOrigin);
|
|
1559
|
+
return {
|
|
1560
|
+
serverOrigin,
|
|
1561
|
+
assetsOrigin: originFromAssetsBase(assetsBase),
|
|
1562
|
+
explicitAssetsBase: hasExplicitAssetsBase(),
|
|
1563
|
+
...options?.hmrWs === true ? { hmrWs: true } : {}
|
|
912
1564
|
};
|
|
1565
|
+
}
|
|
1566
|
+
function buildResourceUiMeta(authorFacts, options) {
|
|
1567
|
+
const csp = buildMergedResourceCsp(authorFacts, resolveCspOptions(options));
|
|
1568
|
+
const ui = { csp };
|
|
913
1569
|
if (authorFacts?.permissions !== void 0) {
|
|
914
1570
|
ui["permissions"] = authorFacts.permissions;
|
|
915
1571
|
}
|
|
@@ -921,19 +1577,35 @@ function buildResourceUiMeta(authorFacts, servingOrigin, options) {
|
|
|
921
1577
|
}
|
|
922
1578
|
return { [UI_META_KEY]: ui };
|
|
923
1579
|
}
|
|
924
|
-
function viewResourceConfig(_viewName, _entry, authorFacts,
|
|
1580
|
+
function viewResourceConfig(_viewName, _entry, authorFacts, options) {
|
|
925
1581
|
return {
|
|
926
1582
|
mimeType: UI_MIME_TYPE,
|
|
927
1583
|
...authorFacts?.description !== void 0 && {
|
|
928
1584
|
description: authorFacts.description
|
|
929
1585
|
},
|
|
930
|
-
_meta: buildResourceUiMeta(authorFacts,
|
|
1586
|
+
_meta: buildResourceUiMeta(authorFacts, options)
|
|
931
1587
|
};
|
|
932
1588
|
}
|
|
933
1589
|
|
|
934
1590
|
// src/server.ts
|
|
1591
|
+
function omitRootSchemaDialect(schema) {
|
|
1592
|
+
if (typeof schema !== "object" || schema === null || Array.isArray(schema) || !("$schema" in schema)) {
|
|
1593
|
+
return schema;
|
|
1594
|
+
}
|
|
1595
|
+
const emittedSchema = { ...schema };
|
|
1596
|
+
delete emittedSchema["$schema"];
|
|
1597
|
+
return emittedSchema;
|
|
1598
|
+
}
|
|
1599
|
+
function omitToolSchemaDialects(tools) {
|
|
1600
|
+
return tools.map((tool) => ({
|
|
1601
|
+
...tool,
|
|
1602
|
+
inputSchema: omitRootSchemaDialect(tool.inputSchema),
|
|
1603
|
+
...tool.outputSchema === void 0 ? {} : { outputSchema: omitRootSchemaDialect(tool.outputSchema) }
|
|
1604
|
+
}));
|
|
1605
|
+
}
|
|
935
1606
|
var MCPServer = class _MCPServer {
|
|
936
1607
|
#config;
|
|
1608
|
+
#branding;
|
|
937
1609
|
#tools = /* @__PURE__ */ new Map();
|
|
938
1610
|
#resources = /* @__PURE__ */ new Map();
|
|
939
1611
|
#resourceTemplates = /* @__PURE__ */ new Map();
|
|
@@ -948,7 +1620,7 @@ var MCPServer = class _MCPServer {
|
|
|
948
1620
|
#viewsPrimed = false;
|
|
949
1621
|
/** When true, resource CSP emission includes the HMR websocket origin. */
|
|
950
1622
|
#viewsDevMode = false;
|
|
951
|
-
/** Project root for filesystem-backed view
|
|
1623
|
+
/** Project root for filesystem-backed view bundle and public routes. */
|
|
952
1624
|
#viewsProjectRoot = process.cwd();
|
|
953
1625
|
#fetchHandler;
|
|
954
1626
|
#handler;
|
|
@@ -958,6 +1630,14 @@ var MCPServer = class _MCPServer {
|
|
|
958
1630
|
#oauthResourceConfigurationAbsent = false;
|
|
959
1631
|
/** Whether the mounted app validates Host headers (fixed at first mount). */
|
|
960
1632
|
#hostValidated = false;
|
|
1633
|
+
#mcpMiddlewares = [];
|
|
1634
|
+
#mcpEventListeners = [];
|
|
1635
|
+
/** Client instances created by {@link MCPServer.proxy} and owned by this server. */
|
|
1636
|
+
#proxyOwners = [];
|
|
1637
|
+
/** Proxy registrations that {@link close} must let finish before cleanup. */
|
|
1638
|
+
#proxyOperations = /* @__PURE__ */ new Set();
|
|
1639
|
+
/** Whether terminal shutdown has begun. */
|
|
1640
|
+
#closed = false;
|
|
961
1641
|
/**
|
|
962
1642
|
* Create an MCP server from a parsed, bundled OpenAPI document.
|
|
963
1643
|
*
|
|
@@ -997,6 +1677,7 @@ var MCPServer = class _MCPServer {
|
|
|
997
1677
|
constructor(config) {
|
|
998
1678
|
assertServerConfig(config);
|
|
999
1679
|
this.#config = config;
|
|
1680
|
+
this.#branding = normalizeServerBranding(config);
|
|
1000
1681
|
if (config.oauth !== void 0) {
|
|
1001
1682
|
const mcpUrl = typeof process === "undefined" ? void 0 : process.env["MCP_URL"];
|
|
1002
1683
|
const resource = resolveConfiguredOAuthResource({
|
|
@@ -1019,6 +1700,24 @@ var MCPServer = class _MCPServer {
|
|
|
1019
1700
|
get basePath() {
|
|
1020
1701
|
return this.#basePath();
|
|
1021
1702
|
}
|
|
1703
|
+
/**
|
|
1704
|
+
* Immutable normalized branding shared by MCP identity and browser pages.
|
|
1705
|
+
*
|
|
1706
|
+
* `favicon` is the final source after explicit-favicon and icon-selection
|
|
1707
|
+
* precedence. Landing-page integrations can use this accessor and link to
|
|
1708
|
+
* the server's root-level `/favicon.ico` route without reading private
|
|
1709
|
+
* configuration or depending on the inspector/view layers.
|
|
1710
|
+
*
|
|
1711
|
+
* @example
|
|
1712
|
+
* ```ts
|
|
1713
|
+
* if (server.branding.favicon) {
|
|
1714
|
+
* console.log("Browser favicon: /favicon.ico");
|
|
1715
|
+
* }
|
|
1716
|
+
* ```
|
|
1717
|
+
*/
|
|
1718
|
+
get branding() {
|
|
1719
|
+
return this.#branding;
|
|
1720
|
+
}
|
|
1022
1721
|
/**
|
|
1023
1722
|
* Register a tool. Input is validated against `inputSchema` before the callback
|
|
1024
1723
|
* runs; results carrying `structuredContent` are type-checked against
|
|
@@ -1039,9 +1738,9 @@ var MCPServer = class _MCPServer {
|
|
|
1039
1738
|
});
|
|
1040
1739
|
}
|
|
1041
1740
|
/**
|
|
1042
|
-
* Prime the views registry from
|
|
1741
|
+
* Prime the views registry from build/dev registry data.
|
|
1043
1742
|
*
|
|
1044
|
-
* @param views -
|
|
1743
|
+
* @param views - Registry map keyed by view directory name.
|
|
1045
1744
|
* @param options - Priming options. When `dev` is true, resource CSP
|
|
1046
1745
|
* emission appends the serving origin's websocket variant to
|
|
1047
1746
|
* `connectDomains` so Vite HMR passes host-enforced CSP. Pass
|
|
@@ -1098,8 +1797,10 @@ var MCPServer = class _MCPServer {
|
|
|
1098
1797
|
*/
|
|
1099
1798
|
resourceTemplate(definition, callback) {
|
|
1100
1799
|
this.#assertNotStarted("resourceTemplate", definition.name);
|
|
1800
|
+
const complete = definition.complete === void 0 ? void 0 : normalizeCompletions(definition.complete);
|
|
1101
1801
|
this.#resourceTemplates.set(definition.name, {
|
|
1102
1802
|
definition,
|
|
1803
|
+
...complete !== void 0 && { complete },
|
|
1103
1804
|
callback
|
|
1104
1805
|
});
|
|
1105
1806
|
return this;
|
|
@@ -1116,6 +1817,23 @@ var MCPServer = class _MCPServer {
|
|
|
1116
1817
|
});
|
|
1117
1818
|
return this;
|
|
1118
1819
|
}
|
|
1820
|
+
async proxy(input) {
|
|
1821
|
+
this.#assertOpen("proxy()");
|
|
1822
|
+
const operation = (async () => {
|
|
1823
|
+
const { isProxyConnection, mountProxyConnection, mountProxyServers } = await import("./mcp-proxy-5YQJJ4RT.js");
|
|
1824
|
+
if (isProxyConnection(input)) {
|
|
1825
|
+
await mountProxyConnection(this.#proxyHost(), input);
|
|
1826
|
+
return;
|
|
1827
|
+
}
|
|
1828
|
+
await mountProxyServers(this.#proxyHost(), input);
|
|
1829
|
+
})();
|
|
1830
|
+
this.#proxyOperations.add(operation);
|
|
1831
|
+
try {
|
|
1832
|
+
await operation;
|
|
1833
|
+
} finally {
|
|
1834
|
+
this.#proxyOperations.delete(operation);
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1119
1837
|
/**
|
|
1120
1838
|
* Web-standard request handler for the whole app (MCP endpoint included) —
|
|
1121
1839
|
* usable directly on serverless/edge runtimes or in tests.
|
|
@@ -1139,8 +1857,68 @@ var MCPServer = class _MCPServer {
|
|
|
1139
1857
|
* ```
|
|
1140
1858
|
*/
|
|
1141
1859
|
getHandler(options = {}) {
|
|
1860
|
+
this.#assertOpen("getHandler()");
|
|
1142
1861
|
const { fetch } = this.#ensureMounted("handler", void 0, options.bus);
|
|
1143
|
-
return fetch;
|
|
1862
|
+
return toFrameworkHandler(fetch);
|
|
1863
|
+
}
|
|
1864
|
+
/**
|
|
1865
|
+
* Node `(req, res) => void` handler for composing with an existing
|
|
1866
|
+
* `http.Server`. Uses the same internal `toNodeHandler` bridge as
|
|
1867
|
+
* {@link MCPServer.listen}; MCPServer users do not need to import
|
|
1868
|
+
* `mcp-use/node`.
|
|
1869
|
+
*
|
|
1870
|
+
* @example
|
|
1871
|
+
* ```ts
|
|
1872
|
+
* import { createServer } from "node:http";
|
|
1873
|
+
* const httpServer = createServer(await server.getNodeHandler());
|
|
1874
|
+
* httpServer.listen(3000);
|
|
1875
|
+
* ```
|
|
1876
|
+
*/
|
|
1877
|
+
async getNodeHandler() {
|
|
1878
|
+
const { fetch } = this.#ensureMounted("handler");
|
|
1879
|
+
const { toNodeHandler } = await import("./node-bridge.js");
|
|
1880
|
+
return toNodeHandler({ fetch });
|
|
1881
|
+
}
|
|
1882
|
+
/**
|
|
1883
|
+
* Register MCP operation middleware that intercepts JSON-RPC dispatch.
|
|
1884
|
+
*
|
|
1885
|
+
* Patterns use an `mcp:` prefix (for example `mcp:tools/call`, `mcp:*`).
|
|
1886
|
+
* Exact methods may transform their typed result. The global `mcp:*` pattern
|
|
1887
|
+
* is pass-through middleware. Middleware runs in registration order; call
|
|
1888
|
+
* `next()` to continue the chain.
|
|
1889
|
+
*
|
|
1890
|
+
* @example
|
|
1891
|
+
* ```ts
|
|
1892
|
+
* server.use("mcp:tools/call", async (ctx, next) => {
|
|
1893
|
+
* console.log(`Calling tool: ${ctx.params.name}`);
|
|
1894
|
+
* return next();
|
|
1895
|
+
* });
|
|
1896
|
+
* ```
|
|
1897
|
+
*/
|
|
1898
|
+
use(pattern, handler) {
|
|
1899
|
+
this.#assertNotStarted("middleware", pattern);
|
|
1900
|
+
this.#mcpMiddlewares.push(createMcpMiddlewareEntry(pattern, handler));
|
|
1901
|
+
return this;
|
|
1902
|
+
}
|
|
1903
|
+
/**
|
|
1904
|
+
* Register a read-only MCP observer. Unlike {@link MCPServer.use}, listeners
|
|
1905
|
+
* cannot block, override, or mutate params. Throwing is logged and does not
|
|
1906
|
+
* fail the request.
|
|
1907
|
+
*
|
|
1908
|
+
* Append `:complete` to run after the handler (for example
|
|
1909
|
+
* `mcp:tools/call:complete`).
|
|
1910
|
+
*
|
|
1911
|
+
* @example
|
|
1912
|
+
* ```ts
|
|
1913
|
+
* server.on("mcp:tools/call", (ctx) => {
|
|
1914
|
+
* metrics.increment("tools.call", { tool: ctx.params.name });
|
|
1915
|
+
* });
|
|
1916
|
+
* ```
|
|
1917
|
+
*/
|
|
1918
|
+
on(pattern, handler) {
|
|
1919
|
+
this.#assertNotStarted("event listener", pattern);
|
|
1920
|
+
this.#mcpEventListeners.push(createMcpEventListenerEntry(pattern, handler));
|
|
1921
|
+
return this;
|
|
1144
1922
|
}
|
|
1145
1923
|
/**
|
|
1146
1924
|
* Publish a tools-list change to v2 clients with active subscriptions.
|
|
@@ -1192,9 +1970,8 @@ var MCPServer = class _MCPServer {
|
|
|
1192
1970
|
* Serve over HTTP on Node. Pass port `0` for an ephemeral port.
|
|
1193
1971
|
*
|
|
1194
1972
|
* Binds `config.host` (default `127.0.0.1`). Localhost-class binds get
|
|
1195
|
-
* DNS-rebinding protection automatically
|
|
1196
|
-
* `
|
|
1197
|
-
* `Origin: null` on asset GETs). To serve publicly set `host: "0.0.0.0"`;
|
|
1973
|
+
* DNS-rebinding Host protection automatically. Origin validation is off
|
|
1974
|
+
* unless `allowedOrigins` is set. To serve publicly set `host: "0.0.0.0"`;
|
|
1198
1975
|
* behind a platform edge that is all that's needed, and `allowedHosts`
|
|
1199
1976
|
* restricts direct exposure (additive — localhost-class values stay allowed).
|
|
1200
1977
|
*
|
|
@@ -1208,6 +1985,7 @@ var MCPServer = class _MCPServer {
|
|
|
1208
1985
|
* already mounted the app without Host validation.
|
|
1209
1986
|
*/
|
|
1210
1987
|
async listen(port = 3e3) {
|
|
1988
|
+
this.#assertOpen("listen()");
|
|
1211
1989
|
this.#assertListenOAuthConfiguration();
|
|
1212
1990
|
const { createServer } = await import("http");
|
|
1213
1991
|
const { toNodeHandler } = await import("./node-bridge.js");
|
|
@@ -1272,15 +2050,43 @@ var MCPServer = class _MCPServer {
|
|
|
1272
2050
|
* instance to serve again.
|
|
1273
2051
|
*/
|
|
1274
2052
|
async close() {
|
|
1275
|
-
|
|
2053
|
+
this.#closed = true;
|
|
2054
|
+
await Promise.allSettled([...this.#proxyOperations]);
|
|
2055
|
+
const errors = [];
|
|
2056
|
+
const proxyOwners = this.#proxyOwners.splice(0);
|
|
2057
|
+
const ownerResults = await Promise.allSettled(
|
|
2058
|
+
proxyOwners.map((owner) => owner.close())
|
|
2059
|
+
);
|
|
2060
|
+
for (const result of ownerResults) {
|
|
2061
|
+
if (result.status === "rejected") errors.push(result.reason);
|
|
2062
|
+
}
|
|
2063
|
+
try {
|
|
2064
|
+
await this.#handler?.close();
|
|
2065
|
+
} catch (error) {
|
|
2066
|
+
errors.push(error);
|
|
2067
|
+
}
|
|
1276
2068
|
const httpServer = this.#httpServer;
|
|
1277
2069
|
if (httpServer !== void 0) {
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
2070
|
+
try {
|
|
2071
|
+
await new Promise((resolve, reject) => {
|
|
2072
|
+
httpServer.close((err) => err ? reject(err) : resolve());
|
|
2073
|
+
});
|
|
2074
|
+
this.#httpServer = void 0;
|
|
2075
|
+
} catch (error) {
|
|
2076
|
+
errors.push(error);
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
if (errors.length > 0) {
|
|
2080
|
+
throw new AggregateError(errors, "Failed to close MCP server cleanly");
|
|
1282
2081
|
}
|
|
1283
2082
|
}
|
|
2083
|
+
#assertOpen(operation) {
|
|
2084
|
+
if (!this.#closed) return;
|
|
2085
|
+
if (operation !== void 0) {
|
|
2086
|
+
throw new Error(`Cannot call ${operation} after the server has closed.`);
|
|
2087
|
+
}
|
|
2088
|
+
throw new Error("Cannot use the server after it has closed.");
|
|
2089
|
+
}
|
|
1284
2090
|
#basePath() {
|
|
1285
2091
|
return this.#config.basePath ?? "/mcp";
|
|
1286
2092
|
}
|
|
@@ -1326,40 +2132,79 @@ var MCPServer = class _MCPServer {
|
|
|
1326
2132
|
);
|
|
1327
2133
|
}
|
|
1328
2134
|
}
|
|
2135
|
+
#proxyHost() {
|
|
2136
|
+
return {
|
|
2137
|
+
isStarted: () => this.#handler !== void 0,
|
|
2138
|
+
hasTool: (name) => this.#tools.has(name),
|
|
2139
|
+
hasResource: (name) => this.#resources.has(name),
|
|
2140
|
+
hasPrompt: (name) => this.#prompts.has(name),
|
|
2141
|
+
registerTool: (definition, callback) => {
|
|
2142
|
+
this.#assertNotStarted("tool", definition.name);
|
|
2143
|
+
this.#tools.set(definition.name, {
|
|
2144
|
+
definition,
|
|
2145
|
+
callback
|
|
2146
|
+
});
|
|
2147
|
+
},
|
|
2148
|
+
registerResource: (definition, callback) => {
|
|
2149
|
+
this.#assertNotStarted("resource", definition.name);
|
|
2150
|
+
this.#resources.set(definition.name, {
|
|
2151
|
+
definition,
|
|
2152
|
+
callback
|
|
2153
|
+
});
|
|
2154
|
+
},
|
|
2155
|
+
registerPrompt: (definition, callback) => {
|
|
2156
|
+
this.#assertNotStarted("prompt", definition.name);
|
|
2157
|
+
this.#prompts.set(definition.name, {
|
|
2158
|
+
definition,
|
|
2159
|
+
callback
|
|
2160
|
+
});
|
|
2161
|
+
},
|
|
2162
|
+
trackOwner: (owner) => {
|
|
2163
|
+
this.#proxyOwners.push(owner);
|
|
2164
|
+
}
|
|
2165
|
+
};
|
|
2166
|
+
}
|
|
1329
2167
|
/**
|
|
1330
2168
|
* Effective Host/Origin allowlists for a mount mode; `undefined` means the
|
|
1331
2169
|
* corresponding validation is off.
|
|
1332
2170
|
*
|
|
1333
2171
|
* Configured lists are additive to the localhost-class allowlists, so local
|
|
1334
2172
|
* runs keep working when a deployment hostname is added. With nothing
|
|
1335
|
-
* configured, `listen()` on a localhost-class bind validates against the
|
|
2173
|
+
* configured, `listen()` on a localhost-class bind validates Host against the
|
|
1336
2174
|
* localhost lists (the DNS-rebinding threat model), while `getHandler()` —
|
|
1337
|
-
* which never binds — applies no validation.
|
|
1338
|
-
*
|
|
1339
|
-
* non-GET/HEAD requests.
|
|
2175
|
+
* which never binds — applies no validation. Origin validation is off unless
|
|
2176
|
+
* `allowedOrigins` is set explicitly (SDK-aligned: the handler is open by
|
|
2177
|
+
* default). When enabled, Origin is checked only on non-GET/HEAD requests.
|
|
1340
2178
|
*/
|
|
1341
2179
|
#validationPolicy(mode) {
|
|
1342
2180
|
const { host = "127.0.0.1", allowedHosts, allowedOrigins } = this.#config;
|
|
1343
2181
|
const localhostBind = ["127.0.0.1", "localhost", "::1"].includes(host);
|
|
1344
2182
|
const hosts = allowedHosts !== void 0 ? [.../* @__PURE__ */ new Set([...localhostAllowedHostnames(), ...allowedHosts])] : mode === "listen" && localhostBind ? localhostAllowedHostnames() : void 0;
|
|
1345
|
-
const origins = allowedOrigins !== void 0 ? [.../* @__PURE__ */ new Set([...localhostAllowedOrigins(), ...allowedOrigins])] :
|
|
2183
|
+
const origins = allowedOrigins !== void 0 ? [.../* @__PURE__ */ new Set([...localhostAllowedOrigins(), ...allowedOrigins])] : void 0;
|
|
1346
2184
|
return { hosts, origins };
|
|
1347
2185
|
}
|
|
1348
2186
|
#ensureMounted(mode, listenPort, bus) {
|
|
2187
|
+
this.#assertOpen();
|
|
1349
2188
|
if (this.#fetchHandler === void 0 || this.#handler === void 0) {
|
|
1350
2189
|
const { hosts, origins } = this.#validationPolicy(mode);
|
|
1351
2190
|
const basePath = this.#basePath();
|
|
2191
|
+
const nestedBasePath = basePath === "/" ? "" : basePath;
|
|
1352
2192
|
const middlewares = [
|
|
1353
2193
|
jsonBodyMiddleware(),
|
|
1354
2194
|
requestLogger(this.#config.logging)
|
|
1355
2195
|
];
|
|
2196
|
+
const corsConfig = this.#config.cors;
|
|
2197
|
+
if (corsConfig !== void 0) {
|
|
2198
|
+
middlewares.unshift(corsFetchMiddleware(corsConfig));
|
|
2199
|
+
}
|
|
2200
|
+
const deferViewCors = isGlobalCorsEnabled(corsConfig);
|
|
1356
2201
|
if (hosts !== void 0) {
|
|
1357
2202
|
middlewares.unshift(hostValidationMiddleware(hosts));
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
2203
|
+
}
|
|
2204
|
+
if (origins !== void 0) {
|
|
2205
|
+
middlewares.push(originValidationMiddleware(origins));
|
|
2206
|
+
}
|
|
2207
|
+
if (hosts === void 0) {
|
|
1363
2208
|
if (mode === "listen") {
|
|
1364
2209
|
console.warn(
|
|
1365
2210
|
`[mcp-use] listen() is serving on ${this.#config.host} without Host validation. Behind a platform edge that only routes your own domains this is expected; if this process is reachable directly, set allowedHosts to restrict it.`
|
|
@@ -1389,7 +2234,7 @@ var MCPServer = class _MCPServer {
|
|
|
1389
2234
|
}
|
|
1390
2235
|
}
|
|
1391
2236
|
);
|
|
1392
|
-
let
|
|
2237
|
+
let protectWithBearer = async (_request, next) => next();
|
|
1393
2238
|
if (resource !== void 0) {
|
|
1394
2239
|
const provider = this.#config.oauth;
|
|
1395
2240
|
const providerOptions = getOAuthProviderOptions(provider);
|
|
@@ -1400,32 +2245,89 @@ var MCPServer = class _MCPServer {
|
|
|
1400
2245
|
requiredScopes: providerOptions.requiredScopes
|
|
1401
2246
|
}
|
|
1402
2247
|
});
|
|
1403
|
-
|
|
2248
|
+
protectWithBearer = async (request, next) => {
|
|
1404
2249
|
const result = await gate(request);
|
|
1405
2250
|
if (result instanceof Response) {
|
|
1406
2251
|
return result;
|
|
1407
2252
|
}
|
|
1408
2253
|
const bag = getRequestBag(request);
|
|
1409
2254
|
bag.authInfo = result;
|
|
1410
|
-
return
|
|
2255
|
+
return next();
|
|
1411
2256
|
};
|
|
1412
2257
|
}
|
|
2258
|
+
const mcpRouteHandler = (request) => protectWithBearer(request, () => mcpFetch(request));
|
|
2259
|
+
const endpointHandler = async (request) => {
|
|
2260
|
+
if (!isHtmlNavigationRequest(request)) {
|
|
2261
|
+
return mcpRouteHandler(request);
|
|
2262
|
+
}
|
|
2263
|
+
const respond = async () => {
|
|
2264
|
+
const { createLandingPageResponse } = await import("./landing-handler-WE66NIGB.js");
|
|
2265
|
+
return createLandingPageResponse(
|
|
2266
|
+
request,
|
|
2267
|
+
basePath,
|
|
2268
|
+
this.#config,
|
|
2269
|
+
this.#branding,
|
|
2270
|
+
this.#tools.values(),
|
|
2271
|
+
this.#prompts.values(),
|
|
2272
|
+
this.#resources.values()
|
|
2273
|
+
);
|
|
2274
|
+
};
|
|
2275
|
+
if (resource !== void 0 && this.#config.publicLandingPage !== true) {
|
|
2276
|
+
return protectWithBearer(request, respond);
|
|
2277
|
+
}
|
|
2278
|
+
return respond();
|
|
2279
|
+
};
|
|
1413
2280
|
const routes = [];
|
|
2281
|
+
const brandingDevMode = this.#viewsPrimed ? this.#viewsDevMode : process.env["NODE_ENV"] !== "production";
|
|
2282
|
+
const faviconHandler = createFaviconHandler(this.#branding, {
|
|
2283
|
+
dev: brandingDevMode,
|
|
2284
|
+
projectRoot: this.#viewsProjectRoot,
|
|
2285
|
+
deferCors: deferViewCors
|
|
2286
|
+
});
|
|
2287
|
+
if (faviconHandler !== void 0) {
|
|
2288
|
+
routes.push({
|
|
2289
|
+
match: (request) => new URL(request.url).pathname === "/favicon.ico",
|
|
2290
|
+
handler: faviconHandler
|
|
2291
|
+
});
|
|
2292
|
+
}
|
|
1414
2293
|
const viewHandler = createViewPublicHandler(basePath, this.#views, {
|
|
1415
|
-
dev: this.#viewsDevMode,
|
|
1416
|
-
projectRoot: this.#viewsProjectRoot
|
|
2294
|
+
dev: this.#viewsPrimed ? this.#viewsDevMode : brandingDevMode,
|
|
2295
|
+
projectRoot: this.#viewsProjectRoot,
|
|
2296
|
+
enabled: hasLocalBrandingAsset(this.#branding),
|
|
2297
|
+
deferCors: deferViewCors
|
|
1417
2298
|
});
|
|
1418
2299
|
if (viewHandler !== void 0) {
|
|
1419
2300
|
routes.push({
|
|
1420
2301
|
match: (request) => request.method === "GET" || request.method === "HEAD" ? new URL(request.url).pathname.startsWith(
|
|
1421
|
-
`${
|
|
2302
|
+
`${nestedBasePath}/_mcp-use/public/`
|
|
1422
2303
|
) : false,
|
|
1423
2304
|
handler: viewHandler
|
|
1424
2305
|
});
|
|
1425
2306
|
}
|
|
2307
|
+
if (!this.#viewsDevMode) {
|
|
2308
|
+
const viewAssetsHandler = createViewAssetsHandler(
|
|
2309
|
+
basePath,
|
|
2310
|
+
this.#views,
|
|
2311
|
+
{ projectRoot: this.#viewsProjectRoot, deferCors: deferViewCors }
|
|
2312
|
+
);
|
|
2313
|
+
if (viewAssetsHandler !== void 0) {
|
|
2314
|
+
routes.push({
|
|
2315
|
+
match: (request) => request.method === "GET" || request.method === "HEAD" ? new URL(request.url).pathname.startsWith(
|
|
2316
|
+
`${nestedBasePath}/_mcp-use/views/`
|
|
2317
|
+
) : false,
|
|
2318
|
+
handler: viewAssetsHandler
|
|
2319
|
+
});
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
1426
2322
|
const inspectorHandler = createInspectorHandler(this.#config.inspector, {
|
|
1427
2323
|
serverName: this.#config.name,
|
|
1428
|
-
basePath
|
|
2324
|
+
basePath,
|
|
2325
|
+
...faviconHandler !== void 0 && {
|
|
2326
|
+
faviconHref: "/favicon.ico",
|
|
2327
|
+
...this.#branding.faviconMimeType !== void 0 && {
|
|
2328
|
+
faviconType: this.#branding.faviconMimeType
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
1429
2331
|
});
|
|
1430
2332
|
if (inspectorHandler !== void 0) {
|
|
1431
2333
|
routes.push({
|
|
@@ -1434,14 +2336,14 @@ var MCPServer = class _MCPServer {
|
|
|
1434
2336
|
return false;
|
|
1435
2337
|
}
|
|
1436
2338
|
const pathname = new URL(request.url).pathname;
|
|
1437
|
-
return pathname
|
|
2339
|
+
return matchesInspectorShellPath(pathname, basePath);
|
|
1438
2340
|
},
|
|
1439
2341
|
handler: inspectorHandler
|
|
1440
2342
|
});
|
|
1441
2343
|
}
|
|
1442
2344
|
routes.push({
|
|
1443
2345
|
match: (request) => matchesPath(request, basePath),
|
|
1444
|
-
handler:
|
|
2346
|
+
handler: endpointHandler
|
|
1445
2347
|
});
|
|
1446
2348
|
const terminal = routeFetch(routes);
|
|
1447
2349
|
this.#fetchHandler = composeFetch(terminal, ...middlewares);
|
|
@@ -1514,10 +2416,21 @@ var MCPServer = class _MCPServer {
|
|
|
1514
2416
|
name,
|
|
1515
2417
|
version,
|
|
1516
2418
|
...title !== void 0 && { title },
|
|
1517
|
-
...description !== void 0 && { description }
|
|
2419
|
+
...description !== void 0 && { description },
|
|
2420
|
+
...this.#branding.websiteUrl !== void 0 && {
|
|
2421
|
+
websiteUrl: this.#branding.websiteUrl
|
|
2422
|
+
},
|
|
2423
|
+
...this.#branding.icons !== void 0 && {
|
|
2424
|
+
icons: resolveImplementationIcons(
|
|
2425
|
+
this.#branding.icons,
|
|
2426
|
+
ctx.requestInfo,
|
|
2427
|
+
this.#basePath()
|
|
2428
|
+
)
|
|
2429
|
+
}
|
|
1518
2430
|
},
|
|
1519
2431
|
{
|
|
1520
2432
|
capabilities: {
|
|
2433
|
+
logging: {},
|
|
1521
2434
|
tools: { listChanged: true },
|
|
1522
2435
|
prompts: { listChanged: true },
|
|
1523
2436
|
resources: { listChanged: true, subscribe: true }
|
|
@@ -1530,7 +2443,7 @@ var MCPServer = class _MCPServer {
|
|
|
1530
2443
|
}
|
|
1531
2444
|
);
|
|
1532
2445
|
const request = ctx.requestInfo;
|
|
1533
|
-
const
|
|
2446
|
+
const viewMetaOptions = request !== void 0 ? { request, hmrWs: this.#viewsDevMode } : { hmrWs: this.#viewsDevMode };
|
|
1534
2447
|
const basePath = this.#basePath();
|
|
1535
2448
|
for (const entry of this.#tools.values()) {
|
|
1536
2449
|
this.#registerTool(server, entry);
|
|
@@ -1549,15 +2462,109 @@ var MCPServer = class _MCPServer {
|
|
|
1549
2462
|
server,
|
|
1550
2463
|
viewName,
|
|
1551
2464
|
viewEntry,
|
|
1552
|
-
|
|
2465
|
+
viewMetaOptions,
|
|
1553
2466
|
basePath
|
|
1554
2467
|
);
|
|
1555
2468
|
}
|
|
2469
|
+
this.#wrapListHandlers(server);
|
|
1556
2470
|
return server;
|
|
1557
2471
|
}
|
|
2472
|
+
#createMiddlewareContext(method, params, ctx) {
|
|
2473
|
+
return {
|
|
2474
|
+
method,
|
|
2475
|
+
params,
|
|
2476
|
+
...ctx.http?.req !== void 0 && { request: ctx.http.req },
|
|
2477
|
+
...ctx.sessionId !== void 0 && {
|
|
2478
|
+
session: { sessionId: ctx.sessionId }
|
|
2479
|
+
},
|
|
2480
|
+
...ctx.http?.authInfo !== void 0 && { auth: ctx.http.authInfo },
|
|
2481
|
+
state: /* @__PURE__ */ new Map()
|
|
2482
|
+
};
|
|
2483
|
+
}
|
|
2484
|
+
#runMcpHook(method, ctx, innerFn) {
|
|
2485
|
+
return runMcpOperation(
|
|
2486
|
+
this.#mcpMiddlewares,
|
|
2487
|
+
this.#mcpEventListeners,
|
|
2488
|
+
method,
|
|
2489
|
+
ctx,
|
|
2490
|
+
innerFn
|
|
2491
|
+
);
|
|
2492
|
+
}
|
|
2493
|
+
/**
|
|
2494
|
+
* Wrap native SDK list handlers with the MCP middleware chain.
|
|
2495
|
+
*
|
|
2496
|
+
* ponytail: uses SDK-private `_requestHandlers`; pin compile-time test.
|
|
2497
|
+
*
|
|
2498
|
+
* @internal
|
|
2499
|
+
*/
|
|
2500
|
+
#wrapListHandlers(server) {
|
|
2501
|
+
const handlers = server.server._requestHandlers;
|
|
2502
|
+
if (handlers === void 0) {
|
|
2503
|
+
return;
|
|
2504
|
+
}
|
|
2505
|
+
const wrapListMethod = (method, resultKey, transform) => {
|
|
2506
|
+
const original = handlers.get(method);
|
|
2507
|
+
if (original === void 0) {
|
|
2508
|
+
return;
|
|
2509
|
+
}
|
|
2510
|
+
if (original.__mcpListWrapped) {
|
|
2511
|
+
return;
|
|
2512
|
+
}
|
|
2513
|
+
const wrapped = async (request, extra) => {
|
|
2514
|
+
const serverContext = extra;
|
|
2515
|
+
const params = request.params ?? {};
|
|
2516
|
+
const mwCtx = this.#createMiddlewareContext(
|
|
2517
|
+
method,
|
|
2518
|
+
params,
|
|
2519
|
+
serverContext
|
|
2520
|
+
);
|
|
2521
|
+
let originalEnvelope;
|
|
2522
|
+
const innerFn = async () => {
|
|
2523
|
+
const downstreamRequest = withMcpMiddlewareParams(
|
|
2524
|
+
request,
|
|
2525
|
+
mwCtx.params
|
|
2526
|
+
);
|
|
2527
|
+
const result = await original(downstreamRequest, extra);
|
|
2528
|
+
if (typeof result !== "object" || result === null) {
|
|
2529
|
+
throw new TypeError(
|
|
2530
|
+
`[mcp-use] ${method} handler returned a non-object result`
|
|
2531
|
+
);
|
|
2532
|
+
}
|
|
2533
|
+
originalEnvelope = result;
|
|
2534
|
+
const items = originalEnvelope[resultKey];
|
|
2535
|
+
if (!Array.isArray(items)) {
|
|
2536
|
+
throw new TypeError(
|
|
2537
|
+
`[mcp-use] ${method} handler result is missing a ${resultKey} array`
|
|
2538
|
+
);
|
|
2539
|
+
}
|
|
2540
|
+
return items;
|
|
2541
|
+
};
|
|
2542
|
+
const filtered = await this.#runMcpHook(method, mwCtx, innerFn);
|
|
2543
|
+
if (!Array.isArray(filtered)) {
|
|
2544
|
+
throw new TypeError(
|
|
2545
|
+
`[mcp-use] ${method} middleware must return a ${resultKey} array`
|
|
2546
|
+
);
|
|
2547
|
+
}
|
|
2548
|
+
const emitted = transform?.(filtered) ?? filtered;
|
|
2549
|
+
return {
|
|
2550
|
+
...originalEnvelope,
|
|
2551
|
+
[resultKey]: emitted
|
|
2552
|
+
};
|
|
2553
|
+
};
|
|
2554
|
+
wrapped.__mcpListWrapped = true;
|
|
2555
|
+
handlers.set(method, wrapped);
|
|
2556
|
+
};
|
|
2557
|
+
wrapListMethod("tools/list", "tools", omitToolSchemaDialects);
|
|
2558
|
+
wrapListMethod("resources/list", "resources");
|
|
2559
|
+
wrapListMethod("prompts/list", "prompts");
|
|
2560
|
+
}
|
|
1558
2561
|
#registerTool(server, { definition, callback }) {
|
|
1559
2562
|
const view = definition.view;
|
|
1560
|
-
const
|
|
2563
|
+
const toolMeta = buildToolUiMeta(
|
|
2564
|
+
view?.name,
|
|
2565
|
+
definition.visibility,
|
|
2566
|
+
definition._meta
|
|
2567
|
+
);
|
|
1561
2568
|
const config = {
|
|
1562
2569
|
...definition.title !== void 0 && { title: definition.title },
|
|
1563
2570
|
...definition.description !== void 0 && {
|
|
@@ -1569,51 +2576,60 @@ var MCPServer = class _MCPServer {
|
|
|
1569
2576
|
...definition.outputSchema !== void 0 && {
|
|
1570
2577
|
outputSchema: definition.outputSchema
|
|
1571
2578
|
},
|
|
1572
|
-
...
|
|
2579
|
+
...toolMeta !== void 0 && { _meta: toolMeta }
|
|
1573
2580
|
};
|
|
1574
2581
|
const wireResultMeta = view !== void 0 ? buildToolResultUiMeta(view.name) : void 0;
|
|
1575
2582
|
const inputSchema = resolveToolInputSchema(definition);
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
{
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
}
|
|
1586
|
-
return {
|
|
1587
|
-
...result,
|
|
1588
|
-
_meta: { ...result._meta, ...wireResultMeta }
|
|
1589
|
-
};
|
|
1590
|
-
}
|
|
2583
|
+
const invokeTool = async (args, ctx) => {
|
|
2584
|
+
const mwCtx = this.#createMiddlewareContext(
|
|
2585
|
+
"tools/call",
|
|
2586
|
+
{
|
|
2587
|
+
name: definition.name,
|
|
2588
|
+
arguments: args,
|
|
2589
|
+
...ctx.mcpReq._meta !== void 0 && { _meta: ctx.mcpReq._meta }
|
|
2590
|
+
},
|
|
2591
|
+
ctx
|
|
1591
2592
|
);
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
const result = await callback(
|
|
1595
|
-
|
|
2593
|
+
const innerFn = async () => {
|
|
2594
|
+
const effectiveArgs = mwCtx.params.arguments ?? {};
|
|
2595
|
+
const result = await callback(
|
|
2596
|
+
effectiveArgs,
|
|
2597
|
+
this.#toRequestContext(ctx)
|
|
2598
|
+
);
|
|
2599
|
+
if (isInputRequiredResult2(result) || wireResultMeta === void 0 || result.isError === true) {
|
|
1596
2600
|
return result;
|
|
1597
2601
|
}
|
|
1598
2602
|
return {
|
|
1599
2603
|
...result,
|
|
1600
2604
|
_meta: { ...result._meta, ...wireResultMeta }
|
|
1601
2605
|
};
|
|
1602
|
-
}
|
|
2606
|
+
};
|
|
2607
|
+
return await this.#runMcpHook("tools/call", mwCtx, innerFn);
|
|
2608
|
+
};
|
|
2609
|
+
if (inputSchema !== void 0) {
|
|
2610
|
+
server.registerTool(
|
|
2611
|
+
definition.name,
|
|
2612
|
+
{ ...config, inputSchema },
|
|
2613
|
+
async (args, ctx) => invokeTool(args, ctx)
|
|
2614
|
+
);
|
|
2615
|
+
} else {
|
|
2616
|
+
server.registerTool(
|
|
2617
|
+
definition.name,
|
|
2618
|
+
config,
|
|
2619
|
+
async (ctx) => invokeTool({}, ctx)
|
|
2620
|
+
);
|
|
1603
2621
|
}
|
|
1604
2622
|
}
|
|
1605
|
-
#registerViewResource(server, viewName, entry,
|
|
2623
|
+
#registerViewResource(server, viewName, entry, metaOptions, basePath) {
|
|
1606
2624
|
const uri = viewResourceUri(viewName);
|
|
1607
2625
|
const authorFacts = this.#viewResourceFacts(
|
|
1608
2626
|
this.#viewBindings.get(viewName)?.config
|
|
1609
2627
|
);
|
|
1610
|
-
const hmrWs = this.#viewsDevMode;
|
|
1611
2628
|
const resourceConfig = viewResourceConfig(
|
|
1612
2629
|
viewName,
|
|
1613
2630
|
entry,
|
|
1614
2631
|
authorFacts,
|
|
1615
|
-
|
|
1616
|
-
{ hmrWs }
|
|
2632
|
+
metaOptions
|
|
1617
2633
|
);
|
|
1618
2634
|
server.registerResource(
|
|
1619
2635
|
viewName,
|
|
@@ -1621,15 +2637,24 @@ var MCPServer = class _MCPServer {
|
|
|
1621
2637
|
resourceConfig,
|
|
1622
2638
|
async (readUri, ctx) => {
|
|
1623
2639
|
const req = ctx.http?.req;
|
|
1624
|
-
const
|
|
1625
|
-
|
|
2640
|
+
const readOptions = req !== void 0 ? {
|
|
2641
|
+
request: req,
|
|
2642
|
+
...metaOptions.hmrWs === true ? { hmrWs: true } : {}
|
|
2643
|
+
} : metaOptions.hmrWs === true ? { hmrWs: true } : {};
|
|
2644
|
+
const assetsBase = req !== void 0 ? resolveAssetsBase(req) : metaOptions.request !== void 0 ? resolveAssetsBase(metaOptions.request) : "";
|
|
2645
|
+
const html = synthesizeViewDocument(
|
|
2646
|
+
entry,
|
|
2647
|
+
assetsBase,
|
|
2648
|
+
basePath,
|
|
2649
|
+
viewName
|
|
2650
|
+
);
|
|
1626
2651
|
return {
|
|
1627
2652
|
contents: [
|
|
1628
2653
|
{
|
|
1629
2654
|
uri: readUri.href,
|
|
1630
2655
|
mimeType: resourceConfig.mimeType,
|
|
1631
2656
|
text: html,
|
|
1632
|
-
_meta: buildResourceUiMeta(authorFacts,
|
|
2657
|
+
_meta: buildResourceUiMeta(authorFacts, readOptions)
|
|
1633
2658
|
}
|
|
1634
2659
|
]
|
|
1635
2660
|
};
|
|
@@ -1647,14 +2672,36 @@ var MCPServer = class _MCPServer {
|
|
|
1647
2672
|
},
|
|
1648
2673
|
...definition.mimeType !== void 0 && {
|
|
1649
2674
|
mimeType: definition.mimeType
|
|
2675
|
+
},
|
|
2676
|
+
...definition.annotations !== void 0 && {
|
|
2677
|
+
annotations: definition.annotations
|
|
2678
|
+
},
|
|
2679
|
+
...definition._meta !== void 0 && {
|
|
2680
|
+
_meta: { ...definition._meta }
|
|
1650
2681
|
}
|
|
1651
2682
|
},
|
|
1652
|
-
async (uri, ctx) =>
|
|
2683
|
+
async (uri, ctx) => {
|
|
2684
|
+
const mwCtx = this.#createMiddlewareContext(
|
|
2685
|
+
"resources/read",
|
|
2686
|
+
{
|
|
2687
|
+
uri: uri.href,
|
|
2688
|
+
...ctx.mcpReq._meta !== void 0 && { _meta: ctx.mcpReq._meta }
|
|
2689
|
+
},
|
|
2690
|
+
ctx
|
|
2691
|
+
);
|
|
2692
|
+
const innerFn = async () => callback(uri, this.#toRequestContext(ctx));
|
|
2693
|
+
return await this.#runMcpHook(
|
|
2694
|
+
"resources/read",
|
|
2695
|
+
mwCtx,
|
|
2696
|
+
innerFn
|
|
2697
|
+
);
|
|
2698
|
+
}
|
|
1653
2699
|
);
|
|
1654
2700
|
}
|
|
1655
|
-
#registerResourceTemplate(server, { definition, callback }) {
|
|
2701
|
+
#registerResourceTemplate(server, { definition, callback, complete }) {
|
|
1656
2702
|
const template = new ResourceTemplate(definition.uriTemplate, {
|
|
1657
|
-
list: void 0
|
|
2703
|
+
list: void 0,
|
|
2704
|
+
...complete !== void 0 && { complete }
|
|
1658
2705
|
});
|
|
1659
2706
|
server.registerResource(
|
|
1660
2707
|
definition.name,
|
|
@@ -1666,13 +2713,34 @@ var MCPServer = class _MCPServer {
|
|
|
1666
2713
|
},
|
|
1667
2714
|
...definition.mimeType !== void 0 && {
|
|
1668
2715
|
mimeType: definition.mimeType
|
|
2716
|
+
},
|
|
2717
|
+
...definition.annotations !== void 0 && {
|
|
2718
|
+
annotations: definition.annotations
|
|
2719
|
+
},
|
|
2720
|
+
...definition._meta !== void 0 && {
|
|
2721
|
+
_meta: { ...definition._meta }
|
|
1669
2722
|
}
|
|
1670
2723
|
},
|
|
1671
|
-
async (uri, variables, ctx) =>
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
2724
|
+
async (uri, variables, ctx) => {
|
|
2725
|
+
const mwCtx = this.#createMiddlewareContext(
|
|
2726
|
+
"resources/read",
|
|
2727
|
+
{
|
|
2728
|
+
uri: uri.href,
|
|
2729
|
+
...ctx.mcpReq._meta !== void 0 && { _meta: ctx.mcpReq._meta }
|
|
2730
|
+
},
|
|
2731
|
+
ctx
|
|
2732
|
+
);
|
|
2733
|
+
const innerFn = async () => callback(
|
|
2734
|
+
uri,
|
|
2735
|
+
variables,
|
|
2736
|
+
this.#toRequestContext(ctx)
|
|
2737
|
+
);
|
|
2738
|
+
return await this.#runMcpHook(
|
|
2739
|
+
"resources/read",
|
|
2740
|
+
mwCtx,
|
|
2741
|
+
innerFn
|
|
2742
|
+
);
|
|
2743
|
+
}
|
|
1676
2744
|
);
|
|
1677
2745
|
}
|
|
1678
2746
|
#viewResourceFacts(viewConfig) {
|
|
@@ -1700,17 +2768,30 @@ var MCPServer = class _MCPServer {
|
|
|
1700
2768
|
description: definition.description
|
|
1701
2769
|
}
|
|
1702
2770
|
};
|
|
2771
|
+
const invokePrompt = async (args, ctx) => {
|
|
2772
|
+
const mwCtx = this.#createMiddlewareContext(
|
|
2773
|
+
"prompts/get",
|
|
2774
|
+
{
|
|
2775
|
+
name: definition.name,
|
|
2776
|
+
arguments: args,
|
|
2777
|
+
...ctx.mcpReq._meta !== void 0 && { _meta: ctx.mcpReq._meta }
|
|
2778
|
+
},
|
|
2779
|
+
ctx
|
|
2780
|
+
);
|
|
2781
|
+
const innerFn = async () => {
|
|
2782
|
+
const effectiveArgs = mwCtx.params.arguments ?? {};
|
|
2783
|
+
return callback(effectiveArgs, this.#toRequestContext(ctx));
|
|
2784
|
+
};
|
|
2785
|
+
return await this.#runMcpHook("prompts/get", mwCtx, innerFn);
|
|
2786
|
+
};
|
|
1703
2787
|
if (definition.schema !== void 0) {
|
|
1704
2788
|
server.registerPrompt(
|
|
1705
2789
|
definition.name,
|
|
1706
2790
|
{ ...config, argsSchema: definition.schema },
|
|
1707
|
-
async (args, ctx) =>
|
|
1708
|
-
const params = args;
|
|
1709
|
-
return callback(params, this.#toRequestContext(ctx));
|
|
1710
|
-
}
|
|
2791
|
+
async (args, ctx) => invokePrompt(args, ctx)
|
|
1711
2792
|
);
|
|
1712
2793
|
} else {
|
|
1713
|
-
const handler = async (ctx) =>
|
|
2794
|
+
const handler = async (ctx) => invokePrompt({}, ctx);
|
|
1714
2795
|
server.registerPrompt(
|
|
1715
2796
|
definition.name,
|
|
1716
2797
|
config,
|
|
@@ -1732,46 +2813,32 @@ import {
|
|
|
1732
2813
|
createRequestStateCodec,
|
|
1733
2814
|
inputRequired as inputRequired2,
|
|
1734
2815
|
inputResponse as inputResponse2,
|
|
1735
|
-
isInputRequiredResult as
|
|
2816
|
+
isInputRequiredResult as isInputRequiredResult3
|
|
1736
2817
|
} from "@modelcontextprotocol/server";
|
|
1737
|
-
|
|
1738
|
-
// src/completable.ts
|
|
1739
|
-
import {
|
|
1740
|
-
completable as sdkCompletable
|
|
1741
|
-
} from "@modelcontextprotocol/server";
|
|
1742
|
-
function completable(schema, complete) {
|
|
1743
|
-
if (typeof complete === "function") {
|
|
1744
|
-
return sdkCompletable(
|
|
1745
|
-
schema,
|
|
1746
|
-
(value, context) => complete(String(value ?? ""), context)
|
|
1747
|
-
);
|
|
1748
|
-
}
|
|
1749
|
-
const values = complete.map(String);
|
|
1750
|
-
return sdkCompletable(schema, (value) => {
|
|
1751
|
-
const prefix = String(value ?? "").toLowerCase();
|
|
1752
|
-
return values.filter((v) => v.toLowerCase().startsWith(prefix));
|
|
1753
|
-
});
|
|
1754
|
-
}
|
|
1755
2818
|
export {
|
|
1756
2819
|
MCPServer,
|
|
1757
2820
|
acceptedContent,
|
|
1758
2821
|
completable,
|
|
1759
2822
|
composeFetch,
|
|
2823
|
+
composeMiddleware,
|
|
2824
|
+
createMcpEventListenerEntry,
|
|
2825
|
+
createMcpMiddlewareEntry,
|
|
1760
2826
|
createMcpMount,
|
|
1761
2827
|
createRequestStateCodec,
|
|
1762
2828
|
getRequestBag,
|
|
1763
2829
|
hostValidationMiddleware,
|
|
1764
2830
|
inputRequired2 as inputRequired,
|
|
1765
2831
|
inputResponse2 as inputResponse,
|
|
1766
|
-
|
|
2832
|
+
isInputRequiredResult3 as isInputRequiredResult,
|
|
1767
2833
|
jsonBodyMiddleware,
|
|
1768
2834
|
matchesPath,
|
|
1769
2835
|
matchesPathPrefix,
|
|
1770
|
-
|
|
2836
|
+
matchesPattern,
|
|
1771
2837
|
originValidationMiddleware,
|
|
1772
2838
|
pathnameOf,
|
|
1773
2839
|
registerViews,
|
|
1774
2840
|
requestLogger,
|
|
1775
|
-
routeFetch
|
|
2841
|
+
routeFetch,
|
|
2842
|
+
toFrameworkHandler
|
|
1776
2843
|
};
|
|
1777
2844
|
//# sourceMappingURL=index.js.map
|