@dudko.dev/agent-web-react 0.0.29 → 0.0.30

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.
@@ -0,0 +1,55 @@
1
+ /**
2
+ * MCP Apps: what the host (the page, `mcp-app.ts`) and the sandbox proxy (a page on ANOTHER
3
+ * origin, `mcp-app-sandbox.ts`) must agree on - the app's Content-Security-Policy, the policy as a
4
+ * path segment of the proxy's URL, and the names of the sandbox messages. Pure code with NO
5
+ * imports at all: the proxy's server bundles it without React or the core (a Worker), so the
6
+ * origin rule below is a copy of the core's `mcpAppOrigin`, and `tests/apps-sandbox.test.ts`
7
+ * holds the two to the same answers.
8
+ */
9
+ /** The proxy tells the host it can take the app (Sandbox → Host; content-free). */
10
+ declare const MCP_APP_SANDBOX_PROXY_READY = "ui/notifications/sandbox-proxy-ready";
11
+ /** The host hands the proxy the app's HTML (Host → Sandbox), once. */
12
+ declare const MCP_APP_SANDBOX_RESOURCE_READY = "ui/notifications/sandbox-resource-ready";
13
+ /** The specification reserves these between a host and its proxy: never relayed to or from an app. */
14
+ declare const isMcpAppSandboxMessage: (data: unknown) => boolean;
15
+ /** The origins an app's policy grants, each already an origin (`mcpAppPolicyOrigin`). */
16
+ interface McpAppPolicyOrigins {
17
+ /** `fetch` / XHR / WebSocket (`connect-src`). */
18
+ connect: string[];
19
+ /** Scripts, styles, images, fonts, media. */
20
+ resources: string[];
21
+ }
22
+ /**
23
+ * The policy of an app's document: scripts and styles inline, `data:` / `blob:` media, and the
24
+ * network ONLY where the resource declared it. Nested frames, workers, plugins, forms and `<base>`
25
+ * are refused whatever was declared (a frame the app may embed would also be a place it may
26
+ * navigate itself to). The lists must already be checked origins: nothing here re-checks them.
27
+ */
28
+ declare const mcpAppPolicy: ({ connect, resources }: McpAppPolicyOrigins) => string;
29
+ /**
30
+ * One declared CSP entry as a source expression a policy may carry, or `undefined`: only an
31
+ * origin (`https://` / `wss://`, a `*.` wildcard over at least two labels, or `http://` /
32
+ * `ws://` on loopback). The same answers as the core's `mcpAppOrigin`, for the proxy's server.
33
+ */
34
+ declare const mcpAppPolicyOrigin: (entry: unknown) => string | undefined;
35
+ /** At most this many origins per list (the core's `MCP_APP_MAX_DOMAINS`). */
36
+ declare const MCP_APP_POLICY_MAX_ORIGINS = 32;
37
+ /** A policy token longer than this is not put in a URL: the app runs without its own origin. */
38
+ declare const MCP_APP_POLICY_TOKEN_MAX_CHARS = 4096;
39
+ /**
40
+ * The policy as one path segment (base64url of `{"c":[…],"r":[…]}`), or `undefined` when it does
41
+ * not fit. It is in the PATH, not the query, because a `frame-src` source expression matches a
42
+ * path exactly and ignores the query: the host pins the proxy's frame to this one URL, so nothing
43
+ * inside the frame can load the proxy page with a policy of its choosing.
44
+ */
45
+ declare const mcpAppPolicyToken: ({ connect, resources, }: McpAppPolicyOrigins) => string | undefined;
46
+ /**
47
+ * The policy a token stands for, or `undefined` for anything that is not exactly what
48
+ * `mcpAppPolicyToken` writes: base64url of an object with the two lists and nothing else, every
49
+ * entry an origin by the rule above, no more than `MCP_APP_POLICY_MAX_ORIGINS` each, the
50
+ * canonical encoding (one URL per policy).
51
+ */
52
+ declare const mcpAppPolicyOfToken: (token: unknown) => McpAppPolicyOrigins | undefined;
53
+
54
+ export { MCP_APP_POLICY_TOKEN_MAX_CHARS as M, MCP_APP_SANDBOX_PROXY_READY as a, MCP_APP_SANDBOX_RESOURCE_READY as b, MCP_APP_POLICY_MAX_ORIGINS as d, mcpAppPolicy as e, mcpAppPolicyOfToken as f, mcpAppPolicyOrigin as g, isMcpAppSandboxMessage as i, mcpAppPolicyToken as m };
55
+ export type { McpAppPolicyOrigins as c };
@@ -0,0 +1,55 @@
1
+ /**
2
+ * MCP Apps: what the host (the page, `mcp-app.ts`) and the sandbox proxy (a page on ANOTHER
3
+ * origin, `mcp-app-sandbox.ts`) must agree on - the app's Content-Security-Policy, the policy as a
4
+ * path segment of the proxy's URL, and the names of the sandbox messages. Pure code with NO
5
+ * imports at all: the proxy's server bundles it without React or the core (a Worker), so the
6
+ * origin rule below is a copy of the core's `mcpAppOrigin`, and `tests/apps-sandbox.test.ts`
7
+ * holds the two to the same answers.
8
+ */
9
+ /** The proxy tells the host it can take the app (Sandbox → Host; content-free). */
10
+ declare const MCP_APP_SANDBOX_PROXY_READY = "ui/notifications/sandbox-proxy-ready";
11
+ /** The host hands the proxy the app's HTML (Host → Sandbox), once. */
12
+ declare const MCP_APP_SANDBOX_RESOURCE_READY = "ui/notifications/sandbox-resource-ready";
13
+ /** The specification reserves these between a host and its proxy: never relayed to or from an app. */
14
+ declare const isMcpAppSandboxMessage: (data: unknown) => boolean;
15
+ /** The origins an app's policy grants, each already an origin (`mcpAppPolicyOrigin`). */
16
+ interface McpAppPolicyOrigins {
17
+ /** `fetch` / XHR / WebSocket (`connect-src`). */
18
+ connect: string[];
19
+ /** Scripts, styles, images, fonts, media. */
20
+ resources: string[];
21
+ }
22
+ /**
23
+ * The policy of an app's document: scripts and styles inline, `data:` / `blob:` media, and the
24
+ * network ONLY where the resource declared it. Nested frames, workers, plugins, forms and `<base>`
25
+ * are refused whatever was declared (a frame the app may embed would also be a place it may
26
+ * navigate itself to). The lists must already be checked origins: nothing here re-checks them.
27
+ */
28
+ declare const mcpAppPolicy: ({ connect, resources }: McpAppPolicyOrigins) => string;
29
+ /**
30
+ * One declared CSP entry as a source expression a policy may carry, or `undefined`: only an
31
+ * origin (`https://` / `wss://`, a `*.` wildcard over at least two labels, or `http://` /
32
+ * `ws://` on loopback). The same answers as the core's `mcpAppOrigin`, for the proxy's server.
33
+ */
34
+ declare const mcpAppPolicyOrigin: (entry: unknown) => string | undefined;
35
+ /** At most this many origins per list (the core's `MCP_APP_MAX_DOMAINS`). */
36
+ declare const MCP_APP_POLICY_MAX_ORIGINS = 32;
37
+ /** A policy token longer than this is not put in a URL: the app runs without its own origin. */
38
+ declare const MCP_APP_POLICY_TOKEN_MAX_CHARS = 4096;
39
+ /**
40
+ * The policy as one path segment (base64url of `{"c":[…],"r":[…]}`), or `undefined` when it does
41
+ * not fit. It is in the PATH, not the query, because a `frame-src` source expression matches a
42
+ * path exactly and ignores the query: the host pins the proxy's frame to this one URL, so nothing
43
+ * inside the frame can load the proxy page with a policy of its choosing.
44
+ */
45
+ declare const mcpAppPolicyToken: ({ connect, resources, }: McpAppPolicyOrigins) => string | undefined;
46
+ /**
47
+ * The policy a token stands for, or `undefined` for anything that is not exactly what
48
+ * `mcpAppPolicyToken` writes: base64url of an object with the two lists and nothing else, every
49
+ * entry an origin by the rule above, no more than `MCP_APP_POLICY_MAX_ORIGINS` each, the
50
+ * canonical encoding (one URL per policy).
51
+ */
52
+ declare const mcpAppPolicyOfToken: (token: unknown) => McpAppPolicyOrigins | undefined;
53
+
54
+ export { MCP_APP_POLICY_TOKEN_MAX_CHARS as M, MCP_APP_SANDBOX_PROXY_READY as a, MCP_APP_SANDBOX_RESOURCE_READY as b, MCP_APP_POLICY_MAX_ORIGINS as d, mcpAppPolicy as e, mcpAppPolicyOfToken as f, mcpAppPolicyOrigin as g, isMcpAppSandboxMessage as i, mcpAppPolicyToken as m };
55
+ export type { McpAppPolicyOrigins as c };
@@ -0,0 +1,313 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/mcp-app-sandbox.ts
21
+ var mcp_app_sandbox_exports = {};
22
+ __export(mcp_app_sandbox_exports, {
23
+ MCP_APP_POLICY_MAX_ORIGINS: () => MCP_APP_POLICY_MAX_ORIGINS,
24
+ MCP_APP_POLICY_TOKEN_MAX_CHARS: () => MCP_APP_POLICY_TOKEN_MAX_CHARS,
25
+ MCP_APP_SANDBOX_PERMISSIONS_POLICY: () => MCP_APP_SANDBOX_PERMISSIONS_POLICY,
26
+ MCP_APP_SANDBOX_PROXY_READY: () => MCP_APP_SANDBOX_PROXY_READY,
27
+ MCP_APP_SANDBOX_RESOURCE_READY: () => MCP_APP_SANDBOX_RESOURCE_READY,
28
+ MCP_APP_SANDBOX_SCRIPT: () => MCP_APP_SANDBOX_SCRIPT,
29
+ isMcpAppSandboxHost: () => isMcpAppSandboxHost,
30
+ isMcpAppSandboxMessage: () => isMcpAppSandboxMessage,
31
+ mcpAppPolicy: () => mcpAppPolicy,
32
+ mcpAppPolicyOfToken: () => mcpAppPolicyOfToken,
33
+ mcpAppPolicyOrigin: () => mcpAppPolicyOrigin,
34
+ mcpAppPolicyToken: () => mcpAppPolicyToken,
35
+ mcpAppSandboxHeaders: () => mcpAppSandboxHeaders,
36
+ mcpAppSandboxPage: () => mcpAppSandboxPage,
37
+ mcpAppSandboxResponse: () => mcpAppSandboxResponse,
38
+ parseMcpAppSandboxHosts: () => parseMcpAppSandboxHosts
39
+ });
40
+ module.exports = __toCommonJS(mcp_app_sandbox_exports);
41
+
42
+ // src/mcp-app-policy.ts
43
+ var MCP_APP_SANDBOX_PROXY_READY = "ui/notifications/sandbox-proxy-ready";
44
+ var MCP_APP_SANDBOX_RESOURCE_READY = "ui/notifications/sandbox-resource-ready";
45
+ var isMcpAppSandboxMessage = (data) => typeof data === "object" && data !== null && typeof data.method === "string" && data.method.startsWith("ui/notifications/sandbox-");
46
+ var mcpAppPolicy = ({ connect, resources }) => {
47
+ const from = resources.length > 0 ? ` ${resources.join(" ")}` : "";
48
+ return [
49
+ "default-src 'none'",
50
+ `script-src 'unsafe-inline'${from}`,
51
+ `style-src 'unsafe-inline'${from}`,
52
+ `img-src data: blob:${from}`,
53
+ `font-src data:${from}`,
54
+ `media-src data: blob:${from}`,
55
+ connect.length > 0 ? `connect-src ${connect.join(" ")}` : "connect-src 'none'",
56
+ "frame-src 'none'",
57
+ "child-src 'none'",
58
+ "worker-src 'none'",
59
+ "object-src 'none'",
60
+ "form-action 'none'",
61
+ "base-uri 'none'",
62
+ "webrtc 'block'"
63
+ ].join("; ");
64
+ };
65
+ var LABEL = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
66
+ var HOST = `(?:\\*\\.)?${LABEL}(?:\\.${LABEL})*`;
67
+ var PORT = "(?::\\d{1,5})?";
68
+ var SECURE_ORIGIN = new RegExp(`^(?:https|wss)://${HOST}${PORT}$`);
69
+ var LOOPBACK_ORIGIN = new RegExp(`^(?:http|ws)://(?:localhost|127\\.0\\.0\\.1|\\[::1\\])${PORT}$`);
70
+ var mcpAppPolicyOrigin = (entry) => {
71
+ if (typeof entry !== "string" || entry.length > 300) return void 0;
72
+ const value = entry.trim().toLowerCase().replace(/\/$/, "");
73
+ if (SECURE_ORIGIN.test(value)) {
74
+ const host = value.replace(/^[a-z]+:\/\//, "").replace(/:\d+$/, "");
75
+ if (host.startsWith("*.") && !host.slice(2).includes(".")) return void 0;
76
+ return value;
77
+ }
78
+ return LOOPBACK_ORIGIN.test(value) ? value : void 0;
79
+ };
80
+ var MCP_APP_POLICY_MAX_ORIGINS = 32;
81
+ var MCP_APP_POLICY_TOKEN_MAX_CHARS = 4096;
82
+ var B64URL = /^[A-Za-z0-9_-]+$/;
83
+ var mcpAppPolicyToken = ({
84
+ connect,
85
+ resources
86
+ }) => {
87
+ const json2 = JSON.stringify({ c: connect, r: resources });
88
+ if (/[^\x20-\x7e]/.test(json2)) return void 0;
89
+ const token = btoa(json2).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
90
+ return token.length <= MCP_APP_POLICY_TOKEN_MAX_CHARS ? token : void 0;
91
+ };
92
+ var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
93
+ var originList = (value) => {
94
+ if (!Array.isArray(value) || value.length > MCP_APP_POLICY_MAX_ORIGINS) return void 0;
95
+ const out = [];
96
+ for (const entry of value) {
97
+ if (typeof entry !== "string" || mcpAppPolicyOrigin(entry) !== entry || out.includes(entry)) {
98
+ return void 0;
99
+ }
100
+ out.push(entry);
101
+ }
102
+ return out;
103
+ };
104
+ var mcpAppPolicyOfToken = (token) => {
105
+ if (typeof token !== "string" || token.length === 0 || token.length > MCP_APP_POLICY_TOKEN_MAX_CHARS || !B64URL.test(token)) {
106
+ return void 0;
107
+ }
108
+ let parsed;
109
+ try {
110
+ parsed = JSON.parse(atob(token.replace(/-/g, "+").replace(/_/g, "/")));
111
+ } catch {
112
+ return void 0;
113
+ }
114
+ if (!isObject(parsed)) return void 0;
115
+ const keys = Object.keys(parsed);
116
+ if (keys.length !== 2 || !keys.includes("c") || !keys.includes("r")) return void 0;
117
+ const connect = originList(parsed.c);
118
+ const resources = originList(parsed.r);
119
+ if (!connect || !resources) return void 0;
120
+ const policy = { connect, resources };
121
+ return mcpAppPolicyToken(policy) === token ? policy : void 0;
122
+ };
123
+
124
+ // src/mcp-app-sandbox.ts
125
+ var LABEL2 = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
126
+ var NAME = `${LABEL2}(?:\\.${LABEL2})+`;
127
+ var EXACT_HTTPS = new RegExp(`^https://${LABEL2}(?:\\.${LABEL2})*(?::\\d{1,5})?$`);
128
+ var EXACT_LOOPBACK = /^http:\/\/(?:localhost|127\.0\.0\.1)(?::\d{1,5})?$/;
129
+ var PATTERN = new RegExp(`^https://([a-z0-9-]{0,40})\\*([a-z0-9-]{0,40})\\.(${NAME})$`);
130
+ var parseMcpAppSandboxHosts = (value) => {
131
+ const entries = (typeof value === "string" ? value.split(/[\s,]+/) : [...value ?? []]).map((e) => typeof e === "string" ? e.trim() : "").filter(Boolean);
132
+ const hosts = { origins: [], patterns: [], frameAncestors: [], invalid: [] };
133
+ const ancestor = (source) => {
134
+ if (!hosts.frameAncestors.includes(source)) hosts.frameAncestors.push(source);
135
+ };
136
+ for (const raw of entries) {
137
+ const entry = raw.toLowerCase().replace(/\/$/, "");
138
+ const pattern = PATTERN.exec(entry);
139
+ if (pattern) {
140
+ const [, prefix, suffix, rest] = pattern;
141
+ if (!hosts.patterns.some((p) => p.prefix === prefix && p.suffix === suffix && p.rest === rest)) {
142
+ hosts.patterns.push({ prefix, suffix, rest });
143
+ }
144
+ ancestor(`https://*.${rest}`);
145
+ } else if (EXACT_HTTPS.test(entry) || EXACT_LOOPBACK.test(entry)) {
146
+ if (!hosts.origins.includes(entry)) hosts.origins.push(entry);
147
+ ancestor(entry);
148
+ } else {
149
+ hosts.invalid.push(raw.slice(0, 120));
150
+ }
151
+ }
152
+ return hosts;
153
+ };
154
+ var isMcpAppSandboxHost = (hosts, origin) => {
155
+ if (hosts.origins.includes(origin)) return true;
156
+ const head = "https://";
157
+ for (const p of hosts.patterns) {
158
+ const tail = `.${p.rest}`;
159
+ if (!origin.startsWith(head) || !origin.endsWith(tail)) continue;
160
+ const label = origin.slice(head.length, origin.length - tail.length);
161
+ if (label.length > 63 || !label.startsWith(p.prefix) || !label.endsWith(p.suffix)) continue;
162
+ const middle = label.slice(p.prefix.length, label.length - p.suffix.length);
163
+ if (/^[a-z0-9-]+$/.test(middle)) return true;
164
+ }
165
+ return false;
166
+ };
167
+ var MCP_APP_SANDBOX_SCRIPT = `(function () {
168
+ 'use strict'
169
+ var READY = ${JSON.stringify(MCP_APP_SANDBOX_PROXY_READY)}
170
+ var RESOURCE = ${JSON.stringify(MCP_APP_SANDBOX_RESOURCE_READY)}
171
+ var RESERVED = 'ui/notifications/sandbox-'
172
+ var me = window
173
+ if (me.parent === me) return
174
+ var cfg
175
+ try {
176
+ cfg = JSON.parse(document.getElementById('mcp-app-sandbox-hosts').textContent)
177
+ } catch (e) {
178
+ return
179
+ }
180
+ var origins = cfg && Array.isArray(cfg.origins) ? cfg.origins : []
181
+ var patterns = cfg && Array.isArray(cfg.patterns) ? cfg.patterns : []
182
+ function allowed(origin) {
183
+ if (typeof origin !== 'string') return false
184
+ if (origins.indexOf(origin) >= 0) return true
185
+ for (var i = 0; i < patterns.length; i++) {
186
+ var p = patterns[i]
187
+ var head = 'https://'
188
+ var tail = '.' + p.rest
189
+ if (origin.indexOf(head) !== 0 || origin.length <= head.length + tail.length) continue
190
+ if (origin.slice(origin.length - tail.length) !== tail) continue
191
+ var label = origin.slice(head.length, origin.length - tail.length)
192
+ if (label.length > 63 || label.indexOf(p.prefix) !== 0) continue
193
+ if (label.slice(label.length - p.suffix.length) !== p.suffix) continue
194
+ if (/^[a-z0-9-]+$/.test(label.slice(p.prefix.length, label.length - p.suffix.length))) return true
195
+ }
196
+ return false
197
+ }
198
+ var ancestors = []
199
+ for (var w = me.parent; ancestors.length < 32; w = w.parent) {
200
+ ancestors.push(w)
201
+ if (w === w.parent) break
202
+ }
203
+ function ancestor(source) {
204
+ for (var i = 0; i < ancestors.length; i++) if (ancestors[i] === source) return true
205
+ return false
206
+ }
207
+ function reserved(d) {
208
+ return !!d && typeof d === 'object' && typeof d.method === 'string' && d.method.indexOf(RESERVED) === 0
209
+ }
210
+ var OWN = me.origin
211
+ var host = null
212
+ var hostOrigin = ''
213
+ var app = null
214
+ me.addEventListener('message', function (e) {
215
+ var d = e.data
216
+ if (app && e.source === app) {
217
+ if (e.origin !== OWN || reserved(d)) return
218
+ host.postMessage(d, hostOrigin)
219
+ return
220
+ }
221
+ if (host) {
222
+ if (e.source !== host || e.origin !== hostOrigin || reserved(d) || !app) return
223
+ app.postMessage(d, OWN)
224
+ return
225
+ }
226
+ if (!d || typeof d !== 'object' || d.jsonrpc !== '2.0' || d.method !== RESOURCE) return
227
+ if (!ancestor(e.source) || !allowed(e.origin)) return
228
+ var p = d.params
229
+ if (!p || typeof p !== 'object' || typeof p.html !== 'string') return
230
+ host = e.source
231
+ hostOrigin = e.origin
232
+ var frame = document.createElement('iframe')
233
+ frame.id = 'app'
234
+ frame.setAttribute('sandbox', 'allow-scripts allow-same-origin')
235
+ frame.setAttribute('referrerpolicy', 'no-referrer')
236
+ frame.setAttribute('title', 'MCP App')
237
+ document.body.appendChild(frame)
238
+ app = frame.contentWindow
239
+ var doc = frame.contentDocument
240
+ doc.open()
241
+ doc.write(p.html)
242
+ doc.close()
243
+ })
244
+ var ready = { jsonrpc: '2.0', method: READY, params: {} }
245
+ for (var i = 0; i < ancestors.length; i++) ancestors[i].postMessage(ready, '*')
246
+ })()`;
247
+ var json = (value) => JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026");
248
+ var mcpAppSandboxPage = (hosts) => `<!doctype html><html><head><meta charset="utf-8"><meta name="robots" content="noindex"><title>MCP App sandbox</title><style>html,body{margin:0;height:100%;overflow:hidden;background:transparent}iframe{display:block;border:0;width:100%;height:100%}</style></head><body><script type="application/json" id="mcp-app-sandbox-hosts">${json({
249
+ origins: hosts.origins,
250
+ patterns: hosts.patterns
251
+ })}</script><script>${MCP_APP_SANDBOX_SCRIPT}</script></body></html>`;
252
+ var MCP_APP_SANDBOX_PERMISSIONS_POLICY = "camera=(), microphone=(), geolocation=(), display-capture=(), payment=(), usb=(), serial=(), midi=()";
253
+ var COMMON = {
254
+ "X-Content-Type-Options": "nosniff",
255
+ "X-Robots-Tag": "noindex, nofollow",
256
+ "Referrer-Policy": "no-referrer",
257
+ "Cache-Control": "no-store"
258
+ };
259
+ var mcpAppSandboxHeaders = (policy, hosts) => ({
260
+ "Content-Type": "text/html; charset=utf-8",
261
+ "Content-Security-Policy": `${mcpAppPolicy(policy)}; frame-ancestors ${hosts.frameAncestors.length > 0 ? hosts.frameAncestors.join(" ") : "'none'"}`,
262
+ "Permissions-Policy": MCP_APP_SANDBOX_PERMISSIONS_POLICY,
263
+ ...COMMON
264
+ });
265
+ var plain = (status, text, extra = {}) => new Response(text, {
266
+ status,
267
+ headers: {
268
+ "Content-Type": "text/plain; charset=utf-8",
269
+ "Content-Security-Policy": "default-src 'none'; frame-ancestors 'none'",
270
+ ...COMMON,
271
+ ...extra
272
+ }
273
+ });
274
+ var mcpAppSandboxResponse = (request, options) => {
275
+ const { pathname } = new URL(request.url);
276
+ const base = options.path.replace(/\/+$/, "");
277
+ if (!pathname.startsWith(`${base}/`)) return plain(404, "Not found");
278
+ const token = pathname.slice(base.length + 1);
279
+ if (token.length === 0 || token.includes("/")) return plain(404, "Not found");
280
+ if (request.method !== "GET" && request.method !== "HEAD") {
281
+ return plain(405, "Method not allowed", { Allow: "GET, HEAD" });
282
+ }
283
+ const policy = mcpAppPolicyOfToken(token);
284
+ if (!policy) return plain(400, "Not a policy this sandbox serves");
285
+ const hosts = parseMcpAppSandboxHosts(options.hosts);
286
+ if (hosts.invalid.length > 0 || hosts.frameAncestors.length === 0) {
287
+ return plain(503, "This sandbox has no valid allowed host origins");
288
+ }
289
+ return new Response(request.method === "HEAD" ? null : mcpAppSandboxPage(hosts), {
290
+ status: 200,
291
+ headers: mcpAppSandboxHeaders(policy, hosts)
292
+ });
293
+ };
294
+ // Annotate the CommonJS export names for ESM import in node:
295
+ 0 && (module.exports = {
296
+ MCP_APP_POLICY_MAX_ORIGINS,
297
+ MCP_APP_POLICY_TOKEN_MAX_CHARS,
298
+ MCP_APP_SANDBOX_PERMISSIONS_POLICY,
299
+ MCP_APP_SANDBOX_PROXY_READY,
300
+ MCP_APP_SANDBOX_RESOURCE_READY,
301
+ MCP_APP_SANDBOX_SCRIPT,
302
+ isMcpAppSandboxHost,
303
+ isMcpAppSandboxMessage,
304
+ mcpAppPolicy,
305
+ mcpAppPolicyOfToken,
306
+ mcpAppPolicyOrigin,
307
+ mcpAppPolicyToken,
308
+ mcpAppSandboxHeaders,
309
+ mcpAppSandboxPage,
310
+ mcpAppSandboxResponse,
311
+ parseMcpAppSandboxHosts
312
+ });
313
+ //# sourceMappingURL=mcp-app-sandbox.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/mcp-app-sandbox.ts","../src/mcp-app-policy.ts"],"sourcesContent":["import {\n isMcpAppSandboxMessage,\n MCP_APP_POLICY_MAX_ORIGINS,\n MCP_APP_POLICY_TOKEN_MAX_CHARS,\n MCP_APP_SANDBOX_PROXY_READY,\n MCP_APP_SANDBOX_RESOURCE_READY,\n mcpAppPolicy,\n mcpAppPolicyOfToken,\n mcpAppPolicyOrigin,\n mcpAppPolicyToken,\n type McpAppPolicyOrigins,\n} from './mcp-app-policy.js'\n\n/**\n * The `./mcp-app-sandbox` entry: the MCP Apps sandbox proxy - the page a host serves on ANOTHER\n * origin, so that an app runs on an origin of its own (storage, cookies, a real `Origin`) and not\n * in an opaque one. Framework-free, no imports but `mcp-app-policy.ts`: a Cloudflare Worker, Deno,\n * Bun or Node (18+) serves it with `mcpAppSandboxResponse` (Request in, Response out).\n *\n * The page, `<base>/<policy>` (`<policy>` = `mcpAppPolicyToken`):\n *\n * 1. Its response carries the app's policy as a HEADER, built from the path (`mcpAppPolicy`), plus\n * `frame-ancestors` = the allowed host origins. The app's document is written into a frame\n * the page creates (`about:blank`, `document.write`), which INHERITS that policy - nothing the\n * app's markup says comes before it, and every document the app can reach on this origin\n * (this page, a reload of it, a frame of it) has a policy some host chose for that frame.\n * 2. Its script binds to the first ANCESTOR window on an allowed host origin that sends it\n * `ui/notifications/sandbox-resource-ready`, once; after that it relays the extension's\n * messages between that window (to its exact origin) and the app's window (to this origin),\n * never the `ui/notifications/sandbox-*` ones, and creates nothing else. It asks for\n * `ui/notifications/sandbox-proxy-ready` with a content-free message to every ancestor.\n * 3. The app's frame: `sandbox=\"allow-scripts allow-same-origin\"`, no `allow` attribute. The app\n * is same-origin with this page and can reach it - which is why the boundary is not here but\n * in what the HOST draws around it (the frame's sandbox, the shell's `frame-src` pinned to\n * this URL) and in the policy header above. A `sandbox`, `csp` or `permissions` the host sends\n * is ignored: the header is the policy, and no permission is ever granted.\n */\n\nexport {\n isMcpAppSandboxMessage,\n MCP_APP_POLICY_MAX_ORIGINS,\n MCP_APP_POLICY_TOKEN_MAX_CHARS,\n MCP_APP_SANDBOX_PROXY_READY,\n MCP_APP_SANDBOX_RESOURCE_READY,\n mcpAppPolicy,\n mcpAppPolicyOfToken,\n mcpAppPolicyOrigin,\n mcpAppPolicyToken,\n}\nexport type { McpAppPolicyOrigins }\n\n/** A host origin pattern: `https://<prefix>*<suffix>.<rest>`, `*` one run of `[a-z0-9-]`. */\nexport interface McpAppSandboxHostPattern {\n prefix: string\n suffix: string\n /** The rest of the host name after the first label: two labels at least. */\n rest: string\n}\n\n/** The host origins a sandbox page answers, as `parseMcpAppSandboxHosts` reads them. */\nexport interface McpAppSandboxHosts {\n /** Exact origins (`https://agent.example.com`, `http://127.0.0.1:4173`). */\n origins: string[]\n /** One-label patterns (`https://*-agents.example.workers.dev`). */\n patterns: McpAppSandboxHostPattern[]\n /** The same as `frame-ancestors` sources (a pattern widened to `https://*.<rest>`). */\n frameAncestors: string[]\n /** Entries that are neither: a sandbox with any of these refuses to serve (503). */\n invalid: string[]\n}\n\nconst LABEL = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?'\nconst NAME = `${LABEL}(?:\\\\.${LABEL})+`\nconst EXACT_HTTPS = new RegExp(`^https://${LABEL}(?:\\\\.${LABEL})*(?::\\\\d{1,5})?$`)\nconst EXACT_LOOPBACK = /^http:\\/\\/(?:localhost|127\\.0\\.0\\.1)(?::\\d{1,5})?$/\nconst PATTERN = new RegExp(`^https://([a-z0-9-]{0,40})\\\\*([a-z0-9-]{0,40})\\\\.(${NAME})$`)\n\n/**\n * The allowed host origins, from a list or a space / comma separated string (a deploy-time\n * setting, e.g. `ALLOWED_HOST_ORIGINS=\"https://agent.example.com https://*-agents.example.workers.dev\"`).\n * An entry is an exact origin - `https://`, or `http://` on `localhost` / `127.0.0.1` - or a\n * pattern with ONE `*` inside the first label of an `https://` host. The page's script holds the\n * pattern to one label (`[a-z0-9-]+`, no dot); `frame-ancestors` cannot say that, so there the\n * pattern is widened to `https://*.<rest>` (every subdomain of `<rest>`). Anything else is\n * `invalid`.\n */\nexport const parseMcpAppSandboxHosts = (\n value: string | readonly string[] | undefined,\n): McpAppSandboxHosts => {\n const entries = (typeof value === 'string' ? value.split(/[\\s,]+/) : [...(value ?? [])])\n .map((e) => (typeof e === 'string' ? e.trim() : ''))\n .filter(Boolean)\n const hosts: McpAppSandboxHosts = { origins: [], patterns: [], frameAncestors: [], invalid: [] }\n const ancestor = (source: string) => {\n if (!hosts.frameAncestors.includes(source)) hosts.frameAncestors.push(source)\n }\n for (const raw of entries) {\n const entry = raw.toLowerCase().replace(/\\/$/, '')\n const pattern = PATTERN.exec(entry)\n if (pattern) {\n const [, prefix, suffix, rest] = pattern\n if (\n !hosts.patterns.some((p) => p.prefix === prefix && p.suffix === suffix && p.rest === rest)\n ) {\n hosts.patterns.push({ prefix, suffix, rest })\n }\n ancestor(`https://*.${rest}`)\n } else if (EXACT_HTTPS.test(entry) || EXACT_LOOPBACK.test(entry)) {\n if (!hosts.origins.includes(entry)) hosts.origins.push(entry)\n ancestor(entry)\n } else {\n hosts.invalid.push(raw.slice(0, 120))\n }\n }\n return hosts\n}\n\n/** Whether an origin is one of the hosts (the same rule the page's script applies). */\nexport const isMcpAppSandboxHost = (hosts: McpAppSandboxHosts, origin: string): boolean => {\n if (hosts.origins.includes(origin)) return true\n const head = 'https://'\n for (const p of hosts.patterns) {\n const tail = `.${p.rest}`\n if (!origin.startsWith(head) || !origin.endsWith(tail)) continue\n const label = origin.slice(head.length, origin.length - tail.length)\n if (label.length > 63 || !label.startsWith(p.prefix) || !label.endsWith(p.suffix)) continue\n const middle = label.slice(p.prefix.length, label.length - p.suffix.length)\n if (/^[a-z0-9-]+$/.test(middle)) return true\n }\n return false\n}\n\n/**\n * The page's script (inline; it runs under the app's own policy, which allows inline scripts).\n * It reads the hosts from `#mcp-app-sandbox-hosts`, binds to the first allowed ancestor that sends\n * the resource, writes the app into its frame, and relays - see the entry's comment.\n */\nexport const MCP_APP_SANDBOX_SCRIPT = `(function () {\n 'use strict'\n var READY = ${JSON.stringify(MCP_APP_SANDBOX_PROXY_READY)}\n var RESOURCE = ${JSON.stringify(MCP_APP_SANDBOX_RESOURCE_READY)}\n var RESERVED = 'ui/notifications/sandbox-'\n var me = window\n if (me.parent === me) return\n var cfg\n try {\n cfg = JSON.parse(document.getElementById('mcp-app-sandbox-hosts').textContent)\n } catch (e) {\n return\n }\n var origins = cfg && Array.isArray(cfg.origins) ? cfg.origins : []\n var patterns = cfg && Array.isArray(cfg.patterns) ? cfg.patterns : []\n function allowed(origin) {\n if (typeof origin !== 'string') return false\n if (origins.indexOf(origin) >= 0) return true\n for (var i = 0; i < patterns.length; i++) {\n var p = patterns[i]\n var head = 'https://'\n var tail = '.' + p.rest\n if (origin.indexOf(head) !== 0 || origin.length <= head.length + tail.length) continue\n if (origin.slice(origin.length - tail.length) !== tail) continue\n var label = origin.slice(head.length, origin.length - tail.length)\n if (label.length > 63 || label.indexOf(p.prefix) !== 0) continue\n if (label.slice(label.length - p.suffix.length) !== p.suffix) continue\n if (/^[a-z0-9-]+$/.test(label.slice(p.prefix.length, label.length - p.suffix.length))) return true\n }\n return false\n }\n var ancestors = []\n for (var w = me.parent; ancestors.length < 32; w = w.parent) {\n ancestors.push(w)\n if (w === w.parent) break\n }\n function ancestor(source) {\n for (var i = 0; i < ancestors.length; i++) if (ancestors[i] === source) return true\n return false\n }\n function reserved(d) {\n return !!d && typeof d === 'object' && typeof d.method === 'string' && d.method.indexOf(RESERVED) === 0\n }\n var OWN = me.origin\n var host = null\n var hostOrigin = ''\n var app = null\n me.addEventListener('message', function (e) {\n var d = e.data\n if (app && e.source === app) {\n if (e.origin !== OWN || reserved(d)) return\n host.postMessage(d, hostOrigin)\n return\n }\n if (host) {\n if (e.source !== host || e.origin !== hostOrigin || reserved(d) || !app) return\n app.postMessage(d, OWN)\n return\n }\n if (!d || typeof d !== 'object' || d.jsonrpc !== '2.0' || d.method !== RESOURCE) return\n if (!ancestor(e.source) || !allowed(e.origin)) return\n var p = d.params\n if (!p || typeof p !== 'object' || typeof p.html !== 'string') return\n host = e.source\n hostOrigin = e.origin\n var frame = document.createElement('iframe')\n frame.id = 'app'\n frame.setAttribute('sandbox', 'allow-scripts allow-same-origin')\n frame.setAttribute('referrerpolicy', 'no-referrer')\n frame.setAttribute('title', 'MCP App')\n document.body.appendChild(frame)\n app = frame.contentWindow\n var doc = frame.contentDocument\n doc.open()\n doc.write(p.html)\n doc.close()\n })\n var ready = { jsonrpc: '2.0', method: READY, params: {} }\n for (var i = 0; i < ancestors.length; i++) ancestors[i].postMessage(ready, '*')\n})()`\n\nconst json = (value: unknown): string =>\n JSON.stringify(value).replace(/</g, '\\\\u003c').replace(/>/g, '\\\\u003e').replace(/&/g, '\\\\u0026')\n\n/** The page: the hosts as data, the script. Serve it with `mcpAppSandboxHeaders`. */\nexport const mcpAppSandboxPage = (hosts: McpAppSandboxHosts): string =>\n '<!doctype html><html><head><meta charset=\"utf-8\"><meta name=\"robots\" content=\"noindex\">' +\n '<title>MCP App sandbox</title>' +\n '<style>html,body{margin:0;height:100%;overflow:hidden;background:transparent}' +\n 'iframe{display:block;border:0;width:100%;height:100%}</style></head><body>' +\n `<script type=\"application/json\" id=\"mcp-app-sandbox-hosts\">${json({\n origins: hosts.origins,\n patterns: hosts.patterns,\n })}</script>` +\n `<script>${MCP_APP_SANDBOX_SCRIPT}</script></body></html>`\n\n/** Browser features the page and the app may never use, whatever an app asks for. */\nexport const MCP_APP_SANDBOX_PERMISSIONS_POLICY =\n 'camera=(), microphone=(), geolocation=(), display-capture=(), payment=(), usb=(), serial=(), midi=()'\n\nconst COMMON = {\n 'X-Content-Type-Options': 'nosniff',\n 'X-Robots-Tag': 'noindex, nofollow',\n 'Referrer-Policy': 'no-referrer',\n 'Cache-Control': 'no-store',\n}\n\n/**\n * The page's response headers: the app's policy AND `frame-ancestors` (the hosts; `'none'` when\n * there are none), `nosniff`, `no-store` (a policy is never served from a stale copy), no referrer,\n * `noindex`, and a Permissions-Policy that grants nothing.\n */\nexport const mcpAppSandboxHeaders = (\n policy: McpAppPolicyOrigins,\n hosts: McpAppSandboxHosts,\n): Record<string, string> => ({\n 'Content-Type': 'text/html; charset=utf-8',\n 'Content-Security-Policy': `${mcpAppPolicy(policy)}; frame-ancestors ${\n hosts.frameAncestors.length > 0 ? hosts.frameAncestors.join(' ') : \"'none'\"\n }`,\n 'Permissions-Policy': MCP_APP_SANDBOX_PERMISSIONS_POLICY,\n ...COMMON,\n})\n\nexport interface McpAppSandboxServeOptions {\n /** Where the pages are: `'/sandbox/v1'` serves `/sandbox/v1/<policy>`. */\n path: string\n /** The host origins that may frame the page and send it an app (see `parseMcpAppSandboxHosts`). */\n hosts: string | readonly string[] | undefined\n}\n\nconst plain = (status: number, text: string, extra: Record<string, string> = {}): Response =>\n new Response(text, {\n status,\n headers: {\n 'Content-Type': 'text/plain; charset=utf-8',\n 'Content-Security-Policy': \"default-src 'none'; frame-ancestors 'none'\",\n ...COMMON,\n ...extra,\n },\n })\n\n/**\n * A fetch handler for the sandbox page: `GET` / `HEAD` of `<path>/<policy>` is the page, with its\n * headers; a token that is not exactly what `mcpAppPolicyToken` writes is 400; another method 405;\n * any other path 404; no valid host origin (or an invalid entry in the setting) 503 - a sandbox\n * nobody may frame is a configuration error, not a page.\n */\nexport const mcpAppSandboxResponse = (\n request: Request,\n options: McpAppSandboxServeOptions,\n): Response => {\n const { pathname } = new URL(request.url)\n const base = options.path.replace(/\\/+$/, '')\n if (!pathname.startsWith(`${base}/`)) return plain(404, 'Not found')\n const token = pathname.slice(base.length + 1)\n if (token.length === 0 || token.includes('/')) return plain(404, 'Not found')\n if (request.method !== 'GET' && request.method !== 'HEAD') {\n return plain(405, 'Method not allowed', { Allow: 'GET, HEAD' })\n }\n const policy = mcpAppPolicyOfToken(token)\n if (!policy) return plain(400, 'Not a policy this sandbox serves')\n const hosts = parseMcpAppSandboxHosts(options.hosts)\n if (hosts.invalid.length > 0 || hosts.frameAncestors.length === 0) {\n return plain(503, 'This sandbox has no valid allowed host origins')\n }\n return new Response(request.method === 'HEAD' ? null : mcpAppSandboxPage(hosts), {\n status: 200,\n headers: mcpAppSandboxHeaders(policy, hosts),\n })\n}\n","/**\n * MCP Apps: what the host (the page, `mcp-app.ts`) and the sandbox proxy (a page on ANOTHER\n * origin, `mcp-app-sandbox.ts`) must agree on - the app's Content-Security-Policy, the policy as a\n * path segment of the proxy's URL, and the names of the sandbox messages. Pure code with NO\n * imports at all: the proxy's server bundles it without React or the core (a Worker), so the\n * origin rule below is a copy of the core's `mcpAppOrigin`, and `tests/apps-sandbox.test.ts`\n * holds the two to the same answers.\n */\n\n/** The proxy tells the host it can take the app (Sandbox → Host; content-free). */\nexport const MCP_APP_SANDBOX_PROXY_READY = 'ui/notifications/sandbox-proxy-ready'\n/** The host hands the proxy the app's HTML (Host → Sandbox), once. */\nexport const MCP_APP_SANDBOX_RESOURCE_READY = 'ui/notifications/sandbox-resource-ready'\n\n/** The specification reserves these between a host and its proxy: never relayed to or from an app. */\nexport const isMcpAppSandboxMessage = (data: unknown): boolean =>\n typeof data === 'object' &&\n data !== null &&\n typeof (data as { method?: unknown }).method === 'string' &&\n (data as { method: string }).method.startsWith('ui/notifications/sandbox-')\n\n/** The origins an app's policy grants, each already an origin (`mcpAppPolicyOrigin`). */\nexport interface McpAppPolicyOrigins {\n /** `fetch` / XHR / WebSocket (`connect-src`). */\n connect: string[]\n /** Scripts, styles, images, fonts, media. */\n resources: string[]\n}\n\n/**\n * The policy of an app's document: scripts and styles inline, `data:` / `blob:` media, and the\n * network ONLY where the resource declared it. Nested frames, workers, plugins, forms and `<base>`\n * are refused whatever was declared (a frame the app may embed would also be a place it may\n * navigate itself to). The lists must already be checked origins: nothing here re-checks them.\n */\nexport const mcpAppPolicy = ({ connect, resources }: McpAppPolicyOrigins): string => {\n const from = resources.length > 0 ? ` ${resources.join(' ')}` : ''\n return [\n \"default-src 'none'\",\n `script-src 'unsafe-inline'${from}`,\n `style-src 'unsafe-inline'${from}`,\n `img-src data: blob:${from}`,\n `font-src data:${from}`,\n `media-src data: blob:${from}`,\n connect.length > 0 ? `connect-src ${connect.join(' ')}` : \"connect-src 'none'\",\n \"frame-src 'none'\",\n \"child-src 'none'\",\n \"worker-src 'none'\",\n \"object-src 'none'\",\n \"form-action 'none'\",\n \"base-uri 'none'\",\n \"webrtc 'block'\",\n ].join('; ')\n}\n\n// ── The origin rule: a COPY of the core's `mcpAppOrigin` (src/mcp/apps.ts) ──────────────────\n\nconst LABEL = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?'\nconst HOST = `(?:\\\\*\\\\.)?${LABEL}(?:\\\\.${LABEL})*`\nconst PORT = '(?::\\\\d{1,5})?'\nconst SECURE_ORIGIN = new RegExp(`^(?:https|wss)://${HOST}${PORT}$`)\nconst LOOPBACK_ORIGIN = new RegExp(`^(?:http|ws)://(?:localhost|127\\\\.0\\\\.0\\\\.1|\\\\[::1\\\\])${PORT}$`)\n\n/**\n * One declared CSP entry as a source expression a policy may carry, or `undefined`: only an\n * origin (`https://` / `wss://`, a `*.` wildcard over at least two labels, or `http://` /\n * `ws://` on loopback). The same answers as the core's `mcpAppOrigin`, for the proxy's server.\n */\nexport const mcpAppPolicyOrigin = (entry: unknown): string | undefined => {\n if (typeof entry !== 'string' || entry.length > 300) return undefined\n const value = entry.trim().toLowerCase().replace(/\\/$/, '')\n if (SECURE_ORIGIN.test(value)) {\n const host = value.replace(/^[a-z]+:\\/\\//, '').replace(/:\\d+$/, '')\n if (host.startsWith('*.') && !host.slice(2).includes('.')) return undefined\n return value\n }\n return LOOPBACK_ORIGIN.test(value) ? value : undefined\n}\n\n// ── The policy in the proxy's URL ────────────────────────────────────────────────────────────\n\n/** At most this many origins per list (the core's `MCP_APP_MAX_DOMAINS`). */\nexport const MCP_APP_POLICY_MAX_ORIGINS = 32\n/** A policy token longer than this is not put in a URL: the app runs without its own origin. */\nexport const MCP_APP_POLICY_TOKEN_MAX_CHARS = 4096\n\nconst B64URL = /^[A-Za-z0-9_-]+$/\n\n/**\n * The policy as one path segment (base64url of `{\"c\":[…],\"r\":[…]}`), or `undefined` when it does\n * not fit. It is in the PATH, not the query, because a `frame-src` source expression matches a\n * path exactly and ignores the query: the host pins the proxy's frame to this one URL, so nothing\n * inside the frame can load the proxy page with a policy of its choosing.\n */\nexport const mcpAppPolicyToken = ({\n connect,\n resources,\n}: McpAppPolicyOrigins): string | undefined => {\n const json = JSON.stringify({ c: connect, r: resources })\n // Origins are ASCII; anything else is not a list of checked origins.\n if (/[^\\x20-\\x7e]/.test(json)) return undefined\n const token = btoa(json).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '')\n return token.length <= MCP_APP_POLICY_TOKEN_MAX_CHARS ? token : undefined\n}\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\n\nconst originList = (value: unknown): string[] | undefined => {\n if (!Array.isArray(value) || value.length > MCP_APP_POLICY_MAX_ORIGINS) return undefined\n const out: string[] = []\n for (const entry of value) {\n // Exactly an origin as the host writes it: checked, canonical, once.\n if (typeof entry !== 'string' || mcpAppPolicyOrigin(entry) !== entry || out.includes(entry)) {\n return undefined\n }\n out.push(entry)\n }\n return out\n}\n\n/**\n * The policy a token stands for, or `undefined` for anything that is not exactly what\n * `mcpAppPolicyToken` writes: base64url of an object with the two lists and nothing else, every\n * entry an origin by the rule above, no more than `MCP_APP_POLICY_MAX_ORIGINS` each, the\n * canonical encoding (one URL per policy).\n */\nexport const mcpAppPolicyOfToken = (token: unknown): McpAppPolicyOrigins | undefined => {\n if (\n typeof token !== 'string' ||\n token.length === 0 ||\n token.length > MCP_APP_POLICY_TOKEN_MAX_CHARS ||\n !B64URL.test(token)\n ) {\n return undefined\n }\n let parsed: unknown\n try {\n parsed = JSON.parse(atob(token.replace(/-/g, '+').replace(/_/g, '/')))\n } catch {\n return undefined\n }\n if (!isObject(parsed)) return undefined\n const keys = Object.keys(parsed)\n if (keys.length !== 2 || !keys.includes('c') || !keys.includes('r')) return undefined\n const connect = originList(parsed.c)\n const resources = originList(parsed.r)\n if (!connect || !resources) return undefined\n const policy = { connect, resources }\n return mcpAppPolicyToken(policy) === token ? policy : undefined\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACUO,IAAM,8BAA8B;AAEpC,IAAM,iCAAiC;AAGvC,IAAM,yBAAyB,CAAC,SACrC,OAAO,SAAS,YAChB,SAAS,QACT,OAAQ,KAA8B,WAAW,YAChD,KAA4B,OAAO,WAAW,2BAA2B;AAgBrE,IAAM,eAAe,CAAC,EAAE,SAAS,UAAU,MAAmC;AACnF,QAAM,OAAO,UAAU,SAAS,IAAI,IAAI,UAAU,KAAK,GAAG,CAAC,KAAK;AAChE,SAAO;AAAA,IACL;AAAA,IACA,6BAA6B,IAAI;AAAA,IACjC,4BAA4B,IAAI;AAAA,IAChC,sBAAsB,IAAI;AAAA,IAC1B,iBAAiB,IAAI;AAAA,IACrB,wBAAwB,IAAI;AAAA,IAC5B,QAAQ,SAAS,IAAI,eAAe,QAAQ,KAAK,GAAG,CAAC,KAAK;AAAA,IAC1D;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AACb;AAIA,IAAM,QAAQ;AACd,IAAM,OAAO,cAAc,KAAK,SAAS,KAAK;AAC9C,IAAM,OAAO;AACb,IAAM,gBAAgB,IAAI,OAAO,oBAAoB,IAAI,GAAG,IAAI,GAAG;AACnE,IAAM,kBAAkB,IAAI,OAAO,yDAAyD,IAAI,GAAG;AAO5F,IAAM,qB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_SANDBOX_RESOURCE_READY, i as isMcpAppSandboxMessage, e as mcpAppPolicy, f as mcpAppPolicyOfToken, g as mcpAppPolicyOrigin, m as mcpAppPolicyToken } from './mcp-app-policy-DIUmGPJP.cjs';
3
+
4
+ /** A host origin pattern: `https://<prefix>*<suffix>.<rest>`, `*` one run of `[a-z0-9-]`. */
5
+ interface McpAppSandboxHostPattern {
6
+ prefix: string;
7
+ suffix: string;
8
+ /** The rest of the host name after the first label: two labels at least. */
9
+ rest: string;
10
+ }
11
+ /** The host origins a sandbox page answers, as `parseMcpAppSandboxHosts` reads them. */
12
+ interface McpAppSandboxHosts {
13
+ /** Exact origins (`https://agent.example.com`, `http://127.0.0.1:4173`). */
14
+ origins: string[];
15
+ /** One-label patterns (`https://*-agents.example.workers.dev`). */
16
+ patterns: McpAppSandboxHostPattern[];
17
+ /** The same as `frame-ancestors` sources (a pattern widened to `https://*.<rest>`). */
18
+ frameAncestors: string[];
19
+ /** Entries that are neither: a sandbox with any of these refuses to serve (503). */
20
+ invalid: string[];
21
+ }
22
+ /**
23
+ * The allowed host origins, from a list or a space / comma separated string (a deploy-time
24
+ * setting, e.g. `ALLOWED_HOST_ORIGINS="https://agent.example.com https://*-agents.example.workers.dev"`).
25
+ * An entry is an exact origin - `https://`, or `http://` on `localhost` / `127.0.0.1` - or a
26
+ * pattern with ONE `*` inside the first label of an `https://` host. The page's script holds the
27
+ * pattern to one label (`[a-z0-9-]+`, no dot); `frame-ancestors` cannot say that, so there the
28
+ * pattern is widened to `https://*.<rest>` (every subdomain of `<rest>`). Anything else is
29
+ * `invalid`.
30
+ */
31
+ declare const parseMcpAppSandboxHosts: (value: string | readonly string[] | undefined) => McpAppSandboxHosts;
32
+ /** Whether an origin is one of the hosts (the same rule the page's script applies). */
33
+ declare const isMcpAppSandboxHost: (hosts: McpAppSandboxHosts, origin: string) => boolean;
34
+ /**
35
+ * The page's script (inline; it runs under the app's own policy, which allows inline scripts).
36
+ * It reads the hosts from `#mcp-app-sandbox-hosts`, binds to the first allowed ancestor that sends
37
+ * the resource, writes the app into its frame, and relays - see the entry's comment.
38
+ */
39
+ declare const MCP_APP_SANDBOX_SCRIPT: string;
40
+ /** The page: the hosts as data, the script. Serve it with `mcpAppSandboxHeaders`. */
41
+ declare const mcpAppSandboxPage: (hosts: McpAppSandboxHosts) => string;
42
+ /** Browser features the page and the app may never use, whatever an app asks for. */
43
+ declare const MCP_APP_SANDBOX_PERMISSIONS_POLICY = "camera=(), microphone=(), geolocation=(), display-capture=(), payment=(), usb=(), serial=(), midi=()";
44
+ /**
45
+ * The page's response headers: the app's policy AND `frame-ancestors` (the hosts; `'none'` when
46
+ * there are none), `nosniff`, `no-store` (a policy is never served from a stale copy), no referrer,
47
+ * `noindex`, and a Permissions-Policy that grants nothing.
48
+ */
49
+ declare const mcpAppSandboxHeaders: (policy: McpAppPolicyOrigins, hosts: McpAppSandboxHosts) => Record<string, string>;
50
+ interface McpAppSandboxServeOptions {
51
+ /** Where the pages are: `'/sandbox/v1'` serves `/sandbox/v1/<policy>`. */
52
+ path: string;
53
+ /** The host origins that may frame the page and send it an app (see `parseMcpAppSandboxHosts`). */
54
+ hosts: string | readonly string[] | undefined;
55
+ }
56
+ /**
57
+ * A fetch handler for the sandbox page: `GET` / `HEAD` of `<path>/<policy>` is the page, with its
58
+ * headers; a token that is not exactly what `mcpAppPolicyToken` writes is 400; another method 405;
59
+ * any other path 404; no valid host origin (or an invalid entry in the setting) 503 - a sandbox
60
+ * nobody may frame is a configuration error, not a page.
61
+ */
62
+ declare const mcpAppSandboxResponse: (request: Request, options: McpAppSandboxServeOptions) => Response;
63
+
64
+ export { MCP_APP_SANDBOX_PERMISSIONS_POLICY, MCP_APP_SANDBOX_SCRIPT, McpAppPolicyOrigins, isMcpAppSandboxHost, mcpAppSandboxHeaders, mcpAppSandboxPage, mcpAppSandboxResponse, parseMcpAppSandboxHosts };
65
+ export type { McpAppSandboxHostPattern, McpAppSandboxHosts, McpAppSandboxServeOptions };
@@ -0,0 +1,65 @@
1
+ import { c as McpAppPolicyOrigins } from './mcp-app-policy-DIUmGPJP.js';
2
+ export { d as MCP_APP_POLICY_MAX_ORIGINS, M as MCP_APP_POLICY_TOKEN_MAX_CHARS, a as MCP_APP_SANDBOX_PROXY_READY, b as MCP_APP_SANDBOX_RESOURCE_READY, i as isMcpAppSandboxMessage, e as mcpAppPolicy, f as mcpAppPolicyOfToken, g as mcpAppPolicyOrigin, m as mcpAppPolicyToken } from './mcp-app-policy-DIUmGPJP.js';
3
+
4
+ /** A host origin pattern: `https://<prefix>*<suffix>.<rest>`, `*` one run of `[a-z0-9-]`. */
5
+ interface McpAppSandboxHostPattern {
6
+ prefix: string;
7
+ suffix: string;
8
+ /** The rest of the host name after the first label: two labels at least. */
9
+ rest: string;
10
+ }
11
+ /** The host origins a sandbox page answers, as `parseMcpAppSandboxHosts` reads them. */
12
+ interface McpAppSandboxHosts {
13
+ /** Exact origins (`https://agent.example.com`, `http://127.0.0.1:4173`). */
14
+ origins: string[];
15
+ /** One-label patterns (`https://*-agents.example.workers.dev`). */
16
+ patterns: McpAppSandboxHostPattern[];
17
+ /** The same as `frame-ancestors` sources (a pattern widened to `https://*.<rest>`). */
18
+ frameAncestors: string[];
19
+ /** Entries that are neither: a sandbox with any of these refuses to serve (503). */
20
+ invalid: string[];
21
+ }
22
+ /**
23
+ * The allowed host origins, from a list or a space / comma separated string (a deploy-time
24
+ * setting, e.g. `ALLOWED_HOST_ORIGINS="https://agent.example.com https://*-agents.example.workers.dev"`).
25
+ * An entry is an exact origin - `https://`, or `http://` on `localhost` / `127.0.0.1` - or a
26
+ * pattern with ONE `*` inside the first label of an `https://` host. The page's script holds the
27
+ * pattern to one label (`[a-z0-9-]+`, no dot); `frame-ancestors` cannot say that, so there the
28
+ * pattern is widened to `https://*.<rest>` (every subdomain of `<rest>`). Anything else is
29
+ * `invalid`.
30
+ */
31
+ declare const parseMcpAppSandboxHosts: (value: string | readonly string[] | undefined) => McpAppSandboxHosts;
32
+ /** Whether an origin is one of the hosts (the same rule the page's script applies). */
33
+ declare const isMcpAppSandboxHost: (hosts: McpAppSandboxHosts, origin: string) => boolean;
34
+ /**
35
+ * The page's script (inline; it runs under the app's own policy, which allows inline scripts).
36
+ * It reads the hosts from `#mcp-app-sandbox-hosts`, binds to the first allowed ancestor that sends
37
+ * the resource, writes the app into its frame, and relays - see the entry's comment.
38
+ */
39
+ declare const MCP_APP_SANDBOX_SCRIPT: string;
40
+ /** The page: the hosts as data, the script. Serve it with `mcpAppSandboxHeaders`. */
41
+ declare const mcpAppSandboxPage: (hosts: McpAppSandboxHosts) => string;
42
+ /** Browser features the page and the app may never use, whatever an app asks for. */
43
+ declare const MCP_APP_SANDBOX_PERMISSIONS_POLICY = "camera=(), microphone=(), geolocation=(), display-capture=(), payment=(), usb=(), serial=(), midi=()";
44
+ /**
45
+ * The page's response headers: the app's policy AND `frame-ancestors` (the hosts; `'none'` when
46
+ * there are none), `nosniff`, `no-store` (a policy is never served from a stale copy), no referrer,
47
+ * `noindex`, and a Permissions-Policy that grants nothing.
48
+ */
49
+ declare const mcpAppSandboxHeaders: (policy: McpAppPolicyOrigins, hosts: McpAppSandboxHosts) => Record<string, string>;
50
+ interface McpAppSandboxServeOptions {
51
+ /** Where the pages are: `'/sandbox/v1'` serves `/sandbox/v1/<policy>`. */
52
+ path: string;
53
+ /** The host origins that may frame the page and send it an app (see `parseMcpAppSandboxHosts`). */
54
+ hosts: string | readonly string[] | undefined;
55
+ }
56
+ /**
57
+ * A fetch handler for the sandbox page: `GET` / `HEAD` of `<path>/<policy>` is the page, with its
58
+ * headers; a token that is not exactly what `mcpAppPolicyToken` writes is 400; another method 405;
59
+ * any other path 404; no valid host origin (or an invalid entry in the setting) 503 - a sandbox
60
+ * nobody may frame is a configuration error, not a page.
61
+ */
62
+ declare const mcpAppSandboxResponse: (request: Request, options: McpAppSandboxServeOptions) => Response;
63
+
64
+ export { MCP_APP_SANDBOX_PERMISSIONS_POLICY, MCP_APP_SANDBOX_SCRIPT, McpAppPolicyOrigins, isMcpAppSandboxHost, mcpAppSandboxHeaders, mcpAppSandboxPage, mcpAppSandboxResponse, parseMcpAppSandboxHosts };
65
+ export type { McpAppSandboxHostPattern, McpAppSandboxHosts, McpAppSandboxServeOptions };