skybridge 0.0.0-dev.99a8152 → 0.0.0-dev.99c619a
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 +8 -7
- package/dist/cli/build-helpers.d.ts +1 -1
- package/dist/cli/build-helpers.js +4 -4
- package/dist/cli/build-helpers.js.map +1 -1
- package/dist/cli/build-helpers.test.js +2 -2
- package/dist/cli/build-helpers.test.js.map +1 -1
- package/dist/cli/build-steps.js +1 -1
- package/dist/cli/build-steps.js.map +1 -1
- package/dist/cli/build-steps.test.js +3 -3
- package/dist/cli/build-steps.test.js.map +1 -1
- package/dist/cli/detect-port.js +0 -1
- package/dist/cli/detect-port.js.map +1 -1
- package/dist/cli/run-plain.js +2 -1
- package/dist/cli/run-plain.js.map +1 -1
- package/dist/cli/telemetry.js +2 -0
- package/dist/cli/telemetry.js.map +1 -1
- package/dist/cli/use-execute-steps.d.ts +1 -1
- package/dist/cli/use-nodemon.d.ts +11 -1
- package/dist/cli/use-nodemon.js +30 -8
- package/dist/cli/use-nodemon.js.map +1 -1
- package/dist/cli/use-typescript-check.js +1 -1
- package/dist/cli/use-typescript-check.js.map +1 -1
- package/dist/commands/dev.js +4 -4
- 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 +194 -0
- package/dist/server/app.js +266 -0
- package/dist/server/app.js.map +1 -0
- package/dist/server/app.test.js +97 -0
- package/dist/server/app.test.js.map +1 -0
- package/dist/server/auth/discovery.d.ts +2 -1
- package/dist/server/auth/discovery.js +2 -2
- package/dist/server/auth/discovery.js.map +1 -1
- package/dist/server/auth/index.d.ts +35 -5
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/auth/providers/auth0.d.ts +25 -3
- package/dist/server/auth/providers/auth0.js +13 -8
- package/dist/server/auth/providers/auth0.js.map +1 -1
- package/dist/server/auth/providers/auth0.test.js +5 -3
- package/dist/server/auth/providers/auth0.test.js.map +1 -1
- package/dist/server/auth/providers/authplane.d.ts +4 -2
- package/dist/server/auth/providers/authplane.js.map +1 -1
- package/dist/server/auth/providers/authplane.test.js +23 -18
- package/dist/server/auth/providers/authplane.test.js.map +1 -1
- package/dist/server/auth/providers/clerk.d.ts +40 -3
- package/dist/server/auth/providers/clerk.js +4 -1
- package/dist/server/auth/providers/clerk.js.map +1 -1
- package/dist/server/auth/providers/clerk.test.js +5 -3
- package/dist/server/auth/providers/clerk.test.js.map +1 -1
- package/dist/server/auth/providers/custom.d.ts +16 -6
- package/dist/server/auth/providers/custom.js +14 -4
- package/dist/server/auth/providers/custom.js.map +1 -1
- package/dist/server/auth/providers/custom.test.js +24 -19
- package/dist/server/auth/providers/custom.test.js.map +1 -1
- package/dist/server/auth/providers/descope.d.ts +32 -3
- package/dist/server/auth/providers/descope.js.map +1 -1
- package/dist/server/auth/providers/descope.test.js +8 -6
- package/dist/server/auth/providers/descope.test.js.map +1 -1
- package/dist/server/auth/providers/stytch.d.ts +16 -3
- package/dist/server/auth/providers/stytch.js +4 -1
- 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 +28 -5
- package/dist/server/auth/providers/workos.js +6 -2
- package/dist/server/auth/providers/workos.js.map +1 -1
- package/dist/server/auth/setup.d.ts +1 -1
- package/dist/server/auth/setup.js +4 -5
- package/dist/server/auth/setup.js.map +1 -1
- package/dist/server/auth/setup.test.js +97 -57
- package/dist/server/auth/setup.test.js.map +1 -1
- package/dist/server/auth/verify.d.ts +42 -6
- package/dist/server/auth/verify.js +27 -3
- package/dist/server/auth/verify.js.map +1 -1
- package/dist/server/auth/verify.test.js +65 -0
- package/dist/server/auth/verify.test.js.map +1 -1
- package/dist/server/auth-extra.test-d.js +130 -0
- package/dist/server/auth-extra.test-d.js.map +1 -0
- package/dist/server/auth.d.ts +43 -6
- package/dist/server/auth.js +4 -5
- package/dist/server/auth.js.map +1 -1
- package/dist/server/build-manifest.test.js +7 -6
- 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 +23 -3
- package/dist/server/express.js +38 -32
- package/dist/server/express.js.map +1 -1
- package/dist/server/express.test.js +220 -103
- package/dist/server/express.test.js.map +1 -1
- package/dist/server/file-ref.d.ts +1 -1
- package/dist/server/file-ref.js +1 -1
- package/dist/server/file-ref.js.map +1 -1
- package/dist/server/index.d.ts +13 -8
- package/dist/server/index.js +6 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server/mcp-errors.test.js +41 -0
- package/dist/server/mcp-errors.test.js.map +1 -0
- package/dist/server/middleware.d.ts +35 -10
- package/dist/server/middleware.js +33 -0
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/middleware.test-d.js +1 -1
- package/dist/server/middleware.test-d.js.map +1 -1
- package/dist/server/middleware.test.js +242 -134
- package/dist/server/middleware.test.js.map +1 -1
- package/dist/server/register-tool.test.js +77 -0
- package/dist/server/register-tool.test.js.map +1 -0
- package/dist/server/server.d.ts +161 -120
- package/dist/server/server.js +163 -303
- package/dist/server/server.js.map +1 -1
- package/dist/server/skills-integration.test.js +19 -12
- package/dist/server/skills-integration.test.js.map +1 -1
- package/dist/server/skills.d.ts +3 -5
- package/dist/server/skills.js +17 -24
- package/dist/server/skills.js.map +1 -1
- package/dist/server/skills.test.js +8 -12
- package/dist/server/skills.test.js.map +1 -1
- package/dist/server/templateHelper.d.ts +0 -3
- package/dist/server/templateHelper.js.map +1 -1
- package/dist/server/templates.generated.js +4 -8
- package/dist/server/templates.generated.js.map +1 -1
- package/dist/server/tool-extra.test.js +88 -0
- package/dist/server/tool-extra.test.js.map +1 -0
- package/dist/server/view-resource-resolution.test.js +18 -13
- package/dist/server/view-resource-resolution.test.js.map +1 -1
- package/dist/test/utils.d.ts +9 -11
- package/dist/test/utils.js +220 -201
- package/dist/test/utils.js.map +1 -1
- package/dist/test/view.test.js +41 -37
- package/dist/test/view.test.js.map +1 -1
- package/dist/views/index.d.ts +10 -0
- package/dist/views/index.js +3 -0
- package/dist/views/index.js.map +1 -0
- package/dist/{web/plugin → views}/scan-views.js +1 -1
- package/dist/views/scan-views.js.map +1 -0
- package/dist/views/scan-views.test.d.ts +1 -0
- package/dist/views/scan-views.test.js.map +1 -0
- package/dist/views/validate-view.d.ts +1 -0
- package/dist/{web/plugin → views}/validate-view.js +2 -2
- package/dist/views/validate-view.js.map +1 -0
- package/dist/views/validate-view.test.d.ts +1 -0
- package/dist/views/validate-view.test.js.map +1 -0
- package/dist/web/bridges/adaptor.d.ts +6 -2
- package/dist/web/bridges/adaptor.js +57 -25
- package/dist/web/bridges/adaptor.js.map +1 -1
- package/dist/web/bridges/adaptor.test.js +11 -4
- package/dist/web/bridges/adaptor.test.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.test.js +2 -2
- package/dist/web/bridges/get-adaptor.test.js.map +1 -1
- package/dist/web/bridges/mcp-app/bridge.d.ts +1 -1
- package/dist/web/bridges/mcp-app/bridge.js +10 -3
- package/dist/web/bridges/mcp-app/bridge.js.map +1 -1
- package/dist/web/bridges/mcp-app/bridge.test.js +2 -2
- package/dist/web/bridges/mcp-app/bridge.test.js.map +1 -1
- package/dist/web/bridges/mcp-app/types.d.ts +26 -3
- package/dist/web/bridges/mcp-app/types.js.map +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +2 -2
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -1
- package/dist/web/bridges/mcp-app/view-tools.test.js +1 -1
- package/dist/web/bridges/mcp-app/view-tools.test.js.map +1 -1
- package/dist/web/bridges/types.d.ts +33 -14
- package/dist/web/bridges/types.js.map +1 -1
- package/dist/web/create-store.test.js +2 -2
- package/dist/web/create-store.test.js.map +1 -1
- package/dist/web/data-llm.js +3 -2
- package/dist/web/data-llm.js.map +1 -1
- package/dist/web/data-llm.test.js +11 -4
- package/dist/web/data-llm.test.js.map +1 -1
- package/dist/web/generate-helpers.d.ts +23 -19
- package/dist/web/generate-helpers.js +21 -17
- 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 +4 -2
- package/dist/web/hooks/index.js +4 -2
- package/dist/web/hooks/index.js.map +1 -1
- package/dist/web/hooks/openai-extensions.test.d.ts +1 -0
- package/dist/web/hooks/openai-extensions.test.js +114 -0
- package/dist/web/hooks/openai-extensions.test.js.map +1 -0
- package/dist/web/hooks/use-call-tool.d.ts +2 -2
- package/dist/web/hooks/use-call-tool.js +15 -10
- package/dist/web/hooks/use-call-tool.js.map +1 -1
- package/dist/web/hooks/use-call-tool.test.js +9 -2
- package/dist/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/web/hooks/use-deep-link.d.ts +22 -0
- package/dist/web/hooks/use-deep-link.js +60 -0
- package/dist/web/hooks/use-deep-link.js.map +1 -0
- 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 +1 -1
- 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 +7 -7
- package/dist/web/hooks/use-download.test.js.map +1 -1
- package/dist/web/hooks/use-files.test.js +1 -1
- package/dist/web/hooks/use-files.test.js.map +1 -1
- package/dist/web/hooks/use-host.d.ts +44 -0
- package/dist/web/hooks/use-host.js +45 -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-info.test.js → use-host.test.js} +7 -7
- package/dist/web/hooks/use-host.test.js.map +1 -0
- package/dist/web/hooks/use-model-context.d.ts +44 -0
- package/dist/web/hooks/use-model-context.js +65 -0
- package/dist/web/hooks/use-model-context.js.map +1 -0
- package/dist/web/hooks/use-open-external.test.js +2 -2
- 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 +1 -1
- package/dist/web/hooks/use-request-close.test.js.map +1 -1
- package/dist/web/hooks/use-request-modal.test.js +1 -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 +1 -1
- package/dist/web/hooks/use-request-size.test.js.map +1 -1
- package/dist/web/hooks/use-set-open-in-app-url.test.js +2 -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 +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 +2 -7
- 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 +5 -3
- package/dist/web/hooks/use-user.test.js.map +1 -1
- package/dist/web/hooks/use-view-state.test.js +2 -2
- 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-layout.test.js → use-viewport.test.js} +12 -32
- package/dist/web/hooks/use-viewport.test.js.map +1 -0
- package/dist/web/mount-view.d.ts +3 -2
- package/dist/web/mount-view.js +5 -8
- package/dist/web/mount-view.js.map +1 -1
- package/package.json +14 -12
- package/dist/web/hooks/use-host-info.d.ts +0 -22
- package/dist/web/hooks/use-host-info.js +0 -30
- package/dist/web/hooks/use-host-info.js.map +0 -1
- package/dist/web/hooks/use-host-info.test.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.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 -39
- package/dist/web/plugin/plugin.js +0 -189
- package/dist/web/plugin/plugin.js.map +0 -1
- package/dist/web/plugin/scan-views.js.map +0 -1
- package/dist/web/plugin/scan-views.test.js.map +0 -1
- package/dist/web/plugin/transform-data-llm.d.ts +0 -12
- package/dist/web/plugin/transform-data-llm.js +0 -96
- package/dist/web/plugin/transform-data-llm.js.map +0 -1
- package/dist/web/plugin/transform-data-llm.test.js +0 -81
- package/dist/web/plugin/transform-data-llm.test.js.map +0 -1
- package/dist/web/plugin/validate-view.d.ts +0 -1
- package/dist/web/plugin/validate-view.js.map +0 -1
- package/dist/web/plugin/validate-view.test.js.map +0 -1
- /package/dist/{web/hooks/use-host-info.test.d.ts → context-warnings.test.d.ts} +0 -0
- /package/dist/{web/hooks/use-layout.test.d.ts → server/app.test.d.ts} +0 -0
- /package/dist/{web/plugin/data-llm.test.d.ts → server/auth-extra.test-d.d.ts} +0 -0
- /package/dist/{web/plugin/scan-views.test.d.ts → server/mcp-errors.test.d.ts} +0 -0
- /package/dist/{web/plugin/transform-data-llm.test.d.ts → server/register-tool.test.d.ts} +0 -0
- /package/dist/{web/plugin/validate-view.test.d.ts → server/tool-extra.test.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,12 +1,9 @@
|
|
|
1
1
|
import type { McpUiToolMeta } from "@modelcontextprotocol/ext-apps";
|
|
2
|
-
import { type ServerOptions } from "@modelcontextprotocol/
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import express, { type ErrorRequestHandler, type Express, type RequestHandler } from "express";
|
|
8
|
-
import type { OAuthConfig } from "./auth/index.js";
|
|
9
|
-
import type { McpExtra, McpExtraFor, McpMethodString, McpMiddlewareFilter, McpMiddlewareFn, McpResultFor, McpTypedMiddlewareFn, McpWildcard } from "./middleware.js";
|
|
2
|
+
import { type ContentBlock, type Icon, type Implementation, McpServer as McpServerBase, type RequestMeta, type ServerOptions, type ServerResult, type StandardSchemaV1, type StandardSchemaWithJSON, type ToolAnnotations } from "@modelcontextprotocol/server";
|
|
3
|
+
import type express from "express";
|
|
4
|
+
import type { ResourceMetadataUrlResolver } from "./auth/setup.js";
|
|
5
|
+
import type { ExtraClaims } from "./auth.js";
|
|
6
|
+
import type { McpExtra, McpExtraFor, McpMethodString, McpMiddlewareEntry, McpMiddlewareFilter, McpMiddlewareFn, McpResultFor, McpTypedMiddlewareFn, McpWildcard } from "./middleware.js";
|
|
10
7
|
import { type SkillsManifest } from "./skills.js";
|
|
11
8
|
/**
|
|
12
9
|
* Type marker for a registered tool — carries its input, output, and response
|
|
@@ -20,12 +17,6 @@ export type ToolDef<TInput = unknown, TOutput = unknown, TResponseMetadata = unk
|
|
|
20
17
|
output: TOutput;
|
|
21
18
|
responseMetadata: TResponseMetadata;
|
|
22
19
|
};
|
|
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
|
-
*/
|
|
28
|
-
export type ViewHostType = "apps-sdk" | "mcp-app";
|
|
29
20
|
/**
|
|
30
21
|
* Content Security Policy origins attached to a view's resource. Each list is
|
|
31
22
|
* passed through to the host's CSP for the view iframe; omit a field to inherit
|
|
@@ -69,11 +60,6 @@ export interface ViewConfig {
|
|
|
69
60
|
component: ViewName;
|
|
70
61
|
/** Human-readable label the host may show alongside the view. */
|
|
71
62
|
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
|
-
*/
|
|
76
|
-
hosts?: ViewHostType[];
|
|
77
63
|
/** Request a visible border around the view (forwarded as `ui.prefersBorder`). */
|
|
78
64
|
prefersBorder?: boolean;
|
|
79
65
|
/** Override the iframe's served domain (advanced; forwarded as `ui.domain`). */
|
|
@@ -89,6 +75,65 @@ export type SecurityScheme = {
|
|
|
89
75
|
type: "oauth2";
|
|
90
76
|
scopes?: string[];
|
|
91
77
|
};
|
|
78
|
+
/** A display mode ChatGPT can render a view in. ChatGPT doesn't support `pip`. */
|
|
79
|
+
export type OpenAIDisplayMode = "inline" | "fullscreen";
|
|
80
|
+
/** A sidebar shortcut that calls another tool of the same server. */
|
|
81
|
+
export interface OpenAIQuickAction {
|
|
82
|
+
title: string;
|
|
83
|
+
icons: [Icon, ...Icon[]];
|
|
84
|
+
target: {
|
|
85
|
+
type: "tool";
|
|
86
|
+
name: string;
|
|
87
|
+
arguments?: Record<string, unknown>;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A place in ChatGPT where users can open the tool's view without the model.
|
|
92
|
+
*
|
|
93
|
+
* - `global`: an entry in the sidebar, opened fullscreen.
|
|
94
|
+
* - `thread`: a tab in a conversation's side panel.
|
|
95
|
+
* - `file`: a viewer for files with these extensions, such as `".stl"`.
|
|
96
|
+
* ChatGPT calls the tool with `{ file: { name, resourceUri } }`.
|
|
97
|
+
* - `settings`: an entry in the plugin settings.
|
|
98
|
+
*
|
|
99
|
+
* ChatGPT calls the tool with `{}` for global and thread entrypoints, so the
|
|
100
|
+
* tool must not require any input.
|
|
101
|
+
*/
|
|
102
|
+
export type OpenAIEntrypoint = {
|
|
103
|
+
type: "global";
|
|
104
|
+
quickAction?: OpenAIQuickAction;
|
|
105
|
+
} | {
|
|
106
|
+
type: "thread";
|
|
107
|
+
} | {
|
|
108
|
+
type: "file";
|
|
109
|
+
extensions: string[];
|
|
110
|
+
} | {
|
|
111
|
+
type: "settings";
|
|
112
|
+
searchTerms?: string[];
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* ChatGPT-only tool options, emitted as `_meta["openai/ui"]` on the tool and
|
|
116
|
+
* on its view resource. Every field is optional: ChatGPT applies the defaults
|
|
117
|
+
* of the OpenAI MCP extensions spec when one is omitted. Requires `view`.
|
|
118
|
+
*
|
|
119
|
+
* @see https://github.com/openai/mcp-extensions/blob/main/docs/spec.md
|
|
120
|
+
*/
|
|
121
|
+
export interface OpenAIToolConfig {
|
|
122
|
+
/** Places where users can open the view directly. */
|
|
123
|
+
entrypoints?: OpenAIEntrypoint[];
|
|
124
|
+
/**
|
|
125
|
+
* Display modes the view supports, read before the view loads. Defaults to
|
|
126
|
+
* `[preferredDisplayMode]` when that is set, otherwise to both modes.
|
|
127
|
+
*/
|
|
128
|
+
availableDisplayModes?: OpenAIDisplayMode[];
|
|
129
|
+
/**
|
|
130
|
+
* Display mode the view prefers to open in. Setting it alone makes it the
|
|
131
|
+
* only available mode, so also set `availableDisplayModes` to keep the other.
|
|
132
|
+
*/
|
|
133
|
+
preferredDisplayMode?: OpenAIDisplayMode;
|
|
134
|
+
/** Display mode the view opens in first when the model calls the tool. */
|
|
135
|
+
preferredModelDisplayMode?: OpenAIDisplayMode;
|
|
136
|
+
}
|
|
92
137
|
/**
|
|
93
138
|
* Declarative per-tool auth. Enforced when the server has an `oauth` provider:
|
|
94
139
|
* anonymous or under-scoped calls are rejected before the handler runs. Omit
|
|
@@ -108,12 +153,14 @@ export type ToolAuth = {
|
|
|
108
153
|
* from Express's own types so the public API doesn't depend on `body-parser`.
|
|
109
154
|
*/
|
|
110
155
|
export type JsonOptions = NonNullable<Parameters<typeof express.json>[0]>;
|
|
111
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* The Skybridge-specific options an {@link McpServer} is built with. A
|
|
158
|
+
* {@link Skybridge} app derives them from its config; pass them directly only
|
|
159
|
+
* when constructing an `McpServer` by hand.
|
|
160
|
+
*/
|
|
112
161
|
export interface SkybridgeServerOptions {
|
|
113
|
-
/**
|
|
114
|
-
|
|
115
|
-
/** Resource-server OAuth config. When set, mounts well-known metadata and bearer auth on `/mcp`. */
|
|
116
|
-
oauth?: OAuthConfig;
|
|
162
|
+
/** Whether an OAuth provider guards `/mcp`; enables per-tool scheme enforcement. */
|
|
163
|
+
oauth?: boolean;
|
|
117
164
|
/**
|
|
118
165
|
* @experimental Serve Agent Skills from `src/skills` over MCP (SEP-2640).
|
|
119
166
|
* API may change.
|
|
@@ -137,7 +184,6 @@ export interface KnownToolMeta {
|
|
|
137
184
|
"openai/fileParams"?: string[];
|
|
138
185
|
/** MCP Apps: control whether the tool is exposed to the model, the app, or both. */
|
|
139
186
|
ui?: Pick<McpUiToolMeta, "visibility">;
|
|
140
|
-
securitySchemes?: SecurityScheme[];
|
|
141
187
|
}
|
|
142
188
|
/** {@link KnownToolMeta} merged with arbitrary string-keyed metadata for custom flags. */
|
|
143
189
|
export type ToolMeta = KnownToolMeta & Record<string, unknown>;
|
|
@@ -163,10 +209,10 @@ export interface McpServerTypes<TTools extends Record<string, ToolDef>> {
|
|
|
163
209
|
type Simplify<T> = {
|
|
164
210
|
[K in keyof T]: T[K];
|
|
165
211
|
};
|
|
166
|
-
type ShapeOutput<Shape extends
|
|
167
|
-
[K in keyof Shape as undefined extends
|
|
212
|
+
type ShapeOutput<Shape extends Record<string, StandardSchemaWithJSON>> = Simplify<{
|
|
213
|
+
[K in keyof Shape as undefined extends StandardSchemaV1.InferOutput<Shape[K]> ? never : K]: StandardSchemaV1.InferOutput<Shape[K]>;
|
|
168
214
|
} & {
|
|
169
|
-
[K in keyof Shape as undefined extends
|
|
215
|
+
[K in keyof Shape as undefined extends StandardSchemaV1.InferOutput<Shape[K]> ? K : never]?: StandardSchemaV1.InferOutput<Shape[K]>;
|
|
170
216
|
}>;
|
|
171
217
|
type ExtractStructuredContent<T> = T extends {
|
|
172
218
|
structuredContent: infer SC;
|
|
@@ -178,17 +224,25 @@ type ExtractMeta<T> = [Extract<T, {
|
|
|
178
224
|
}> extends {
|
|
179
225
|
_meta: infer M;
|
|
180
226
|
} ? Simplify<M> : unknown;
|
|
181
|
-
type AddTool<TTools, TName extends string, TInput extends
|
|
227
|
+
type AddTool<TTools, TName extends string, TInput extends Record<string, StandardSchemaWithJSON>, TOutput, TResponseMetadata = unknown, TAuthExtra extends ExtraClaims = ExtraClaims> = McpServer<TTools & {
|
|
182
228
|
[K in TName]: ToolDef<ShapeOutput<TInput>, TOutput, TResponseMetadata>;
|
|
183
|
-
}>;
|
|
184
|
-
interface ToolConfigBase<TInput extends
|
|
229
|
+
}, TAuthExtra>;
|
|
230
|
+
interface ToolConfigBase<TInput extends Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON> {
|
|
185
231
|
name: string;
|
|
186
232
|
title?: string;
|
|
187
233
|
description?: string;
|
|
188
234
|
inputSchema?: TInput;
|
|
189
|
-
outputSchema?:
|
|
235
|
+
outputSchema?: Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON;
|
|
190
236
|
annotations?: ToolAnnotations;
|
|
237
|
+
/**
|
|
238
|
+
* Icons for the tool, a standard MCP field. Hosts choose whether and where
|
|
239
|
+
* to show them. ChatGPT asks for them on every entrypoint tool, as a
|
|
240
|
+
* monochrome SVG on a 20x20 viewport that uses `currentColor`.
|
|
241
|
+
*/
|
|
242
|
+
icons?: Icon[];
|
|
191
243
|
view?: ViewConfig;
|
|
244
|
+
/** ChatGPT-only options. See {@link OpenAIToolConfig}. */
|
|
245
|
+
openai?: OpenAIToolConfig;
|
|
192
246
|
_meta?: ToolMeta;
|
|
193
247
|
}
|
|
194
248
|
/**
|
|
@@ -209,7 +263,7 @@ type ToolAuthConfig = {
|
|
|
209
263
|
*/
|
|
210
264
|
securitySchemes?: SecurityScheme[];
|
|
211
265
|
};
|
|
212
|
-
type ToolConfig<TInput extends
|
|
266
|
+
type ToolConfig<TInput extends Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON> = ToolConfigBase<TInput> & ToolAuthConfig;
|
|
213
267
|
/**
|
|
214
268
|
* Optional client-supplied hints attached to `params._meta` on every tool call
|
|
215
269
|
* by the Apps SDK host. Hints only: never use for authorization, and tolerate
|
|
@@ -238,15 +292,26 @@ export interface ClientHintsMeta {
|
|
|
238
292
|
"openai/organization"?: string;
|
|
239
293
|
/** Stable id for the currently mounted widget instance. */
|
|
240
294
|
"openai/widgetSessionId"?: string;
|
|
295
|
+
/**
|
|
296
|
+
* Set by ChatGPT desktop on tool calls from a view opened through a file
|
|
297
|
+
* entrypoint. `path` is the absolute path of the opened file. Any MCP client
|
|
298
|
+
* can send this key: never use it for authorization, and resolve the path
|
|
299
|
+
* and keep it inside an allowed directory before touching the filesystem.
|
|
300
|
+
*/
|
|
301
|
+
"openai/resource"?: {
|
|
302
|
+
path?: string;
|
|
303
|
+
};
|
|
241
304
|
}
|
|
242
|
-
type ToolHandlerExtra = Omit<
|
|
243
|
-
_meta
|
|
305
|
+
type ToolHandlerExtra<TAuthExtra extends ExtraClaims = ExtraClaims> = Omit<McpExtra<TAuthExtra>, "mcpReq"> & {
|
|
306
|
+
mcpReq: Omit<McpExtra<TAuthExtra>["mcpReq"], "_meta"> & {
|
|
307
|
+
_meta?: RequestMeta & ClientHintsMeta;
|
|
308
|
+
};
|
|
244
309
|
};
|
|
245
|
-
type ToolHandler<TInput extends
|
|
310
|
+
type ToolHandler<TInput extends Record<string, StandardSchemaWithJSON>, TReturn extends {
|
|
246
311
|
content?: HandlerContent;
|
|
247
312
|
} = {
|
|
248
313
|
content?: HandlerContent;
|
|
249
|
-
}> = (args: ShapeOutput<TInput>, extra: ToolHandlerExtra) => TReturn | Promise<TReturn>;
|
|
314
|
+
}, TAuthExtra extends ExtraClaims = ExtraClaims> = (args: ShapeOutput<TInput>, extra: ToolHandlerExtra<TAuthExtra>) => TReturn | Promise<TReturn>;
|
|
250
315
|
/**
|
|
251
316
|
* Coerce a tool handler's return value into an MCP `content` array. Strings
|
|
252
317
|
* become a single `TextContent`; a single block is wrapped in an array;
|
|
@@ -268,26 +333,38 @@ export declare function __setBuildManifest(manifest: Record<string, {
|
|
|
268
333
|
file: string;
|
|
269
334
|
}>): void;
|
|
270
335
|
export declare function __setSkillsManifest(manifest: SkillsManifest): void;
|
|
271
|
-
|
|
336
|
+
/**
|
|
337
|
+
* Typed registration sugar over the MCP SDK's `McpServer`: a tool registry
|
|
338
|
+
* that carries input/output/meta shapes, view resources, per-tool security
|
|
339
|
+
* schemes, and prompt/resource registration. A {@link Skybridge} app builds
|
|
340
|
+
* one of these per request and hands it to your `handler`; chain
|
|
341
|
+
* {@link McpServer.registerTool} calls on it and return the result.
|
|
342
|
+
*
|
|
343
|
+
* The `TTools` generic accumulates each registered tool's input/output/meta
|
|
344
|
+
* shape, so `typeof app` carries enough information for view-side helpers
|
|
345
|
+
* like {@link generateHelpers} to produce fully-typed hooks.
|
|
346
|
+
*
|
|
347
|
+
* @typeParam TTools - Accumulated tool registry. Filled in by `registerTool`
|
|
348
|
+
* chaining; you almost never set this manually.
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```ts
|
|
352
|
+
* export const app = new Skybridge({
|
|
353
|
+
* name: "my-app",
|
|
354
|
+
* version: "1.0.0",
|
|
355
|
+
* handler: (server) =>
|
|
356
|
+
* server.registerTool({
|
|
357
|
+
* name: "search",
|
|
358
|
+
* inputSchema: { query: z.string() },
|
|
359
|
+
* view: { component: "search" },
|
|
360
|
+
* }, async ({ query }) => ({ content: `Results for ${query}` })),
|
|
361
|
+
* });
|
|
362
|
+
* ```
|
|
363
|
+
*
|
|
364
|
+
* @see https://docs.skybridge.tech/api-reference/mcp-server
|
|
365
|
+
*/
|
|
366
|
+
export declare class McpServer<TTools extends Record<string, ToolDef> = Record<never, ToolDef>, TAuthExtra extends ExtraClaims = ExtraClaims> extends McpServerBaseOmitted {
|
|
272
367
|
readonly $types: McpServerTypes<TTools>;
|
|
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;
|
|
288
|
-
private customErrorMiddleware;
|
|
289
|
-
private mcpMiddlewareEntries;
|
|
290
|
-
private mcpMiddlewareApplied;
|
|
291
368
|
private claimedViews;
|
|
292
369
|
private viewMetaBuilders;
|
|
293
370
|
/**
|
|
@@ -298,45 +375,34 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
298
375
|
*/
|
|
299
376
|
private viewUriByPath;
|
|
300
377
|
private viteManifest;
|
|
301
|
-
private readonly serverInfo;
|
|
302
|
-
private readonly serverOptions?;
|
|
303
378
|
private oauthEnabled;
|
|
304
379
|
private resolveResourceMetadataUrl?;
|
|
305
|
-
private
|
|
380
|
+
private readonly toolSecuritySchemes;
|
|
381
|
+
private readonly userMiddlewareEntries;
|
|
306
382
|
constructor(serverInfo: Implementation, options?: ServerOptions, skybridgeOptions?: SkybridgeServerOptions);
|
|
307
|
-
private setupSkills;
|
|
308
383
|
/**
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
384
|
+
* The per-tool security schemes collected during registration, keyed by tool
|
|
385
|
+
* name. Read by the OAuth layer to decide whether anonymous requests are
|
|
386
|
+
* allowed and which schemes gate a given `tools/call`.
|
|
312
387
|
*
|
|
313
|
-
*
|
|
314
|
-
* locally and on self-hosted deployments.
|
|
388
|
+
* @internal
|
|
315
389
|
*/
|
|
316
|
-
|
|
317
|
-
use(path: string, ...handlers: RequestHandler[]): this;
|
|
390
|
+
get securitySchemesByTool(): ReadonlyMap<string, SecurityScheme[] | undefined>;
|
|
318
391
|
/**
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
* thrown by tool handlers before the default error handler responds.
|
|
392
|
+
* Inject the resolver the app uses to build the protected-resource metadata
|
|
393
|
+
* URL, so tool handlers can emit in-band auth challenges.
|
|
322
394
|
*
|
|
323
|
-
* @
|
|
324
|
-
* ```ts
|
|
325
|
-
* server.useOnError((err, _req, _res, next) => {
|
|
326
|
-
* logger.error(err);
|
|
327
|
-
* next(err);
|
|
328
|
-
* });
|
|
329
|
-
* ```
|
|
395
|
+
* @internal
|
|
330
396
|
*/
|
|
331
|
-
|
|
332
|
-
|
|
397
|
+
setResourceMetadataUrlResolver(resolve: ResourceMetadataUrlResolver): this;
|
|
398
|
+
private setupSkills;
|
|
333
399
|
/** Register MCP protocol-level middleware (catch-all). */
|
|
334
|
-
mcpMiddleware(handler: McpMiddlewareFn): this;
|
|
400
|
+
mcpMiddleware(handler: McpMiddlewareFn<TAuthExtra>): this;
|
|
335
401
|
/** Register MCP protocol-level middleware for all requests (`extra` is `McpExtra`). */
|
|
336
402
|
mcpMiddleware(filter: "request", handler: (request: {
|
|
337
403
|
method: string;
|
|
338
404
|
params: Record<string, unknown>;
|
|
339
|
-
}, extra: McpExtra
|
|
405
|
+
}, extra: McpExtra<TAuthExtra>, next: () => Promise<ServerResult>) => Promise<unknown> | unknown): this;
|
|
340
406
|
/** Register MCP protocol-level middleware for all notifications (`extra` is `undefined`). */
|
|
341
407
|
mcpMiddleware(filter: "notification", handler: (request: {
|
|
342
408
|
method: string;
|
|
@@ -346,7 +412,7 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
346
412
|
* Register MCP protocol-level middleware for an exact method.
|
|
347
413
|
* Narrows `params`, `extra`, and `next()` result based on the method string.
|
|
348
414
|
*/
|
|
349
|
-
mcpMiddleware<M extends McpMethodString>(filter: M, handler: McpTypedMiddlewareFn<M>): this;
|
|
415
|
+
mcpMiddleware<M extends McpMethodString>(filter: M, handler: McpTypedMiddlewareFn<M, TAuthExtra>): this;
|
|
350
416
|
/**
|
|
351
417
|
* Register MCP protocol-level middleware for a wildcard pattern (e.g. `"tools/*"`).
|
|
352
418
|
* `next()` returns the union of result types for matching methods.
|
|
@@ -354,49 +420,22 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
354
420
|
mcpMiddleware<W extends McpWildcard>(filter: W, handler: (request: {
|
|
355
421
|
method: string;
|
|
356
422
|
params: Record<string, unknown>;
|
|
357
|
-
}, extra: McpExtraFor<W>, next: () => Promise<McpResultFor<W>>) => Promise<unknown> | unknown): this;
|
|
423
|
+
}, extra: McpExtraFor<W, TAuthExtra>, next: () => Promise<McpResultFor<W>>) => Promise<unknown> | unknown): this;
|
|
358
424
|
/**
|
|
359
425
|
* Register MCP protocol-level middleware with a method filter.
|
|
360
426
|
* Filter can be an exact method (`"tools/call"`), wildcard (`"tools/*"`),
|
|
361
427
|
* category (`"request"` | `"notification"`), or an array of those.
|
|
362
428
|
*/
|
|
363
|
-
mcpMiddleware(filter: McpMiddlewareFilter, handler: McpMiddlewareFn): this;
|
|
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
|
-
*/
|
|
373
|
-
connect(transport: Parameters<typeof McpServerBase.prototype.connect>[0]): Promise<void>;
|
|
429
|
+
mcpMiddleware(filter: McpMiddlewareFilter, handler: McpMiddlewareFn<TAuthExtra>): this;
|
|
374
430
|
/**
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
* we build a fresh underlying `Server` per request and share the main
|
|
380
|
-
* server's handler maps by reference. The cast is unavoidable: there's
|
|
381
|
-
* no public API to inject handler maps. `getHandlerMaps` validates the
|
|
382
|
-
* read side and fails fast on SDK field renames.
|
|
383
|
-
*/
|
|
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}.
|
|
431
|
+
* This instance's protocol-level middleware: the framework's own entries
|
|
432
|
+
* (view `_meta` on `resources/list`, version-agnostic view resolution on
|
|
433
|
+
* `resources/read`, the top-level `securitySchemes` mirror on `tools/list`)
|
|
434
|
+
* followed by the ones registered via {@link McpServer.mcpMiddleware}.
|
|
390
435
|
*
|
|
391
|
-
*
|
|
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.
|
|
436
|
+
* @internal
|
|
396
437
|
*/
|
|
397
|
-
|
|
398
|
-
fetch: (...args: unknown[]) => unknown;
|
|
399
|
-
} | Express | undefined>;
|
|
438
|
+
protocolMiddlewareEntries(): McpMiddlewareEntry[];
|
|
400
439
|
private enforceOneToolPerView;
|
|
401
440
|
private resolveViewRequestContext;
|
|
402
441
|
private registerViewResources;
|
|
@@ -445,11 +484,13 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
445
484
|
*
|
|
446
485
|
* @see https://docs.skybridge.tech/api-reference/register-tool
|
|
447
486
|
*/
|
|
448
|
-
registerTool<TName extends string, InputArgs extends
|
|
487
|
+
registerTool<TName extends string, InputArgs extends Record<string, StandardSchemaWithJSON>, TReturn extends {
|
|
449
488
|
content?: HandlerContent;
|
|
450
489
|
}>(config: ToolConfig<InputArgs> & {
|
|
451
490
|
name: TName;
|
|
452
|
-
}, cb: ToolHandler<InputArgs, TReturn>): AddTool<TTools, TName, InputArgs, ExtractStructuredContent<TReturn>, ExtractMeta<TReturn
|
|
453
|
-
registerTool<InputArgs extends
|
|
491
|
+
}, cb: ToolHandler<InputArgs, TReturn, TAuthExtra>): AddTool<TTools, TName, InputArgs, ExtractStructuredContent<TReturn>, ExtractMeta<TReturn>, TAuthExtra>;
|
|
492
|
+
registerTool<InputArgs extends Record<string, StandardSchemaWithJSON>>(config: ToolConfig<InputArgs>, cb: ToolHandler<InputArgs, {
|
|
493
|
+
content?: HandlerContent;
|
|
494
|
+
}, TAuthExtra>): this;
|
|
454
495
|
}
|
|
455
496
|
export {};
|