skybridge 0.0.0-dev.8cced89 → 0.0.0-dev.8ceb3ae
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 +126 -124
- package/dist/cli/build-helpers.d.ts +11 -0
- package/dist/cli/build-helpers.js +107 -0
- package/dist/cli/build-helpers.js.map +1 -0
- package/dist/cli/build-helpers.test.js +132 -0
- package/dist/cli/build-helpers.test.js.map +1 -0
- 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 +9 -20
- package/dist/cli/detect-port.js.map +1 -1
- package/dist/cli/header.d.ts +1 -1
- package/dist/cli/header.js.map +1 -1
- package/dist/cli/resolve-skybridge-config.d.ts +5 -0
- package/dist/cli/resolve-skybridge-config.js +18 -0
- package/dist/cli/resolve-skybridge-config.js.map +1 -0
- package/dist/cli/run-command.js.map +1 -1
- 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/telemetry.js.map +1 -1
- package/dist/cli/tunnel-control-server.js.map +1 -1
- package/dist/cli/tunnel-control-server.test.js.map +1 -1
- package/dist/cli/tunnel-handler.js.map +1 -1
- package/dist/cli/tunnel-handler.test.js.map +1 -1
- package/dist/cli/tunnel.js +2 -2
- package/dist/cli/tunnel.js.map +1 -1
- package/dist/cli/tunnel.test.js.map +1 -1
- package/dist/cli/types.js.map +1 -1
- package/dist/cli/use-execute-steps.d.ts +1 -1
- package/dist/cli/use-execute-steps.js.map +1 -1
- package/dist/cli/use-messages.js.map +1 -1
- package/dist/cli/use-nodemon.d.ts +14 -0
- package/dist/cli/use-nodemon.js +72 -52
- package/dist/cli/use-nodemon.js.map +1 -1
- package/dist/cli/use-open-browser.d.ts +1 -0
- package/dist/cli/use-open-browser.js +44 -0
- package/dist/cli/use-open-browser.js.map +1 -0
- package/dist/cli/use-tunnel.js.map +1 -1
- package/dist/cli/use-typescript-check.d.ts +8 -2
- package/dist/cli/use-typescript-check.js +71 -68
- package/dist/cli/use-typescript-check.js.map +1 -1
- package/dist/commands/build.d.ts +0 -3
- package/dist/commands/build.js +2 -38
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/create.d.ts +9 -0
- package/dist/commands/create.js +30 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/dev.d.ts +2 -0
- package/dist/commands/dev.js +55 -0
- 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/commands/telemetry/disable.js.map +1 -1
- package/dist/commands/telemetry/enable.js.map +1 -1
- package/dist/commands/telemetry/status.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/asset-base-url-transform-plugin.d.ts +1 -0
- package/dist/server/asset-base-url-transform-plugin.js +16 -1
- package/dist/server/asset-base-url-transform-plugin.js.map +1 -1
- package/dist/server/asset-base-url-transform-plugin.test.js +51 -1
- package/dist/server/asset-base-url-transform-plugin.test.js.map +1 -1
- 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.d.ts +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 +498 -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 +57 -0
- package/dist/server/auth.js +27 -0
- package/dist/server/auth.js.map +1 -0
- package/dist/server/build-manifest.test.d.ts +1 -0
- package/dist/server/build-manifest.test.js +27 -0
- package/dist/server/build-manifest.test.js.map +1 -0
- package/dist/server/content-helpers.d.ts +41 -1
- package/dist/server/content-helpers.js +33 -0
- package/dist/server/content-helpers.js.map +1 -1
- package/dist/server/content-helpers.test.js.map +1 -1
- package/dist/server/express.d.ts +1 -5
- package/dist/server/express.js +15 -28
- package/dist/server/express.js.map +1 -1
- package/dist/server/express.test.js +249 -71
- package/dist/server/express.test.js.map +1 -1
- package/dist/server/file-ref.d.ts +28 -0
- package/dist/server/file-ref.js +27 -0
- package/dist/server/file-ref.js.map +1 -0
- 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 -2
- package/dist/server/index.js +13 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/inferUtilityTypes.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/metric.js.map +1 -1
- package/dist/server/middleware.d.ts +51 -13
- 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 +38 -3
- 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 +25 -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 +364 -43
- package/dist/server/server.js +550 -207
- 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 -2
- package/dist/server/templateHelper.js +3 -22
- package/dist/server/templateHelper.js.map +1 -1
- package/dist/server/templates.generated.d.ts +4 -0
- package/dist/server/templates.generated.js +47 -0
- package/dist/server/templates.generated.js.map +1 -0
- 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/tunnel-proxy-router.js.map +1 -1
- package/dist/server/tunnel-proxy-router.test.js.map +1 -1
- 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 +169 -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/standard-schema.d.ts +3 -0
- package/dist/standard-schema.js +2 -0
- package/dist/standard-schema.js.map +1 -0
- package/dist/test/utils.d.ts +5 -8
- package/dist/test/utils.js +8 -4
- package/dist/test/utils.js.map +1 -1
- package/dist/test/view.test.js +119 -106
- package/dist/test/view.test.js.map +1 -1
- package/dist/version.js +1 -3
- package/dist/version.js.map +1 -1
- package/dist/views/index.d.ts +3 -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 -1
- package/dist/web/bridges/apps-sdk/bridge.js +15 -3
- 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/types.d.ts +8 -1
- package/dist/web/bridges/apps-sdk/types.js.map +1 -1
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.d.ts +11 -0
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js +11 -0
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js.map +1 -1
- package/dist/web/bridges/get-adaptor.d.ts +7 -0
- package/dist/web/bridges/get-adaptor.js +9 -7
- 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/index.js.map +1 -1
- package/dist/web/bridges/mcp-app/bridge.d.ts +15 -2
- package/dist/web/bridges/mcp-app/bridge.js +73 -7
- 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 +12 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js +12 -0
- 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.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 +117 -4
- 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/bridges/use-host-context.d.ts +5 -0
- package/dist/web/bridges/use-host-context.js +5 -0
- package/dist/web/bridges/use-host-context.js.map +1 -1
- 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.d.ts +26 -0
- package/dist/web/create-store.js +26 -0
- package/dist/web/create-store.js.map +1 -1
- package/dist/web/create-store.test.js +9 -6
- package/dist/web/create-store.test.js.map +1 -1
- package/dist/web/data-llm.d.ts +34 -1
- package/dist/web/data-llm.js +28 -0
- package/dist/web/data-llm.js.map +1 -1
- package/dist/web/data-llm.test.js +19 -6
- package/dist/web/data-llm.test.js.map +1 -1
- package/dist/web/generate-helpers.d.ts +2 -0
- package/dist/web/generate-helpers.js +2 -0
- package/dist/web/generate-helpers.js.map +1 -1
- package/dist/web/generate-helpers.test-d.js +4 -2
- package/dist/web/generate-helpers.test-d.js.map +1 -1
- package/dist/web/generate-helpers.test.js.map +1 -1
- package/dist/web/helpers/state.js.map +1 -1
- package/dist/web/helpers/state.test.js.map +1 -1
- package/dist/web/hooks/index.d.ts +6 -1
- package/dist/web/hooks/index.js +6 -1
- package/dist/web/hooks/index.js.map +1 -1
- package/dist/web/hooks/test/utils.d.ts +7 -2
- package/dist/web/hooks/test/utils.js +14 -3
- package/dist/web/hooks/test/utils.js.map +1 -1
- package/dist/web/hooks/use-call-tool.d.ts +45 -0
- package/dist/web/hooks/use-call-tool.js +28 -0
- package/dist/web/hooks/use-call-tool.js.map +1 -1
- package/dist/web/hooks/use-call-tool.test-d.js.map +1 -1
- package/dist/web/hooks/use-call-tool.test.js +64 -29
- package/dist/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/web/hooks/use-display-mode.d.ts +20 -0
- package/dist/web/hooks/use-display-mode.js +20 -0
- package/dist/web/hooks/use-display-mode.js.map +1 -1
- package/dist/web/hooks/use-display-mode.test-d.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 +3 -0
- package/dist/web/hooks/use-download.js +7 -0
- package/dist/web/hooks/use-download.js.map +1 -0
- package/dist/web/hooks/use-download.test.d.ts +1 -0
- package/dist/web/hooks/use-download.test.js +103 -0
- package/dist/web/hooks/use-download.test.js.map +1 -0
- package/dist/web/hooks/use-files.d.ts +32 -0
- package/dist/web/hooks/use-files.js +32 -0
- package/dist/web/hooks/use-files.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.d.ts +17 -0
- package/dist/web/hooks/use-open-external.js +16 -0
- package/dist/web/hooks/use-open-external.js.map +1 -1
- package/dist/web/hooks/use-open-external.test.js +14 -4
- 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.d.ts +16 -0
- package/dist/web/hooks/use-request-close.js +21 -0
- package/dist/web/hooks/use-request-close.js.map +1 -0
- package/dist/web/hooks/use-request-close.test.d.ts +1 -0
- package/dist/web/hooks/use-request-close.test.js +47 -0
- package/dist/web/hooks/use-request-close.test.js.map +1 -0
- package/dist/web/hooks/use-request-modal.d.ts +16 -1
- package/dist/web/hooks/use-request-modal.js +16 -1
- package/dist/web/hooks/use-request-modal.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 +20 -0
- package/dist/web/hooks/use-request-size.js +24 -0
- package/dist/web/hooks/use-request-size.js.map +1 -0
- package/dist/web/hooks/use-request-size.test.d.ts +1 -0
- package/dist/web/hooks/use-request-size.test.js +47 -0
- package/dist/web/hooks/use-request-size.test.js.map +1 -0
- package/dist/web/hooks/use-send-follow-up-message.d.ts +19 -1
- package/dist/web/hooks/use-send-follow-up-message.js +19 -2
- package/dist/web/hooks/use-send-follow-up-message.js.map +1 -1
- package/dist/web/hooks/use-set-open-in-app-url.d.ts +17 -0
- package/dist/web/hooks/use-set-open-in-app-url.js +17 -0
- package/dist/web/hooks/use-set-open-in-app-url.js.map +1 -1
- package/dist/web/hooks/use-set-open-in-app-url.test.js +29 -9
- package/dist/web/hooks/use-set-open-in-app-url.test.js.map +1 -1
- package/dist/web/hooks/use-tool-info.d.ts +46 -14
- package/dist/web/hooks/use-tool-info.js +29 -7
- 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 +41 -36
- package/dist/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/web/hooks/use-user.d.ts +5 -2
- package/dist/web/hooks/use-user.js +6 -3
- package/dist/web/hooks/use-user.js.map +1 -1
- package/dist/web/hooks/use-user.test.js +84 -36
- package/dist/web/hooks/use-user.test.js.map +1 -1
- package/dist/web/hooks/use-view-state.d.ts +21 -0
- 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 +38 -3
- 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/index.d.ts +1 -0
- package/dist/web/index.js.map +1 -1
- package/dist/web/mount-view.d.ts +20 -0
- package/dist/web/mount-view.js +20 -0
- package/dist/web/mount-view.js.map +1 -1
- package/dist/web/proxy.js.map +1 -1
- package/dist/web/types.d.ts +4 -0
- package/dist/web/types.js.map +1 -1
- package/package.json +41 -28
- package/dist/server/templates/development.hbs +0 -12
- package/dist/server/templates/production.hbs +0 -6
- package/dist/web/bridges/apps-sdk/adaptor.d.ts +0 -24
- package/dist/web/bridges/apps-sdk/adaptor.js +0 -93
- package/dist/web/bridges/apps-sdk/adaptor.js.map +0 -1
- package/dist/web/bridges/mcp-app/adaptor.d.ts +0 -48
- package/dist/web/bridges/mcp-app/adaptor.js +0 -268
- package/dist/web/bridges/mcp-app/adaptor.js.map +0 -1
- package/dist/web/hooks/use-layout.d.ts +0 -22
- package/dist/web/hooks/use-layout.js +0 -23
- 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 -5
- package/dist/web/plugin/plugin.js +0 -163
- 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-helpers.test.d.ts} +0 -0
- /package/dist/{web/plugin/data-llm.test.d.ts → cli/build-steps.test.d.ts} +0 -0
- /package/dist/{web/plugin/scan-views.test.d.ts → context-warnings.test.d.ts} +0 -0
- /package/dist/{web/plugin/validate-view.test.d.ts → server/auth/discovery.test.d.ts} +0 -0
- /package/dist/{web/plugin/transform-data-llm.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,16 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { McpServer as McpServerBase } from "@modelcontextprotocol/
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
1
|
+
import type { McpUiToolMeta } from "@modelcontextprotocol/ext-apps";
|
|
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 Server as SdkServer, type ServerOptions, type ServerResult, type StandardSchemaV1, type StandardSchemaWithJSON, type ToolAnnotations } from "@modelcontextprotocol/server";
|
|
3
|
+
import express, { type ErrorRequestHandler, type Express, type RequestHandler } from "express";
|
|
4
|
+
import type { InferSchemaOutput, RawInputShape } from "../standard-schema.js";
|
|
5
|
+
import type { OAuthConfig } from "./auth/index.js";
|
|
6
|
+
import type { ExtraClaims } from "./auth.js";
|
|
7
7
|
import type { McpExtra, McpExtraFor, McpMethodString, McpMiddlewareFilter, McpMiddlewareFn, McpResultFor, McpTypedMiddlewareFn, McpWildcard } from "./middleware.js";
|
|
8
|
+
import { type SkillsManifest } from "./skills.js";
|
|
9
|
+
/**
|
|
10
|
+
* Type marker for a registered tool — carries its input, output, and response
|
|
11
|
+
* metadata shapes so views can infer types from `typeof server`.
|
|
12
|
+
*
|
|
13
|
+
* You normally never construct this by hand; it is produced by `registerTool`
|
|
14
|
+
* and consumed by helpers like {@link InferTools} and {@link generateHelpers}.
|
|
15
|
+
*/
|
|
8
16
|
export type ToolDef<TInput = unknown, TOutput = unknown, TResponseMetadata = unknown> = {
|
|
9
17
|
input: TInput;
|
|
10
18
|
output: TOutput;
|
|
11
19
|
responseMetadata: TResponseMetadata;
|
|
12
20
|
};
|
|
13
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The runtime a served view page declares on `window.skybridge`. Every view
|
|
23
|
+
* emits a single ext-apps resource, so this is always `"mcp-app"`; the Apps
|
|
24
|
+
* SDK runtime is detected at load time via `window.openai` instead.
|
|
25
|
+
*/
|
|
26
|
+
export type ViewHostType = "mcp-app";
|
|
27
|
+
/**
|
|
28
|
+
* Content Security Policy origins attached to a view's resource. Each list is
|
|
29
|
+
* passed through to the host's CSP for the view iframe; omit a field to inherit
|
|
30
|
+
* the host's default for that directive.
|
|
31
|
+
*/
|
|
14
32
|
export interface ViewCsp {
|
|
15
33
|
/** Origins for static assets (images, fonts, scripts, styles). */
|
|
16
34
|
resourceDomains?: string[];
|
|
@@ -23,24 +41,109 @@ export interface ViewCsp {
|
|
|
23
41
|
/** Origins allowed in `<base href>` tags (mcp-apps only). */
|
|
24
42
|
baseUriDomains?: string[];
|
|
25
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Registry of view component names. The Skybridge Vite plugin augments this
|
|
46
|
+
* interface in the generated `.skybridge/views.d.ts` with one key per view
|
|
47
|
+
* file, which narrows {@link ViewName} from `string` to the concrete union.
|
|
48
|
+
*/
|
|
26
49
|
export interface ViewNameRegistry {
|
|
27
50
|
}
|
|
28
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Resolve view component names from a registry: the union of its keys, or
|
|
53
|
+
* `string` when the registry is empty. The empty case happens before
|
|
54
|
+
* `.skybridge/views.d.ts` is generated; falling back to `string` keeps valid
|
|
55
|
+
* view names from erroring on a fresh checkout, and narrowing kicks in once
|
|
56
|
+
* the generated file augments the registry.
|
|
57
|
+
*/
|
|
58
|
+
export type ViewNameFor<Registry> = [keyof Registry & string] extends [never] ? string : keyof Registry & string;
|
|
59
|
+
/** Union of valid view component names. Narrowed by {@link ViewNameRegistry}. */
|
|
60
|
+
export type ViewName = ViewNameFor<ViewNameRegistry>;
|
|
61
|
+
/**
|
|
62
|
+
* Pass under `view` in a tool's `registerTool` config to render the tool's
|
|
63
|
+
* result through a Skybridge view instead of a plain text response.
|
|
64
|
+
*/
|
|
29
65
|
export interface ViewConfig {
|
|
66
|
+
/** Filename of the view module (without extension) — matches a file in your `viewsDir`. */
|
|
30
67
|
component: ViewName;
|
|
68
|
+
/** Human-readable label the host may show alongside the view. */
|
|
31
69
|
description?: string;
|
|
32
|
-
|
|
70
|
+
/** Request a visible border around the view (forwarded as `ui.prefersBorder`). */
|
|
33
71
|
prefersBorder?: boolean;
|
|
72
|
+
/** Override the iframe's served domain (advanced; forwarded as `ui.domain`). */
|
|
34
73
|
domain?: string;
|
|
74
|
+
/** Per-view CSP overrides — see {@link ViewCsp}. */
|
|
35
75
|
csp?: ViewCsp;
|
|
76
|
+
/** Free-form metadata forwarded on the view resource's `_meta`. */
|
|
36
77
|
_meta?: Record<string, unknown>;
|
|
37
78
|
}
|
|
79
|
+
export type SecurityScheme = {
|
|
80
|
+
type: "noauth";
|
|
81
|
+
} | {
|
|
82
|
+
type: "oauth2";
|
|
83
|
+
scopes?: string[];
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Declarative per-tool auth. Enforced when the server has an `oauth` provider:
|
|
87
|
+
* anonymous or under-scoped calls are rejected before the handler runs. Omit
|
|
88
|
+
* `auth` entirely for the secure default (sign-in required, no specific scope).
|
|
89
|
+
*/
|
|
90
|
+
export type ToolAuth = {
|
|
91
|
+
/**
|
|
92
|
+
* When `true`, the tool is callable signed out; the token is still used when
|
|
93
|
+
* one is present. Omit (or `false`) to require sign-in.
|
|
94
|
+
*/
|
|
95
|
+
allowsAnonymous?: boolean;
|
|
96
|
+
/** OAuth scopes the caller's token must carry to invoke the tool. */
|
|
97
|
+
scopes?: string[];
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Options forwarded to the built-in `express.json()` body parser. Derived
|
|
101
|
+
* from Express's own types so the public API doesn't depend on `body-parser`.
|
|
102
|
+
*/
|
|
103
|
+
export type JsonOptions = NonNullable<Parameters<typeof express.json>[0]>;
|
|
104
|
+
/**
|
|
105
|
+
* Skybridge-specific server options, passed as the third `McpServer` constructor
|
|
106
|
+
* argument.
|
|
107
|
+
*
|
|
108
|
+
* @typeParam TAuthExtra - Claims the `oauth` verifier populates. Inferred from
|
|
109
|
+
* the config a provider returns, and carried on to tool handlers.
|
|
110
|
+
*/
|
|
111
|
+
export interface SkybridgeServerOptions<TAuthExtra extends ExtraClaims = ExtraClaims> {
|
|
112
|
+
/** Options for the built-in `express.json()` middleware, e.g. `{ limit: "10mb" }`. */
|
|
113
|
+
json?: JsonOptions;
|
|
114
|
+
/** Resource-server OAuth config. When set, mounts well-known metadata and bearer auth on `/mcp`. */
|
|
115
|
+
oauth?: OAuthConfig<TAuthExtra>;
|
|
116
|
+
/**
|
|
117
|
+
* @experimental Serve Agent Skills from `src/skills` over MCP (SEP-2640).
|
|
118
|
+
* API may change.
|
|
119
|
+
*/
|
|
120
|
+
skills?: boolean;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Well-known keys recognized by host runtimes when set on a tool's `_meta`.
|
|
124
|
+
* Use {@link ToolMeta} to also pass arbitrary custom metadata alongside these.
|
|
125
|
+
*
|
|
126
|
+
* @see https://developers.openai.com/apps-sdk/reference#tool-descriptor-parameters
|
|
127
|
+
*/
|
|
38
128
|
export interface KnownToolMeta {
|
|
129
|
+
/** Apps SDK: allow the rendered view to call this tool from inside its iframe. */
|
|
39
130
|
"openai/widgetAccessible"?: boolean;
|
|
131
|
+
/** Apps SDK: status text shown while the tool is running (e.g. `"Searching trips"`). */
|
|
40
132
|
"openai/toolInvocation/invoking"?: string;
|
|
133
|
+
/** Apps SDK: status text shown once the tool returns (e.g. `"Found 3 trips"`). */
|
|
41
134
|
"openai/toolInvocation/invoked"?: string;
|
|
135
|
+
/** Apps SDK: input parameters that hold file references — the host attaches uploaded files to them. */
|
|
136
|
+
"openai/fileParams"?: string[];
|
|
137
|
+
/** MCP Apps: control whether the tool is exposed to the model, the app, or both. */
|
|
138
|
+
ui?: Pick<McpUiToolMeta, "visibility">;
|
|
42
139
|
}
|
|
140
|
+
/** {@link KnownToolMeta} merged with arbitrary string-keyed metadata for custom flags. */
|
|
43
141
|
export type ToolMeta = KnownToolMeta & Record<string, unknown>;
|
|
142
|
+
/**
|
|
143
|
+
* Convenient return type for tool handlers — a plain string, a single
|
|
144
|
+
* {@link ContentBlock}, or an array. Skybridge normalizes it to the MCP
|
|
145
|
+
* `content: ContentBlock[]` shape before responding.
|
|
146
|
+
*/
|
|
44
147
|
export type HandlerContent = string | ContentBlock | ContentBlock[];
|
|
45
148
|
/**
|
|
46
149
|
* Type-level marker interface for cross-package type inference.
|
|
@@ -58,10 +161,10 @@ export interface McpServerTypes<TTools extends Record<string, ToolDef>> {
|
|
|
58
161
|
type Simplify<T> = {
|
|
59
162
|
[K in keyof T]: T[K];
|
|
60
163
|
};
|
|
61
|
-
type ShapeOutput<Shape extends
|
|
62
|
-
[K in keyof Shape as undefined extends
|
|
164
|
+
type ShapeOutput<Shape extends RawInputShape> = Simplify<{
|
|
165
|
+
[K in keyof Shape as undefined extends InferSchemaOutput<Shape[K]> ? never : K]: InferSchemaOutput<Shape[K]>;
|
|
63
166
|
} & {
|
|
64
|
-
[K in keyof Shape as undefined extends
|
|
167
|
+
[K in keyof Shape as undefined extends InferSchemaOutput<Shape[K]> ? K : never]?: InferSchemaOutput<Shape[K]>;
|
|
65
168
|
}>;
|
|
66
169
|
type ExtractStructuredContent<T> = T extends {
|
|
67
170
|
structuredContent: infer SC;
|
|
@@ -73,50 +176,194 @@ type ExtractMeta<T> = [Extract<T, {
|
|
|
73
176
|
}> extends {
|
|
74
177
|
_meta: infer M;
|
|
75
178
|
} ? Simplify<M> : unknown;
|
|
76
|
-
type AddTool<TTools, TName extends string, TInput extends
|
|
179
|
+
type AddTool<TTools, TName extends string, TInput extends RawInputShape, TOutput, TResponseMetadata = unknown, TAuthExtra extends ExtraClaims = ExtraClaims> = McpServer<TTools & {
|
|
77
180
|
[K in TName]: ToolDef<ShapeOutput<TInput>, TOutput, TResponseMetadata>;
|
|
78
|
-
}>;
|
|
79
|
-
interface
|
|
181
|
+
}, TAuthExtra>;
|
|
182
|
+
interface ToolConfigBase<TInput extends RawInputShape | StandardSchemaV1> {
|
|
80
183
|
name: string;
|
|
81
184
|
title?: string;
|
|
82
185
|
description?: string;
|
|
83
186
|
inputSchema?: TInput;
|
|
84
|
-
outputSchema?:
|
|
187
|
+
outputSchema?: RawInputShape | StandardSchemaV1;
|
|
85
188
|
annotations?: ToolAnnotations;
|
|
86
189
|
view?: ViewConfig;
|
|
87
190
|
_meta?: ToolMeta;
|
|
88
191
|
}
|
|
89
|
-
|
|
192
|
+
/**
|
|
193
|
+
* The auth face of a tool config: either the high-level `auth` shorthand or the
|
|
194
|
+
* low-level `securitySchemes` escape hatch, never both.
|
|
195
|
+
*/
|
|
196
|
+
type ToolAuthConfig = {
|
|
197
|
+
auth?: ToolAuth;
|
|
198
|
+
securitySchemes?: never;
|
|
199
|
+
} | {
|
|
200
|
+
auth?: never;
|
|
201
|
+
/**
|
|
202
|
+
* Declares which auth schemes this tool supports (e.g. `noauth`, `oauth2`).
|
|
203
|
+
* Lets clients label tools that require sign-in before calling, and pass
|
|
204
|
+
* the right scopes through the OAuth flow. Listing both `noauth` and
|
|
205
|
+
* `oauth2` signals that the tool works for anonymous callers and gives
|
|
206
|
+
* enhanced behavior to authenticated ones.
|
|
207
|
+
*/
|
|
208
|
+
securitySchemes?: SecurityScheme[];
|
|
209
|
+
};
|
|
210
|
+
type ToolConfig<TInput extends RawInputShape | StandardSchemaV1> = ToolConfigBase<TInput> & ToolAuthConfig;
|
|
211
|
+
/**
|
|
212
|
+
* Optional client-supplied hints attached to `params._meta` on every tool call
|
|
213
|
+
* by the Apps SDK host. Hints only: never use for authorization, and tolerate
|
|
214
|
+
* absence.
|
|
215
|
+
* @see https://developers.openai.com/apps-sdk/reference#_meta-fields-the-client-provides
|
|
216
|
+
*/
|
|
217
|
+
export interface ClientHintsMeta {
|
|
218
|
+
/** Requested locale (BCP-47, e.g. `"en-US"`). */
|
|
219
|
+
"openai/locale"?: string;
|
|
220
|
+
/** Browser user-agent */
|
|
221
|
+
"openai/userAgent"?: string;
|
|
222
|
+
/** Coarse user location. May be partially populated. */
|
|
223
|
+
"openai/userLocation"?: {
|
|
224
|
+
city?: string;
|
|
225
|
+
region?: string;
|
|
226
|
+
country?: string;
|
|
227
|
+
timezone?: string;
|
|
228
|
+
longitude?: number;
|
|
229
|
+
latitude?: number;
|
|
230
|
+
};
|
|
231
|
+
/** Anonymized user id. */
|
|
232
|
+
"openai/subject"?: string;
|
|
233
|
+
/** Anonymized conversation id, stable within a ChatGPT session. */
|
|
234
|
+
"openai/session"?: string;
|
|
235
|
+
/** Anonymized organization id, when the user account is part of an organization. */
|
|
236
|
+
"openai/organization"?: string;
|
|
237
|
+
/** Stable id for the currently mounted widget instance. */
|
|
238
|
+
"openai/widgetSessionId"?: string;
|
|
239
|
+
}
|
|
240
|
+
type ToolHandlerExtra<TAuthExtra extends ExtraClaims = ExtraClaims> = Omit<McpExtra<TAuthExtra>, "mcpReq"> & {
|
|
241
|
+
mcpReq: Omit<McpExtra<TAuthExtra>["mcpReq"], "_meta"> & {
|
|
242
|
+
_meta?: RequestMeta & ClientHintsMeta;
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
type ToolHandler<TInput extends RawInputShape, TReturn extends {
|
|
90
246
|
content?: HandlerContent;
|
|
91
247
|
} = {
|
|
92
248
|
content?: HandlerContent;
|
|
93
|
-
}> = (args: ShapeOutput<TInput>, extra:
|
|
249
|
+
}, TAuthExtra extends ExtraClaims = ExtraClaims> = (args: ShapeOutput<TInput>, extra: ToolHandlerExtra<TAuthExtra>) => TReturn | Promise<TReturn>;
|
|
250
|
+
/**
|
|
251
|
+
* Coerce a tool handler's return value into an MCP `content` array. Strings
|
|
252
|
+
* become a single `TextContent`; a single block is wrapped in an array;
|
|
253
|
+
* `undefined` produces `[]`. Mostly used internally — exported so consumers
|
|
254
|
+
* who build content lazily can apply the same normalization.
|
|
255
|
+
*/
|
|
94
256
|
export declare function normalizeContent(content: HandlerContent | undefined): ContentBlock[];
|
|
95
|
-
interface McpServerBaseOmitted extends Omit<McpServerBase, "registerTool" | "connect"> {
|
|
257
|
+
interface McpServerBaseOmitted extends Omit<McpServerBase, "registerTool" | "registerResource" | "registerPrompt" | "connect"> {
|
|
96
258
|
}
|
|
97
259
|
declare const McpServerBaseOmitted: new (...args: ConstructorParameters<typeof McpServerBase>) => McpServerBaseOmitted;
|
|
98
|
-
|
|
260
|
+
/**
|
|
261
|
+
* Prime the build-time Vite manifest before user code constructs its
|
|
262
|
+
* `McpServer`. Called from the generated `dist/__entry.js`; not part of the
|
|
263
|
+
* user-facing API.
|
|
264
|
+
*
|
|
265
|
+
* @internal
|
|
266
|
+
*/
|
|
267
|
+
export declare function __setBuildManifest(manifest: Record<string, {
|
|
268
|
+
file: string;
|
|
269
|
+
}>): void;
|
|
270
|
+
export declare function __setSkillsManifest(manifest: SkillsManifest): void;
|
|
271
|
+
export declare class McpServer<TTools extends Record<string, ToolDef> = Record<never, ToolDef>, TAuthExtra extends ExtraClaims = ExtraClaims> extends McpServerBaseOmitted {
|
|
99
272
|
readonly $types: McpServerTypes<TTools>;
|
|
100
|
-
|
|
101
|
-
|
|
273
|
+
/**
|
|
274
|
+
* The underlying Express app. Use this to extend the HTTP server with
|
|
275
|
+
* custom routes, middleware, or settings — e.g.
|
|
276
|
+
* `server.express.get("/health", ...)`.
|
|
277
|
+
*
|
|
278
|
+
* `express.json()` is pre-applied — tune it via the constructor's third
|
|
279
|
+
* argument, e.g. `new McpServer(info, {}, { json: { limit: "10mb" } })`.
|
|
280
|
+
* Register your handlers before `run()`;
|
|
281
|
+
* after `run()`, dev-mode middleware, the `/mcp` route, and the default
|
|
282
|
+
* error handler are appended in that order.
|
|
283
|
+
*
|
|
284
|
+
* Note: Alpic Cloud only routes traffic to `/mcp` — custom routes work
|
|
285
|
+
* locally and on self-hosted deployments.
|
|
286
|
+
*/
|
|
287
|
+
readonly express: Express;
|
|
102
288
|
private customErrorMiddleware;
|
|
103
289
|
private mcpMiddlewareEntries;
|
|
104
290
|
private mcpMiddlewareApplied;
|
|
291
|
+
private middlewareEntriesCache;
|
|
292
|
+
private readonly registrations;
|
|
105
293
|
private claimedViews;
|
|
294
|
+
private viewMetaBuilders;
|
|
295
|
+
/**
|
|
296
|
+
* Maps a view resource's query-less path to its canonical registered URI
|
|
297
|
+
* (the one carrying the `?v=` cache key). Lets `resources/read` resolve the
|
|
298
|
+
* underlying view no matter which version param the consumer sends, since
|
|
299
|
+
* the param is only a cache key, not part of the resource's identity.
|
|
300
|
+
*/
|
|
301
|
+
private viewUriByPath;
|
|
302
|
+
private viteManifest;
|
|
106
303
|
private readonly serverInfo;
|
|
107
304
|
private readonly serverOptions?;
|
|
108
|
-
|
|
305
|
+
private oauthEnabled;
|
|
306
|
+
private resolveResourceMetadataUrl?;
|
|
307
|
+
private securitySchemesByTool;
|
|
308
|
+
constructor(serverInfo: Implementation, options?: ServerOptions, skybridgeOptions?: SkybridgeServerOptions<TAuthExtra>);
|
|
309
|
+
/**
|
|
310
|
+
* Register a resource, recorded so every per-request instance carries it.
|
|
311
|
+
* Signature owned by Skybridge (not inherited) so a typed wrapper can land
|
|
312
|
+
* in a minor without a type-level break.
|
|
313
|
+
*/
|
|
314
|
+
registerResource(name: string, uri: string, config: ResourceMetadata & {
|
|
315
|
+
cacheHint?: CacheHint;
|
|
316
|
+
}, readCallback: ReadResourceCallback): RegisteredResource;
|
|
317
|
+
registerResource(name: string, template: ResourceTemplate, config: ResourceMetadata & {
|
|
318
|
+
cacheHint?: CacheHint;
|
|
319
|
+
}, readCallback: ReadResourceTemplateCallback): RegisteredResourceTemplate;
|
|
320
|
+
/**
|
|
321
|
+
* Register a prompt, recorded so every per-request instance carries it.
|
|
322
|
+
* Signature owned by Skybridge (not inherited) so a typed wrapper can land
|
|
323
|
+
* in a minor without a type-level break.
|
|
324
|
+
*/
|
|
325
|
+
registerPrompt<Args extends StandardSchemaWithJSON>(name: string, config: {
|
|
326
|
+
title?: string;
|
|
327
|
+
description?: string;
|
|
328
|
+
argsSchema?: Args;
|
|
329
|
+
icons?: Icon[];
|
|
330
|
+
_meta?: Record<string, unknown>;
|
|
331
|
+
}, cb: PromptCallback<Args>): RegisteredPrompt;
|
|
332
|
+
private recordInherited;
|
|
333
|
+
private skillRegistrar;
|
|
334
|
+
private setupSkills;
|
|
335
|
+
/**
|
|
336
|
+
* Register Express middleware on the underlying app. Mirrors `app.use` —
|
|
337
|
+
* pass handlers directly or a path-prefixed handler list. Register before
|
|
338
|
+
* {@link McpServer.run}; ordering matches Express.
|
|
339
|
+
*
|
|
340
|
+
* Note: Alpic Cloud only routes traffic to `/mcp`. Custom paths work
|
|
341
|
+
* locally and on self-hosted deployments.
|
|
342
|
+
*/
|
|
109
343
|
use(...handlers: RequestHandler[]): this;
|
|
110
344
|
use(path: string, ...handlers: RequestHandler[]): this;
|
|
345
|
+
/**
|
|
346
|
+
* Register Express error-handling middleware to run after the built-in
|
|
347
|
+
* `/mcp` route (or your custom route). Use this to log or transform errors
|
|
348
|
+
* thrown by tool handlers before the default error handler responds.
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```ts
|
|
352
|
+
* server.useOnError((err, _req, _res, next) => {
|
|
353
|
+
* logger.error(err);
|
|
354
|
+
* next(err);
|
|
355
|
+
* });
|
|
356
|
+
* ```
|
|
357
|
+
*/
|
|
111
358
|
useOnError(...handlers: ErrorRequestHandler[]): this;
|
|
112
359
|
useOnError(path: string, ...handlers: ErrorRequestHandler[]): this;
|
|
113
360
|
/** Register MCP protocol-level middleware (catch-all). */
|
|
114
|
-
mcpMiddleware(handler: McpMiddlewareFn): this;
|
|
361
|
+
mcpMiddleware(handler: McpMiddlewareFn<TAuthExtra>): this;
|
|
115
362
|
/** Register MCP protocol-level middleware for all requests (`extra` is `McpExtra`). */
|
|
116
363
|
mcpMiddleware(filter: "request", handler: (request: {
|
|
117
364
|
method: string;
|
|
118
365
|
params: Record<string, unknown>;
|
|
119
|
-
}, extra: McpExtra
|
|
366
|
+
}, extra: McpExtra<TAuthExtra>, next: () => Promise<ServerResult>) => Promise<unknown> | unknown): this;
|
|
120
367
|
/** Register MCP protocol-level middleware for all notifications (`extra` is `undefined`). */
|
|
121
368
|
mcpMiddleware(filter: "notification", handler: (request: {
|
|
122
369
|
method: string;
|
|
@@ -126,7 +373,7 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
126
373
|
* Register MCP protocol-level middleware for an exact method.
|
|
127
374
|
* Narrows `params`, `extra`, and `next()` result based on the method string.
|
|
128
375
|
*/
|
|
129
|
-
mcpMiddleware<M extends McpMethodString>(filter: M, handler: McpTypedMiddlewareFn<M>): this;
|
|
376
|
+
mcpMiddleware<M extends McpMethodString>(filter: M, handler: McpTypedMiddlewareFn<M, TAuthExtra>): this;
|
|
130
377
|
/**
|
|
131
378
|
* Register MCP protocol-level middleware for a wildcard pattern (e.g. `"tools/*"`).
|
|
132
379
|
* `next()` returns the union of result types for matching methods.
|
|
@@ -134,40 +381,114 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
134
381
|
mcpMiddleware<W extends McpWildcard>(filter: W, handler: (request: {
|
|
135
382
|
method: string;
|
|
136
383
|
params: Record<string, unknown>;
|
|
137
|
-
}, extra: McpExtraFor<W>, next: () => Promise<McpResultFor<W>>) => Promise<unknown> | unknown): this;
|
|
384
|
+
}, extra: McpExtraFor<W, TAuthExtra>, next: () => Promise<McpResultFor<W>>) => Promise<unknown> | unknown): this;
|
|
138
385
|
/**
|
|
139
386
|
* Register MCP protocol-level middleware with a method filter.
|
|
140
387
|
* Filter can be an exact method (`"tools/call"`), wildcard (`"tools/*"`),
|
|
141
388
|
* category (`"request"` | `"notification"`), or an array of those.
|
|
142
389
|
*/
|
|
143
|
-
mcpMiddleware(filter: McpMiddlewareFilter, handler: McpMiddlewareFn): this;
|
|
390
|
+
mcpMiddleware(filter: McpMiddlewareFilter, handler: McpMiddlewareFn<TAuthExtra>): this;
|
|
144
391
|
private applyMcpMiddleware;
|
|
392
|
+
private instrumentHandlers;
|
|
393
|
+
/**
|
|
394
|
+
* Connect to an MCP transport (override of the SDK's `connect`). Use this
|
|
395
|
+
* when you're embedding Skybridge in a host that already manages its own
|
|
396
|
+
* transport (e.g. stdio for desktop apps); for HTTP, prefer {@link McpServer.run}
|
|
397
|
+
* which sets the transport up for you. Locks in any middleware registered
|
|
398
|
+
* via {@link McpServer.mcpMiddleware} — further calls to that method will
|
|
399
|
+
* throw afterwards.
|
|
400
|
+
*/
|
|
145
401
|
connect(transport: Parameters<typeof McpServerBase.prototype.connect>[0]): Promise<void>;
|
|
146
402
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
403
|
+
* Build a fresh server for one stateless HTTP request, as
|
|
404
|
+
* `createMcpHandler`'s factory contract requires: every registration is
|
|
405
|
+
* replayed onto the new instance so the SDK's handler closures belong to
|
|
406
|
+
* the instance whose protocol era it stamps. Sharing the singleton's
|
|
407
|
+
* handler maps instead would bind them to an instance that is never
|
|
408
|
+
* marked, pinning every request to the 2025 codec and letting concurrent
|
|
409
|
+
* callers overwrite each other's negotiated version.
|
|
410
|
+
*/
|
|
411
|
+
createStatelessServerInstance(): SdkServer;
|
|
412
|
+
/**
|
|
413
|
+
* Apply an SDK registration to the singleton and remember it, so each
|
|
414
|
+
* per-request instance can be built with the same surface.
|
|
415
|
+
*/
|
|
416
|
+
private record;
|
|
417
|
+
/** Records a raw request handler (used for methods the SDK has no sugar for). */
|
|
418
|
+
private recordRequestHandler;
|
|
419
|
+
/**
|
|
420
|
+
* Start the HTTP server. Listens on `process.env.__PORT` (default `3000`),
|
|
421
|
+
* mounts the `/mcp` route, applies any custom Express middleware registered
|
|
422
|
+
* via {@link McpServer.use} / {@link McpServer.useOnError}, and locks in
|
|
423
|
+
* any MCP middleware registered via {@link McpServer.mcpMiddleware}.
|
|
424
|
+
*
|
|
425
|
+
* On Cloudflare Workers / workerd, returns an object exposing `fetch` so
|
|
426
|
+
* the runtime can bridge incoming requests to the Node HTTP server. On
|
|
427
|
+
* Vercel (`VERCEL === "1"`), returns the Express app directly so the
|
|
428
|
+
* serverless function entry can call it as a `(req, res)` handler. On
|
|
429
|
+
* Node, returns `undefined` once listening. When the process was spawned
|
|
430
|
+
* with an IPC channel, the bound port is reported to the parent as
|
|
431
|
+
* `{ type: "skybridge:listening", port }`, the readiness signal test runners
|
|
432
|
+
* wait on instead of polling.
|
|
433
|
+
*/
|
|
434
|
+
run(): Promise<{
|
|
435
|
+
fetch: (...args: unknown[]) => unknown;
|
|
436
|
+
} | Express | undefined>;
|
|
158
437
|
private enforceOneToolPerView;
|
|
438
|
+
private resolveViewRequestContext;
|
|
159
439
|
private registerViewResources;
|
|
160
440
|
private registerViewResource;
|
|
161
|
-
private
|
|
441
|
+
private serveLegacyAppsSdkUrl;
|
|
442
|
+
private decorateToolHandler;
|
|
162
443
|
private computeViewVersionParam;
|
|
163
444
|
private lookupViewFile;
|
|
164
445
|
private lookupDistFile;
|
|
446
|
+
/**
|
|
447
|
+
* Inject the Vite manifest as a value rather than letting `readManifest()`
|
|
448
|
+
* load it from disk. Required for runtimes without a usable filesystem
|
|
449
|
+
* (Cloudflare Workers, etc.) — the user's `skybridge build` emits the
|
|
450
|
+
* manifest as a JS module which the entry imports and passes here.
|
|
451
|
+
*/
|
|
452
|
+
setViteManifest(manifest: Record<string, {
|
|
453
|
+
file: string;
|
|
454
|
+
}>): this;
|
|
165
455
|
private readManifest;
|
|
166
|
-
|
|
456
|
+
/**
|
|
457
|
+
* Register a tool. Pass a `config` describing the tool (name, schemas,
|
|
458
|
+
* optional {@link ViewConfig}, optional {@link ToolMeta}) and a handler that
|
|
459
|
+
* returns the tool's result.
|
|
460
|
+
*
|
|
461
|
+
* Chain calls to build up a server: each call returns a new `McpServer`
|
|
462
|
+
* type that captures the tool's input/output/`_meta` shape so the
|
|
463
|
+
* resulting `typeof server` can drive {@link generateHelpers}.
|
|
464
|
+
*
|
|
465
|
+
* The handler's return shape determines the output types: the
|
|
466
|
+
* `structuredContent` field becomes the tool's typed output, and `_meta`
|
|
467
|
+
* becomes its `responseMetadata`. The `content` field is normalized through
|
|
468
|
+
* {@link normalizeContent}.
|
|
469
|
+
*
|
|
470
|
+
* @example
|
|
471
|
+
* ```ts
|
|
472
|
+
* server.registerTool({
|
|
473
|
+
* name: "search",
|
|
474
|
+
* inputSchema: { query: z.string() },
|
|
475
|
+
* outputSchema: { results: z.array(z.string()) },
|
|
476
|
+
* view: { component: "search" },
|
|
477
|
+
* }, async ({ query }) => ({
|
|
478
|
+
* content: `Found results for ${query}`,
|
|
479
|
+
* structuredContent: { results: [...] },
|
|
480
|
+
* }));
|
|
481
|
+
* ```
|
|
482
|
+
*
|
|
483
|
+
* @see https://docs.skybridge.tech/api-reference/register-tool
|
|
484
|
+
*/
|
|
485
|
+
registerTool<TName extends string, InputArgs extends RawInputShape, TReturn extends {
|
|
167
486
|
content?: HandlerContent;
|
|
168
487
|
}>(config: ToolConfig<InputArgs> & {
|
|
169
488
|
name: TName;
|
|
170
|
-
}, cb: ToolHandler<InputArgs, TReturn>): AddTool<TTools, TName, InputArgs, ExtractStructuredContent<TReturn>, ExtractMeta<TReturn
|
|
171
|
-
registerTool<InputArgs extends
|
|
489
|
+
}, cb: ToolHandler<InputArgs, TReturn, TAuthExtra>): AddTool<TTools, TName, InputArgs, ExtractStructuredContent<TReturn>, ExtractMeta<TReturn>, TAuthExtra>;
|
|
490
|
+
registerTool<InputArgs extends RawInputShape>(config: ToolConfig<InputArgs>, cb: ToolHandler<InputArgs, {
|
|
491
|
+
content?: HandlerContent;
|
|
492
|
+
}, TAuthExtra>): this;
|
|
172
493
|
}
|
|
173
494
|
export {};
|