@toolgrain/protocol 0.3.0-alpha.1 → 0.3.0-alpha.3
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 +25 -0
- package/README.md +28 -0
- package/dist/apps-provenance.json +15 -0
- package/dist/apps.d.ts +168 -0
- package/dist/apps.js +6 -0
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @toolgrain/protocol
|
|
2
2
|
|
|
3
|
+
## 0.3.0-alpha.3
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 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 the published React alpha, matching-version installation, resource
|
|
16
|
+
metadata examples, and implemented versus deferred React protocol features.
|
|
17
|
+
- 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
|
+
|
|
22
|
+
## 0.3.0-alpha.2
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- Add native MCP Apps protocol contracts and typed React widgets with shared-entry routing.
|
|
27
|
+
|
|
3
28
|
## 0.3.0-alpha.1
|
|
4
29
|
|
|
5
30
|
No changes in this release.
|
package/README.md
CHANGED
|
@@ -57,6 +57,34 @@ 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
|
+
The `0.3.0-alpha.3` candidate 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. These new exports are absent
|
|
71
|
+
from published `0.3.0-alpha.2`.
|
|
72
|
+
|
|
73
|
+
`AppResourceMeta` describes CSP, requested browser permissions, sandbox origin,
|
|
74
|
+
and border preference. Tool `_meta.ui` uses `AppToolMeta` for `resourceUri` and
|
|
75
|
+
visibility; CSP and permissions belong on the resource content item.
|
|
76
|
+
|
|
77
|
+
The `0.3.0-alpha.3` candidate adds named resource CSP/permission, host styling,
|
|
78
|
+
theme-token, and content-modality types. They are not additional
|
|
79
|
+
browser actions in the published `0.3.0-alpha.2`. Known styling tokens support
|
|
80
|
+
autocomplete while custom variables and unknown host capability fields remain
|
|
81
|
+
accepted for forward compatibility.
|
|
82
|
+
|
|
83
|
+
The package retains `dist/apps-provenance.json` with exact reviewed specification
|
|
84
|
+
and upstream type-file commits/checksums. The declarations are Toolgrain-authored;
|
|
85
|
+
no Apps SDK implementation is vendored and there are no runtime dependencies.
|
|
86
|
+
See the [Apps API reference](https://toolgrain.mintlify.site/mcp-apps/reference).
|
|
87
|
+
|
|
60
88
|
## Requirements
|
|
61
89
|
|
|
62
90
|
ESM only. Supported application runtimes are Node.js `^24.20.0` or Bun
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"revision": "2026-01-26",
|
|
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
|
+
},
|
|
12
|
+
"apiReference": "https://apps.extensions.modelcontextprotocol.io/api/",
|
|
13
|
+
"implementation": "Toolgrain-authored wire declarations derived from the reviewed specification and type contracts; no upstream implementation is vendored.",
|
|
14
|
+
"reviewed": "2026-11-07"
|
|
15
|
+
}
|
package/dist/apps.d.ts
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
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
|
+
*/
|
|
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
|
+
/** 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>;
|
|
34
|
+
}
|
|
35
|
+
/** Requested sandbox configuration on a resource content item's `_meta.ui`. */
|
|
36
|
+
export interface AppResourceMeta {
|
|
37
|
+
csp?: AppResourceCsp;
|
|
38
|
+
permissions?: AppResourcePermissions;
|
|
39
|
+
domain?: string;
|
|
40
|
+
/** Request a host-provided border/background; omission leaves the choice to the host. */
|
|
41
|
+
prefersBorder?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/** Display modes of the iframe view. */
|
|
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
|
+
}
|
|
62
|
+
/** Host-provided presentation hints. These are not verified identity or policy. */
|
|
63
|
+
export interface AppHostContext {
|
|
64
|
+
theme?: AppTheme;
|
|
65
|
+
styles?: AppHostStyles;
|
|
66
|
+
locale?: string;
|
|
67
|
+
timeZone?: string;
|
|
68
|
+
displayMode?: AppDisplayMode;
|
|
69
|
+
availableDisplayModes?: AppDisplayMode[];
|
|
70
|
+
containerDimensions?: {
|
|
71
|
+
width?: number;
|
|
72
|
+
maxWidth?: number;
|
|
73
|
+
height?: number;
|
|
74
|
+
maxHeight?: number;
|
|
75
|
+
};
|
|
76
|
+
platform?: "web" | "desktop" | "mobile";
|
|
77
|
+
deviceCapabilities?: {
|
|
78
|
+
touch?: boolean;
|
|
79
|
+
hover?: boolean;
|
|
80
|
+
};
|
|
81
|
+
safeAreaInsets?: {
|
|
82
|
+
top: number;
|
|
83
|
+
right: number;
|
|
84
|
+
bottom: number;
|
|
85
|
+
left: number;
|
|
86
|
+
};
|
|
87
|
+
userAgent?: string;
|
|
88
|
+
toolInfo?: {
|
|
89
|
+
id?: string | number;
|
|
90
|
+
tool: Tool;
|
|
91
|
+
};
|
|
92
|
+
[key: string]: unknown;
|
|
93
|
+
}
|
|
94
|
+
/** Content kinds a host advertises for an optional action; this declares no React action API. */
|
|
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
|
+
}
|
|
103
|
+
/** Capabilities negotiated by the host on the iframe channel. */
|
|
104
|
+
export interface AppHostCapabilities {
|
|
105
|
+
experimental?: Record<string, object>;
|
|
106
|
+
serverTools?: {
|
|
107
|
+
listChanged?: boolean;
|
|
108
|
+
};
|
|
109
|
+
serverResources?: {
|
|
110
|
+
listChanged?: boolean;
|
|
111
|
+
};
|
|
112
|
+
openLinks?: Record<string, unknown>;
|
|
113
|
+
downloadFile?: Record<string, unknown>;
|
|
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
|
+
};
|
|
124
|
+
[key: string]: unknown;
|
|
125
|
+
}
|
|
126
|
+
/** Tool envelope delivered by the host; structured data can be omitted by legacy conversion. */
|
|
127
|
+
export interface AppToolResult<Structured = unknown, Meta = MetaObject> {
|
|
128
|
+
content: ContentBlock[];
|
|
129
|
+
structuredContent?: Structured;
|
|
130
|
+
_meta?: Meta;
|
|
131
|
+
isError?: boolean;
|
|
132
|
+
[key: string]: unknown;
|
|
133
|
+
}
|
|
134
|
+
/** View-to-host Apps handshake parameters. */
|
|
135
|
+
export interface AppInitializeParams {
|
|
136
|
+
protocolVersion: typeof APPS_PROTOCOL_VERSION;
|
|
137
|
+
appInfo: Implementation;
|
|
138
|
+
appCapabilities: {
|
|
139
|
+
availableDisplayModes?: AppDisplayMode[];
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/** Host-to-view Apps handshake response. */
|
|
143
|
+
export interface AppInitializeResult {
|
|
144
|
+
protocolVersion: string;
|
|
145
|
+
hostInfo: Implementation;
|
|
146
|
+
hostCapabilities: AppHostCapabilities;
|
|
147
|
+
hostContext?: AppHostContext;
|
|
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/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.
|
|
3
|
+
"version": "0.3.0-alpha.3",
|
|
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": [
|