@modelcontextprotocol/ext-apps 0.0.7 → 0.1.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 +1 -1
- package/dist/src/app-bridge.d.ts +33 -2
- package/dist/src/app-bridge.js +6 -6
- package/dist/src/app.d.ts +102 -3
- package/dist/src/app.js +13 -13
- package/dist/src/generated/schema.d.ts +612 -0
- package/dist/src/generated/schema.test.d.ts +26 -0
- package/dist/src/react/index.js +7 -7
- package/dist/src/spec.types.d.ts +339 -0
- package/dist/src/types.d.ts +8 -845
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @modelcontextprotocol/ext-apps
|
|
2
2
|
|
|
3
|
-
[](https://modelcontextprotocol.github.io/ext-apps/api/)
|
|
3
|
+
[](https://www.npmjs.com/package/@modelcontextprotocol/ext-apps) [](https://modelcontextprotocol.github.io/ext-apps/api/)
|
|
4
4
|
|
|
5
5
|
This repo contains the SDK and [specification](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/draft/apps.mdx) for MCP Apps Extension ([SEP-1865](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/1865)).
|
|
6
6
|
|
package/dist/src/app-bridge.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
|
2
2
|
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
3
3
|
import { Implementation, LoggingMessageNotification, Notification, PingRequest, Request, Result } from "@modelcontextprotocol/sdk/types.js";
|
|
4
4
|
import { Protocol, ProtocolOptions, RequestOptions } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
5
|
-
import { type McpUiSandboxResourceReadyNotification, type McpUiSizeChangedNotification, type McpUiToolInputNotification, type McpUiToolInputPartialNotification, type McpUiToolResultNotification, McpUiAppCapabilities, McpUiHostCapabilities, McpUiHostContext, McpUiHostContextChangedNotification, McpUiInitializedNotification, McpUiMessageRequest, McpUiMessageResult, McpUiOpenLinkRequest, McpUiOpenLinkResult, McpUiResourceTeardownRequest, McpUiSandboxProxyReadyNotification } from "./types";
|
|
5
|
+
import { type McpUiSandboxResourceReadyNotification, type McpUiSizeChangedNotification, type McpUiToolCancelledNotification, type McpUiToolInputNotification, type McpUiToolInputPartialNotification, type McpUiToolResultNotification, McpUiAppCapabilities, McpUiHostCapabilities, McpUiHostContext, McpUiHostContextChangedNotification, McpUiInitializedNotification, McpUiMessageRequest, McpUiMessageResult, McpUiOpenLinkRequest, McpUiOpenLinkResult, McpUiResourceTeardownRequest, McpUiSandboxProxyReadyNotification } from "./types";
|
|
6
6
|
export * from "./types";
|
|
7
7
|
export { RESOURCE_URI_META_KEY, RESOURCE_MIME_TYPE } from "./app";
|
|
8
8
|
export { PostMessageTransport } from "./message-transport";
|
|
@@ -510,6 +510,37 @@ export declare class AppBridge extends Protocol<Request, Notification, Result> {
|
|
|
510
510
|
* @see {@link sendToolInput} for sending tool arguments before results
|
|
511
511
|
*/
|
|
512
512
|
sendToolResult(params: McpUiToolResultNotification["params"]): Promise<void>;
|
|
513
|
+
/**
|
|
514
|
+
* Notify the Guest UI that tool execution was cancelled.
|
|
515
|
+
*
|
|
516
|
+
* The host MUST send this notification if tool execution was cancelled for any
|
|
517
|
+
* reason, including user action, sampling error, classifier intervention, or
|
|
518
|
+
* any other interruption. This allows the Guest UI to update its state and
|
|
519
|
+
* display appropriate feedback to the user.
|
|
520
|
+
*
|
|
521
|
+
* @param params - Optional cancellation details:
|
|
522
|
+
* - `reason`: Human-readable explanation for why the tool was cancelled
|
|
523
|
+
*
|
|
524
|
+
* @example User-initiated cancellation
|
|
525
|
+
* ```typescript
|
|
526
|
+
* // User clicked "Cancel" button
|
|
527
|
+
* bridge.sendToolCancelled({ reason: "User cancelled the operation" });
|
|
528
|
+
* ```
|
|
529
|
+
*
|
|
530
|
+
* @example System-level cancellation
|
|
531
|
+
* ```typescript
|
|
532
|
+
* // Sampling error or timeout
|
|
533
|
+
* bridge.sendToolCancelled({ reason: "Request timeout after 30 seconds" });
|
|
534
|
+
*
|
|
535
|
+
* // Classifier intervention
|
|
536
|
+
* bridge.sendToolCancelled({ reason: "Content policy violation detected" });
|
|
537
|
+
* ```
|
|
538
|
+
*
|
|
539
|
+
* @see {@link McpUiToolCancelledNotification} for the notification type
|
|
540
|
+
* @see {@link sendToolResult} for sending successful results
|
|
541
|
+
* @see {@link sendToolInput} for sending tool arguments
|
|
542
|
+
*/
|
|
543
|
+
sendToolCancelled(params: McpUiToolCancelledNotification["params"]): Promise<void>;
|
|
513
544
|
/**
|
|
514
545
|
* Send HTML resource to the sandbox proxy for secure loading.
|
|
515
546
|
*
|
|
@@ -550,7 +581,7 @@ export declare class AppBridge extends Protocol<Request, Notification, Result> {
|
|
|
550
581
|
* }
|
|
551
582
|
* ```
|
|
552
583
|
*/
|
|
553
|
-
sendResourceTeardown(params: McpUiResourceTeardownRequest["params"], options?: RequestOptions): Promise<
|
|
584
|
+
sendResourceTeardown(params: McpUiResourceTeardownRequest["params"], options?: RequestOptions): Promise<Record<string, unknown>>;
|
|
554
585
|
private forwardRequest;
|
|
555
586
|
private forwardNotification;
|
|
556
587
|
/**
|