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