@toolgrain/protocol 0.3.0-alpha.2 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,18 +1,28 @@
1
1
  # @toolgrain/protocol
2
2
 
3
- ## 0.3.0-alpha.2
3
+ ## 0.3.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - Add native MCP Apps protocol contracts and typed React widgets with shared-entry routing.
7
+ - 1cde354: Add named Apps resource, styling, theme-token, and content-modality wire types,
8
+ with explicit host capability advertisements and pinned specification/type
9
+ provenance. Preserve custom styling variables and unknown host capability fields.
10
+
11
+ `AppToolMeta` now rejects resource-only CSP and permissions, including metadata
12
+ assigned through a variable. Put those fields on the resource content item's
13
+ `_meta.ui`; tool metadata retains its resource URI and visibility settings.
14
+
15
+ Document React widgets, matching-version installation, resource
16
+ metadata examples, and implemented versus deferred React protocol features.
17
+ - 712e975: Add native React host actions for links, user messages, replacement model context,
18
+ and display modes, with capability checks, cancellation/deadlines, and typed
19
+ request/result contracts. Let providers declare supported display modes and expose
20
+ live action availability through `useHostActions()`.
21
+ - 1cde354: Add native MCP Apps protocol contracts and typed React widgets with shared-entry routing.
8
22
 
9
- ## 0.3.0-alpha.1
10
-
11
- No changes in this release.
12
-
13
- ## 0.3.0-alpha.0
23
+ ### Patch Changes
14
24
 
15
- No changes in this release.
25
+ - 414e8f5: Clarify MCP Apps installation, browser support, and implemented React APIs for the combined 0.3.0 release; preserve dated prerelease acceptance evidence.
16
26
 
17
27
  ## 0.2.0
18
28
 
package/README.md CHANGED
@@ -57,6 +57,35 @@ The root exports the modern schema, `LEGACY_PROTOCOL_VERSION`,
57
57
  `ProtocolResponse` envelopes. The `2025-06-18` subpath exports the legacy schema.
58
58
  These are wire definitions; runtime validation remains in `@toolgrain/mcp`.
59
59
 
60
+ ## MCP Apps contracts
61
+
62
+ The `@toolgrain/protocol/apps` subpath describes the Apps iframe channel,
63
+ independently of either outer MCP revision. It exports the Apps version,
64
+ extension identifier, HTML MIME type, resource/tool metadata, host context,
65
+ capabilities, initialization envelopes, and tool-result envelope.
66
+
67
+ Toolgrain 0.3.0 or later also exports `AppMessageParams`,
68
+ `AppModelContextParams`, `AppActionResult`, and `AppDisplayModeResult` for native
69
+ host requests. They describe user messages, replacement model context, full
70
+ acknowledgements, and actual selected display modes. Check the
71
+ [publication status](https://toolgrain.mintlify.site/project/releases#current-release-status)
72
+ before installing these APIs.
73
+
74
+ `AppResourceMeta` describes CSP, requested browser permissions, sandbox origin,
75
+ and border preference. Tool `_meta.ui` uses `AppToolMeta` for `resourceUri` and
76
+ visibility; CSP and permissions belong on the resource content item.
77
+
78
+ Named resource CSP/permission, host styling, theme-token, and content-modality
79
+ types describe the wire protocol. A type declaration does not implement a browser
80
+ action. Known styling tokens support
81
+ autocomplete while custom variables and unknown host capability fields remain
82
+ accepted for forward compatibility.
83
+
84
+ The package retains `dist/apps-provenance.json` with exact reviewed specification
85
+ and upstream type-file commits/checksums. The declarations are Toolgrain-authored;
86
+ no Apps SDK implementation is vendored and there are no runtime dependencies.
87
+ See the [Apps API reference](https://toolgrain.mintlify.site/mcp-apps/reference).
88
+
60
89
  ## Requirements
61
90
 
62
91
  ESM only. Supported application runtimes are Node.js `^24.20.0` or Bun
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "revision": "2026-01-26",
3
- "specification": "https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx",
3
+ "specification": "https://github.com/modelcontextprotocol/ext-apps/blob/298e884ec3f02daba085acdb02042d73bd00b355/specification/2026-01-26/apps.mdx",
4
+ "specificationCommit": "298e884ec3f02daba085acdb02042d73bd00b355",
5
+ "specificationSha256": "ee452a7d1b9b7fb900acfeb4d6932d3963375b0f3f37d196a4b93eb80312af0e",
6
+ "upstreamTypes": {
7
+ "source": "https://github.com/modelcontextprotocol/ext-apps/blob/040942b3af064bf76b705021e3472b6593ae839e/src/spec.types.ts",
8
+ "commit": "040942b3af064bf76b705021e3472b6593ae839e",
9
+ "sha256": "f46212be3355fa0437c81b01659187efacdeef6fa50be23be02a47d03610bc6a",
10
+ "scope": "Capability advertisements, styling tokens, and host-action request/result contracts. Declarations alone do not implement optional host actions."
11
+ },
4
12
  "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"
13
+ "implementation": "Toolgrain-authored wire declarations derived from the reviewed specification and type contracts; no upstream implementation is vendored.",
14
+ "reviewed": "2026-11-07"
7
15
  }
package/dist/apps.d.ts CHANGED
@@ -1,6 +1,6 @@
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.
1
+ /** Native Apps 2026-01-26 wire contracts. Reviewed specification and upstream
2
+ * type references are pinned in apps-provenance.json. Toolgrain authors these
3
+ * declarations directly; browser implementations live in @toolgrain/react.
4
4
  */
5
5
  import type { ContentBlock, Implementation, MetaObject, Tool } from "./index.js";
6
6
  /** Apps iframe revision; independent of the outer MCP connection revision. */
@@ -13,35 +13,56 @@ export declare const APPS_MIME_TYPE = "text/html;profile=mcp-app";
13
13
  export interface AppToolMeta {
14
14
  resourceUri?: string;
15
15
  visibility?: readonly ("model" | "app")[];
16
+ /** Resource configuration belongs on the returned HTML content item's `_meta.ui`. */
17
+ csp?: never;
18
+ /** Resource configuration belongs on the returned HTML content item's `_meta.ui`. */
19
+ permissions?: never;
20
+ }
21
+ /** Origins requested by a resource; the host constructs and enforces its CSP. */
22
+ export interface AppResourceCsp {
23
+ connectDomains?: readonly string[];
24
+ resourceDomains?: readonly string[];
25
+ frameDomains?: readonly string[];
26
+ baseUriDomains?: readonly string[];
27
+ }
28
+ /** Requested browser permissions; empty objects request access without guaranteeing a grant. */
29
+ export interface AppResourcePermissions {
30
+ camera?: Record<string, never>;
31
+ microphone?: Record<string, never>;
32
+ geolocation?: Record<string, never>;
33
+ clipboardWrite?: Record<string, never>;
16
34
  }
17
35
  /** Requested sandbox configuration on a resource content item's `_meta.ui`. */
18
36
  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
- };
37
+ csp?: AppResourceCsp;
38
+ permissions?: AppResourcePermissions;
31
39
  domain?: string;
40
+ /** Request a host-provided border/background; omission leaves the choice to the host. */
32
41
  prefersBorder?: boolean;
33
42
  }
34
43
  /** Display modes of the iframe view. */
35
44
  export type AppDisplayMode = "inline" | "fullscreen" | "pip";
45
+ /** Host color-scheme preference. */
46
+ export type AppTheme = "light" | "dark";
47
+ /** Standardized Apps theme tokens; custom host variables may also be supplied. */
48
+ export type AppStyleVariableKey = `--color-${"background" | "text" | "border"}-${"primary" | "secondary" | "tertiary" | "inverse" | "ghost" | "info" | "danger" | "success" | "warning" | "disabled"}` | `--color-ring-${"primary" | "secondary" | "inverse" | "info" | "danger" | "success" | "warning"}` | `--font-${"sans" | "mono"}` | `--font-weight-${"normal" | "medium" | "semibold" | "bold"}` | `--font-text-${"xs" | "sm" | "md" | "lg"}-${"size" | "line-height"}` | `--font-heading-${"xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl"}-${"size" | "line-height"}` | `--border-radius-${"xs" | "sm" | "md" | "lg" | "xl" | "full"}` | "--border-width-regular" | `--shadow-${"hairline" | "sm" | "md" | "lg"}`;
49
+ /** Optional known tokens with string-valued extensions for forward compatibility. */
50
+ export type AppStyleVariables = Partial<Record<AppStyleVariableKey, string | undefined>> & Record<string, string | undefined>;
51
+ /** Host font-loading CSS applied by the React provider when host styling is enabled. */
52
+ export interface AppHostCss {
53
+ fonts?: string;
54
+ [key: string]: unknown;
55
+ }
56
+ /** Host-provided theme variables and font-loading CSS. */
57
+ export interface AppHostStyles {
58
+ variables?: AppStyleVariables;
59
+ css?: AppHostCss;
60
+ [key: string]: unknown;
61
+ }
36
62
  /** Host-provided presentation hints. These are not verified identity or policy. */
37
63
  export interface AppHostContext {
38
- theme?: "light" | "dark";
39
- styles?: {
40
- variables?: Record<string, string | undefined>;
41
- css?: {
42
- fonts?: string;
43
- };
44
- };
64
+ theme?: AppTheme;
65
+ styles?: AppHostStyles;
45
66
  locale?: string;
46
67
  timeZone?: string;
47
68
  displayMode?: AppDisplayMode;
@@ -70,8 +91,18 @@ export interface AppHostContext {
70
91
  };
71
92
  [key: string]: unknown;
72
93
  }
94
+ /** Content kinds a host advertises for message and model-context actions. */
95
+ export interface AppContentModalities {
96
+ text?: Record<string, unknown>;
97
+ image?: Record<string, unknown>;
98
+ audio?: Record<string, unknown>;
99
+ resource?: Record<string, unknown>;
100
+ resourceLink?: Record<string, unknown>;
101
+ structuredContent?: Record<string, unknown>;
102
+ }
73
103
  /** Capabilities negotiated by the host on the iframe channel. */
74
104
  export interface AppHostCapabilities {
105
+ experimental?: Record<string, object>;
75
106
  serverTools?: {
76
107
  listChanged?: boolean;
77
108
  };
@@ -79,7 +110,17 @@ export interface AppHostCapabilities {
79
110
  listChanged?: boolean;
80
111
  };
81
112
  openLinks?: Record<string, unknown>;
113
+ downloadFile?: Record<string, unknown>;
82
114
  logging?: Record<string, unknown>;
115
+ sandbox?: {
116
+ permissions?: AppResourcePermissions;
117
+ csp?: AppResourceCsp;
118
+ };
119
+ updateModelContext?: AppContentModalities;
120
+ message?: AppContentModalities;
121
+ sampling?: {
122
+ tools?: Record<string, unknown>;
123
+ };
83
124
  [key: string]: unknown;
84
125
  }
85
126
  /** Tool envelope delivered by the host; structured data can be omitted by legacy conversion. */
@@ -105,3 +146,23 @@ export interface AppInitializeResult {
105
146
  hostCapabilities: AppHostCapabilities;
106
147
  hostContext?: AppHostContext;
107
148
  }
149
+ /** User message submitted through the host; sending can trigger a model follow-up. */
150
+ export interface AppMessageParams {
151
+ role: "user";
152
+ content: readonly ContentBlock[];
153
+ }
154
+ /** Replacement context for future model turns. An empty object can clear prior app context. */
155
+ export interface AppModelContextParams {
156
+ content?: readonly ContentBlock[];
157
+ structuredContent?: Record<string, unknown>;
158
+ }
159
+ /** Full host acknowledgement; explicit denials may resolve with isError. RPC errors reject. */
160
+ export interface AppActionResult {
161
+ isError?: boolean;
162
+ [key: string]: unknown;
163
+ }
164
+ /** Actual display mode selected by the host, which can differ from the requested mode. */
165
+ export interface AppDisplayModeResult {
166
+ mode: AppDisplayMode;
167
+ [key: string]: unknown;
168
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolgrain/protocol",
3
- "version": "0.3.0-alpha.2",
3
+ "version": "0.3.0",
4
4
  "description": "Pinned MCP wire types, protocol versions, and upstream provenance for Toolgrain.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -22,7 +22,7 @@
22
22
  "publishConfig": {
23
23
  "access": "public",
24
24
  "registry": "https://registry.npmjs.org/",
25
- "tag": "alpha"
25
+ "tag": "latest"
26
26
  },
27
27
  "type": "module",
28
28
  "exports": {