@modelcontextprotocol/ext-apps 0.2.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/dist/src/app-bridge.js +8 -8
- package/dist/src/app.d.ts +1 -1
- package/dist/src/app.js +8 -8
- package/dist/src/generated/schema.d.ts +24 -6
- package/dist/src/generated/schema.test.d.ts +1 -0
- package/dist/src/react/index.d.ts +1 -0
- package/dist/src/react/index.js +8 -8
- package/dist/src/react/useHostStyles.d.ts +65 -0
- package/dist/src/server/index.js +12 -12
- package/dist/src/spec.types.d.ts +10 -1
- package/dist/src/styles.d.ts +52 -0
- package/dist/src/types.d.ts +2 -2
- package/package.json +12 -12
package/dist/src/styles.d.ts
CHANGED
|
@@ -87,3 +87,55 @@ export declare function applyDocumentTheme(theme: McpUiTheme): void;
|
|
|
87
87
|
* @see {@link McpUiHostContext} for the full host context structure
|
|
88
88
|
*/
|
|
89
89
|
export declare function applyHostStyleVariables(styles: McpUiStyles, root?: HTMLElement): void;
|
|
90
|
+
/**
|
|
91
|
+
* Apply host font CSS to the document.
|
|
92
|
+
*
|
|
93
|
+
* This function takes the `css.fonts` string from `McpUiHostContext.styles` and
|
|
94
|
+
* injects it as a `<style>` tag. The CSS can contain `@font-face` rules for
|
|
95
|
+
* self-hosted fonts, `@import` statements for Google Fonts or other font services,
|
|
96
|
+
* or a combination of both.
|
|
97
|
+
*
|
|
98
|
+
* The styles are only injected once. Subsequent calls will not create duplicate
|
|
99
|
+
* style tags.
|
|
100
|
+
*
|
|
101
|
+
* @param fontCss - CSS string containing @font-face rules and/or @import statements
|
|
102
|
+
*
|
|
103
|
+
* @example Apply fonts from host context
|
|
104
|
+
* ```typescript
|
|
105
|
+
* import { applyHostFonts } from '@modelcontextprotocol/ext-apps';
|
|
106
|
+
*
|
|
107
|
+
* app.onhostcontextchanged = (params) => {
|
|
108
|
+
* if (params.styles?.css?.fonts) {
|
|
109
|
+
* applyHostFonts(params.styles.css.fonts);
|
|
110
|
+
* }
|
|
111
|
+
* };
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @example Host providing self-hosted fonts
|
|
115
|
+
* ```typescript
|
|
116
|
+
* hostContext.styles.css.fonts = `
|
|
117
|
+
* @font-face {
|
|
118
|
+
* font-family: "Anthropic Sans";
|
|
119
|
+
* src: url("https://assets.anthropic.com/.../Regular.otf") format("opentype");
|
|
120
|
+
* font-weight: 400;
|
|
121
|
+
* }
|
|
122
|
+
* `;
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* @example Host providing Google Fonts
|
|
126
|
+
* ```typescript
|
|
127
|
+
* hostContext.styles.css.fonts = `
|
|
128
|
+
* @import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');
|
|
129
|
+
* `;
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @example Use host fonts in CSS
|
|
133
|
+
* ```css
|
|
134
|
+
* body {
|
|
135
|
+
* font-family: "Anthropic Sans", sans-serif;
|
|
136
|
+
* }
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* @see {@link McpUiHostContext} for the full host context structure
|
|
140
|
+
*/
|
|
141
|
+
export declare function applyHostFonts(fontCss: string): void;
|
package/dist/src/types.d.ts
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* @see generated/schema.ts for auto-generated Zod schemas
|
|
9
9
|
* @see generated/schema.test.ts for compile-time verification
|
|
10
10
|
*/
|
|
11
|
-
export { LATEST_PROTOCOL_VERSION, type McpUiTheme, type McpUiDisplayMode, type McpUiStyleVariableKey, type McpUiStyles, type McpUiHostStyles, type McpUiOpenLinkRequest, type McpUiOpenLinkResult, type McpUiMessageRequest, type McpUiMessageResult, type McpUiSandboxProxyReadyNotification, type McpUiSandboxResourceReadyNotification, type McpUiSizeChangedNotification, type McpUiToolInputNotification, type McpUiToolInputPartialNotification, type McpUiToolResultNotification, type McpUiToolCancelledNotification, type McpUiHostContext, type McpUiHostContextChangedNotification, type McpUiResourceTeardownRequest, type McpUiResourceTeardownResult, type McpUiHostCapabilities, type McpUiAppCapabilities, type McpUiInitializeRequest, type McpUiInitializeResult, type McpUiInitializedNotification, type McpUiResourceCsp, type McpUiResourceMeta, type McpUiRequestDisplayModeRequest, type McpUiRequestDisplayModeResult, type McpUiToolVisibility, type McpUiToolMeta, } from "./spec.types.js";
|
|
11
|
+
export { LATEST_PROTOCOL_VERSION, type McpUiTheme, type McpUiDisplayMode, type McpUiStyleVariableKey, type McpUiStyles, type McpUiHostCss, type McpUiHostStyles, type McpUiOpenLinkRequest, type McpUiOpenLinkResult, type McpUiMessageRequest, type McpUiMessageResult, type McpUiSandboxProxyReadyNotification, type McpUiSandboxResourceReadyNotification, type McpUiSizeChangedNotification, type McpUiToolInputNotification, type McpUiToolInputPartialNotification, type McpUiToolResultNotification, type McpUiToolCancelledNotification, type McpUiHostContext, type McpUiHostContextChangedNotification, type McpUiResourceTeardownRequest, type McpUiResourceTeardownResult, type McpUiHostCapabilities, type McpUiAppCapabilities, type McpUiInitializeRequest, type McpUiInitializeResult, type McpUiInitializedNotification, type McpUiResourceCsp, type McpUiResourceMeta, type McpUiRequestDisplayModeRequest, type McpUiRequestDisplayModeResult, type McpUiToolVisibility, type McpUiToolMeta, } from "./spec.types.js";
|
|
12
12
|
import type { McpUiInitializeRequest, McpUiOpenLinkRequest, McpUiMessageRequest, McpUiResourceTeardownRequest, McpUiRequestDisplayModeRequest, McpUiHostContextChangedNotification, McpUiToolInputNotification, McpUiToolInputPartialNotification, McpUiToolResultNotification, McpUiToolCancelledNotification, McpUiSandboxResourceReadyNotification, McpUiInitializedNotification, McpUiSizeChangedNotification, McpUiSandboxProxyReadyNotification, McpUiInitializeResult, McpUiOpenLinkResult, McpUiMessageResult, McpUiResourceTeardownResult, McpUiRequestDisplayModeResult } from "./spec.types.js";
|
|
13
|
-
export { McpUiThemeSchema, McpUiDisplayModeSchema, McpUiHostStylesSchema, McpUiOpenLinkRequestSchema, McpUiOpenLinkResultSchema, McpUiMessageRequestSchema, McpUiMessageResultSchema, McpUiSandboxProxyReadyNotificationSchema, McpUiSandboxResourceReadyNotificationSchema, McpUiSizeChangedNotificationSchema, McpUiToolInputNotificationSchema, McpUiToolInputPartialNotificationSchema, McpUiToolResultNotificationSchema, McpUiToolCancelledNotificationSchema, McpUiHostContextSchema, McpUiHostContextChangedNotificationSchema, McpUiResourceTeardownRequestSchema, McpUiResourceTeardownResultSchema, McpUiHostCapabilitiesSchema, McpUiAppCapabilitiesSchema, McpUiInitializeRequestSchema, McpUiInitializeResultSchema, McpUiInitializedNotificationSchema, McpUiResourceCspSchema, McpUiResourceMetaSchema, McpUiRequestDisplayModeRequestSchema, McpUiRequestDisplayModeResultSchema, McpUiToolVisibilitySchema, McpUiToolMetaSchema, } from "./generated/schema.js";
|
|
13
|
+
export { McpUiThemeSchema, McpUiDisplayModeSchema, McpUiHostCssSchema, McpUiHostStylesSchema, McpUiOpenLinkRequestSchema, McpUiOpenLinkResultSchema, McpUiMessageRequestSchema, McpUiMessageResultSchema, McpUiSandboxProxyReadyNotificationSchema, McpUiSandboxResourceReadyNotificationSchema, McpUiSizeChangedNotificationSchema, McpUiToolInputNotificationSchema, McpUiToolInputPartialNotificationSchema, McpUiToolResultNotificationSchema, McpUiToolCancelledNotificationSchema, McpUiHostContextSchema, McpUiHostContextChangedNotificationSchema, McpUiResourceTeardownRequestSchema, McpUiResourceTeardownResultSchema, McpUiHostCapabilitiesSchema, McpUiAppCapabilitiesSchema, McpUiInitializeRequestSchema, McpUiInitializeResultSchema, McpUiInitializedNotificationSchema, McpUiResourceCspSchema, McpUiResourceMetaSchema, McpUiRequestDisplayModeRequestSchema, McpUiRequestDisplayModeResultSchema, McpUiToolVisibilitySchema, McpUiToolMetaSchema, } from "./generated/schema.js";
|
|
14
14
|
import { CallToolRequest, CallToolResult, EmptyResult, ListPromptsRequest, ListPromptsResult, ListResourcesRequest, ListResourcesResult, ListResourceTemplatesRequest, ListResourceTemplatesResult, ListToolsRequest, ListToolsResult, LoggingMessageNotification, PingRequest, PromptListChangedNotification, ReadResourceRequest, ReadResourceResult, ResourceListChangedNotification, ToolListChangedNotification } from "@modelcontextprotocol/sdk/types.js";
|
|
15
15
|
/**
|
|
16
16
|
* All request types in the MCP Apps protocol.
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"url": "https://github.com/modelcontextprotocol/ext-apps"
|
|
6
6
|
},
|
|
7
7
|
"homepage": "https://github.com/modelcontextprotocol/ext-apps",
|
|
8
|
-
"version": "0.2.
|
|
8
|
+
"version": "0.2.1",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"description": "MCP Apps SDK — Enable MCP servers to display interactive user interfaces in conversational clients.",
|
|
11
11
|
"type": "module",
|
|
@@ -97,17 +97,17 @@
|
|
|
97
97
|
"prettier": "^3.6.2"
|
|
98
98
|
},
|
|
99
99
|
"optionalDependencies": {
|
|
100
|
-
"@oven/bun-darwin-aarch64": "^1.
|
|
101
|
-
"@oven/bun-darwin-x64": "^1.
|
|
102
|
-
"@oven/bun-darwin-x64-baseline": "^1.
|
|
103
|
-
"@oven/bun-linux-aarch64": "^1.
|
|
104
|
-
"@oven/bun-linux-aarch64-musl": "^1.
|
|
105
|
-
"@oven/bun-linux-x64": "^1.
|
|
106
|
-
"@oven/bun-linux-x64-baseline": "^1.
|
|
107
|
-
"@oven/bun-linux-x64-musl": "^1.
|
|
108
|
-
"@oven/bun-linux-x64-musl-baseline": "^1.
|
|
109
|
-
"@oven/bun-windows-x64": "^1.
|
|
110
|
-
"@oven/bun-windows-x64-baseline": "^1.
|
|
100
|
+
"@oven/bun-darwin-aarch64": "^1.2.21",
|
|
101
|
+
"@oven/bun-darwin-x64": "^1.2.21",
|
|
102
|
+
"@oven/bun-darwin-x64-baseline": "^1.2.21",
|
|
103
|
+
"@oven/bun-linux-aarch64": "^1.2.21",
|
|
104
|
+
"@oven/bun-linux-aarch64-musl": "^1.2.21",
|
|
105
|
+
"@oven/bun-linux-x64": "^1.2.21",
|
|
106
|
+
"@oven/bun-linux-x64-baseline": "^1.2.21",
|
|
107
|
+
"@oven/bun-linux-x64-musl": "^1.2.21",
|
|
108
|
+
"@oven/bun-linux-x64-musl-baseline": "^1.2.21",
|
|
109
|
+
"@oven/bun-windows-x64": "^1.2.21",
|
|
110
|
+
"@oven/bun-windows-x64-baseline": "^1.2.21",
|
|
111
111
|
"@rollup/rollup-darwin-arm64": "^4.53.3",
|
|
112
112
|
"@rollup/rollup-darwin-x64": "^4.53.3",
|
|
113
113
|
"@rollup/rollup-linux-arm64-gnu": "^4.53.3",
|