skybridge 0.0.0-dev.f3a5e82 → 0.0.0-dev.f3a8932
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 +125 -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.d.ts +1 -0
- package/dist/cli/build-helpers.test.js +130 -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.d.ts +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/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-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-nodemon.d.ts +14 -0
- package/dist/cli/use-nodemon.js +71 -60
- 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 +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 -73
- 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 +1 -0
- package/dist/commands/dev.js +48 -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/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 +32 -0
- package/dist/server/auth/discovery.js +56 -0
- package/dist/server/auth/discovery.js.map +1 -0
- package/dist/server/auth/discovery.test.d.ts +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 +18 -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 +18 -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 +48 -0
- package/dist/server/auth/providers/auth0.test.js.map +1 -0
- package/dist/server/auth/providers/authplane.d.ts +47 -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 +138 -0
- package/dist/server/auth/providers/authplane.test.js.map +1 -0
- package/dist/server/auth/providers/clerk.d.ts +14 -0
- package/dist/server/auth/providers/clerk.js +16 -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 +28 -0
- package/dist/server/auth/providers/clerk.test.js.map +1 -0
- package/dist/server/auth/providers/custom.d.ts +32 -0
- package/dist/server/auth/providers/custom.js +49 -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 +156 -0
- package/dist/server/auth/providers/custom.test.js.map +1 -0
- package/dist/server/auth/providers/descope.d.ts +15 -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 +60 -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 +12 -0
- package/dist/server/auth/providers/stytch.js +13 -0
- package/dist/server/auth/providers/stytch.js.map +1 -0
- package/dist/server/auth/providers/workos.d.ts +11 -0
- package/dist/server/auth/providers/workos.js +12 -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 +92 -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 +474 -0
- package/dist/server/auth/setup.test.js.map +1 -0
- package/dist/server/auth/verify.d.ts +12 -0
- package/dist/server/auth/verify.js +38 -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 +100 -0
- package/dist/server/auth/verify.test.js.map +1 -0
- package/dist/server/auth.d.ts +20 -0
- package/dist/server/auth.js +28 -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 +40 -0
- package/dist/server/content-helpers.js +33 -0
- package/dist/server/content-helpers.js.map +1 -1
- package/dist/server/express.test.js +61 -0
- 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 +13 -2
- package/dist/server/index.js +11 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/middleware.d.ts +16 -3
- package/dist/server/middleware.js.map +1 -1
- 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 +268 -9
- package/dist/server/server.js +436 -173
- 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 +63 -0
- package/dist/server/skills-integration.test.js.map +1 -0
- package/dist/server/skills.d.ts +23 -0
- package/dist/server/skills.js +178 -0
- package/dist/server/skills.js.map +1 -0
- package/dist/server/skills.test.d.ts +1 -0
- package/dist/server/skills.test.js +210 -0
- package/dist/server/skills.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 +171 -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/view.test.js +109 -96
- package/dist/test/view.test.js.map +1 -1
- package/dist/web/bridges/adaptor.d.ts +51 -0
- package/dist/web/bridges/adaptor.js +341 -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 +224 -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 +2 -0
- 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/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/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 +104 -1
- 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 +8 -5
- 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 +17 -5
- 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/hooks/index.d.ts +5 -0
- package/dist/web/hooks/index.js +5 -0
- 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.js +62 -23
- 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.js +56 -20
- package/dist/web/hooks/use-display-mode.test.js.map +1 -1
- package/dist/web/hooks/use-download.d.ts +5 -0
- package/dist/web/hooks/use-download.js +8 -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 +10 -2
- package/dist/web/hooks/use-files.test.js.map +1 -1
- package/dist/web/hooks/use-host-info.d.ts +22 -0
- package/dist/web/hooks/use-host-info.js +30 -0
- package/dist/web/hooks/use-host-info.js.map +1 -0
- package/dist/web/hooks/use-host-info.test.d.ts +1 -0
- package/dist/web/hooks/use-host-info.test.js +59 -0
- package/dist/web/hooks/use-host-info.test.js.map +1 -0
- package/dist/web/hooks/use-layout.d.ts +2 -0
- package/dist/web/hooks/use-layout.js +2 -0
- package/dist/web/hooks/use-layout.js.map +1 -1
- package/dist/web/hooks/use-layout.test.js +59 -26
- package/dist/web/hooks/use-layout.test.js.map +1 -1
- 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 +13 -3
- package/dist/web/hooks/use-open-external.test.js.map +1 -1
- package/dist/web/hooks/use-register-view-tool.d.ts +38 -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 +10 -0
- 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 +17 -0
- package/dist/web/hooks/use-send-follow-up-message.js +17 -0
- 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 +28 -8
- package/dist/web/hooks/use-set-open-in-app-url.test.js.map +1 -1
- package/dist/web/hooks/use-tool-info.d.ts +53 -2
- package/dist/web/hooks/use-tool-info.js +30 -7
- package/dist/web/hooks/use-tool-info.js.map +1 -1
- package/dist/web/hooks/use-tool-info.test-d.js +11 -29
- package/dist/web/hooks/use-tool-info.test-d.js.map +1 -1
- package/dist/web/hooks/use-tool-info.test.js +42 -32
- package/dist/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/web/hooks/use-user.d.ts +2 -0
- package/dist/web/hooks/use-user.js +2 -0
- package/dist/web/hooks/use-user.js.map +1 -1
- package/dist/web/hooks/use-user.test.js +81 -35
- 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 +37 -2
- package/dist/web/hooks/use-view-state.test.js.map +1 -1
- package/dist/web/mount-view.d.ts +19 -0
- package/dist/web/mount-view.js +19 -0
- package/dist/web/mount-view.js.map +1 -1
- package/dist/web/plugin/plugin.d.ts +34 -0
- package/dist/web/plugin/plugin.js +36 -3
- package/dist/web/plugin/plugin.js.map +1 -1
- package/dist/web/types.d.ts +4 -0
- package/dist/web/types.js.map +1 -1
- package/package.json +24 -16
- package/dist/web/bridges/apps-sdk/adaptor.d.ts +0 -24
- package/dist/web/bridges/apps-sdk/adaptor.js +0 -96
- 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 -263
- package/dist/web/bridges/mcp-app/adaptor.js.map +0 -1
package/dist/server/server.d.ts
CHANGED
|
@@ -1,16 +1,36 @@
|
|
|
1
|
+
import type { McpUiToolMeta } from "@modelcontextprotocol/ext-apps";
|
|
1
2
|
import { type ServerOptions } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
3
|
import { McpServer as McpServerBase } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
4
|
import type { AnySchema, SchemaOutput, ZodRawShapeCompat } from "@modelcontextprotocol/sdk/server/zod-compat.js";
|
|
4
5
|
import type { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
5
|
-
import type { ContentBlock, Implementation, ServerNotification, ServerRequest, ServerResult, ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
|
|
6
|
-
import { type ErrorRequestHandler, type Express, type RequestHandler } from "express";
|
|
6
|
+
import type { ContentBlock, Implementation, RequestMeta, ServerNotification, ServerRequest, ServerResult, ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
|
|
7
|
+
import express, { type ErrorRequestHandler, type Express, type RequestHandler } from "express";
|
|
8
|
+
import type { OAuthConfig } from "./auth/index.js";
|
|
7
9
|
import type { McpExtra, McpExtraFor, McpMethodString, McpMiddlewareFilter, McpMiddlewareFn, McpResultFor, McpTypedMiddlewareFn, McpWildcard } from "./middleware.js";
|
|
10
|
+
import { type SkillsManifest } from "./skills.js";
|
|
11
|
+
/**
|
|
12
|
+
* Type marker for a registered tool — carries its input, output, and response
|
|
13
|
+
* metadata shapes so views can infer types from `typeof server`.
|
|
14
|
+
*
|
|
15
|
+
* You normally never construct this by hand; it is produced by `registerTool`
|
|
16
|
+
* and consumed by helpers like {@link InferTools} and {@link generateHelpers}.
|
|
17
|
+
*/
|
|
8
18
|
export type ToolDef<TInput = unknown, TOutput = unknown, TResponseMetadata = unknown> = {
|
|
9
19
|
input: TInput;
|
|
10
20
|
output: TOutput;
|
|
11
21
|
responseMetadata: TResponseMetadata;
|
|
12
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Views now always emit a single ext-apps resource; host targeting
|
|
25
|
+
* no longer applies. Retained for backwards compatibility; will be removed in a
|
|
26
|
+
* future major.
|
|
27
|
+
*/
|
|
13
28
|
export type ViewHostType = "apps-sdk" | "mcp-app";
|
|
29
|
+
/**
|
|
30
|
+
* Content Security Policy origins attached to a view's resource. Each list is
|
|
31
|
+
* passed through to the host's CSP for the view iframe; omit a field to inherit
|
|
32
|
+
* the host's default for that directive.
|
|
33
|
+
*/
|
|
14
34
|
export interface ViewCsp {
|
|
15
35
|
/** Origins for static assets (images, fonts, scripts, styles). */
|
|
16
36
|
resourceDomains?: string[];
|
|
@@ -23,24 +43,109 @@ export interface ViewCsp {
|
|
|
23
43
|
/** Origins allowed in `<base href>` tags (mcp-apps only). */
|
|
24
44
|
baseUriDomains?: string[];
|
|
25
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Registry of view component names. The Skybridge Vite plugin augments this
|
|
48
|
+
* interface in the generated `.skybridge/views.d.ts` with one key per view
|
|
49
|
+
* file, which narrows {@link ViewName} from `string` to the concrete union.
|
|
50
|
+
*/
|
|
26
51
|
export interface ViewNameRegistry {
|
|
27
52
|
}
|
|
28
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Resolve view component names from a registry: the union of its keys, or
|
|
55
|
+
* `string` when the registry is empty. The empty case happens before
|
|
56
|
+
* `.skybridge/views.d.ts` is generated; falling back to `string` keeps valid
|
|
57
|
+
* view names from erroring on a fresh checkout, and narrowing kicks in once
|
|
58
|
+
* the generated file augments the registry.
|
|
59
|
+
*/
|
|
60
|
+
export type ViewNameFor<Registry> = [keyof Registry & string] extends [never] ? string : keyof Registry & string;
|
|
61
|
+
/** Union of valid view component names. Narrowed by {@link ViewNameRegistry}. */
|
|
62
|
+
export type ViewName = ViewNameFor<ViewNameRegistry>;
|
|
63
|
+
/**
|
|
64
|
+
* Pass under `view` in a tool's `registerTool` config to render the tool's
|
|
65
|
+
* result through a Skybridge view instead of a plain text response.
|
|
66
|
+
*/
|
|
29
67
|
export interface ViewConfig {
|
|
68
|
+
/** Filename of the view module (without extension) — matches a file in your `viewsDir`. */
|
|
30
69
|
component: ViewName;
|
|
70
|
+
/** Human-readable label the host may show alongside the view. */
|
|
31
71
|
description?: string;
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated No-op. Every view emits a single ext-apps resource regardless
|
|
74
|
+
* of this value. Will be removed in a future major.
|
|
75
|
+
*/
|
|
32
76
|
hosts?: ViewHostType[];
|
|
77
|
+
/** Request a visible border around the view (forwarded as `ui.prefersBorder`). */
|
|
33
78
|
prefersBorder?: boolean;
|
|
79
|
+
/** Override the iframe's served domain (advanced; forwarded as `ui.domain`). */
|
|
34
80
|
domain?: string;
|
|
81
|
+
/** Per-view CSP overrides — see {@link ViewCsp}. */
|
|
35
82
|
csp?: ViewCsp;
|
|
83
|
+
/** Free-form metadata forwarded on the view resource's `_meta`. */
|
|
36
84
|
_meta?: Record<string, unknown>;
|
|
37
85
|
}
|
|
86
|
+
export type SecurityScheme = {
|
|
87
|
+
type: "noauth";
|
|
88
|
+
} | {
|
|
89
|
+
type: "oauth2";
|
|
90
|
+
scopes?: string[];
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Declarative per-tool auth. Enforced when the server has an `oauth` provider:
|
|
94
|
+
* anonymous or under-scoped calls are rejected before the handler runs. Omit
|
|
95
|
+
* `auth` entirely for the secure default (sign-in required, no specific scope).
|
|
96
|
+
*/
|
|
97
|
+
export type ToolAuth = {
|
|
98
|
+
/**
|
|
99
|
+
* When `true`, the tool is callable signed out; the token is still used when
|
|
100
|
+
* one is present. Omit (or `false`) to require sign-in.
|
|
101
|
+
*/
|
|
102
|
+
allowsAnonymous?: boolean;
|
|
103
|
+
/** OAuth scopes the caller's token must carry to invoke the tool. */
|
|
104
|
+
scopes?: string[];
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Options forwarded to the built-in `express.json()` body parser. Derived
|
|
108
|
+
* from Express's own types so the public API doesn't depend on `body-parser`.
|
|
109
|
+
*/
|
|
110
|
+
export type JsonOptions = NonNullable<Parameters<typeof express.json>[0]>;
|
|
111
|
+
/** Skybridge-specific server options, passed as the third `McpServer` constructor argument. */
|
|
112
|
+
export interface SkybridgeServerOptions {
|
|
113
|
+
/** Options for the built-in `express.json()` middleware, e.g. `{ limit: "10mb" }`. */
|
|
114
|
+
json?: JsonOptions;
|
|
115
|
+
/** Resource-server OAuth config. When set, mounts well-known metadata and bearer auth on `/mcp`. */
|
|
116
|
+
oauth?: OAuthConfig;
|
|
117
|
+
/**
|
|
118
|
+
* @experimental Serve Agent Skills from `src/skills` over MCP (SEP-2640).
|
|
119
|
+
* API may change.
|
|
120
|
+
*/
|
|
121
|
+
skills?: boolean;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Well-known keys recognized by host runtimes when set on a tool's `_meta`.
|
|
125
|
+
* Use {@link ToolMeta} to also pass arbitrary custom metadata alongside these.
|
|
126
|
+
*
|
|
127
|
+
* @see https://developers.openai.com/apps-sdk/reference#tool-descriptor-parameters
|
|
128
|
+
*/
|
|
38
129
|
export interface KnownToolMeta {
|
|
130
|
+
/** Apps SDK: allow the rendered view to call this tool from inside its iframe. */
|
|
39
131
|
"openai/widgetAccessible"?: boolean;
|
|
132
|
+
/** Apps SDK: status text shown while the tool is running (e.g. `"Searching trips"`). */
|
|
40
133
|
"openai/toolInvocation/invoking"?: string;
|
|
134
|
+
/** Apps SDK: status text shown once the tool returns (e.g. `"Found 3 trips"`). */
|
|
41
135
|
"openai/toolInvocation/invoked"?: string;
|
|
136
|
+
/** Apps SDK: input parameters that hold file references — the host attaches uploaded files to them. */
|
|
137
|
+
"openai/fileParams"?: string[];
|
|
138
|
+
/** MCP Apps: control whether the tool is exposed to the model, the app, or both. */
|
|
139
|
+
ui?: Pick<McpUiToolMeta, "visibility">;
|
|
140
|
+
securitySchemes?: SecurityScheme[];
|
|
42
141
|
}
|
|
142
|
+
/** {@link KnownToolMeta} merged with arbitrary string-keyed metadata for custom flags. */
|
|
43
143
|
export type ToolMeta = KnownToolMeta & Record<string, unknown>;
|
|
144
|
+
/**
|
|
145
|
+
* Convenient return type for tool handlers — a plain string, a single
|
|
146
|
+
* {@link ContentBlock}, or an array. Skybridge normalizes it to the MCP
|
|
147
|
+
* `content: ContentBlock[]` shape before responding.
|
|
148
|
+
*/
|
|
44
149
|
export type HandlerContent = string | ContentBlock | ContentBlock[];
|
|
45
150
|
/**
|
|
46
151
|
* Type-level marker interface for cross-package type inference.
|
|
@@ -76,7 +181,7 @@ type ExtractMeta<T> = [Extract<T, {
|
|
|
76
181
|
type AddTool<TTools, TName extends string, TInput extends ZodRawShapeCompat, TOutput, TResponseMetadata = unknown> = McpServer<TTools & {
|
|
77
182
|
[K in TName]: ToolDef<ShapeOutput<TInput>, TOutput, TResponseMetadata>;
|
|
78
183
|
}>;
|
|
79
|
-
interface
|
|
184
|
+
interface ToolConfigBase<TInput extends ZodRawShapeCompat | AnySchema> {
|
|
80
185
|
name: string;
|
|
81
186
|
title?: string;
|
|
82
187
|
description?: string;
|
|
@@ -86,15 +191,83 @@ interface ToolConfig<TInput extends ZodRawShapeCompat | AnySchema> {
|
|
|
86
191
|
view?: ViewConfig;
|
|
87
192
|
_meta?: ToolMeta;
|
|
88
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* The auth face of a tool config: either the high-level `auth` shorthand or the
|
|
196
|
+
* low-level `securitySchemes` escape hatch, never both.
|
|
197
|
+
*/
|
|
198
|
+
type ToolAuthConfig = {
|
|
199
|
+
auth?: ToolAuth;
|
|
200
|
+
securitySchemes?: never;
|
|
201
|
+
} | {
|
|
202
|
+
auth?: never;
|
|
203
|
+
/**
|
|
204
|
+
* Declares which auth schemes this tool supports (e.g. `noauth`, `oauth2`).
|
|
205
|
+
* Lets clients label tools that require sign-in before calling, and pass
|
|
206
|
+
* the right scopes through the OAuth flow. Listing both `noauth` and
|
|
207
|
+
* `oauth2` signals that the tool works for anonymous callers and gives
|
|
208
|
+
* enhanced behavior to authenticated ones.
|
|
209
|
+
*/
|
|
210
|
+
securitySchemes?: SecurityScheme[];
|
|
211
|
+
};
|
|
212
|
+
type ToolConfig<TInput extends ZodRawShapeCompat | AnySchema> = ToolConfigBase<TInput> & ToolAuthConfig;
|
|
213
|
+
/**
|
|
214
|
+
* Optional client-supplied hints attached to `params._meta` on every tool call
|
|
215
|
+
* by the Apps SDK host. Hints only: never use for authorization, and tolerate
|
|
216
|
+
* absence.
|
|
217
|
+
* @see https://developers.openai.com/apps-sdk/reference#_meta-fields-the-client-provides
|
|
218
|
+
*/
|
|
219
|
+
export interface ClientHintsMeta {
|
|
220
|
+
/** Requested locale (BCP-47, e.g. `"en-US"`). */
|
|
221
|
+
"openai/locale"?: string;
|
|
222
|
+
/** Browser user-agent */
|
|
223
|
+
"openai/userAgent"?: string;
|
|
224
|
+
/** Coarse user location. May be partially populated. */
|
|
225
|
+
"openai/userLocation"?: {
|
|
226
|
+
city?: string;
|
|
227
|
+
region?: string;
|
|
228
|
+
country?: string;
|
|
229
|
+
timezone?: string;
|
|
230
|
+
longitude?: number;
|
|
231
|
+
latitude?: number;
|
|
232
|
+
};
|
|
233
|
+
/** Anonymized user id. */
|
|
234
|
+
"openai/subject"?: string;
|
|
235
|
+
/** Anonymized conversation id, stable within a ChatGPT session. */
|
|
236
|
+
"openai/session"?: string;
|
|
237
|
+
/** Anonymized organization id, when the user account is part of an organization. */
|
|
238
|
+
"openai/organization"?: string;
|
|
239
|
+
/** Stable id for the currently mounted widget instance. */
|
|
240
|
+
"openai/widgetSessionId"?: string;
|
|
241
|
+
}
|
|
242
|
+
type ToolHandlerExtra = Omit<RequestHandlerExtra<ServerRequest, ServerNotification>, "_meta"> & {
|
|
243
|
+
_meta?: RequestMeta & ClientHintsMeta;
|
|
244
|
+
};
|
|
89
245
|
type ToolHandler<TInput extends ZodRawShapeCompat, TReturn extends {
|
|
90
246
|
content?: HandlerContent;
|
|
91
247
|
} = {
|
|
92
248
|
content?: HandlerContent;
|
|
93
|
-
}> = (args: ShapeOutput<TInput>, extra:
|
|
249
|
+
}> = (args: ShapeOutput<TInput>, extra: ToolHandlerExtra) => 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
257
|
interface McpServerBaseOmitted extends Omit<McpServerBase, "registerTool" | "connect"> {
|
|
96
258
|
}
|
|
97
259
|
declare const McpServerBaseOmitted: new (...args: ConstructorParameters<typeof McpServerBase>) => McpServerBaseOmitted;
|
|
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;
|
|
98
271
|
export declare class McpServer<TTools extends Record<string, ToolDef> = Record<never, ToolDef>> extends McpServerBaseOmitted {
|
|
99
272
|
readonly $types: McpServerTypes<TTools>;
|
|
100
273
|
/**
|
|
@@ -102,7 +275,9 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
102
275
|
* custom routes, middleware, or settings — e.g.
|
|
103
276
|
* `server.express.get("/health", ...)`.
|
|
104
277
|
*
|
|
105
|
-
* `express.json()` is pre-applied
|
|
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()`;
|
|
106
281
|
* after `run()`, dev-mode middleware, the `/mcp` route, and the default
|
|
107
282
|
* error handler are appended in that order.
|
|
108
283
|
*
|
|
@@ -114,12 +289,45 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
114
289
|
private mcpMiddlewareEntries;
|
|
115
290
|
private mcpMiddlewareApplied;
|
|
116
291
|
private claimedViews;
|
|
292
|
+
private viewMetaBuilders;
|
|
293
|
+
/**
|
|
294
|
+
* Maps a view resource's query-less path to its canonical registered URI
|
|
295
|
+
* (the one carrying the `?v=` cache key). Lets `resources/read` resolve the
|
|
296
|
+
* underlying view no matter which version param the consumer sends, since
|
|
297
|
+
* the param is only a cache key, not part of the resource's identity.
|
|
298
|
+
*/
|
|
299
|
+
private viewUriByPath;
|
|
117
300
|
private viteManifest;
|
|
118
301
|
private readonly serverInfo;
|
|
119
302
|
private readonly serverOptions?;
|
|
120
|
-
|
|
303
|
+
private oauthEnabled;
|
|
304
|
+
private resolveResourceMetadataUrl?;
|
|
305
|
+
private securitySchemesByTool;
|
|
306
|
+
constructor(serverInfo: Implementation, options?: ServerOptions, skybridgeOptions?: SkybridgeServerOptions);
|
|
307
|
+
private setupSkills;
|
|
308
|
+
/**
|
|
309
|
+
* Register Express middleware on the underlying app. Mirrors `app.use` —
|
|
310
|
+
* pass handlers directly or a path-prefixed handler list. Register before
|
|
311
|
+
* {@link McpServer.run}; ordering matches Express.
|
|
312
|
+
*
|
|
313
|
+
* Note: Alpic Cloud only routes traffic to `/mcp`. Custom paths work
|
|
314
|
+
* locally and on self-hosted deployments.
|
|
315
|
+
*/
|
|
121
316
|
use(...handlers: RequestHandler[]): this;
|
|
122
317
|
use(path: string, ...handlers: RequestHandler[]): this;
|
|
318
|
+
/**
|
|
319
|
+
* Register Express error-handling middleware to run after the built-in
|
|
320
|
+
* `/mcp` route (or your custom route). Use this to log or transform errors
|
|
321
|
+
* thrown by tool handlers before the default error handler responds.
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* ```ts
|
|
325
|
+
* server.useOnError((err, _req, _res, next) => {
|
|
326
|
+
* logger.error(err);
|
|
327
|
+
* next(err);
|
|
328
|
+
* });
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
123
331
|
useOnError(...handlers: ErrorRequestHandler[]): this;
|
|
124
332
|
useOnError(path: string, ...handlers: ErrorRequestHandler[]): this;
|
|
125
333
|
/** Register MCP protocol-level middleware (catch-all). */
|
|
@@ -154,6 +362,14 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
154
362
|
*/
|
|
155
363
|
mcpMiddleware(filter: McpMiddlewareFilter, handler: McpMiddlewareFn): this;
|
|
156
364
|
private applyMcpMiddleware;
|
|
365
|
+
/**
|
|
366
|
+
* Connect to an MCP transport (override of the SDK's `connect`). Use this
|
|
367
|
+
* when you're embedding Skybridge in a host that already manages its own
|
|
368
|
+
* transport (e.g. stdio for desktop apps); for HTTP, prefer {@link McpServer.run}
|
|
369
|
+
* which sets the transport up for you. Locks in any middleware registered
|
|
370
|
+
* via {@link McpServer.mcpMiddleware} — further calls to that method will
|
|
371
|
+
* throw afterwards.
|
|
372
|
+
*/
|
|
157
373
|
connect(transport: Parameters<typeof McpServerBase.prototype.connect>[0]): Promise<void>;
|
|
158
374
|
/**
|
|
159
375
|
* Per-request stateless connect. The SDK's `Protocol` only allows one
|
|
@@ -166,13 +382,27 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
166
382
|
* read side and fails fast on SDK field renames.
|
|
167
383
|
*/
|
|
168
384
|
connectStatelessTransport(transport: Parameters<typeof McpServerBase.prototype.connect>[0]): Promise<void>;
|
|
385
|
+
/**
|
|
386
|
+
* Start the HTTP server. Listens on `process.env.__PORT` (default `3000`),
|
|
387
|
+
* mounts the `/mcp` route, applies any custom Express middleware registered
|
|
388
|
+
* via {@link McpServer.use} / {@link McpServer.useOnError}, and locks in
|
|
389
|
+
* any MCP middleware registered via {@link McpServer.mcpMiddleware}.
|
|
390
|
+
*
|
|
391
|
+
* On Cloudflare Workers / workerd, returns an object exposing `fetch` so
|
|
392
|
+
* the runtime can bridge incoming requests to the Node HTTP server. On
|
|
393
|
+
* Vercel (`VERCEL === "1"`), returns the Express app directly so the
|
|
394
|
+
* serverless function entry can call it as a `(req, res)` handler. On
|
|
395
|
+
* Node, returns `undefined` once listening.
|
|
396
|
+
*/
|
|
169
397
|
run(): Promise<{
|
|
170
398
|
fetch: (...args: unknown[]) => unknown;
|
|
171
|
-
} | undefined>;
|
|
399
|
+
} | Express | undefined>;
|
|
172
400
|
private enforceOneToolPerView;
|
|
401
|
+
private resolveViewRequestContext;
|
|
173
402
|
private registerViewResources;
|
|
174
403
|
private registerViewResource;
|
|
175
|
-
private
|
|
404
|
+
private serveLegacyAppsSdkUrl;
|
|
405
|
+
private decorateToolHandler;
|
|
176
406
|
private computeViewVersionParam;
|
|
177
407
|
private lookupViewFile;
|
|
178
408
|
private lookupDistFile;
|
|
@@ -186,6 +416,35 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
186
416
|
file: string;
|
|
187
417
|
}>): this;
|
|
188
418
|
private readManifest;
|
|
419
|
+
/**
|
|
420
|
+
* Register a tool. Pass a `config` describing the tool (name, schemas,
|
|
421
|
+
* optional {@link ViewConfig}, optional {@link ToolMeta}) and a handler that
|
|
422
|
+
* returns the tool's result.
|
|
423
|
+
*
|
|
424
|
+
* Chain calls to build up a server: each call returns a new `McpServer`
|
|
425
|
+
* type that captures the tool's input/output/`_meta` shape so the
|
|
426
|
+
* resulting `typeof server` can drive {@link generateHelpers}.
|
|
427
|
+
*
|
|
428
|
+
* The handler's return shape determines the output types: the
|
|
429
|
+
* `structuredContent` field becomes the tool's typed output, and `_meta`
|
|
430
|
+
* becomes its `responseMetadata`. The `content` field is normalized through
|
|
431
|
+
* {@link normalizeContent}.
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* ```ts
|
|
435
|
+
* server.registerTool({
|
|
436
|
+
* name: "search",
|
|
437
|
+
* inputSchema: { query: z.string() },
|
|
438
|
+
* outputSchema: { results: z.array(z.string()) },
|
|
439
|
+
* view: { component: "search" },
|
|
440
|
+
* }, async ({ query }) => ({
|
|
441
|
+
* content: `Found results for ${query}`,
|
|
442
|
+
* structuredContent: { results: [...] },
|
|
443
|
+
* }));
|
|
444
|
+
* ```
|
|
445
|
+
*
|
|
446
|
+
* @see https://docs.skybridge.tech/api-reference/register-tool
|
|
447
|
+
*/
|
|
189
448
|
registerTool<TName extends string, InputArgs extends ZodRawShapeCompat, TReturn extends {
|
|
190
449
|
content?: HandlerContent;
|
|
191
450
|
}>(config: ToolConfig<InputArgs> & {
|