skybridge 0.0.0-dev.b9f65be → 0.0.0-dev.b9f85b3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/cli/build-helpers.d.ts +7 -1
- package/dist/cli/build-helpers.js +58 -6
- package/dist/cli/build-helpers.js.map +1 -1
- package/dist/cli/build-helpers.test.js +89 -1
- package/dist/cli/build-helpers.test.js.map +1 -1
- package/dist/cli/build-steps.d.ts +2 -0
- package/dist/cli/build-steps.js +73 -0
- package/dist/cli/build-steps.js.map +1 -0
- package/dist/cli/build-steps.test.js +52 -0
- package/dist/cli/build-steps.test.js.map +1 -0
- package/dist/cli/detect-port.d.ts +2 -2
- package/dist/cli/detect-port.js +8 -20
- package/dist/cli/detect-port.js.map +1 -1
- package/dist/cli/header.d.ts +1 -1
- package/dist/cli/resolve-skybridge-config.d.ts +5 -0
- package/dist/cli/{resolve-views-dir.js → resolve-skybridge-config.js} +4 -3
- package/dist/cli/resolve-skybridge-config.js.map +1 -0
- package/dist/cli/run-plain.d.ts +18 -0
- package/dist/cli/run-plain.js +89 -0
- package/dist/cli/run-plain.js.map +1 -0
- package/dist/cli/use-execute-steps.d.ts +1 -1
- package/dist/cli/use-nodemon.d.ts +14 -0
- package/dist/cli/use-nodemon.js +81 -62
- package/dist/cli/use-nodemon.js.map +1 -1
- package/dist/cli/use-typescript-check.d.ts +8 -2
- package/dist/cli/use-typescript-check.js +70 -67
- package/dist/cli/use-typescript-check.js.map +1 -1
- package/dist/commands/build.d.ts +0 -3
- package/dist/commands/build.js +5 -56
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/dev.d.ts +1 -0
- package/dist/commands/dev.js +35 -3
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/start.js +7 -1
- package/dist/commands/start.js.map +1 -1
- package/dist/context-warnings.d.ts +5 -0
- package/dist/context-warnings.js +31 -0
- package/dist/context-warnings.js.map +1 -0
- package/dist/context-warnings.test.js +28 -0
- package/dist/context-warnings.test.js.map +1 -0
- package/dist/server/app.d.ts +175 -0
- package/dist/server/app.js +275 -0
- package/dist/server/app.js.map +1 -0
- package/dist/server/auth/discovery.d.ts +33 -0
- package/dist/server/auth/discovery.js +56 -0
- package/dist/server/auth/discovery.js.map +1 -0
- package/dist/server/auth/discovery.test.js +93 -0
- package/dist/server/auth/discovery.test.js.map +1 -0
- package/dist/server/auth/index.d.ts +30 -0
- package/dist/server/auth/index.js +2 -0
- package/dist/server/auth/index.js.map +1 -0
- package/dist/server/auth/providers/auth0.d.ts +40 -0
- package/dist/server/auth/providers/auth0.js +31 -0
- package/dist/server/auth/providers/auth0.js.map +1 -0
- package/dist/server/auth/providers/auth0.test.js +50 -0
- package/dist/server/auth/providers/auth0.test.js.map +1 -0
- package/dist/server/auth/providers/authplane.d.ts +49 -0
- package/dist/server/auth/providers/authplane.js +57 -0
- package/dist/server/auth/providers/authplane.js.map +1 -0
- package/dist/server/auth/providers/authplane.test.d.ts +1 -0
- package/dist/server/auth/providers/authplane.test.js +140 -0
- package/dist/server/auth/providers/authplane.test.js.map +1 -0
- package/dist/server/auth/providers/clerk.d.ts +51 -0
- package/dist/server/auth/providers/clerk.js +19 -0
- package/dist/server/auth/providers/clerk.js.map +1 -0
- package/dist/server/auth/providers/clerk.test.d.ts +1 -0
- package/dist/server/auth/providers/clerk.test.js +30 -0
- package/dist/server/auth/providers/clerk.test.js.map +1 -0
- package/dist/server/auth/providers/custom.d.ts +40 -0
- package/dist/server/auth/providers/custom.js +56 -0
- package/dist/server/auth/providers/custom.js.map +1 -0
- package/dist/server/auth/providers/custom.test.d.ts +1 -0
- package/dist/server/auth/providers/custom.test.js +158 -0
- package/dist/server/auth/providers/custom.test.js.map +1 -0
- package/dist/server/auth/providers/descope.d.ts +44 -0
- package/dist/server/auth/providers/descope.js +44 -0
- package/dist/server/auth/providers/descope.js.map +1 -0
- package/dist/server/auth/providers/descope.test.d.ts +1 -0
- package/dist/server/auth/providers/descope.test.js +62 -0
- package/dist/server/auth/providers/descope.test.js.map +1 -0
- package/dist/server/auth/providers/shared.d.ts +2 -0
- package/dist/server/auth/providers/shared.js +6 -0
- package/dist/server/auth/providers/shared.js.map +1 -0
- package/dist/server/auth/providers/shared.test.d.ts +1 -0
- package/dist/server/auth/providers/shared.test.js +10 -0
- package/dist/server/auth/providers/shared.test.js.map +1 -0
- package/dist/server/auth/providers/stytch.d.ts +25 -0
- package/dist/server/auth/providers/stytch.js +16 -0
- package/dist/server/auth/providers/stytch.js.map +1 -0
- package/dist/server/auth/providers/verify-spy.d.ts +12 -0
- package/dist/server/auth/providers/verify-spy.js +21 -0
- package/dist/server/auth/providers/verify-spy.js.map +1 -0
- package/dist/server/auth/providers/workos.d.ts +33 -0
- package/dist/server/auth/providers/workos.js +15 -0
- package/dist/server/auth/providers/workos.js.map +1 -0
- package/dist/server/auth/security-schemes.d.ts +23 -0
- package/dist/server/auth/security-schemes.js +64 -0
- package/dist/server/auth/security-schemes.js.map +1 -0
- package/dist/server/auth/security-schemes.test.d.ts +1 -0
- package/dist/server/auth/security-schemes.test.js +99 -0
- package/dist/server/auth/security-schemes.test.js.map +1 -0
- package/dist/server/auth/setup.d.ts +6 -0
- package/dist/server/auth/setup.js +91 -0
- package/dist/server/auth/setup.js.map +1 -0
- package/dist/server/auth/setup.test.d.ts +1 -0
- package/dist/server/auth/setup.test.js +512 -0
- package/dist/server/auth/setup.test.js.map +1 -0
- package/dist/server/auth/verify.d.ts +46 -0
- package/dist/server/auth/verify.js +62 -0
- package/dist/server/auth/verify.js.map +1 -0
- package/dist/server/auth/verify.test.d.ts +1 -0
- package/dist/server/auth/verify.test.js +149 -0
- package/dist/server/auth/verify.test.js.map +1 -0
- package/dist/server/auth-extra.test-d.js +71 -0
- package/dist/server/auth-extra.test-d.js.map +1 -0
- package/dist/server/auth.d.ts +42 -5
- package/dist/server/auth.js +3 -4
- package/dist/server/auth.js.map +1 -1
- package/dist/server/build-manifest.test.d.ts +1 -0
- package/dist/server/build-manifest.test.js +28 -0
- package/dist/server/build-manifest.test.js.map +1 -0
- package/dist/server/content-helpers.d.ts +1 -1
- package/dist/server/content-helpers.js.map +1 -1
- package/dist/server/express.d.ts +23 -3
- package/dist/server/express.js +37 -32
- package/dist/server/express.js.map +1 -1
- package/dist/server/express.test.js +154 -95
- package/dist/server/express.test.js.map +1 -1
- package/dist/server/factory-loader.test.d.ts +1 -0
- package/dist/server/factory-loader.test.js +81 -0
- package/dist/server/factory-loader.test.js.map +1 -0
- package/dist/server/file-ref.d.ts +1 -1
- package/dist/server/file-ref.js +1 -1
- package/dist/server/file-ref.js.map +1 -1
- package/dist/server/host.d.ts +2 -0
- package/dist/server/host.js +11 -0
- package/dist/server/host.js.map +1 -0
- package/dist/server/host.test.d.ts +1 -0
- package/dist/server/host.test.js +13 -0
- package/dist/server/host.test.js.map +1 -0
- package/dist/server/index.d.ts +16 -3
- package/dist/server/index.js +13 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server/mcp-errors.test.d.ts +1 -0
- package/dist/server/mcp-errors.test.js +37 -0
- package/dist/server/mcp-errors.test.js.map +1 -0
- package/dist/server/middleware.d.ts +35 -10
- package/dist/server/middleware.js +33 -0
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/middleware.test-d.js +1 -1
- package/dist/server/middleware.test-d.js.map +1 -1
- package/dist/server/middleware.test.js +190 -131
- package/dist/server/middleware.test.js.map +1 -1
- package/dist/server/register-tool.test.d.ts +1 -0
- package/dist/server/register-tool.test.js +23 -0
- package/dist/server/register-tool.test.js.map +1 -0
- package/dist/server/requestOrigin.d.ts +7 -0
- package/dist/server/requestOrigin.js +25 -0
- package/dist/server/requestOrigin.js.map +1 -0
- package/dist/server/server.d.ts +167 -122
- package/dist/server/server.js +346 -330
- package/dist/server/server.js.map +1 -1
- package/dist/server/skills-integration.test.d.ts +1 -0
- package/dist/server/skills-integration.test.js +79 -0
- package/dist/server/skills-integration.test.js.map +1 -0
- package/dist/server/skills.d.ts +27 -0
- package/dist/server/skills.js +188 -0
- package/dist/server/skills.js.map +1 -0
- package/dist/server/skills.test.d.ts +1 -0
- package/dist/server/skills.test.js +243 -0
- package/dist/server/skills.test.js.map +1 -0
- package/dist/server/templateHelper.d.ts +0 -3
- package/dist/server/templateHelper.js.map +1 -1
- package/dist/server/templates.generated.js +4 -8
- package/dist/server/templates.generated.js.map +1 -1
- package/dist/server/tool-extra.test.d.ts +1 -0
- package/dist/server/tool-extra.test.js +72 -0
- package/dist/server/tool-extra.test.js.map +1 -0
- package/dist/server/view-name.test-d.d.ts +1 -0
- package/dist/server/view-name.test-d.js +8 -0
- package/dist/server/view-name.test-d.js.map +1 -0
- package/dist/server/view-resource-resolution.test.d.ts +6 -0
- package/dist/server/view-resource-resolution.test.js +172 -0
- package/dist/server/view-resource-resolution.test.js.map +1 -0
- package/dist/server/viewsDevServer.js +4 -1
- package/dist/server/viewsDevServer.js.map +1 -1
- package/dist/test/utils.d.ts +9 -11
- package/dist/test/utils.js +18 -13
- package/dist/test/utils.js.map +1 -1
- package/dist/test/view.test.js +88 -120
- package/dist/test/view.test.js.map +1 -1
- package/dist/views/index.d.ts +10 -0
- package/dist/views/index.js +3 -0
- package/dist/views/index.js.map +1 -0
- package/dist/{web/plugin → views}/scan-views.js +1 -1
- package/dist/views/scan-views.js.map +1 -0
- package/dist/views/scan-views.test.d.ts +1 -0
- package/dist/views/scan-views.test.js.map +1 -0
- package/dist/views/validate-view.d.ts +1 -0
- package/dist/{web/plugin → views}/validate-view.js +2 -2
- package/dist/views/validate-view.js.map +1 -0
- package/dist/views/validate-view.test.d.ts +1 -0
- package/dist/views/validate-view.test.js.map +1 -0
- package/dist/web/bridges/adaptor.d.ts +51 -0
- package/dist/web/bridges/adaptor.js +327 -0
- package/dist/web/bridges/adaptor.js.map +1 -0
- package/dist/web/bridges/adaptor.test.d.ts +1 -0
- package/dist/web/bridges/adaptor.test.js +225 -0
- package/dist/web/bridges/adaptor.test.js.map +1 -0
- package/dist/web/bridges/apps-sdk/bridge.d.ts +6 -2
- package/dist/web/bridges/apps-sdk/bridge.js +15 -4
- package/dist/web/bridges/apps-sdk/bridge.js.map +1 -1
- package/dist/web/bridges/apps-sdk/index.d.ts +0 -1
- package/dist/web/bridges/apps-sdk/index.js +0 -1
- package/dist/web/bridges/apps-sdk/index.js.map +1 -1
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.d.ts +1 -1
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js +1 -1
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js.map +1 -1
- package/dist/web/bridges/get-adaptor.d.ts +4 -4
- package/dist/web/bridges/get-adaptor.js +6 -11
- package/dist/web/bridges/get-adaptor.js.map +1 -1
- package/dist/web/bridges/get-adaptor.test.d.ts +1 -0
- package/dist/web/bridges/get-adaptor.test.js +32 -0
- package/dist/web/bridges/get-adaptor.test.js.map +1 -0
- package/dist/web/bridges/mcp-app/bridge.d.ts +15 -3
- package/dist/web/bridges/mcp-app/bridge.js +73 -8
- package/dist/web/bridges/mcp-app/bridge.js.map +1 -1
- package/dist/web/bridges/mcp-app/bridge.test.d.ts +1 -0
- package/dist/web/bridges/mcp-app/bridge.test.js +17 -0
- package/dist/web/bridges/mcp-app/bridge.test.js.map +1 -0
- package/dist/web/bridges/mcp-app/index.d.ts +0 -1
- package/dist/web/bridges/mcp-app/index.js +0 -1
- package/dist/web/bridges/mcp-app/index.js.map +1 -1
- package/dist/web/bridges/mcp-app/types.d.ts +2 -0
- package/dist/web/bridges/mcp-app/types.js.map +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -1
- package/dist/web/bridges/mcp-app/view-tools.test.d.ts +1 -0
- package/dist/web/bridges/mcp-app/view-tools.test.js +143 -0
- package/dist/web/bridges/mcp-app/view-tools.test.js.map +1 -0
- package/dist/web/bridges/types.d.ts +55 -7
- package/dist/web/bridges/types.js +14 -1
- package/dist/web/bridges/types.js.map +1 -1
- package/dist/web/bridges/types.test.d.ts +1 -0
- package/dist/web/bridges/types.test.js +19 -0
- package/dist/web/bridges/types.test.js.map +1 -0
- package/dist/web/components/modal-provider.d.ts +1 -1
- package/dist/web/components/modal-provider.js +4 -3
- package/dist/web/components/modal-provider.js.map +1 -1
- package/dist/web/create-store.test.js +10 -7
- package/dist/web/create-store.test.js.map +1 -1
- package/dist/web/data-llm.d.ts +1 -1
- package/dist/web/data-llm.test.js +20 -7
- package/dist/web/data-llm.test.js.map +1 -1
- package/dist/web/generate-helpers.d.ts +13 -12
- package/dist/web/generate-helpers.js +10 -9
- package/dist/web/generate-helpers.js.map +1 -1
- package/dist/web/generate-helpers.test-d.js +7 -5
- package/dist/web/generate-helpers.test-d.js.map +1 -1
- package/dist/web/generate-helpers.test.js +2 -2
- package/dist/web/generate-helpers.test.js.map +1 -1
- package/dist/web/hooks/index.d.ts +3 -1
- package/dist/web/hooks/index.js +3 -1
- package/dist/web/hooks/index.js.map +1 -1
- package/dist/web/hooks/test/utils.d.ts +2 -1
- package/dist/web/hooks/test/utils.js +1 -1
- package/dist/web/hooks/test/utils.js.map +1 -1
- package/dist/web/hooks/use-call-tool.test.js +39 -25
- package/dist/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/web/hooks/use-display-mode.d.ts +1 -1
- package/dist/web/hooks/use-display-mode.js +1 -1
- package/dist/web/hooks/use-display-mode.js.map +1 -1
- package/dist/web/hooks/use-display-mode.test.js +57 -21
- package/dist/web/hooks/use-display-mode.test.js.map +1 -1
- package/dist/web/hooks/use-download.d.ts +1 -3
- package/dist/web/hooks/use-download.js +1 -2
- package/dist/web/hooks/use-download.js.map +1 -1
- package/dist/web/hooks/use-download.test.js +18 -10
- package/dist/web/hooks/use-download.test.js.map +1 -1
- package/dist/web/hooks/use-files.test.js +11 -3
- package/dist/web/hooks/use-files.test.js.map +1 -1
- package/dist/web/hooks/use-host.d.ts +22 -0
- package/dist/web/hooks/use-host.js +30 -0
- package/dist/web/hooks/use-host.js.map +1 -0
- package/dist/web/hooks/use-host.test.d.ts +1 -0
- package/dist/web/hooks/use-host.test.js +59 -0
- package/dist/web/hooks/use-host.test.js.map +1 -0
- package/dist/web/hooks/use-open-external.test.js +15 -5
- package/dist/web/hooks/use-open-external.test.js.map +1 -1
- package/dist/web/hooks/use-register-view-tool.d.ts +37 -0
- package/dist/web/hooks/use-register-view-tool.js +50 -0
- package/dist/web/hooks/use-register-view-tool.js.map +1 -0
- package/dist/web/hooks/use-request-close.test.js +35 -40
- package/dist/web/hooks/use-request-close.test.js.map +1 -1
- package/dist/web/hooks/use-request-modal.test.js +11 -1
- package/dist/web/hooks/use-request-modal.test.js.map +1 -1
- package/dist/web/hooks/use-request-size.d.ts +1 -1
- package/dist/web/hooks/use-request-size.js +1 -1
- package/dist/web/hooks/use-request-size.js.map +1 -1
- package/dist/web/hooks/use-request-size.test.js +35 -53
- package/dist/web/hooks/use-request-size.test.js.map +1 -1
- package/dist/web/hooks/use-set-open-in-app-url.test.js +26 -12
- package/dist/web/hooks/use-set-open-in-app-url.test.js.map +1 -1
- package/dist/web/hooks/use-tool-info.d.ts +18 -19
- package/dist/web/hooks/use-tool-info.js +4 -8
- package/dist/web/hooks/use-tool-info.js.map +1 -1
- package/dist/web/hooks/use-tool-info.test-d.js +11 -34
- package/dist/web/hooks/use-tool-info.test-d.js.map +1 -1
- package/dist/web/hooks/use-tool-info.test.js +42 -37
- package/dist/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/web/hooks/use-user.d.ts +3 -2
- package/dist/web/hooks/use-user.js +4 -3
- package/dist/web/hooks/use-user.js.map +1 -1
- package/dist/web/hooks/use-user.test.js +85 -37
- package/dist/web/hooks/use-user.test.js.map +1 -1
- package/dist/web/hooks/use-view-state.js +19 -9
- package/dist/web/hooks/use-view-state.js.map +1 -1
- package/dist/web/hooks/use-view-state.test.js +39 -4
- package/dist/web/hooks/use-view-state.test.js.map +1 -1
- package/dist/web/hooks/use-viewport.d.ts +20 -0
- package/dist/web/hooks/use-viewport.js +21 -0
- package/dist/web/hooks/use-viewport.js.map +1 -0
- package/dist/web/hooks/use-viewport.test.d.ts +1 -0
- package/dist/web/hooks/use-viewport.test.js +109 -0
- package/dist/web/hooks/use-viewport.test.js.map +1 -0
- package/dist/web/mount-view.d.ts +3 -2
- package/dist/web/mount-view.js +5 -8
- package/dist/web/mount-view.js.map +1 -1
- package/package.json +33 -27
- package/dist/cli/resolve-views-dir.d.ts +0 -1
- package/dist/cli/resolve-views-dir.js.map +0 -1
- package/dist/web/bridges/apps-sdk/adaptor.d.ts +0 -28
- package/dist/web/bridges/apps-sdk/adaptor.js +0 -113
- package/dist/web/bridges/apps-sdk/adaptor.js.map +0 -1
- package/dist/web/bridges/mcp-app/adaptor.d.ts +0 -52
- package/dist/web/bridges/mcp-app/adaptor.js +0 -280
- package/dist/web/bridges/mcp-app/adaptor.js.map +0 -1
- package/dist/web/hooks/use-layout.d.ts +0 -24
- package/dist/web/hooks/use-layout.js +0 -25
- package/dist/web/hooks/use-layout.js.map +0 -1
- package/dist/web/hooks/use-layout.test.js +0 -96
- package/dist/web/hooks/use-layout.test.js.map +0 -1
- package/dist/web/plugin/data-llm.test.js +0 -81
- package/dist/web/plugin/data-llm.test.js.map +0 -1
- package/dist/web/plugin/plugin.d.ts +0 -33
- package/dist/web/plugin/plugin.js +0 -189
- package/dist/web/plugin/plugin.js.map +0 -1
- package/dist/web/plugin/scan-views.js.map +0 -1
- package/dist/web/plugin/scan-views.test.js.map +0 -1
- package/dist/web/plugin/transform-data-llm.d.ts +0 -12
- package/dist/web/plugin/transform-data-llm.js +0 -96
- package/dist/web/plugin/transform-data-llm.js.map +0 -1
- package/dist/web/plugin/transform-data-llm.test.js +0 -81
- package/dist/web/plugin/transform-data-llm.test.js.map +0 -1
- package/dist/web/plugin/validate-view.d.ts +0 -1
- package/dist/web/plugin/validate-view.js.map +0 -1
- package/dist/web/plugin/validate-view.test.js.map +0 -1
- /package/dist/{web/hooks/use-layout.test.d.ts → cli/build-steps.test.d.ts} +0 -0
- /package/dist/{web/plugin/data-llm.test.d.ts → context-warnings.test.d.ts} +0 -0
- /package/dist/{web/plugin/transform-data-llm.test.d.ts → server/auth/discovery.test.d.ts} +0 -0
- /package/dist/{web/plugin/validate-view.test.d.ts → server/auth/providers/auth0.test.d.ts} +0 -0
- /package/dist/{web/plugin/scan-views.test.d.ts → server/auth-extra.test-d.d.ts} +0 -0
- /package/dist/{web/plugin → views}/scan-views.d.ts +0 -0
- /package/dist/{web/plugin → views}/scan-views.test.js +0 -0
- /package/dist/{web/plugin → views}/validate-view.test.js +0 -0
package/dist/server/server.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { McpUiToolMeta } from "@modelcontextprotocol/ext-apps";
|
|
2
|
-
import { type ServerOptions } from "@modelcontextprotocol/
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
2
|
+
import { type CacheHint, type ContentBlock, type Icon, type Implementation, McpServer as McpServerBase, type PromptCallback, type ReadResourceCallback, type ReadResourceTemplateCallback, type RegisteredPrompt, type RegisteredResource, type RegisteredResourceTemplate, type RequestMeta, type ResourceMetadata, type ResourceTemplate, type ServerOptions, type ServerResult, type StandardSchemaV1, type StandardSchemaWithJSON, type ToolAnnotations } from "@modelcontextprotocol/server";
|
|
3
|
+
import type express from "express";
|
|
4
|
+
import type { OAuthConfig } from "./auth/index.js";
|
|
5
|
+
import type { ResourceMetadataUrlResolver } from "./auth/setup.js";
|
|
6
|
+
import type { ExtraClaims } from "./auth.js";
|
|
7
|
+
import type { McpExtra, McpExtraFor, McpMethodString, McpMiddlewareEntry, McpMiddlewareFilter, McpMiddlewareFn, McpResultFor, McpTypedMiddlewareFn, McpWildcard } from "./middleware.js";
|
|
8
|
+
import { type SkillsManifest } from "./skills.js";
|
|
9
9
|
/**
|
|
10
10
|
* Type marker for a registered tool — carries its input, output, and response
|
|
11
11
|
* metadata shapes so views can infer types from `typeof server`.
|
|
@@ -18,8 +18,6 @@ export type ToolDef<TInput = unknown, TOutput = unknown, TResponseMetadata = unk
|
|
|
18
18
|
output: TOutput;
|
|
19
19
|
responseMetadata: TResponseMetadata;
|
|
20
20
|
};
|
|
21
|
-
/** Which host runtime a view targets — `"apps-sdk"` (ChatGPT) or `"mcp-app"` (MCP Apps spec). */
|
|
22
|
-
export type ViewHostType = "apps-sdk" | "mcp-app";
|
|
23
21
|
/**
|
|
24
22
|
* Content Security Policy origins attached to a view's resource. Each list is
|
|
25
23
|
* passed through to the host's CSP for the view iframe; omit a field to inherit
|
|
@@ -44,8 +42,16 @@ export interface ViewCsp {
|
|
|
44
42
|
*/
|
|
45
43
|
export interface ViewNameRegistry {
|
|
46
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Resolve view component names from a registry: the union of its keys, or
|
|
47
|
+
* `string` when the registry is empty. The empty case happens before
|
|
48
|
+
* `.skybridge/views.d.ts` is generated; falling back to `string` keeps valid
|
|
49
|
+
* view names from erroring on a fresh checkout, and narrowing kicks in once
|
|
50
|
+
* the generated file augments the registry.
|
|
51
|
+
*/
|
|
52
|
+
export type ViewNameFor<Registry> = [keyof Registry & string] extends [never] ? string : keyof Registry & string;
|
|
47
53
|
/** Union of valid view component names. Narrowed by {@link ViewNameRegistry}. */
|
|
48
|
-
export type ViewName =
|
|
54
|
+
export type ViewName = ViewNameFor<ViewNameRegistry>;
|
|
49
55
|
/**
|
|
50
56
|
* Pass under `view` in a tool's `registerTool` config to render the tool's
|
|
51
57
|
* result through a Skybridge view instead of a plain text response.
|
|
@@ -55,11 +61,9 @@ export interface ViewConfig {
|
|
|
55
61
|
component: ViewName;
|
|
56
62
|
/** Human-readable label the host may show alongside the view. */
|
|
57
63
|
description?: string;
|
|
58
|
-
/**
|
|
59
|
-
hosts?: ViewHostType[];
|
|
60
|
-
/** Apps SDK only: request a visible border around the widget. */
|
|
64
|
+
/** Request a visible border around the view (forwarded as `ui.prefersBorder`). */
|
|
61
65
|
prefersBorder?: boolean;
|
|
62
|
-
/**
|
|
66
|
+
/** Override the iframe's served domain (advanced; forwarded as `ui.domain`). */
|
|
63
67
|
domain?: string;
|
|
64
68
|
/** Per-view CSP overrides — see {@link ViewCsp}. */
|
|
65
69
|
csp?: ViewCsp;
|
|
@@ -72,6 +76,43 @@ export type SecurityScheme = {
|
|
|
72
76
|
type: "oauth2";
|
|
73
77
|
scopes?: string[];
|
|
74
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* Declarative per-tool auth. Enforced when the server has an `oauth` provider:
|
|
81
|
+
* anonymous or under-scoped calls are rejected before the handler runs. Omit
|
|
82
|
+
* `auth` entirely for the secure default (sign-in required, no specific scope).
|
|
83
|
+
*/
|
|
84
|
+
export type ToolAuth = {
|
|
85
|
+
/**
|
|
86
|
+
* When `true`, the tool is callable signed out; the token is still used when
|
|
87
|
+
* one is present. Omit (or `false`) to require sign-in.
|
|
88
|
+
*/
|
|
89
|
+
allowsAnonymous?: boolean;
|
|
90
|
+
/** OAuth scopes the caller's token must carry to invoke the tool. */
|
|
91
|
+
scopes?: string[];
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Options forwarded to the built-in `express.json()` body parser. Derived
|
|
95
|
+
* from Express's own types so the public API doesn't depend on `body-parser`.
|
|
96
|
+
*/
|
|
97
|
+
export type JsonOptions = NonNullable<Parameters<typeof express.json>[0]>;
|
|
98
|
+
/**
|
|
99
|
+
* Skybridge-specific options, part of the {@link SkybridgeConfig} bag passed to
|
|
100
|
+
* the `Skybridge` constructor.
|
|
101
|
+
*
|
|
102
|
+
* @typeParam TAuthExtra - Claims the `oauth` verifier populates. Inferred from
|
|
103
|
+
* the config a provider returns, and carried on to tool handlers.
|
|
104
|
+
*/
|
|
105
|
+
export interface SkybridgeServerOptions<TAuthExtra extends ExtraClaims = ExtraClaims> {
|
|
106
|
+
/** Options for the built-in `express.json()` middleware, e.g. `{ limit: "10mb" }`. */
|
|
107
|
+
json?: JsonOptions;
|
|
108
|
+
/** Resource-server OAuth config. When set, mounts well-known metadata and bearer auth on `/mcp`. Pass a zero-arg async function to load it lazily — it resolves once, at `run()` or on the first request, never at module import. */
|
|
109
|
+
oauth?: OAuthConfig<TAuthExtra> | (() => Promise<OAuthConfig<TAuthExtra>>);
|
|
110
|
+
/**
|
|
111
|
+
* @experimental Serve Agent Skills from `src/skills` over MCP (SEP-2640).
|
|
112
|
+
* API may change.
|
|
113
|
+
*/
|
|
114
|
+
skills?: boolean;
|
|
115
|
+
}
|
|
75
116
|
/**
|
|
76
117
|
* Well-known keys recognized by host runtimes when set on a tool's `_meta`.
|
|
77
118
|
* Use {@link ToolMeta} to also pass arbitrary custom metadata alongside these.
|
|
@@ -89,7 +130,6 @@ export interface KnownToolMeta {
|
|
|
89
130
|
"openai/fileParams"?: string[];
|
|
90
131
|
/** MCP Apps: control whether the tool is exposed to the model, the app, or both. */
|
|
91
132
|
ui?: Pick<McpUiToolMeta, "visibility">;
|
|
92
|
-
securitySchemes?: SecurityScheme[];
|
|
93
133
|
}
|
|
94
134
|
/** {@link KnownToolMeta} merged with arbitrary string-keyed metadata for custom flags. */
|
|
95
135
|
export type ToolMeta = KnownToolMeta & Record<string, unknown>;
|
|
@@ -115,10 +155,10 @@ export interface McpServerTypes<TTools extends Record<string, ToolDef>> {
|
|
|
115
155
|
type Simplify<T> = {
|
|
116
156
|
[K in keyof T]: T[K];
|
|
117
157
|
};
|
|
118
|
-
type ShapeOutput<Shape extends
|
|
119
|
-
[K in keyof Shape as undefined extends
|
|
158
|
+
type ShapeOutput<Shape extends Record<string, StandardSchemaWithJSON>> = Simplify<{
|
|
159
|
+
[K in keyof Shape as undefined extends StandardSchemaV1.InferOutput<Shape[K]> ? never : K]: StandardSchemaV1.InferOutput<Shape[K]>;
|
|
120
160
|
} & {
|
|
121
|
-
[K in keyof Shape as undefined extends
|
|
161
|
+
[K in keyof Shape as undefined extends StandardSchemaV1.InferOutput<Shape[K]> ? K : never]?: StandardSchemaV1.InferOutput<Shape[K]>;
|
|
122
162
|
}>;
|
|
123
163
|
type ExtractStructuredContent<T> = T extends {
|
|
124
164
|
structuredContent: infer SC;
|
|
@@ -130,17 +170,28 @@ type ExtractMeta<T> = [Extract<T, {
|
|
|
130
170
|
}> extends {
|
|
131
171
|
_meta: infer M;
|
|
132
172
|
} ? Simplify<M> : unknown;
|
|
133
|
-
type AddTool<TTools, TName extends string, TInput extends
|
|
173
|
+
type AddTool<TTools, TName extends string, TInput extends Record<string, StandardSchemaWithJSON>, TOutput, TResponseMetadata = unknown, TAuthExtra extends ExtraClaims = ExtraClaims> = McpServer<TTools & {
|
|
134
174
|
[K in TName]: ToolDef<ShapeOutput<TInput>, TOutput, TResponseMetadata>;
|
|
135
|
-
}>;
|
|
136
|
-
interface
|
|
175
|
+
}, TAuthExtra>;
|
|
176
|
+
interface ToolConfigBase<TInput extends Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON> {
|
|
137
177
|
name: string;
|
|
138
178
|
title?: string;
|
|
139
179
|
description?: string;
|
|
140
180
|
inputSchema?: TInput;
|
|
141
|
-
outputSchema?:
|
|
181
|
+
outputSchema?: Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON;
|
|
142
182
|
annotations?: ToolAnnotations;
|
|
143
183
|
view?: ViewConfig;
|
|
184
|
+
_meta?: ToolMeta;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The auth face of a tool config: either the high-level `auth` shorthand or the
|
|
188
|
+
* low-level `securitySchemes` escape hatch, never both.
|
|
189
|
+
*/
|
|
190
|
+
type ToolAuthConfig = {
|
|
191
|
+
auth?: ToolAuth;
|
|
192
|
+
securitySchemes?: never;
|
|
193
|
+
} | {
|
|
194
|
+
auth?: never;
|
|
144
195
|
/**
|
|
145
196
|
* Declares which auth schemes this tool supports (e.g. `noauth`, `oauth2`).
|
|
146
197
|
* Lets clients label tools that require sign-in before calling, and pass
|
|
@@ -149,8 +200,8 @@ interface ToolConfig<TInput extends ZodRawShapeCompat | AnySchema> {
|
|
|
149
200
|
* enhanced behavior to authenticated ones.
|
|
150
201
|
*/
|
|
151
202
|
securitySchemes?: SecurityScheme[];
|
|
152
|
-
|
|
153
|
-
|
|
203
|
+
};
|
|
204
|
+
type ToolConfig<TInput extends Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON> = ToolConfigBase<TInput> & ToolAuthConfig;
|
|
154
205
|
/**
|
|
155
206
|
* Optional client-supplied hints attached to `params._meta` on every tool call
|
|
156
207
|
* by the Apps SDK host. Hints only: never use for authorization, and tolerate
|
|
@@ -180,14 +231,16 @@ export interface ClientHintsMeta {
|
|
|
180
231
|
/** Stable id for the currently mounted widget instance. */
|
|
181
232
|
"openai/widgetSessionId"?: string;
|
|
182
233
|
}
|
|
183
|
-
type ToolHandlerExtra = Omit<
|
|
184
|
-
_meta
|
|
234
|
+
type ToolHandlerExtra<TAuthExtra extends ExtraClaims = ExtraClaims> = Omit<McpExtra<TAuthExtra>, "mcpReq"> & {
|
|
235
|
+
mcpReq: Omit<McpExtra<TAuthExtra>["mcpReq"], "_meta"> & {
|
|
236
|
+
_meta?: RequestMeta & ClientHintsMeta;
|
|
237
|
+
};
|
|
185
238
|
};
|
|
186
|
-
type ToolHandler<TInput extends
|
|
239
|
+
type ToolHandler<TInput extends Record<string, StandardSchemaWithJSON>, TReturn extends {
|
|
187
240
|
content?: HandlerContent;
|
|
188
241
|
} = {
|
|
189
242
|
content?: HandlerContent;
|
|
190
|
-
}> = (args: ShapeOutput<TInput>, extra: ToolHandlerExtra) => TReturn | Promise<TReturn>;
|
|
243
|
+
}, TAuthExtra extends ExtraClaims = ExtraClaims> = (args: ShapeOutput<TInput>, extra: ToolHandlerExtra<TAuthExtra>) => TReturn | Promise<TReturn>;
|
|
191
244
|
/**
|
|
192
245
|
* Coerce a tool handler's return value into an MCP `content` array. Strings
|
|
193
246
|
* become a single `TextContent`; a single block is wrapped in an array;
|
|
@@ -195,18 +248,29 @@ type ToolHandler<TInput extends ZodRawShapeCompat, TReturn extends {
|
|
|
195
248
|
* who build content lazily can apply the same normalization.
|
|
196
249
|
*/
|
|
197
250
|
export declare function normalizeContent(content: HandlerContent | undefined): ContentBlock[];
|
|
198
|
-
interface McpServerBaseOmitted extends Omit<McpServerBase, "registerTool" | "connect"> {
|
|
251
|
+
interface McpServerBaseOmitted extends Omit<McpServerBase, "registerTool" | "registerResource" | "registerPrompt" | "connect"> {
|
|
199
252
|
}
|
|
200
253
|
declare const McpServerBaseOmitted: new (...args: ConstructorParameters<typeof McpServerBase>) => McpServerBaseOmitted;
|
|
201
254
|
/**
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
255
|
+
* Prime the build-time Vite manifest before user code constructs its
|
|
256
|
+
* `McpServer`. Called from the generated `dist/__entry.js`; not part of the
|
|
257
|
+
* user-facing API.
|
|
258
|
+
*
|
|
259
|
+
* @internal
|
|
260
|
+
*/
|
|
261
|
+
export declare function __setBuildManifest(manifest: Record<string, {
|
|
262
|
+
file: string;
|
|
263
|
+
}>): void;
|
|
264
|
+
export declare function __setSkillsManifest(manifest: SkillsManifest): void;
|
|
265
|
+
/**
|
|
266
|
+
* Typed registration sugar over the MCP SDK's `McpServer`: a tool registry
|
|
267
|
+
* that carries input/output/meta shapes, view resources, per-tool security
|
|
268
|
+
* schemes, and prompt/resource registration. A {@link Skybridge} app builds
|
|
269
|
+
* one of these per request and hands it to your setup factory; chain
|
|
270
|
+
* {@link McpServer.registerTool} calls on it and return the result.
|
|
207
271
|
*
|
|
208
272
|
* The `TTools` generic accumulates each registered tool's input/output/meta
|
|
209
|
-
* shape, so `typeof
|
|
273
|
+
* shape, so `typeof app` carries enough information for view-side helpers
|
|
210
274
|
* like {@link generateHelpers} to produce fully-typed hooks.
|
|
211
275
|
*
|
|
212
276
|
* @typeParam TTools - Accumulated tool registry. Filled in by `registerTool`
|
|
@@ -214,75 +278,80 @@ declare const McpServerBaseOmitted: new (...args: ConstructorParameters<typeof M
|
|
|
214
278
|
*
|
|
215
279
|
* @example
|
|
216
280
|
* ```ts
|
|
217
|
-
* const
|
|
218
|
-
* .registerTool({
|
|
281
|
+
* export const app = new Skybridge({ name: "my-app", version: "1.0.0" }, (server) =>
|
|
282
|
+
* server.registerTool({
|
|
219
283
|
* name: "search",
|
|
220
284
|
* inputSchema: { query: z.string() },
|
|
221
285
|
* view: { component: "search" },
|
|
222
|
-
* }, async ({ query }) => ({ content: `Results for ${query}` }))
|
|
223
|
-
*
|
|
224
|
-
* await server.run();
|
|
225
|
-
* export type AppType = typeof server;
|
|
286
|
+
* }, async ({ query }) => ({ content: `Results for ${query}` })),
|
|
287
|
+
* );
|
|
226
288
|
* ```
|
|
227
289
|
*
|
|
228
290
|
* @see https://docs.skybridge.tech/api-reference/mcp-server
|
|
229
291
|
*/
|
|
230
|
-
export declare class McpServer<TTools extends Record<string, ToolDef> = Record<never, ToolDef
|
|
292
|
+
export declare class McpServer<TTools extends Record<string, ToolDef> = Record<never, ToolDef>, TAuthExtra extends ExtraClaims = ExtraClaims> extends McpServerBaseOmitted {
|
|
231
293
|
readonly $types: McpServerTypes<TTools>;
|
|
232
|
-
/**
|
|
233
|
-
* The underlying Express app. Use this to extend the HTTP server with
|
|
234
|
-
* custom routes, middleware, or settings — e.g.
|
|
235
|
-
* `server.express.get("/health", ...)`.
|
|
236
|
-
*
|
|
237
|
-
* `express.json()` is pre-applied. Register your handlers before `run()`;
|
|
238
|
-
* after `run()`, dev-mode middleware, the `/mcp` route, and the default
|
|
239
|
-
* error handler are appended in that order.
|
|
240
|
-
*
|
|
241
|
-
* Note: Alpic Cloud only routes traffic to `/mcp` — custom routes work
|
|
242
|
-
* locally and on self-hosted deployments.
|
|
243
|
-
*/
|
|
244
|
-
readonly express: Express;
|
|
245
|
-
private customErrorMiddleware;
|
|
246
|
-
private mcpMiddlewareEntries;
|
|
247
|
-
private mcpMiddlewareApplied;
|
|
248
294
|
private claimedViews;
|
|
249
295
|
private viewMetaBuilders;
|
|
296
|
+
/**
|
|
297
|
+
* Maps a view resource's query-less path to its canonical registered URI
|
|
298
|
+
* (the one carrying the `?v=` cache key). Lets `resources/read` resolve the
|
|
299
|
+
* underlying view no matter which version param the consumer sends, since
|
|
300
|
+
* the param is only a cache key, not part of the resource's identity.
|
|
301
|
+
*/
|
|
302
|
+
private viewUriByPath;
|
|
250
303
|
private viteManifest;
|
|
251
|
-
private
|
|
252
|
-
private
|
|
253
|
-
|
|
304
|
+
private oauthEnabled;
|
|
305
|
+
private resolveResourceMetadataUrl?;
|
|
306
|
+
private readonly toolSecuritySchemes;
|
|
307
|
+
private readonly userMiddlewareEntries;
|
|
308
|
+
constructor(serverInfo: Implementation, options?: ServerOptions, skybridgeOptions?: SkybridgeServerOptions<TAuthExtra>);
|
|
254
309
|
/**
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
310
|
+
* The per-tool security schemes collected during registration, keyed by tool
|
|
311
|
+
* name. Read by the OAuth layer to decide whether anonymous requests are
|
|
312
|
+
* allowed and which schemes gate a given `tools/call`.
|
|
258
313
|
*
|
|
259
|
-
*
|
|
260
|
-
* locally and on self-hosted deployments.
|
|
314
|
+
* @internal
|
|
261
315
|
*/
|
|
262
|
-
|
|
263
|
-
use(path: string, ...handlers: RequestHandler[]): this;
|
|
316
|
+
get securitySchemesByTool(): ReadonlyMap<string, SecurityScheme[] | undefined>;
|
|
264
317
|
/**
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
* thrown by tool handlers before the default error handler responds.
|
|
318
|
+
* Inject the resolver the app uses to build the protected-resource metadata
|
|
319
|
+
* URL, so tool handlers can emit in-band auth challenges.
|
|
268
320
|
*
|
|
269
|
-
* @
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
|
|
321
|
+
* @internal
|
|
322
|
+
*/
|
|
323
|
+
setResourceMetadataUrlResolver(resolve: ResourceMetadataUrlResolver): this;
|
|
324
|
+
/**
|
|
325
|
+
* Register a resource. Signature owned by Skybridge (not inherited) so a
|
|
326
|
+
* typed wrapper can land in a minor without a type-level break.
|
|
327
|
+
*/
|
|
328
|
+
registerResource(name: string, uri: string, config: ResourceMetadata & {
|
|
329
|
+
cacheHint?: CacheHint;
|
|
330
|
+
}, readCallback: ReadResourceCallback): RegisteredResource;
|
|
331
|
+
registerResource(name: string, template: ResourceTemplate, config: ResourceMetadata & {
|
|
332
|
+
cacheHint?: CacheHint;
|
|
333
|
+
}, readCallback: ReadResourceTemplateCallback): RegisteredResourceTemplate;
|
|
334
|
+
/**
|
|
335
|
+
* Register a prompt. Signature owned by Skybridge (not inherited) so a
|
|
336
|
+
* typed wrapper can land in a minor without a type-level break.
|
|
276
337
|
*/
|
|
277
|
-
|
|
278
|
-
|
|
338
|
+
registerPrompt<Args extends StandardSchemaWithJSON>(name: string, config: {
|
|
339
|
+
title?: string;
|
|
340
|
+
description?: string;
|
|
341
|
+
argsSchema?: Args;
|
|
342
|
+
icons?: Icon[];
|
|
343
|
+
_meta?: Record<string, unknown>;
|
|
344
|
+
}, cb: PromptCallback<Args>): RegisteredPrompt;
|
|
345
|
+
private applyInherited;
|
|
346
|
+
private skillRegistrar;
|
|
347
|
+
private setupSkills;
|
|
279
348
|
/** Register MCP protocol-level middleware (catch-all). */
|
|
280
|
-
mcpMiddleware(handler: McpMiddlewareFn): this;
|
|
349
|
+
mcpMiddleware(handler: McpMiddlewareFn<TAuthExtra>): this;
|
|
281
350
|
/** Register MCP protocol-level middleware for all requests (`extra` is `McpExtra`). */
|
|
282
351
|
mcpMiddleware(filter: "request", handler: (request: {
|
|
283
352
|
method: string;
|
|
284
353
|
params: Record<string, unknown>;
|
|
285
|
-
}, extra: McpExtra
|
|
354
|
+
}, extra: McpExtra<TAuthExtra>, next: () => Promise<ServerResult>) => Promise<unknown> | unknown): this;
|
|
286
355
|
/** Register MCP protocol-level middleware for all notifications (`extra` is `undefined`). */
|
|
287
356
|
mcpMiddleware(filter: "notification", handler: (request: {
|
|
288
357
|
method: string;
|
|
@@ -292,7 +361,7 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
292
361
|
* Register MCP protocol-level middleware for an exact method.
|
|
293
362
|
* Narrows `params`, `extra`, and `next()` result based on the method string.
|
|
294
363
|
*/
|
|
295
|
-
mcpMiddleware<M extends McpMethodString>(filter: M, handler: McpTypedMiddlewareFn<M>): this;
|
|
364
|
+
mcpMiddleware<M extends McpMethodString>(filter: M, handler: McpTypedMiddlewareFn<M, TAuthExtra>): this;
|
|
296
365
|
/**
|
|
297
366
|
* Register MCP protocol-level middleware for a wildcard pattern (e.g. `"tools/*"`).
|
|
298
367
|
* `next()` returns the union of result types for matching methods.
|
|
@@ -300,54 +369,28 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
300
369
|
mcpMiddleware<W extends McpWildcard>(filter: W, handler: (request: {
|
|
301
370
|
method: string;
|
|
302
371
|
params: Record<string, unknown>;
|
|
303
|
-
}, extra: McpExtraFor<W>, next: () => Promise<McpResultFor<W>>) => Promise<unknown> | unknown): this;
|
|
372
|
+
}, extra: McpExtraFor<W, TAuthExtra>, next: () => Promise<McpResultFor<W>>) => Promise<unknown> | unknown): this;
|
|
304
373
|
/**
|
|
305
374
|
* Register MCP protocol-level middleware with a method filter.
|
|
306
375
|
* Filter can be an exact method (`"tools/call"`), wildcard (`"tools/*"`),
|
|
307
376
|
* category (`"request"` | `"notification"`), or an array of those.
|
|
308
377
|
*/
|
|
309
|
-
mcpMiddleware(filter: McpMiddlewareFilter, handler: McpMiddlewareFn): this;
|
|
310
|
-
private applyMcpMiddleware;
|
|
311
|
-
/**
|
|
312
|
-
* Connect to an MCP transport (override of the SDK's `connect`). Use this
|
|
313
|
-
* when you're embedding Skybridge in a host that already manages its own
|
|
314
|
-
* transport (e.g. stdio for desktop apps); for HTTP, prefer {@link McpServer.run}
|
|
315
|
-
* which sets the transport up for you. Locks in any middleware registered
|
|
316
|
-
* via {@link McpServer.mcpMiddleware} — further calls to that method will
|
|
317
|
-
* throw afterwards.
|
|
318
|
-
*/
|
|
319
|
-
connect(transport: Parameters<typeof McpServerBase.prototype.connect>[0]): Promise<void>;
|
|
378
|
+
mcpMiddleware(filter: McpMiddlewareFilter, handler: McpMiddlewareFn<TAuthExtra>): this;
|
|
320
379
|
/**
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
* we build a fresh underlying `Server` per request and share the main
|
|
326
|
-
* server's handler maps by reference. The cast is unavoidable: there's
|
|
327
|
-
* no public API to inject handler maps. `getHandlerMaps` validates the
|
|
328
|
-
* read side and fails fast on SDK field renames.
|
|
329
|
-
*/
|
|
330
|
-
connectStatelessTransport(transport: Parameters<typeof McpServerBase.prototype.connect>[0]): Promise<void>;
|
|
331
|
-
/**
|
|
332
|
-
* Start the HTTP server. Listens on `process.env.__PORT` (default `3000`),
|
|
333
|
-
* mounts the `/mcp` route, applies any custom Express middleware registered
|
|
334
|
-
* via {@link McpServer.use} / {@link McpServer.useOnError}, and locks in
|
|
335
|
-
* any MCP middleware registered via {@link McpServer.mcpMiddleware}.
|
|
380
|
+
* This instance's protocol-level middleware: the framework's own entries
|
|
381
|
+
* (view `_meta` on `resources/list`, version-agnostic view resolution on
|
|
382
|
+
* `resources/read`, the top-level `securitySchemes` mirror on `tools/list`)
|
|
383
|
+
* followed by the ones registered via {@link McpServer.mcpMiddleware}.
|
|
336
384
|
*
|
|
337
|
-
*
|
|
338
|
-
* the runtime can bridge incoming requests to the Node HTTP server. On
|
|
339
|
-
* Vercel (`VERCEL === "1"`), returns the Express app directly so the
|
|
340
|
-
* serverless function entry can call it as a `(req, res)` handler. On
|
|
341
|
-
* Node, returns `undefined` once listening.
|
|
385
|
+
* @internal
|
|
342
386
|
*/
|
|
343
|
-
|
|
344
|
-
fetch: (...args: unknown[]) => unknown;
|
|
345
|
-
} | Express | undefined>;
|
|
387
|
+
protocolMiddlewareEntries(): McpMiddlewareEntry[];
|
|
346
388
|
private enforceOneToolPerView;
|
|
347
389
|
private resolveViewRequestContext;
|
|
348
390
|
private registerViewResources;
|
|
349
391
|
private registerViewResource;
|
|
350
|
-
private
|
|
392
|
+
private serveLegacyAppsSdkUrl;
|
|
393
|
+
private decorateToolHandler;
|
|
351
394
|
private computeViewVersionParam;
|
|
352
395
|
private lookupViewFile;
|
|
353
396
|
private lookupDistFile;
|
|
@@ -390,11 +433,13 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
390
433
|
*
|
|
391
434
|
* @see https://docs.skybridge.tech/api-reference/register-tool
|
|
392
435
|
*/
|
|
393
|
-
registerTool<TName extends string, InputArgs extends
|
|
436
|
+
registerTool<TName extends string, InputArgs extends Record<string, StandardSchemaWithJSON>, TReturn extends {
|
|
394
437
|
content?: HandlerContent;
|
|
395
438
|
}>(config: ToolConfig<InputArgs> & {
|
|
396
439
|
name: TName;
|
|
397
|
-
}, cb: ToolHandler<InputArgs, TReturn>): AddTool<TTools, TName, InputArgs, ExtractStructuredContent<TReturn>, ExtractMeta<TReturn
|
|
398
|
-
registerTool<InputArgs extends
|
|
440
|
+
}, cb: ToolHandler<InputArgs, TReturn, TAuthExtra>): AddTool<TTools, TName, InputArgs, ExtractStructuredContent<TReturn>, ExtractMeta<TReturn>, TAuthExtra>;
|
|
441
|
+
registerTool<InputArgs extends Record<string, StandardSchemaWithJSON>>(config: ToolConfig<InputArgs>, cb: ToolHandler<InputArgs, {
|
|
442
|
+
content?: HandlerContent;
|
|
443
|
+
}, TAuthExtra>): this;
|
|
399
444
|
}
|
|
400
445
|
export {};
|