@toolgrain/protocol 0.3.0-alpha.0 → 0.3.0-alpha.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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @toolgrain/protocol
2
2
 
3
+ ## 0.3.0-alpha.2
4
+
5
+ ### Minor Changes
6
+
7
+ - Add native MCP Apps protocol contracts and typed React widgets with shared-entry routing.
8
+
9
+ ## 0.3.0-alpha.1
10
+
11
+ No changes in this release.
12
+
3
13
  ## 0.3.0-alpha.0
4
14
 
5
15
  No changes in this release.
@@ -0,0 +1,7 @@
1
+ {
2
+ "revision": "2026-01-26",
3
+ "specification": "https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx",
4
+ "apiReference": "https://apps.extensions.modelcontextprotocol.io/api/",
5
+ "implementation": "Toolgrain-authored wire declarations derived from the stable specification; no upstream implementation is vendored.",
6
+ "reviewed": "2026-11-06"
7
+ }
package/dist/apps.d.ts ADDED
@@ -0,0 +1,107 @@
1
+ /** Native wire contracts derived from SEP-1865, stable revision 2026-01-26.
2
+ * Source: https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx
3
+ * Toolgrain-authored declarations; no upstream implementation is vendored.
4
+ */
5
+ import type { ContentBlock, Implementation, MetaObject, Tool } from "./index.js";
6
+ /** Apps iframe revision; independent of the outer MCP connection revision. */
7
+ export declare const APPS_PROTOCOL_VERSION = "2026-01-26";
8
+ /** Client capability extension identifier. */
9
+ export declare const APPS_EXTENSION_ID = "io.modelcontextprotocol/ui";
10
+ /** HTML resource MIME type required by MCP Apps. */
11
+ export declare const APPS_MIME_TYPE = "text/html;profile=mcp-app";
12
+ /** UI association and host-enforced visibility on a tool's `_meta.ui`. */
13
+ export interface AppToolMeta {
14
+ resourceUri?: string;
15
+ visibility?: readonly ("model" | "app")[];
16
+ }
17
+ /** Requested sandbox configuration on a resource content item's `_meta.ui`. */
18
+ export interface AppResourceMeta {
19
+ csp?: {
20
+ connectDomains?: readonly string[];
21
+ resourceDomains?: readonly string[];
22
+ frameDomains?: readonly string[];
23
+ baseUriDomains?: readonly string[];
24
+ };
25
+ permissions?: {
26
+ camera?: Record<string, never>;
27
+ microphone?: Record<string, never>;
28
+ geolocation?: Record<string, never>;
29
+ clipboardWrite?: Record<string, never>;
30
+ };
31
+ domain?: string;
32
+ prefersBorder?: boolean;
33
+ }
34
+ /** Display modes of the iframe view. */
35
+ export type AppDisplayMode = "inline" | "fullscreen" | "pip";
36
+ /** Host-provided presentation hints. These are not verified identity or policy. */
37
+ export interface AppHostContext {
38
+ theme?: "light" | "dark";
39
+ styles?: {
40
+ variables?: Record<string, string | undefined>;
41
+ css?: {
42
+ fonts?: string;
43
+ };
44
+ };
45
+ locale?: string;
46
+ timeZone?: string;
47
+ displayMode?: AppDisplayMode;
48
+ availableDisplayModes?: AppDisplayMode[];
49
+ containerDimensions?: {
50
+ width?: number;
51
+ maxWidth?: number;
52
+ height?: number;
53
+ maxHeight?: number;
54
+ };
55
+ platform?: "web" | "desktop" | "mobile";
56
+ deviceCapabilities?: {
57
+ touch?: boolean;
58
+ hover?: boolean;
59
+ };
60
+ safeAreaInsets?: {
61
+ top: number;
62
+ right: number;
63
+ bottom: number;
64
+ left: number;
65
+ };
66
+ userAgent?: string;
67
+ toolInfo?: {
68
+ id?: string | number;
69
+ tool: Tool;
70
+ };
71
+ [key: string]: unknown;
72
+ }
73
+ /** Capabilities negotiated by the host on the iframe channel. */
74
+ export interface AppHostCapabilities {
75
+ serverTools?: {
76
+ listChanged?: boolean;
77
+ };
78
+ serverResources?: {
79
+ listChanged?: boolean;
80
+ };
81
+ openLinks?: Record<string, unknown>;
82
+ logging?: Record<string, unknown>;
83
+ [key: string]: unknown;
84
+ }
85
+ /** Tool envelope delivered by the host; structured data can be omitted by legacy conversion. */
86
+ export interface AppToolResult<Structured = unknown, Meta = MetaObject> {
87
+ content: ContentBlock[];
88
+ structuredContent?: Structured;
89
+ _meta?: Meta;
90
+ isError?: boolean;
91
+ [key: string]: unknown;
92
+ }
93
+ /** View-to-host Apps handshake parameters. */
94
+ export interface AppInitializeParams {
95
+ protocolVersion: typeof APPS_PROTOCOL_VERSION;
96
+ appInfo: Implementation;
97
+ appCapabilities: {
98
+ availableDisplayModes?: AppDisplayMode[];
99
+ };
100
+ }
101
+ /** Host-to-view Apps handshake response. */
102
+ export interface AppInitializeResult {
103
+ protocolVersion: string;
104
+ hostInfo: Implementation;
105
+ hostCapabilities: AppHostCapabilities;
106
+ hostContext?: AppHostContext;
107
+ }
package/dist/apps.js ADDED
@@ -0,0 +1,6 @@
1
+ /** Apps iframe revision; independent of the outer MCP connection revision. */
2
+ export const APPS_PROTOCOL_VERSION = "2026-01-26";
3
+ /** Client capability extension identifier. */
4
+ export const APPS_EXTENSION_ID = "io.modelcontextprotocol/ui";
5
+ /** HTML resource MIME type required by MCP Apps. */
6
+ export const APPS_MIME_TYPE = "text/html;profile=mcp-app";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolgrain/protocol",
3
- "version": "0.3.0-alpha.0",
3
+ "version": "0.3.0-alpha.2",
4
4
  "description": "Pinned MCP wire types, protocol versions, and upstream provenance for Toolgrain.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -33,6 +33,10 @@
33
33
  "./2025-06-18": {
34
34
  "types": "./dist/legacy.d.ts",
35
35
  "import": "./dist/legacy.js"
36
+ },
37
+ "./apps": {
38
+ "types": "./dist/apps.d.ts",
39
+ "import": "./dist/apps.js"
36
40
  }
37
41
  },
38
42
  "files": [