@mcp-use/client 2.0.0-beta.8 → 2.0.0
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 +18 -19
- package/dist/.tsbuildinfo +1 -1
- package/dist/auth/browser.d.ts +62 -6
- package/dist/auth/browser.d.ts.map +1 -1
- package/dist/auth/callback.d.ts.map +1 -1
- package/dist/auth/flow.d.ts.map +1 -1
- package/dist/auth/node.d.ts +115 -5
- package/dist/auth/node.d.ts.map +1 -1
- package/dist/auth/session-store.d.ts +7 -1
- package/dist/auth/session-store.d.ts.map +1 -1
- package/dist/auth/storage.d.ts +12 -3
- package/dist/auth/storage.d.ts.map +1 -1
- package/dist/code-mode/executor-e2b.d.ts.map +1 -1
- package/dist/core/base.d.ts +4 -8
- package/dist/core/base.d.ts.map +1 -1
- package/dist/core/browser.d.ts +14 -2
- package/dist/core/browser.d.ts.map +1 -1
- package/dist/core/config.d.ts +82 -20
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/node.d.ts +7 -10
- package/dist/core/node.d.ts.map +1 -1
- package/dist/core/session.d.ts +102 -25
- package/dist/core/session.d.ts.map +1 -1
- package/dist/index-browser.d.ts +1 -0
- package/dist/index-browser.d.ts.map +1 -1
- package/dist/index-browser.js +568 -163
- package/dist/index-browser.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +407 -92
- package/dist/index.js.map +1 -1
- package/dist/react/McpClientProvider.d.ts +22 -10
- package/dist/react/McpClientProvider.d.ts.map +1 -1
- package/dist/react/index.d.ts +5 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1104 -368
- package/dist/react/index.js.map +1 -1
- package/dist/react/rpc-logger.d.ts +5 -0
- package/dist/react/rpc-logger.d.ts.map +1 -1
- package/dist/react/storage.d.ts +57 -10
- package/dist/react/storage.d.ts.map +1 -1
- package/dist/react/token-expiry.d.ts +9 -0
- package/dist/react/token-expiry.d.ts.map +1 -0
- package/dist/react/types.d.ts +134 -22
- package/dist/react/types.d.ts.map +1 -1
- package/dist/react/useMcp-helpers.d.ts.map +1 -1
- package/dist/react/useMcp-operations.d.ts +24 -6
- package/dist/react/useMcp-operations.d.ts.map +1 -1
- package/dist/react/useMcp.d.ts.map +1 -1
- package/dist/react/useMcpServerQueues.d.ts +36 -9
- package/dist/react/useMcpServerQueues.d.ts.map +1 -1
- package/dist/react/view/ViewRenderer.d.ts +12 -4
- package/dist/react/view/ViewRenderer.d.ts.map +1 -1
- package/dist/react/view/ext-apps-bridge.d.ts +1 -1
- package/dist/react/view/ext-apps-bridge.d.ts.map +1 -1
- package/dist/react/view/inject-openai-file-apis.d.ts.map +1 -1
- package/dist/react/view/parse-custom-props.d.ts +8 -0
- package/dist/react/view/parse-custom-props.d.ts.map +1 -1
- package/dist/react/view/resolve-view-resource.d.ts +10 -0
- package/dist/react/view/resolve-view-resource.d.ts.map +1 -1
- package/dist/react/view/sandbox-blob-url.d.ts +2 -0
- package/dist/react/view/sandbox-blob-url.d.ts.map +1 -1
- package/dist/react/view/types.d.ts +111 -4
- package/dist/react/view/types.d.ts.map +1 -1
- package/dist/react/view/view-detection.d.ts +18 -0
- package/dist/react/view/view-detection.d.ts.map +1 -1
- package/dist/react/view/view-host-policy.d.ts +61 -0
- package/dist/react/view/view-host-policy.d.ts.map +1 -0
- package/dist/sandbox.d.ts +2 -0
- package/dist/sandbox.d.ts.map +1 -0
- package/dist/sandbox.js +283 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/telemetry/events.d.ts.map +1 -1
- package/dist/telemetry/tel-fetch.d.ts.map +1 -1
- package/dist/telemetry/telemetry.d.ts +5 -1
- package/dist/telemetry/telemetry.d.ts.map +1 -1
- package/dist/transport/base.d.ts +169 -34
- package/dist/transport/base.d.ts.map +1 -1
- package/dist/transport/connection-manager.d.ts +5 -1
- package/dist/transport/connection-manager.d.ts.map +1 -1
- package/dist/transport/http.d.ts +51 -2
- package/dist/transport/http.d.ts.map +1 -1
- package/dist/transport/stdio.d.ts +29 -1
- package/dist/transport/stdio.d.ts.map +1 -1
- package/dist/utils/elicitation.d.ts +4 -2
- package/dist/utils/elicitation.d.ts.map +1 -1
- package/dist/utils/logging.d.ts +1 -0
- package/dist/utils/logging.d.ts.map +1 -1
- package/dist/utils/version.d.ts +6 -0
- package/dist/utils/version.d.ts.map +1 -1
- package/package.json +9 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMcp-operations.d.ts","sourceRoot":"","sources":["../../src/react/useMcp-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,cAAc,EACd,MAAM,EACN,QAAQ,EACR,oBAAoB,IAAI,gBAAgB,EACxC,IAAI,EACL,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,KAAK,MAAM,GAAG,CACZ,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAC3C,OAAO,EAAE,MAAM,EACf,GAAG,IAAI,EAAE,OAAO,EAAE,KACf,IAAI,CAAC;AAEV,KAAK,MAAM,GAAG;IACZ,QAAQ,EAAE,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3C,aAAa,EAAE,SAAS,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAC/C,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3C,YAAY,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,EA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,CAAC,CAAC;IACnD,oBAAoB,EAAE,QAAQ,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;IACnE,UAAU,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAmBF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM;;eAsJy/c,CAAC;uBAA6G,CAAC;8BAA+H,CAAC;cAAsE,CAAC;;;wBA7G90d,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAkFL,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAQnC,qBAAqB,KAAG,OAAO,CAAC,cAAc,CAAC;EAkBlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMcp.d.ts","sourceRoot":"","sources":["../../src/react/useMcp.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"useMcp.d.ts","sourceRoot":"","sources":["../../src/react/useMcp.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAqC9D,KAAK,qBAAqB,GAAG,aAAa,GAAG;IAC3C,kBAAkB,CAAC,EAAE;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,KAAK,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAClD,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,qBAAqB,GAAG,YAAY,CAy5DnE"}
|
|
@@ -65,9 +65,18 @@ export declare function useMcpServerQueues(params: {
|
|
|
65
65
|
};
|
|
66
66
|
_meta?: {
|
|
67
67
|
[x: string]: unknown;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
"io.modelcontextprotocol/serverInfo"?: {
|
|
69
|
+
version: string;
|
|
70
|
+
name: string;
|
|
71
|
+
websiteUrl?: string | undefined;
|
|
72
|
+
description?: string | undefined;
|
|
73
|
+
icons?: {
|
|
74
|
+
src: string;
|
|
75
|
+
mimeType?: string | undefined;
|
|
76
|
+
sizes?: string[] | undefined;
|
|
77
|
+
theme?: "light" | "dark" | undefined;
|
|
78
|
+
}[] | undefined;
|
|
79
|
+
title?: string | undefined;
|
|
71
80
|
} | undefined;
|
|
72
81
|
} | undefined;
|
|
73
82
|
stopReason?: string | undefined;
|
|
@@ -350,9 +359,18 @@ export declare function useMcpServerQueues(params: {
|
|
|
350
359
|
})[];
|
|
351
360
|
_meta?: {
|
|
352
361
|
[x: string]: unknown;
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
362
|
+
"io.modelcontextprotocol/serverInfo"?: {
|
|
363
|
+
version: string;
|
|
364
|
+
name: string;
|
|
365
|
+
websiteUrl?: string | undefined;
|
|
366
|
+
description?: string | undefined;
|
|
367
|
+
icons?: {
|
|
368
|
+
src: string;
|
|
369
|
+
mimeType?: string | undefined;
|
|
370
|
+
sizes?: string[] | undefined;
|
|
371
|
+
theme?: "light" | "dark" | undefined;
|
|
372
|
+
}[] | undefined;
|
|
373
|
+
title?: string | undefined;
|
|
356
374
|
} | undefined;
|
|
357
375
|
} | undefined;
|
|
358
376
|
stopReason?: string | undefined;
|
|
@@ -362,9 +380,18 @@ export declare function useMcpServerQueues(params: {
|
|
|
362
380
|
action: "cancel" | "accept" | "decline";
|
|
363
381
|
_meta?: {
|
|
364
382
|
[x: string]: unknown;
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
383
|
+
"io.modelcontextprotocol/serverInfo"?: {
|
|
384
|
+
version: string;
|
|
385
|
+
name: string;
|
|
386
|
+
websiteUrl?: string | undefined;
|
|
387
|
+
description?: string | undefined;
|
|
388
|
+
icons?: {
|
|
389
|
+
src: string;
|
|
390
|
+
mimeType?: string | undefined;
|
|
391
|
+
sizes?: string[] | undefined;
|
|
392
|
+
theme?: "light" | "dark" | undefined;
|
|
393
|
+
}[] | undefined;
|
|
394
|
+
title?: string | undefined;
|
|
368
395
|
} | undefined;
|
|
369
396
|
} | undefined;
|
|
370
397
|
content?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMcpServerQueues.d.ts","sourceRoot":"","sources":["../../src/react/useMcpServerQueues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACtB,YAAY,EACZ,YAAY,EACb,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EACV,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAWpB,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB,CAAC,EAAE,CAAC,YAAY,EAAE,eAAe,KAAK,IAAI,CAAC;IACjE,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAC9D,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,yBAAyB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAkD3B,uBAAuB,GAAG,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;wBAlH3B,MAAM;EA+K9C"}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ViewRendererProps } from "./types.js";
|
|
3
|
-
declare function ViewRendererBase({ viewId, source, sandboxUrl, toolName, toolInput, toolOutput, partialToolInput, customProps, cancelled, hostInfo, hostContext, hostCapabilities, cspMode, displayMode: displayModeProp, onDisplayModeChange, inlineMaxWidth, chromeless, onMessage, onModelContextUpdate, onLog, onReady, onLifecycleChange, onError, onCspViolation, onResourceResolved, wrapTransport, toolCallTimeout, mockOpenAiFileApis, onInlineHeightChange, fullscreenHeader, renderFullscreenClose, className, testId, invoking, invoked, }: ViewRendererProps): React.JSX.Element;
|
|
3
|
+
declare function ViewRendererBase({ viewId, source, sandboxUrl, toolName, toolInput, toolOutput, partialToolInput, customProps, cancelled, hostInfo, hostContext, hostCapabilities, messageCapabilities, modelContextCapabilities, cspMode, displayMode: displayModeProp, onDisplayModeChange, inlineMaxWidth, chromeless, onMessage, onSamplingRequest, onDownloadFile, onAppToolsChanged, onModelContextUpdate, onLog, onReady, onLifecycleChange, onError, onCspViolation, onResourceResolved, wrapTransport, toolCallTimeout, mockOpenAiFileApis, onInlineHeightChange, fullscreenHeader, renderFullscreenClose, className, testId, invoking, invoked, }: ViewRendererProps): React.JSX.Element;
|
|
4
|
+
/**
|
|
5
|
+
* Renders an MCP App inside an isolated iframe and bridges host capabilities.
|
|
6
|
+
*
|
|
7
|
+
* The renderer resolves live MCP resources or accepts preloaded HTML, applies
|
|
8
|
+
* the selected CSP policy, and forwards tool state and host callbacks through
|
|
9
|
+
* the MCP Apps bridge.
|
|
10
|
+
*/
|
|
4
11
|
export declare const ViewRenderer: React.MemoExoticComponent<typeof ViewRendererBase>;
|
|
5
12
|
export type { ViewRendererProps } from "./types.js";
|
|
6
13
|
export { resolveViewResource } from "./resolve-view-resource.js";
|
|
7
14
|
export { getViewResourceUri, isViewResource, isViewTool, } from "./view-detection.js";
|
|
15
|
+
export { isToolVisibleToModel } from "./view-host-policy.js";
|
|
8
16
|
export { parseCustomProps } from "./parse-custom-props.js";
|
|
9
|
-
export { buildViewSandboxBlobUrl } from "./sandbox-blob-url.js";
|
|
17
|
+
export { buildSandboxProxyBlobHtml, buildViewSandboxBlobUrl, buildViewSandboxUrl, } from "./sandbox-blob-url.js";
|
|
10
18
|
export { injectOpenAiFileApis } from "./inject-openai-file-apis.js";
|
|
11
|
-
export type { ViewConnection, ViewDisplayMode, ViewCspMode, ViewRendererSource, ResolvedViewResource, ViewCspViolation, ViewLifecycleEvent, ViewLifecycleStatus, } from "./types.js";
|
|
12
|
-
export type { McpUiHostCapabilities, McpUiHostContext, McpUiResourceCsp, McpUiResourcePermissions, } from "./ext-apps-bridge.js";
|
|
19
|
+
export type { ViewConnection, ViewDisplayMode, ViewCspMode, ViewRendererSource, ResolvedViewResource, ViewCspViolation, ViewLifecycleEvent, ViewLifecycleStatus, ViewAppToolConnection, } from "./types.js";
|
|
20
|
+
export type { McpUiDownloadFileRequest, McpUiDownloadFileResult, McpUiHostCapabilities, McpUiHostContext, McpUiResourceCsp, McpUiResourcePermissions, McpUiSupportedContentBlockModalities, } from "./ext-apps-bridge.js";
|
|
13
21
|
//# sourceMappingURL=ViewRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewRenderer.d.ts","sourceRoot":"","sources":["../../../src/react/view/ViewRenderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ViewRenderer.d.ts","sourceRoot":"","sources":["../../../src/react/view/ViewRenderer.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAQN,MAAM,OAAO,CAAC;AAKf,OAAO,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,GACtB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,oCAAoC,GACrC,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { AppBridge, PostMessageTransport, buildAllowAttribute, RESOURCE_MIME_TYPE, } from "@modelcontextprotocol/ext-apps/app-bridge";
|
|
2
|
-
export type { McpUiHostCapabilities, McpUiHostContext, McpUiMessageRequest, McpUiOpenLinkRequest, McpUiRequestDisplayModeRequest, McpUiResourceCsp, McpUiResourcePermissions, McpUiSizeChangedNotification, McpUiUpdateModelContextRequest, } from "@modelcontextprotocol/ext-apps/app-bridge";
|
|
2
|
+
export type { McpUiDownloadFileRequest, McpUiDownloadFileResult, McpUiHostCapabilities, McpUiHostContext, McpUiMessageRequest, McpUiOpenLinkRequest, McpUiRequestDisplayModeRequest, McpUiResourceCsp, McpUiResourcePermissions, McpUiSizeChangedNotification, McpUiSupportedContentBlockModalities, McpUiUpdateModelContextRequest, } from "@modelcontextprotocol/ext-apps/app-bridge";
|
|
3
3
|
//# sourceMappingURL=ext-apps-bridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ext-apps-bridge.d.ts","sourceRoot":"","sources":["../../../src/react/view/ext-apps-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,2CAA2C,CAAC;AAEnD,YAAY,EACV,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,8BAA8B,EAC9B,gBAAgB,EAChB,wBAAwB,EACxB,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,2CAA2C,CAAC"}
|
|
1
|
+
{"version":3,"file":"ext-apps-bridge.d.ts","sourceRoot":"","sources":["../../../src/react/view/ext-apps-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,2CAA2C,CAAC;AAEnD,YAAY,EACV,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,8BAA8B,EAC9B,gBAAgB,EAChB,wBAAwB,EACxB,4BAA4B,EAC5B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,2CAA2C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject-openai-file-apis.d.ts","sourceRoot":"","sources":["../../../src/react/view/inject-openai-file-apis.ts"],"names":[],"mappings":"AAmBA;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"inject-openai-file-apis.d.ts","sourceRoot":"","sources":["../../../src/react/view/inject-openai-file-apis.ts"],"names":[],"mappings":"AAmBA;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAsBzD"}
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses JSON object and array values from string-valued custom properties.
|
|
3
|
+
*
|
|
4
|
+
* Invalid JSON and scalar-looking strings are preserved unchanged.
|
|
5
|
+
*
|
|
6
|
+
* @param customProps - Properties supplied by a host integration.
|
|
7
|
+
* @returns A new record containing parsed object and array values.
|
|
8
|
+
*/
|
|
1
9
|
export declare function parseCustomProps(customProps?: Record<string, string>): Record<string, unknown>;
|
|
2
10
|
//# sourceMappingURL=parse-custom-props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-custom-props.d.ts","sourceRoot":"","sources":["../../../src/react/view/parse-custom-props.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAC9B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkBzB"}
|
|
1
|
+
{"version":3,"file":"parse-custom-props.d.ts","sourceRoot":"","sources":["../../../src/react/view/parse-custom-props.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkBzB"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import type { ResolvedViewResource, ViewCspMode } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a resource response into HTML and effective MCP App policy.
|
|
4
|
+
*
|
|
5
|
+
* Content-level UI metadata overrides listing metadata. In permissive mode the
|
|
6
|
+
* declared CSP is reported but not enforced.
|
|
7
|
+
*
|
|
8
|
+
* @param options - Resource response, listing metadata, CSP policy, and URI.
|
|
9
|
+
* @returns The normalized view resource.
|
|
10
|
+
* @throws When the first content block contains no text or base64 HTML.
|
|
11
|
+
*/
|
|
2
12
|
export declare function resolveViewResource(options: {
|
|
3
13
|
resourceResult: unknown;
|
|
4
14
|
listingResource?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-view-resource.d.ts","sourceRoot":"","sources":["../../../src/react/view/resolve-view-resource.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve-view-resource.d.ts","sourceRoot":"","sources":["../../../src/react/view/resolve-view-resource.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AASpE;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IAC3C,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE;YAAE,EAAE,CAAC,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE,GAAG,IAAI,CAAC;IACtD,OAAO,EAAE,WAAW,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,oBAAoB,CAkEvB"}
|
|
@@ -11,6 +11,8 @@ type ViewSandboxBlobUrlOptions = {
|
|
|
11
11
|
permissions?: McpUiResourcePermissions;
|
|
12
12
|
widgetCsp?: McpUiResourceCsp;
|
|
13
13
|
};
|
|
14
|
+
/** Build a configured HTTP(S) sandbox proxy URL. */
|
|
15
|
+
export declare function buildViewSandboxUrl(sandboxDocumentUrl: URL, options: ViewSandboxBlobUrlOptions): URL;
|
|
14
16
|
/** Build a blob: sandbox iframe URL (no backend sandbox-proxy route). */
|
|
15
17
|
export declare function buildViewSandboxBlobUrl(options: ViewSandboxBlobUrlOptions): URL;
|
|
16
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-blob-url.d.ts","sourceRoot":"","sources":["../../../src/react/view/sandbox-blob-url.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,WAAW,CAAC,EAAE,wBAAwB,CAAC;IACvC,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B,CAAC;
|
|
1
|
+
{"version":3,"file":"sandbox-blob-url.d.ts","sourceRoot":"","sources":["../../../src/react/view/sandbox-blob-url.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,WAAW,CAAC,EAAE,wBAAwB,CAAC;IACvC,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B,CAAC;AAEF,oDAAoD;AACpD,wBAAgB,mBAAmB,CACjC,kBAAkB,EAAE,GAAG,EACvB,OAAO,EAAE,yBAAyB,GACjC,GAAG,CAIL;AAoBD,yEAAyE;AACzE,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,yBAAyB,GACjC,GAAG,CAKL;AAWD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKhE"}
|
|
@@ -1,94 +1,195 @@
|
|
|
1
|
-
import type { McpUiHostCapabilities, McpUiHostContext, McpUiResourceCsp, McpUiResourcePermissions } from "./ext-apps-bridge.js";
|
|
2
|
-
|
|
1
|
+
import type { McpUiDownloadFileRequest, McpUiDownloadFileResult, McpUiHostCapabilities, McpUiHostContext, McpUiResourceCsp, McpUiResourcePermissions, McpUiSupportedContentBlockModalities } from "./ext-apps-bridge.js";
|
|
2
|
+
import type { CreateMessageRequest, CreateMessageResult, CreateMessageResultWithTools, Tool } from "@modelcontextprotocol/client";
|
|
3
|
+
export type { McpUiDownloadFileRequest, McpUiDownloadFileResult, McpUiHostCapabilities, McpUiHostContext, McpUiResourceCsp, McpUiResourcePermissions, McpUiSupportedContentBlockModalities, };
|
|
3
4
|
import type { Transport } from "@modelcontextprotocol/client";
|
|
4
5
|
import type { ReactNode } from "react";
|
|
6
|
+
/** Display mode requested by an MCP App. */
|
|
5
7
|
export type ViewDisplayMode = "inline" | "pip" | "fullscreen";
|
|
8
|
+
/** Policy used to enforce an MCP App's declared content security policy. */
|
|
6
9
|
export type ViewCspMode = "permissive" | "widget-declared";
|
|
10
|
+
/** Host operations and server metadata available to a live MCP App. */
|
|
7
11
|
export interface ViewConnection {
|
|
12
|
+
/** Calls an MCP server tool. */
|
|
8
13
|
callTool: (name: string, args?: Record<string, unknown>, options?: {
|
|
9
14
|
timeout?: number;
|
|
10
15
|
resetTimeoutOnProgress?: boolean;
|
|
11
16
|
}) => Promise<unknown>;
|
|
17
|
+
/** Reads an MCP resource by URI. */
|
|
12
18
|
readResource: (uri: string) => Promise<unknown>;
|
|
19
|
+
/** Tools available to the host, including app visibility metadata. */
|
|
20
|
+
tools?: readonly {
|
|
21
|
+
/** Tool name. */
|
|
22
|
+
name: string;
|
|
23
|
+
/** Optional tool metadata. */
|
|
24
|
+
_meta?: {
|
|
25
|
+
/** MCP App-specific tool metadata. */
|
|
26
|
+
ui?: {
|
|
27
|
+
/** Surfaces allowed to invoke or receive the tool. */
|
|
28
|
+
visibility?: readonly ("model" | "app")[];
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}[];
|
|
32
|
+
/** Resources available to the host. */
|
|
13
33
|
resources?: readonly {
|
|
34
|
+
/** Resource URI. */
|
|
14
35
|
uri: string;
|
|
36
|
+
/** Optional resource metadata. */
|
|
15
37
|
_meta?: {
|
|
38
|
+
/** MCP App-specific resource metadata. */
|
|
16
39
|
ui?: unknown;
|
|
17
40
|
};
|
|
18
41
|
}[];
|
|
19
42
|
}
|
|
43
|
+
/** Live or preloaded content used to initialize a {@link ViewRenderer}. */
|
|
20
44
|
export type ViewRendererSource = {
|
|
45
|
+
/** Selects live resource resolution. */
|
|
21
46
|
kind: "live";
|
|
47
|
+
/** MCP connection used to read the resource and call tools. */
|
|
22
48
|
connection: ViewConnection;
|
|
49
|
+
/** URI of the MCP App resource to load. */
|
|
23
50
|
resourceUri: string;
|
|
24
51
|
} | {
|
|
52
|
+
/** Selects preloaded HTML rendering. */
|
|
25
53
|
kind: "preloaded";
|
|
54
|
+
/** Complete HTML document to render. */
|
|
26
55
|
html: string;
|
|
56
|
+
/** CSP declared for the preloaded document. */
|
|
27
57
|
csp?: McpUiResourceCsp;
|
|
58
|
+
/** Browser permissions requested by the preloaded document. */
|
|
28
59
|
permissions?: McpUiResourcePermissions;
|
|
60
|
+
/** Whether the preloaded app prefers visible host borders. */
|
|
29
61
|
prefersBorder?: boolean;
|
|
30
62
|
};
|
|
63
|
+
/** Normalized HTML, CSP, permissions, and MIME metadata for a rendered view. */
|
|
31
64
|
export type ResolvedViewResource = {
|
|
65
|
+
/** HTML document rendered in the sandbox. */
|
|
32
66
|
html: string;
|
|
67
|
+
/** CSP declared by the resource before host policy is applied. */
|
|
33
68
|
declaredCsp: McpUiResourceCsp | undefined;
|
|
69
|
+
/** CSP enforced by the host, if any. */
|
|
34
70
|
csp: McpUiResourceCsp | undefined;
|
|
71
|
+
/** Browser permissions requested by the resource. */
|
|
35
72
|
permissions: McpUiResourcePermissions | undefined;
|
|
73
|
+
/** Whether the app prefers a visible host border. */
|
|
36
74
|
prefersBorder: boolean;
|
|
75
|
+
/** MIME type reported by the resource. */
|
|
37
76
|
mimeType: string | undefined;
|
|
77
|
+
/** Whether the MIME type is the MCP App resource media type. */
|
|
38
78
|
mimeTypeValid: boolean;
|
|
79
|
+
/** MIME validation warning, or `null` for a valid resource. */
|
|
39
80
|
mimeTypeWarning: string | null;
|
|
40
81
|
};
|
|
82
|
+
/** Browser CSP violation observed while an MCP App is running. */
|
|
41
83
|
export type ViewCspViolation = {
|
|
84
|
+
/** CSP directive reported by the browser. */
|
|
42
85
|
directive: string;
|
|
86
|
+
/** Effective CSP directive reported by the browser. */
|
|
43
87
|
effectiveDirective?: string;
|
|
88
|
+
/** URI blocked by the policy. */
|
|
44
89
|
blockedUri: string;
|
|
90
|
+
/** Source file associated with the violation. */
|
|
45
91
|
sourceFile?: string | null;
|
|
92
|
+
/** Source line associated with the violation. */
|
|
46
93
|
lineNumber?: number | null;
|
|
94
|
+
/** Source column associated with the violation. */
|
|
47
95
|
columnNumber?: number | null;
|
|
96
|
+
/** Original policy text reported by the browser. */
|
|
48
97
|
originalPolicy?: string;
|
|
98
|
+
/** Unix timestamp in milliseconds when the violation occurred. */
|
|
49
99
|
timestamp: number;
|
|
50
100
|
};
|
|
101
|
+
/** App-visible tools and the function used to call them. */
|
|
102
|
+
export type ViewAppToolConnection = {
|
|
103
|
+
/** Tools available to the app. */
|
|
104
|
+
tools: Tool[];
|
|
105
|
+
/** Calls an app-visible tool. */
|
|
106
|
+
callTool: (name: string, args?: Record<string, unknown>) => Promise<unknown>;
|
|
107
|
+
};
|
|
108
|
+
/** Lifecycle stage reported by a rendered MCP App. */
|
|
51
109
|
export type ViewLifecycleStatus = "resolving" | "sandbox-loading" | "connecting" | "initialized" | "ready" | "tearing-down" | "closed" | "error";
|
|
110
|
+
/** Lifecycle update emitted by {@link ViewRenderer}. */
|
|
52
111
|
export type ViewLifecycleEvent = {
|
|
112
|
+
/** Current lifecycle stage. */
|
|
53
113
|
status: ViewLifecycleStatus;
|
|
114
|
+
/** Error message when `status` is `"error"`. */
|
|
54
115
|
error?: string;
|
|
55
116
|
};
|
|
117
|
+
/** Props accepted by {@link ViewRenderer}. */
|
|
56
118
|
export interface ViewRendererProps {
|
|
119
|
+
/** Stable identifier for the view instance. */
|
|
57
120
|
viewId: string;
|
|
121
|
+
/** Live resource or preloaded HTML to render. */
|
|
58
122
|
source: ViewRendererSource;
|
|
123
|
+
/** Sandbox page URL or function that derives one from the resolved resource. */
|
|
59
124
|
sandboxUrl?: URL | ((resolved: ResolvedViewResource) => URL);
|
|
125
|
+
/** Tool associated with the view. */
|
|
60
126
|
toolName?: string;
|
|
127
|
+
/** Complete tool input forwarded to the app. */
|
|
61
128
|
toolInput?: Record<string, unknown>;
|
|
129
|
+
/** Tool result forwarded to the app. */
|
|
62
130
|
toolOutput?: unknown;
|
|
131
|
+
/** Partial streaming tool input forwarded to the app. */
|
|
63
132
|
partialToolInput?: Record<string, unknown>;
|
|
133
|
+
/** String-valued custom properties forwarded to the app. */
|
|
64
134
|
customProps?: Record<string, string>;
|
|
135
|
+
/** Whether the associated tool call was cancelled. */
|
|
65
136
|
cancelled?: boolean;
|
|
137
|
+
/** Host identity advertised to the app. */
|
|
66
138
|
hostInfo?: {
|
|
139
|
+
/** Stable host name. */
|
|
67
140
|
name: string;
|
|
141
|
+
/** Host version. */
|
|
68
142
|
version: string;
|
|
69
143
|
};
|
|
144
|
+
/** Initial host context sent to the app. */
|
|
70
145
|
hostContext?: McpUiHostContext;
|
|
146
|
+
/** Explicit host capability overrides. */
|
|
71
147
|
hostCapabilities?: Partial<McpUiHostCapabilities>;
|
|
148
|
+
/** Content modalities accepted by the host's message handler. */
|
|
149
|
+
messageCapabilities?: McpUiSupportedContentBlockModalities;
|
|
150
|
+
/** Content modalities accepted by the model-context handler. */
|
|
151
|
+
modelContextCapabilities?: McpUiSupportedContentBlockModalities;
|
|
152
|
+
/** CSP enforcement mode. Defaults to `"permissive"`. */
|
|
72
153
|
cspMode?: ViewCspMode;
|
|
154
|
+
/** Initial display mode. Defaults to `"inline"`. */
|
|
73
155
|
displayMode?: ViewDisplayMode;
|
|
156
|
+
/** Called when the app requests a supported display mode. */
|
|
74
157
|
onDisplayModeChange?: (mode: ViewDisplayMode) => void;
|
|
158
|
+
/** Maximum inline view width in pixels. */
|
|
75
159
|
inlineMaxWidth?: number;
|
|
160
|
+
/** Whether to hide the built-in view chrome. */
|
|
76
161
|
chromeless?: boolean;
|
|
77
|
-
|
|
162
|
+
/** Handles content the app sends to the conversation. */
|
|
163
|
+
onMessage?: (content: unknown[]) => void | Promise<void>;
|
|
164
|
+
/** Handles sampling requests from the app. */
|
|
165
|
+
onSamplingRequest?: (params: CreateMessageRequest["params"]) => Promise<CreateMessageResult | CreateMessageResultWithTools>;
|
|
166
|
+
/** Handles file-download requests from the app. */
|
|
167
|
+
onDownloadFile?: (params: McpUiDownloadFileRequest["params"]) => Promise<McpUiDownloadFileResult>;
|
|
168
|
+
/** Receives the current app-visible tool connection. */
|
|
169
|
+
onAppToolsChanged?: (connection: ViewAppToolConnection | null) => void;
|
|
170
|
+
/** Handles model-context updates from the app. */
|
|
78
171
|
onModelContextUpdate?: (ctx: {
|
|
79
172
|
content?: unknown;
|
|
80
173
|
structuredContent?: unknown;
|
|
81
|
-
}) => void
|
|
174
|
+
}) => void | Promise<void>;
|
|
175
|
+
/** Handles structured log entries from the app. */
|
|
82
176
|
onLog?: (entry: {
|
|
83
177
|
level: string;
|
|
84
178
|
data: unknown;
|
|
85
179
|
}) => void;
|
|
180
|
+
/** Called when the app signals that it is ready. */
|
|
86
181
|
onReady?: () => void;
|
|
182
|
+
/** Called for each view lifecycle transition. */
|
|
87
183
|
onLifecycleChange?: (event: ViewLifecycleEvent) => void;
|
|
184
|
+
/** Called when view initialization or runtime handling fails. */
|
|
88
185
|
onError?: (message: string) => void;
|
|
186
|
+
/** Called when the browser reports a CSP violation. */
|
|
89
187
|
onCspViolation?: (violation: ViewCspViolation) => void;
|
|
188
|
+
/** Called after a live or preloaded resource is normalized. */
|
|
90
189
|
onResourceResolved?: (resolved: ResolvedViewResource) => void;
|
|
190
|
+
/** Wraps the host transport before it is connected to the app bridge. */
|
|
91
191
|
wrapTransport?: (transport: Transport, viewId: string) => Transport;
|
|
192
|
+
/** Timeout in milliseconds for app-initiated tool calls. Defaults to `600000`. */
|
|
92
193
|
toolCallTimeout?: number;
|
|
93
194
|
/** Dev mock of ChatGPT file APIs for local hosts (inspector). Default false. */
|
|
94
195
|
mockOpenAiFileApis?: boolean;
|
|
@@ -96,7 +197,9 @@ export interface ViewRendererProps {
|
|
|
96
197
|
onInlineHeightChange?: (height: number) => void;
|
|
97
198
|
/** Inspector-only chrome shown above the iframe in fullscreen display mode. */
|
|
98
199
|
fullscreenHeader?: {
|
|
200
|
+
/** Header title. */
|
|
99
201
|
title: string;
|
|
202
|
+
/** Optional header icon URL. */
|
|
100
203
|
iconUrl?: string | null;
|
|
101
204
|
};
|
|
102
205
|
/** Optional host close control for fullscreen (e.g. shared Button + icon). */
|
|
@@ -105,9 +208,13 @@ export interface ViewRendererProps {
|
|
|
105
208
|
"data-testid": string;
|
|
106
209
|
"aria-label": string;
|
|
107
210
|
}) => ReactNode;
|
|
211
|
+
/** Additional class name applied to the view container. */
|
|
108
212
|
className?: string;
|
|
213
|
+
/** Test identifier applied to the view container. */
|
|
109
214
|
testId?: string;
|
|
215
|
+
/** Status text shown while the associated tool is running. */
|
|
110
216
|
invoking?: string;
|
|
217
|
+
/** Status text shown after the associated tool completes. */
|
|
111
218
|
invoked?: string;
|
|
112
219
|
}
|
|
113
220
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/react/view/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/react/view/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,oCAAoC,EACrC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,4BAA4B,EAC5B,IAAI,EACL,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EACV,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,oCAAoC,GACrC,CAAC;AACF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,4CAA4C;AAC5C,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,KAAK,GAAG,YAAY,CAAC;AAE9D,4EAA4E;AAC5E,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,iBAAiB,CAAC;AAE3D,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,QAAQ,EAAE,CACR,IA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AAM,CAAC;CAClB"}
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the MCP App resource URI from tool metadata.
|
|
3
|
+
*
|
|
4
|
+
* @param toolMeta - Tool `_meta` object.
|
|
5
|
+
* @returns The declared view resource URI, or `null` when none is declared.
|
|
6
|
+
*/
|
|
1
7
|
export declare function getViewResourceUri(toolMeta?: Record<string, unknown>): string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Tests whether tool metadata declares an MCP App resource.
|
|
10
|
+
*
|
|
11
|
+
* @param toolMeta - Tool `_meta` object.
|
|
12
|
+
* @returns `true` when the tool declares a view resource URI.
|
|
13
|
+
*/
|
|
2
14
|
export declare function isViewTool(toolMeta?: Record<string, unknown>): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Tests whether a resource uses the MCP App HTML media type.
|
|
17
|
+
*
|
|
18
|
+
* @param mimeType - Resource MIME type.
|
|
19
|
+
* @returns `true` for the MCP App resource media type.
|
|
20
|
+
*/
|
|
3
21
|
export declare function isViewResource(mimeType?: string): boolean;
|
|
4
22
|
//# sourceMappingURL=view-detection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view-detection.d.ts","sourceRoot":"","sources":["../../../src/react/view/view-detection.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,MAAM,GAAG,IAAI,CAWf;AAED,wBAAgB,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAEtE;AAED,wBAAgB,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAEzD"}
|
|
1
|
+
{"version":3,"file":"view-detection.d.ts","sourceRoot":"","sources":["../../../src/react/view/view-detection.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,MAAM,GAAG,IAAI,CAWf;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAEtE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAEzD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { McpUiHostCapabilities, McpUiSupportedContentBlockModalities } from "./ext-apps-bridge.js";
|
|
2
|
+
import type { ViewConnection, ViewDisplayMode } from "./types.js";
|
|
3
|
+
/** Inputs used to derive the capabilities advertised by an MCP App host. */
|
|
4
|
+
type CapabilityInputs = {
|
|
5
|
+
hasConnection: boolean;
|
|
6
|
+
hasMessageHandler: boolean;
|
|
7
|
+
hasModelContextHandler: boolean;
|
|
8
|
+
hasLogHandler: boolean;
|
|
9
|
+
hasSamplingHandler?: boolean;
|
|
10
|
+
hasDownloadHandler?: boolean;
|
|
11
|
+
messageCapabilities?: McpUiSupportedContentBlockModalities;
|
|
12
|
+
modelContextCapabilities?: McpUiSupportedContentBlockModalities;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Builds host capabilities from the callbacks and connections the host exposes.
|
|
16
|
+
*
|
|
17
|
+
* @param inputs - Available host features and supported content modalities.
|
|
18
|
+
* @returns Capabilities suitable for MCP App bridge initialization.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildDefaultHostCapabilities({ hasConnection, hasMessageHandler, hasModelContextHandler, hasLogHandler, hasSamplingHandler, hasDownloadHandler, messageCapabilities, modelContextCapabilities, }: CapabilityInputs): McpUiHostCapabilities;
|
|
21
|
+
/**
|
|
22
|
+
* Tests whether a tool is visible to the model.
|
|
23
|
+
*
|
|
24
|
+
* Tools without explicit visibility metadata remain model-visible.
|
|
25
|
+
*
|
|
26
|
+
* @param tool - Tool metadata to inspect.
|
|
27
|
+
* @returns `true` when the tool may be presented to the model.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isToolVisibleToModel(tool: {
|
|
30
|
+
_meta?: unknown;
|
|
31
|
+
}): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Validates and dispatches an MCP App `ui/message` payload.
|
|
34
|
+
*
|
|
35
|
+
* @param handler - Host callback that accepts message content.
|
|
36
|
+
* @param content - Content blocks supplied by the app.
|
|
37
|
+
* @throws When the host has no message handler or `content` is empty.
|
|
38
|
+
*/
|
|
39
|
+
export declare function dispatchUiMessage(handler: ((content: unknown[]) => void | Promise<void>) | undefined, content: unknown[]): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Resolves a display-mode request against host and app availability.
|
|
42
|
+
*
|
|
43
|
+
* @param options - Requested and current modes plus each side's supported modes.
|
|
44
|
+
* @returns The requested mode when both sides support it; otherwise `current`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function resolveRequestedDisplayMode({ requested, current, hostAvailable, appAvailable, }: {
|
|
47
|
+
requested: ViewDisplayMode;
|
|
48
|
+
current: ViewDisplayMode;
|
|
49
|
+
hostAvailable?: readonly ViewDisplayMode[];
|
|
50
|
+
appAvailable?: readonly ViewDisplayMode[];
|
|
51
|
+
}): ViewDisplayMode;
|
|
52
|
+
/**
|
|
53
|
+
* Asserts that an MCP App may call a named server tool.
|
|
54
|
+
*
|
|
55
|
+
* @param tools - Tools available through the live view connection.
|
|
56
|
+
* @param name - Tool name requested by the app.
|
|
57
|
+
* @throws When the tool is unavailable or not visible to apps.
|
|
58
|
+
*/
|
|
59
|
+
export declare function assertAppCanCallTool(tools: ViewConnection["tools"], name: string): void;
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=view-host-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-host-policy.d.ts","sourceRoot":"","sources":["../../../src/react/view/view-host-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAA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