skybridge 0.0.0-dev.ed29eee → 0.0.0-dev.ed38f16
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/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 +21 -17
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/auth/providers/auth0.d.ts +2 -2
- 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 +1 -1
- package/dist/server/auth/providers/auth0.test.js.map +1 -1
- package/dist/server/auth/providers/authplane.d.ts +2 -2
- package/dist/server/auth/providers/authplane.js.map +1 -1
- package/dist/server/auth/providers/authplane.test.js +10 -7
- package/dist/server/auth/providers/authplane.test.js.map +1 -1
- package/dist/server/auth/providers/clerk.d.ts +2 -2
- package/dist/server/auth/providers/clerk.js.map +1 -1
- package/dist/server/auth/providers/clerk.test.js +1 -1
- package/dist/server/auth/providers/clerk.test.js.map +1 -1
- package/dist/server/auth/providers/custom.d.ts +8 -6
- package/dist/server/auth/providers/custom.js +5 -2
- package/dist/server/auth/providers/custom.js.map +1 -1
- package/dist/server/auth/providers/custom.test.js +13 -10
- package/dist/server/auth/providers/custom.test.js.map +1 -1
- package/dist/server/auth/providers/descope.d.ts +2 -2
- package/dist/server/auth/providers/descope.js.map +1 -1
- package/dist/server/auth/providers/descope.test.js +3 -3
- package/dist/server/auth/providers/descope.test.js.map +1 -1
- package/dist/server/auth/providers/stytch.d.ts +2 -2
- package/dist/server/auth/providers/stytch.js.map +1 -1
- package/dist/server/auth/providers/workos.d.ts +5 -4
- package/dist/server/auth/providers/workos.js +2 -1
- 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 +3 -4
- package/dist/server/auth/setup.js.map +1 -1
- package/dist/server/auth/setup.test.js +83 -77
- package/dist/server/auth/setup.test.js.map +1 -1
- package/dist/server/auth/verify.d.ts +5 -3
- package/dist/server/auth/verify.js +2 -2
- package/dist/server/auth/verify.js.map +1 -1
- package/dist/server/auth/verify.test.js +16 -0
- package/dist/server/auth/verify.test.js.map +1 -1
- package/dist/server/auth-extra.test-d.js +97 -49
- package/dist/server/auth-extra.test-d.js.map +1 -1
- package/dist/server/auth.d.ts +7 -8
- 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 +6 -3
- package/dist/server/index.js +3 -1
- 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 +6 -6
- 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 +222 -150
- 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 +149 -119
- package/dist/server/server.js +146 -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 +25 -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.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.js.map +1 -0
- package/dist/web/bridges/adaptor.d.ts +6 -2
- package/dist/web/bridges/adaptor.js +47 -10
- package/dist/web/bridges/adaptor.js.map +1 -1
- package/dist/web/bridges/adaptor.test.js +1 -1
- 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 +8 -2
- 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.js +104 -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-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 +42 -0
- package/dist/web/hooks/use-model-context.js +63 -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-build.test.js +0 -54
- package/dist/web/plugin/plugin-build.test.js.map +0 -1
- package/dist/web/plugin/plugin.d.ts +0 -39
- package/dist/web/plugin/plugin.js +0 -200
- package/dist/web/plugin/plugin.js.map +0 -1
- package/dist/web/plugin/plugin.test.js +0 -61
- package/dist/web/plugin/plugin.test.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 → server/app.test.d.ts} +0 -0
- /package/dist/{web/hooks/use-layout.test.d.ts → server/mcp-errors.test.d.ts} +0 -0
- /package/dist/{web/plugin/data-llm.test.d.ts → server/register-tool.test.d.ts} +0 -0
- /package/dist/{web/plugin/plugin-build.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.d.ts +0 -0
- /package/dist/{web/plugin → views}/scan-views.test.js +0 -0
- /package/dist/{web/plugin → views}/validate-view.test.d.ts +0 -0
- /package/dist/{web/plugin → views}/validate-view.test.js +0 -0
- /package/dist/web/{plugin/plugin.test.d.ts → hooks/openai-extensions.test.d.ts} +0 -0
- /package/dist/web/{plugin/transform-data-llm.test.d.ts → hooks/use-host.test.d.ts} +0 -0
package/dist/server/server.d.ts
CHANGED
|
@@ -1,13 +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 { AuthInfo, ExtraClaims } from "./auth.js";
|
|
10
|
-
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";
|
|
11
7
|
import { type SkillsManifest } from "./skills.js";
|
|
12
8
|
/**
|
|
13
9
|
* Type marker for a registered tool — carries its input, output, and response
|
|
@@ -21,12 +17,6 @@ export type ToolDef<TInput = unknown, TOutput = unknown, TResponseMetadata = unk
|
|
|
21
17
|
output: TOutput;
|
|
22
18
|
responseMetadata: TResponseMetadata;
|
|
23
19
|
};
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated Views now always emit a single ext-apps resource; host targeting
|
|
26
|
-
* no longer applies. Retained for backwards compatibility; will be removed in a
|
|
27
|
-
* future major.
|
|
28
|
-
*/
|
|
29
|
-
export type ViewHostType = "apps-sdk" | "mcp-app";
|
|
30
20
|
/**
|
|
31
21
|
* Content Security Policy origins attached to a view's resource. Each list is
|
|
32
22
|
* passed through to the host's CSP for the view iframe; omit a field to inherit
|
|
@@ -70,11 +60,6 @@ export interface ViewConfig {
|
|
|
70
60
|
component: ViewName;
|
|
71
61
|
/** Human-readable label the host may show alongside the view. */
|
|
72
62
|
description?: string;
|
|
73
|
-
/**
|
|
74
|
-
* @deprecated No-op. Every view emits a single ext-apps resource regardless
|
|
75
|
-
* of this value. Will be removed in a future major.
|
|
76
|
-
*/
|
|
77
|
-
hosts?: ViewHostType[];
|
|
78
63
|
/** Request a visible border around the view (forwarded as `ui.prefersBorder`). */
|
|
79
64
|
prefersBorder?: boolean;
|
|
80
65
|
/** Override the iframe's served domain (advanced; forwarded as `ui.domain`). */
|
|
@@ -90,6 +75,64 @@ export type SecurityScheme = {
|
|
|
90
75
|
type: "oauth2";
|
|
91
76
|
scopes?: string[];
|
|
92
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[];
|
|
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
|
+
* - `settings`: an entry in the plugin settings.
|
|
97
|
+
*
|
|
98
|
+
* ChatGPT calls the tool with `{}` for global and thread entrypoints, so the
|
|
99
|
+
* tool must not require any input.
|
|
100
|
+
*/
|
|
101
|
+
export type OpenAIEntrypoint = {
|
|
102
|
+
type: "global";
|
|
103
|
+
quickAction?: OpenAIQuickAction;
|
|
104
|
+
} | {
|
|
105
|
+
type: "thread";
|
|
106
|
+
} | {
|
|
107
|
+
type: "file";
|
|
108
|
+
extensions: string[];
|
|
109
|
+
} | {
|
|
110
|
+
type: "settings";
|
|
111
|
+
searchTerms?: string[];
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* ChatGPT-only tool options, emitted as `_meta["openai/ui"]` on the tool and
|
|
115
|
+
* on its view resource. Every field is optional: ChatGPT applies the defaults
|
|
116
|
+
* of the OpenAI MCP extensions spec when one is omitted. Requires `view`.
|
|
117
|
+
*
|
|
118
|
+
* @see https://github.com/openai/mcp-extensions/blob/main/docs/spec.md
|
|
119
|
+
*/
|
|
120
|
+
export interface OpenAIToolConfig {
|
|
121
|
+
/** Places where users can open the view directly. */
|
|
122
|
+
entrypoints?: OpenAIEntrypoint[];
|
|
123
|
+
/**
|
|
124
|
+
* Display modes the view supports, read before the view loads. Defaults to
|
|
125
|
+
* `[preferredDisplayMode]` when that is set, otherwise to both modes.
|
|
126
|
+
*/
|
|
127
|
+
availableDisplayModes?: OpenAIDisplayMode[];
|
|
128
|
+
/**
|
|
129
|
+
* Display mode the view prefers to open in. Setting it alone makes it the
|
|
130
|
+
* only available mode, so also set `availableDisplayModes` to keep the other.
|
|
131
|
+
*/
|
|
132
|
+
preferredDisplayMode?: OpenAIDisplayMode;
|
|
133
|
+
/** Display mode the view opens in first when the model calls the tool. */
|
|
134
|
+
preferredModelDisplayMode?: OpenAIDisplayMode;
|
|
135
|
+
}
|
|
93
136
|
/**
|
|
94
137
|
* Declarative per-tool auth. Enforced when the server has an `oauth` provider:
|
|
95
138
|
* anonymous or under-scoped calls are rejected before the handler runs. Omit
|
|
@@ -110,17 +153,13 @@ export type ToolAuth = {
|
|
|
110
153
|
*/
|
|
111
154
|
export type JsonOptions = NonNullable<Parameters<typeof express.json>[0]>;
|
|
112
155
|
/**
|
|
113
|
-
* Skybridge-specific
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* @typeParam TAuthExtra - Claims the `oauth` verifier populates. Inferred from
|
|
117
|
-
* the config a provider returns, and carried on to tool handlers.
|
|
156
|
+
* The Skybridge-specific options an {@link McpServer} is built with. A
|
|
157
|
+
* {@link Skybridge} app derives them from its config; pass them directly only
|
|
158
|
+
* when constructing an `McpServer` by hand.
|
|
118
159
|
*/
|
|
119
|
-
export interface SkybridgeServerOptions
|
|
120
|
-
/**
|
|
121
|
-
|
|
122
|
-
/** Resource-server OAuth config. When set, mounts well-known metadata and bearer auth on `/mcp`. */
|
|
123
|
-
oauth?: OAuthConfig<TAuthExtra>;
|
|
160
|
+
export interface SkybridgeServerOptions {
|
|
161
|
+
/** Whether an OAuth provider guards `/mcp`; enables per-tool scheme enforcement. */
|
|
162
|
+
oauth?: boolean;
|
|
124
163
|
/**
|
|
125
164
|
* @experimental Serve Agent Skills from `src/skills` over MCP (SEP-2640).
|
|
126
165
|
* API may change.
|
|
@@ -144,7 +183,6 @@ export interface KnownToolMeta {
|
|
|
144
183
|
"openai/fileParams"?: string[];
|
|
145
184
|
/** MCP Apps: control whether the tool is exposed to the model, the app, or both. */
|
|
146
185
|
ui?: Pick<McpUiToolMeta, "visibility">;
|
|
147
|
-
securitySchemes?: SecurityScheme[];
|
|
148
186
|
}
|
|
149
187
|
/** {@link KnownToolMeta} merged with arbitrary string-keyed metadata for custom flags. */
|
|
150
188
|
export type ToolMeta = KnownToolMeta & Record<string, unknown>;
|
|
@@ -170,10 +208,10 @@ export interface McpServerTypes<TTools extends Record<string, ToolDef>> {
|
|
|
170
208
|
type Simplify<T> = {
|
|
171
209
|
[K in keyof T]: T[K];
|
|
172
210
|
};
|
|
173
|
-
type ShapeOutput<Shape extends
|
|
174
|
-
[K in keyof Shape as undefined extends
|
|
211
|
+
type ShapeOutput<Shape extends Record<string, StandardSchemaWithJSON>> = Simplify<{
|
|
212
|
+
[K in keyof Shape as undefined extends StandardSchemaV1.InferOutput<Shape[K]> ? never : K]: StandardSchemaV1.InferOutput<Shape[K]>;
|
|
175
213
|
} & {
|
|
176
|
-
[K in keyof Shape as undefined extends
|
|
214
|
+
[K in keyof Shape as undefined extends StandardSchemaV1.InferOutput<Shape[K]> ? K : never]?: StandardSchemaV1.InferOutput<Shape[K]>;
|
|
177
215
|
}>;
|
|
178
216
|
type ExtractStructuredContent<T> = T extends {
|
|
179
217
|
structuredContent: infer SC;
|
|
@@ -185,17 +223,25 @@ type ExtractMeta<T> = [Extract<T, {
|
|
|
185
223
|
}> extends {
|
|
186
224
|
_meta: infer M;
|
|
187
225
|
} ? Simplify<M> : unknown;
|
|
188
|
-
type AddTool<TTools, TName extends string, TInput extends
|
|
226
|
+
type AddTool<TTools, TName extends string, TInput extends Record<string, StandardSchemaWithJSON>, TOutput, TResponseMetadata = unknown, TAuthExtra extends ExtraClaims = ExtraClaims> = McpServer<TTools & {
|
|
189
227
|
[K in TName]: ToolDef<ShapeOutput<TInput>, TOutput, TResponseMetadata>;
|
|
190
228
|
}, TAuthExtra>;
|
|
191
|
-
interface ToolConfigBase<TInput extends
|
|
229
|
+
interface ToolConfigBase<TInput extends Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON> {
|
|
192
230
|
name: string;
|
|
193
231
|
title?: string;
|
|
194
232
|
description?: string;
|
|
195
233
|
inputSchema?: TInput;
|
|
196
|
-
outputSchema?:
|
|
234
|
+
outputSchema?: Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON;
|
|
197
235
|
annotations?: ToolAnnotations;
|
|
236
|
+
/**
|
|
237
|
+
* Icons for the tool. The server's `icons` already cover every entrypoint,
|
|
238
|
+
* so set these only to tell several entrypoints apart. ChatGPT expects a
|
|
239
|
+
* monochrome SVG on a 20x20 viewport that uses `currentColor`.
|
|
240
|
+
*/
|
|
241
|
+
icons?: Icon[];
|
|
198
242
|
view?: ViewConfig;
|
|
243
|
+
/** ChatGPT-only options. See {@link OpenAIToolConfig}. */
|
|
244
|
+
openai?: OpenAIToolConfig;
|
|
199
245
|
_meta?: ToolMeta;
|
|
200
246
|
}
|
|
201
247
|
/**
|
|
@@ -216,7 +262,7 @@ type ToolAuthConfig = {
|
|
|
216
262
|
*/
|
|
217
263
|
securitySchemes?: SecurityScheme[];
|
|
218
264
|
};
|
|
219
|
-
type ToolConfig<TInput extends
|
|
265
|
+
type ToolConfig<TInput extends Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON> = ToolConfigBase<TInput> & ToolAuthConfig;
|
|
220
266
|
/**
|
|
221
267
|
* Optional client-supplied hints attached to `params._meta` on every tool call
|
|
222
268
|
* by the Apps SDK host. Hints only: never use for authorization, and tolerate
|
|
@@ -245,12 +291,22 @@ export interface ClientHintsMeta {
|
|
|
245
291
|
"openai/organization"?: string;
|
|
246
292
|
/** Stable id for the currently mounted widget instance. */
|
|
247
293
|
"openai/widgetSessionId"?: string;
|
|
294
|
+
/**
|
|
295
|
+
* Set by ChatGPT desktop on tool calls from a view opened through a file
|
|
296
|
+
* entrypoint. `path` is the absolute path of the opened file. Any MCP client
|
|
297
|
+
* can send this key: never use it for authorization, and resolve the path
|
|
298
|
+
* and keep it inside an allowed directory before touching the filesystem.
|
|
299
|
+
*/
|
|
300
|
+
"openai/resource"?: {
|
|
301
|
+
path?: string;
|
|
302
|
+
};
|
|
248
303
|
}
|
|
249
|
-
type ToolHandlerExtra<TAuthExtra extends ExtraClaims = ExtraClaims> = Omit<
|
|
250
|
-
_meta
|
|
251
|
-
|
|
304
|
+
type ToolHandlerExtra<TAuthExtra extends ExtraClaims = ExtraClaims> = Omit<McpExtra<TAuthExtra>, "mcpReq"> & {
|
|
305
|
+
mcpReq: Omit<McpExtra<TAuthExtra>["mcpReq"], "_meta"> & {
|
|
306
|
+
_meta?: RequestMeta & ClientHintsMeta;
|
|
307
|
+
};
|
|
252
308
|
};
|
|
253
|
-
type ToolHandler<TInput extends
|
|
309
|
+
type ToolHandler<TInput extends Record<string, StandardSchemaWithJSON>, TReturn extends {
|
|
254
310
|
content?: HandlerContent;
|
|
255
311
|
} = {
|
|
256
312
|
content?: HandlerContent;
|
|
@@ -276,26 +332,38 @@ export declare function __setBuildManifest(manifest: Record<string, {
|
|
|
276
332
|
file: string;
|
|
277
333
|
}>): void;
|
|
278
334
|
export declare function __setSkillsManifest(manifest: SkillsManifest): void;
|
|
335
|
+
/**
|
|
336
|
+
* Typed registration sugar over the MCP SDK's `McpServer`: a tool registry
|
|
337
|
+
* that carries input/output/meta shapes, view resources, per-tool security
|
|
338
|
+
* schemes, and prompt/resource registration. A {@link Skybridge} app builds
|
|
339
|
+
* one of these per request and hands it to your `handler`; chain
|
|
340
|
+
* {@link McpServer.registerTool} calls on it and return the result.
|
|
341
|
+
*
|
|
342
|
+
* The `TTools` generic accumulates each registered tool's input/output/meta
|
|
343
|
+
* shape, so `typeof app` carries enough information for view-side helpers
|
|
344
|
+
* like {@link generateHelpers} to produce fully-typed hooks.
|
|
345
|
+
*
|
|
346
|
+
* @typeParam TTools - Accumulated tool registry. Filled in by `registerTool`
|
|
347
|
+
* chaining; you almost never set this manually.
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* ```ts
|
|
351
|
+
* export const app = new Skybridge({
|
|
352
|
+
* name: "my-app",
|
|
353
|
+
* version: "1.0.0",
|
|
354
|
+
* handler: (server) =>
|
|
355
|
+
* server.registerTool({
|
|
356
|
+
* name: "search",
|
|
357
|
+
* inputSchema: { query: z.string() },
|
|
358
|
+
* view: { component: "search" },
|
|
359
|
+
* }, async ({ query }) => ({ content: `Results for ${query}` })),
|
|
360
|
+
* });
|
|
361
|
+
* ```
|
|
362
|
+
*
|
|
363
|
+
* @see https://docs.skybridge.tech/api-reference/mcp-server
|
|
364
|
+
*/
|
|
279
365
|
export declare class McpServer<TTools extends Record<string, ToolDef> = Record<never, ToolDef>, TAuthExtra extends ExtraClaims = ExtraClaims> extends McpServerBaseOmitted {
|
|
280
366
|
readonly $types: McpServerTypes<TTools>;
|
|
281
|
-
/**
|
|
282
|
-
* The underlying Express app. Use this to extend the HTTP server with
|
|
283
|
-
* custom routes, middleware, or settings — e.g.
|
|
284
|
-
* `server.express.get("/health", ...)`.
|
|
285
|
-
*
|
|
286
|
-
* `express.json()` is pre-applied — tune it via the constructor's third
|
|
287
|
-
* argument, e.g. `new McpServer(info, {}, { json: { limit: "10mb" } })`.
|
|
288
|
-
* Register your handlers before `run()`;
|
|
289
|
-
* after `run()`, dev-mode middleware, the `/mcp` route, and the default
|
|
290
|
-
* error handler are appended in that order.
|
|
291
|
-
*
|
|
292
|
-
* Note: Alpic Cloud only routes traffic to `/mcp` — custom routes work
|
|
293
|
-
* locally and on self-hosted deployments.
|
|
294
|
-
*/
|
|
295
|
-
readonly express: Express;
|
|
296
|
-
private customErrorMiddleware;
|
|
297
|
-
private mcpMiddlewareEntries;
|
|
298
|
-
private mcpMiddlewareApplied;
|
|
299
367
|
private claimedViews;
|
|
300
368
|
private viewMetaBuilders;
|
|
301
369
|
/**
|
|
@@ -306,38 +374,27 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
306
374
|
*/
|
|
307
375
|
private viewUriByPath;
|
|
308
376
|
private viteManifest;
|
|
309
|
-
private readonly serverInfo;
|
|
310
|
-
private readonly serverOptions?;
|
|
311
377
|
private oauthEnabled;
|
|
312
378
|
private resolveResourceMetadataUrl?;
|
|
313
|
-
private
|
|
314
|
-
|
|
315
|
-
|
|
379
|
+
private readonly toolSecuritySchemes;
|
|
380
|
+
private readonly userMiddlewareEntries;
|
|
381
|
+
constructor(serverInfo: Implementation, options?: ServerOptions, skybridgeOptions?: SkybridgeServerOptions);
|
|
316
382
|
/**
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
383
|
+
* The per-tool security schemes collected during registration, keyed by tool
|
|
384
|
+
* name. Read by the OAuth layer to decide whether anonymous requests are
|
|
385
|
+
* allowed and which schemes gate a given `tools/call`.
|
|
320
386
|
*
|
|
321
|
-
*
|
|
322
|
-
* locally and on self-hosted deployments.
|
|
387
|
+
* @internal
|
|
323
388
|
*/
|
|
324
|
-
|
|
325
|
-
use(path: string, ...handlers: RequestHandler[]): this;
|
|
389
|
+
get securitySchemesByTool(): ReadonlyMap<string, SecurityScheme[] | undefined>;
|
|
326
390
|
/**
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
* thrown by tool handlers before the default error handler responds.
|
|
391
|
+
* Inject the resolver the app uses to build the protected-resource metadata
|
|
392
|
+
* URL, so tool handlers can emit in-band auth challenges.
|
|
330
393
|
*
|
|
331
|
-
* @
|
|
332
|
-
* ```ts
|
|
333
|
-
* server.useOnError((err, _req, _res, next) => {
|
|
334
|
-
* logger.error(err);
|
|
335
|
-
* next(err);
|
|
336
|
-
* });
|
|
337
|
-
* ```
|
|
394
|
+
* @internal
|
|
338
395
|
*/
|
|
339
|
-
|
|
340
|
-
|
|
396
|
+
setResourceMetadataUrlResolver(resolve: ResourceMetadataUrlResolver): this;
|
|
397
|
+
private setupSkills;
|
|
341
398
|
/** Register MCP protocol-level middleware (catch-all). */
|
|
342
399
|
mcpMiddleware(handler: McpMiddlewareFn<TAuthExtra>): this;
|
|
343
400
|
/** Register MCP protocol-level middleware for all requests (`extra` is `McpExtra`). */
|
|
@@ -369,42 +426,15 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
369
426
|
* category (`"request"` | `"notification"`), or an array of those.
|
|
370
427
|
*/
|
|
371
428
|
mcpMiddleware(filter: McpMiddlewareFilter, handler: McpMiddlewareFn<TAuthExtra>): this;
|
|
372
|
-
private applyMcpMiddleware;
|
|
373
|
-
/**
|
|
374
|
-
* Connect to an MCP transport (override of the SDK's `connect`). Use this
|
|
375
|
-
* when you're embedding Skybridge in a host that already manages its own
|
|
376
|
-
* transport (e.g. stdio for desktop apps); for HTTP, prefer {@link McpServer.run}
|
|
377
|
-
* which sets the transport up for you. Locks in any middleware registered
|
|
378
|
-
* via {@link McpServer.mcpMiddleware} — further calls to that method will
|
|
379
|
-
* throw afterwards.
|
|
380
|
-
*/
|
|
381
|
-
connect(transport: Parameters<typeof McpServerBase.prototype.connect>[0]): Promise<void>;
|
|
382
|
-
/**
|
|
383
|
-
* Per-request stateless connect. The SDK's `Protocol` only allows one
|
|
384
|
-
* transport per instance, so we can't reuse this `McpServer` across
|
|
385
|
-
* concurrent requests. The SDK's idiomatic fix is a `() => McpServer`
|
|
386
|
-
* factory, but that would break Skybridge's singleton API — so instead
|
|
387
|
-
* we build a fresh underlying `Server` per request and share the main
|
|
388
|
-
* server's handler maps by reference. The cast is unavoidable: there's
|
|
389
|
-
* no public API to inject handler maps. `getHandlerMaps` validates the
|
|
390
|
-
* read side and fails fast on SDK field renames.
|
|
391
|
-
*/
|
|
392
|
-
connectStatelessTransport(transport: Parameters<typeof McpServerBase.prototype.connect>[0]): Promise<void>;
|
|
393
429
|
/**
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
430
|
+
* This instance's protocol-level middleware: the framework's own entries
|
|
431
|
+
* (view `_meta` on `resources/list`, version-agnostic view resolution on
|
|
432
|
+
* `resources/read`, the top-level `securitySchemes` mirror on `tools/list`)
|
|
433
|
+
* followed by the ones registered via {@link McpServer.mcpMiddleware}.
|
|
398
434
|
*
|
|
399
|
-
*
|
|
400
|
-
* the runtime can bridge incoming requests to the Node HTTP server. On
|
|
401
|
-
* Vercel (`VERCEL === "1"`), returns the Express app directly so the
|
|
402
|
-
* serverless function entry can call it as a `(req, res)` handler. On
|
|
403
|
-
* Node, returns `undefined` once listening.
|
|
435
|
+
* @internal
|
|
404
436
|
*/
|
|
405
|
-
|
|
406
|
-
fetch: (...args: unknown[]) => unknown;
|
|
407
|
-
} | Express | undefined>;
|
|
437
|
+
protocolMiddlewareEntries(): McpMiddlewareEntry[];
|
|
408
438
|
private enforceOneToolPerView;
|
|
409
439
|
private resolveViewRequestContext;
|
|
410
440
|
private registerViewResources;
|
|
@@ -453,12 +483,12 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
453
483
|
*
|
|
454
484
|
* @see https://docs.skybridge.tech/api-reference/register-tool
|
|
455
485
|
*/
|
|
456
|
-
registerTool<TName extends string, InputArgs extends
|
|
486
|
+
registerTool<TName extends string, InputArgs extends Record<string, StandardSchemaWithJSON>, TReturn extends {
|
|
457
487
|
content?: HandlerContent;
|
|
458
488
|
}>(config: ToolConfig<InputArgs> & {
|
|
459
489
|
name: TName;
|
|
460
490
|
}, cb: ToolHandler<InputArgs, TReturn, TAuthExtra>): AddTool<TTools, TName, InputArgs, ExtractStructuredContent<TReturn>, ExtractMeta<TReturn>, TAuthExtra>;
|
|
461
|
-
registerTool<InputArgs extends
|
|
491
|
+
registerTool<InputArgs extends Record<string, StandardSchemaWithJSON>>(config: ToolConfig<InputArgs>, cb: ToolHandler<InputArgs, {
|
|
462
492
|
content?: HandlerContent;
|
|
463
493
|
}, TAuthExtra>): this;
|
|
464
494
|
}
|