@modelcontextprotocol/ext-apps 0.1.0 → 0.2.1
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 +310 -26
- package/dist/src/app-bridge.js +38 -25
- package/dist/src/app.d.ts +41 -9
- package/dist/src/app.js +38 -25
- package/dist/src/generated/schema.d.ts +119 -5
- package/dist/src/generated/schema.test.d.ts +9 -1
- package/dist/src/react/index.d.ts +5 -0
- package/dist/src/react/index.js +38 -25
- package/dist/src/react/useDocumentTheme.d.ts +46 -0
- package/dist/src/react/useHostStyles.d.ts +121 -0
- package/dist/src/server/index.d.ts +109 -0
- package/dist/src/server/index.js +42 -0
- package/dist/src/server/index.test.d.ts +1 -0
- package/dist/src/spec.types.d.ts +83 -1
- package/dist/src/styles.d.ts +141 -0
- package/dist/src/types.d.ts +31 -2
- package/package.json +51 -16
package/dist/src/app.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { type RequestOptions, Protocol, ProtocolOptions } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
2
|
-
import { CallToolRequest, CallToolResult, Implementation, ListToolsRequest, LoggingMessageNotification
|
|
3
|
-
import {
|
|
2
|
+
import { CallToolRequest, CallToolResult, Implementation, ListToolsRequest, LoggingMessageNotification } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { AppNotification, AppRequest, AppResult } from "./types";
|
|
4
|
+
import { McpUiAppCapabilities, McpUiHostCapabilities, McpUiHostContext, McpUiHostContextChangedNotification, McpUiMessageRequest, McpUiOpenLinkRequest, McpUiResourceTeardownRequest, McpUiResourceTeardownResult, McpUiSizeChangedNotification, McpUiToolCancelledNotification, McpUiToolInputNotification, McpUiToolInputPartialNotification, McpUiToolResultNotification, McpUiRequestDisplayModeRequest } from "./types";
|
|
4
5
|
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
5
6
|
export { PostMessageTransport } from "./message-transport";
|
|
6
7
|
export * from "./types";
|
|
8
|
+
export { applyHostStyleVariables, applyHostFonts, getDocumentTheme, applyDocumentTheme, } from "./styles";
|
|
7
9
|
/**
|
|
8
10
|
* Metadata key for associating a resource URI with a tool call.
|
|
9
11
|
*
|
|
@@ -137,7 +139,7 @@ type RequestHandlerExtra = Parameters<Parameters<App["setRequestHandler"]>[1]>[1
|
|
|
137
139
|
* });
|
|
138
140
|
* ```
|
|
139
141
|
*/
|
|
140
|
-
export declare class App extends Protocol<
|
|
142
|
+
export declare class App extends Protocol<AppRequest, AppNotification, AppResult> {
|
|
141
143
|
private _appInfo;
|
|
142
144
|
private _capabilities;
|
|
143
145
|
private options;
|
|
@@ -498,17 +500,17 @@ export declare class App extends Protocol<Request, Notification, Result> {
|
|
|
498
500
|
* Verify that the host supports the capability required for the given request method.
|
|
499
501
|
* @internal
|
|
500
502
|
*/
|
|
501
|
-
assertCapabilityForMethod(method:
|
|
503
|
+
assertCapabilityForMethod(method: AppRequest["method"]): void;
|
|
502
504
|
/**
|
|
503
505
|
* Verify that the app declared the capability required for the given request method.
|
|
504
506
|
* @internal
|
|
505
507
|
*/
|
|
506
|
-
assertRequestHandlerCapability(method:
|
|
508
|
+
assertRequestHandlerCapability(method: AppRequest["method"]): void;
|
|
507
509
|
/**
|
|
508
510
|
* Verify that the app supports the capability required for the given notification method.
|
|
509
511
|
* @internal
|
|
510
512
|
*/
|
|
511
|
-
assertNotificationCapability(method:
|
|
513
|
+
assertNotificationCapability(method: AppNotification["method"]): void;
|
|
512
514
|
/**
|
|
513
515
|
* Verify that task creation is supported for the given request method.
|
|
514
516
|
* @internal
|
|
@@ -622,7 +624,7 @@ export declare class App extends Protocol<Request, Notification, Result> {
|
|
|
622
624
|
* @example Open documentation link
|
|
623
625
|
* ```typescript
|
|
624
626
|
* try {
|
|
625
|
-
* await app.
|
|
627
|
+
* await app.openLink({ url: "https://docs.example.com" });
|
|
626
628
|
* } catch (error) {
|
|
627
629
|
* console.error("Failed to open link:", error);
|
|
628
630
|
* // Optionally show fallback: display URL for manual copy
|
|
@@ -631,10 +633,40 @@ export declare class App extends Protocol<Request, Notification, Result> {
|
|
|
631
633
|
*
|
|
632
634
|
* @see {@link McpUiOpenLinkRequest} for request structure
|
|
633
635
|
*/
|
|
634
|
-
|
|
636
|
+
openLink(params: McpUiOpenLinkRequest["params"], options?: RequestOptions): Promise<{
|
|
635
637
|
[x: string]: unknown;
|
|
636
638
|
isError?: boolean | undefined;
|
|
637
639
|
}>;
|
|
640
|
+
/** @deprecated Use {@link openLink} instead */
|
|
641
|
+
sendOpenLink: App["openLink"];
|
|
642
|
+
/**
|
|
643
|
+
* Request a change to the display mode.
|
|
644
|
+
*
|
|
645
|
+
* Requests the host to change the UI container to the specified display mode
|
|
646
|
+
* (e.g., "inline", "fullscreen", "pip"). The host will respond with the actual
|
|
647
|
+
* display mode that was set, which may differ from the requested mode if
|
|
648
|
+
* the requested mode is not available (check `availableDisplayModes` in host context).
|
|
649
|
+
*
|
|
650
|
+
* @param params - The display mode being requested
|
|
651
|
+
* @param options - Request options (timeout, etc.)
|
|
652
|
+
* @returns Result containing the actual display mode that was set
|
|
653
|
+
*
|
|
654
|
+
* @example Request fullscreen mode
|
|
655
|
+
* ```typescript
|
|
656
|
+
* const context = app.getHostContext();
|
|
657
|
+
* if (context?.availableDisplayModes?.includes("fullscreen")) {
|
|
658
|
+
* const result = await app.requestDisplayMode({ mode: "fullscreen" });
|
|
659
|
+
* console.log("Display mode set to:", result.mode);
|
|
660
|
+
* }
|
|
661
|
+
* ```
|
|
662
|
+
*
|
|
663
|
+
* @see {@link McpUiRequestDisplayModeRequest} for request structure
|
|
664
|
+
* @see {@link McpUiHostContext} for checking availableDisplayModes
|
|
665
|
+
*/
|
|
666
|
+
requestDisplayMode(params: McpUiRequestDisplayModeRequest["params"], options?: RequestOptions): Promise<{
|
|
667
|
+
[x: string]: unknown;
|
|
668
|
+
mode: "inline" | "fullscreen" | "pip";
|
|
669
|
+
}>;
|
|
638
670
|
/**
|
|
639
671
|
* Notify the host of UI size changes.
|
|
640
672
|
*
|
|
@@ -719,5 +751,5 @@ export declare class App extends Protocol<Request, Notification, Result> {
|
|
|
719
751
|
* @see {@link McpUiInitializedNotification} for the initialized notification
|
|
720
752
|
* @see {@link PostMessageTransport} for the typical transport implementation
|
|
721
753
|
*/
|
|
722
|
-
connect(transport
|
|
754
|
+
connect(transport?: Transport, options?: RequestOptions): Promise<void>;
|
|
723
755
|
}
|