@modelcontextprotocol/ext-apps 1.1.1 → 1.1.2
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/dist/src/app-bridge.d.ts +44 -1
- package/dist/src/app-bridge.js +10 -10
- package/dist/src/app-with-deps.js +10 -10
- package/dist/src/app.d.ts +68 -1
- package/dist/src/app.js +11 -11
- package/dist/src/generated/schema.d.ts +72 -0
- package/dist/src/generated/schema.test.d.ts +2 -0
- package/dist/src/react/index.js +10 -10
- package/dist/src/react/react-with-deps.js +10 -10
- package/dist/src/server/index.js +10 -10
- package/dist/src/spec.types.d.ts +34 -1
- package/dist/src/types.d.ts +5 -5
- package/package.json +2 -2
package/dist/src/app.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type RequestOptions, Protocol, ProtocolOptions } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
2
2
|
import { CallToolRequest, CallToolResult, Implementation, ListToolsRequest, LoggingMessageNotification } from "@modelcontextprotocol/sdk/types.js";
|
|
3
3
|
import { AppNotification, AppRequest, AppResult } from "./types";
|
|
4
|
-
import { McpUiAppCapabilities, McpUiUpdateModelContextRequest, McpUiHostCapabilities, McpUiHostContext, McpUiHostContextChangedNotification, McpUiMessageRequest, McpUiOpenLinkRequest, McpUiResourceTeardownRequest, McpUiResourceTeardownResult, McpUiSizeChangedNotification, McpUiToolCancelledNotification, McpUiToolInputNotification, McpUiToolInputPartialNotification, McpUiToolResultNotification, McpUiRequestDisplayModeRequest } from "./types";
|
|
4
|
+
import { McpUiAppCapabilities, McpUiUpdateModelContextRequest, McpUiHostCapabilities, McpUiHostContext, McpUiHostContextChangedNotification, McpUiMessageRequest, McpUiOpenLinkRequest, McpUiDownloadFileRequest, McpUiResourceTeardownRequest, McpUiResourceTeardownResult, McpUiSizeChangedNotification, McpUiToolCancelledNotification, McpUiToolInputNotification, McpUiToolInputPartialNotification, McpUiToolResultNotification, McpUiRequestDisplayModeRequest } from "./types";
|
|
5
5
|
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
6
6
|
export { PostMessageTransport } from "./message-transport";
|
|
7
7
|
export * from "./types";
|
|
@@ -708,6 +708,73 @@ export declare class App extends Protocol<AppRequest, AppNotification, AppResult
|
|
|
708
708
|
}>;
|
|
709
709
|
/** @deprecated Use {@link openLink `openLink`} instead */
|
|
710
710
|
sendOpenLink: App["openLink"];
|
|
711
|
+
/**
|
|
712
|
+
* Request the host to download a file.
|
|
713
|
+
*
|
|
714
|
+
* Since MCP Apps run in sandboxed iframes where direct downloads are blocked,
|
|
715
|
+
* this provides a host-mediated mechanism for file exports. The host will
|
|
716
|
+
* typically show a confirmation dialog before initiating the download.
|
|
717
|
+
*
|
|
718
|
+
* Uses standard MCP resource types: `EmbeddedResource` for inline content
|
|
719
|
+
* and `ResourceLink` for content the host can fetch directly.
|
|
720
|
+
*
|
|
721
|
+
* @param params - Resource contents to download
|
|
722
|
+
* @param options - Request options (timeout, etc.)
|
|
723
|
+
* @returns Result with `isError: true` if the host denied the request (e.g., user cancelled)
|
|
724
|
+
*
|
|
725
|
+
* @throws {Error} If the request times out or the connection is lost
|
|
726
|
+
*
|
|
727
|
+
* @example Download a JSON file (embedded text resource)
|
|
728
|
+
* ```ts
|
|
729
|
+
* const data = JSON.stringify({ items: selectedItems }, null, 2);
|
|
730
|
+
* const { isError } = await app.downloadFile({
|
|
731
|
+
* contents: [{
|
|
732
|
+
* type: "resource",
|
|
733
|
+
* resource: {
|
|
734
|
+
* uri: "file:///export.json",
|
|
735
|
+
* mimeType: "application/json",
|
|
736
|
+
* text: data,
|
|
737
|
+
* },
|
|
738
|
+
* }],
|
|
739
|
+
* });
|
|
740
|
+
* if (isError) {
|
|
741
|
+
* console.warn("Download denied or cancelled");
|
|
742
|
+
* }
|
|
743
|
+
* ```
|
|
744
|
+
*
|
|
745
|
+
* @example Download binary content (embedded blob resource)
|
|
746
|
+
* ```ts
|
|
747
|
+
* const { isError } = await app.downloadFile({
|
|
748
|
+
* contents: [{
|
|
749
|
+
* type: "resource",
|
|
750
|
+
* resource: {
|
|
751
|
+
* uri: "file:///image.png",
|
|
752
|
+
* mimeType: "image/png",
|
|
753
|
+
* blob: base64EncodedPng,
|
|
754
|
+
* },
|
|
755
|
+
* }],
|
|
756
|
+
* });
|
|
757
|
+
* ```
|
|
758
|
+
*
|
|
759
|
+
* @example Download via resource link (host fetches)
|
|
760
|
+
* ```ts
|
|
761
|
+
* const { isError } = await app.downloadFile({
|
|
762
|
+
* contents: [{
|
|
763
|
+
* type: "resource_link",
|
|
764
|
+
* uri: "https://api.example.com/reports/q4.pdf",
|
|
765
|
+
* name: "Q4 Report",
|
|
766
|
+
* mimeType: "application/pdf",
|
|
767
|
+
* }],
|
|
768
|
+
* });
|
|
769
|
+
* ```
|
|
770
|
+
*
|
|
771
|
+
* @see {@link McpUiDownloadFileRequest `McpUiDownloadFileRequest`} for request structure
|
|
772
|
+
* @see {@link McpUiDownloadFileResult `McpUiDownloadFileResult`} for result structure
|
|
773
|
+
*/
|
|
774
|
+
downloadFile(params: McpUiDownloadFileRequest["params"], options?: RequestOptions): Promise<{
|
|
775
|
+
[x: string]: unknown;
|
|
776
|
+
isError?: boolean | undefined;
|
|
777
|
+
}>;
|
|
711
778
|
/**
|
|
712
779
|
* Request a change to the display mode.
|
|
713
780
|
*
|