@copilotkit/mcp-apps-renderer 2.0.0-rc.36 → 2.0.0-rc.38
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/session.d.mts +1 -58
- package/dist/session.d.mts.map +1 -1
- package/package.json +2 -2
package/dist/session.d.mts
CHANGED
|
@@ -4,25 +4,6 @@ import { AbstractAgent } from "@ag-ui/client";
|
|
|
4
4
|
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
5
5
|
|
|
6
6
|
//#region src/session.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* Decode a base64 resource body as UTF-8.
|
|
9
|
-
*
|
|
10
|
-
* @internal exported for testing.
|
|
11
|
-
*
|
|
12
|
-
* `atob` alone yields a latin1 string, which mangles non-ASCII widget HTML
|
|
13
|
-
* (`<p>Été ☀️</p>` decoded to `<p>Été ☀ï¸</p>`). Decode to bytes first, then
|
|
14
|
-
* run them through a UTF-8 TextDecoder.
|
|
15
|
-
*/
|
|
16
|
-
declare function ɵdecodeBase64(value: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* The MCP Apps protocol version this host negotiates. Sourced directly from the
|
|
19
|
-
* ext-apps bridge (single source of truth, no hand-maintained literal). It lives
|
|
20
|
-
* here (a bridge-side module) rather than in the bridge-free `./constants` /
|
|
21
|
-
* `./activity` entry so the lightweight activity-registration surface stays free
|
|
22
|
-
* of the ext-apps bundle; consumers that need the version import it from the
|
|
23
|
-
* package root, which already loads the bridge.
|
|
24
|
-
*/
|
|
25
|
-
declare const MCP_APPS_PROTOCOL_VERSION = "2026-01-26";
|
|
26
7
|
/** A resource fetched from the MCP server via the agent proxy. */
|
|
27
8
|
interface FetchedResource {
|
|
28
9
|
uri: string;
|
|
@@ -162,40 +143,11 @@ interface McpAppSessionOptions {
|
|
|
162
143
|
*/
|
|
163
144
|
allowSameOriginFallback?: boolean;
|
|
164
145
|
}
|
|
165
|
-
/** Defaults every frontend inherits unless it overrides them. */
|
|
166
|
-
declare const MCP_APPS_SESSION_DEFAULTS: Readonly<Required<McpAppSessionOptions>>;
|
|
167
146
|
/**
|
|
168
147
|
* Returns the URL to open, or `undefined` to refuse. Receiving the raw string
|
|
169
148
|
* (not a parsed URL) lets a policy resolve relative links itself.
|
|
170
149
|
*/
|
|
171
150
|
type McpAppOpenLinkPolicy = (url: string) => string | undefined;
|
|
172
|
-
/**
|
|
173
|
-
* The MCP Apps link policy, shared by every frontend.
|
|
174
|
-
*
|
|
175
|
-
* Three independent rules, deliberately kept as ONE policy so a widget behaves
|
|
176
|
-
* the same whichever framework hosts it:
|
|
177
|
-
*
|
|
178
|
-
* 1. **Scheme denylist**, not an allowlist. Only the schemes that execute script
|
|
179
|
-
* or render attacker-controlled HTML are refused (`javascript:`, `data:`,
|
|
180
|
-
* `vbscript:`, `blob:`, `file:`). Everything else is allowed, including
|
|
181
|
-
* app-defined deep links (`myapp:`, `whatsapp:`), which hand off to an OS
|
|
182
|
-
* handler rather than executing in the page. An allowlist could never
|
|
183
|
-
* enumerate those, and restricting to http/https would break them.
|
|
184
|
-
* 2. **Embedded credentials refused** (`https://user:pw@host`): a widget must not
|
|
185
|
-
* hand the browser a URL carrying someone's credentials.
|
|
186
|
-
* 3. **Path-relative links resolved** against the host document, so `/docs`,
|
|
187
|
-
* `./x` and `../x` open instead of failing URL parsing. Only those three
|
|
188
|
-
* forms: every string is technically a valid relative reference, so anything
|
|
189
|
-
* else stays refused rather than becoming a navigation on the host origin.
|
|
190
|
-
* This does mean a widget can reach a path of the HOST application - the same
|
|
191
|
-
* reach a normal anchor in the page would have.
|
|
192
|
-
*
|
|
193
|
-
* Rules 2 and 3 come from the Angular host, which enforced them before it moved
|
|
194
|
-
* onto this session; rule 1 is the CopilotKit product decision (it matches the
|
|
195
|
-
* Anthropic Software Directory policy: https origins plus owned custom URI
|
|
196
|
-
* schemes). Merging them means no frontend overrides anything.
|
|
197
|
-
*/
|
|
198
|
-
declare const denyDangerousSchemes: McpAppOpenLinkPolicy;
|
|
199
151
|
interface McpAppSession {
|
|
200
152
|
/** Forward the tool call input to the widget (host -> app). Buffered until ready. */
|
|
201
153
|
sendToolInput(args: Record<string, unknown>): void;
|
|
@@ -215,15 +167,6 @@ interface McpAppSession {
|
|
|
215
167
|
/** Disconnect the bridge and release listeners. Does NOT remove the iframe. */
|
|
216
168
|
teardown(): void;
|
|
217
169
|
}
|
|
218
|
-
/**
|
|
219
|
-
* Bind an MCP App to a host-provided sandbox iframe: fetch the widget resource
|
|
220
|
-
* through the agent, connect the ext-apps `AppBridge` over a PostMessage
|
|
221
|
-
* transport, and wire the app<->host protocol (ui/message, ui/open-link,
|
|
222
|
-
* tools/call + resources/read proxy, size, host context). Framework-agnostic:
|
|
223
|
-
* the React/Vue/Angular renderers create the iframe and wire reactive state via
|
|
224
|
-
* `hooks`, but all protocol logic lives here.
|
|
225
|
-
*/
|
|
226
|
-
declare function bindMcpApp(opts: BindMcpAppOptions): McpAppSession;
|
|
227
170
|
//#endregion
|
|
228
|
-
export { BindMcpAppOptions,
|
|
171
|
+
export { BindMcpAppOptions, McpAppSession, McpAppSessionOptions };
|
|
229
172
|
//# sourceMappingURL=session.d.mts.map
|
package/dist/session.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.mts","names":[],"sources":["../src/session.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"session.d.mts","names":[],"sources":["../src/session.ts"],"mappings":";;;;;;;UAwIiB,eAAA;EACf,GAAA;EACA,QAAA;EACA,IAAA;EACA,IAAA;EACA,KAAA;IACE,EAAA;MACE,aAAA;MACA,GAAA;QACE,cAAA;QACA,eAAA;MAAA;IAAA;EAAA;AAAA;;UAOS,kBAAA;EAcD;EAZd,aAAA,EAAe,IAAA;IAAQ,KAAA;IAAgB,MAAA;EAAA;EAwBvC;EAtBA,aAAA;EAsBgB;EApBhB,cAAA;EAoBiC;EAlBjC,UAAA,EAAY,QAAA,EAAU,eAAA;EAqBU;;;;;EAfhC,OAAA,EAAS,GAAA,EAAK,KAAA;EA0CN;EAxCR,eAAA,EAAiB,GAAA,EAAK,KAAA;EAyDL;;;;;;;;;EA/CjB,cAAA,EAAgB,GAAA,EAAK,KAAA;AAAA;AAAA,UAGN,iBAAA;EA2Bf;;;;;;EApBA,MAAA,EAAQ,iBAAA;EA+CR;EA7CA,UAAA,QAAkB,sBAAA;EA+CS;EA7C3B,QAAA,QAAgB,aAAA;EAiDD;EA/Cf,IAAA,EAAM,gBAAA;;;;AAoDR;;;;;;;;;EAvCE,SAAA;EACA,KAAA,GAAQ,kBAAA;EAkDG;;;;;;EA3CX,OAAA,GAAU,oBAAA;EAyDa;AAmBzB;;;;;AA8DA;;;EAhIE,cAAA,GAAiB,oBAAA;EAoIM;;;;;;;EA5HvB,yBAAA;EA4HuB;EA1HvB,uBAAA;EAqIA;EAnIA,2BAAA;AAAA;;UAIe,cAAA;EACf,IAAA;EACA,OAAA;AAAA;AAAA,UAGe,oBAAA;;EAEf,aAAA;;;;;;;;EAQA,uBAAA;;EAEA,QAAA,GAAW,cAAA;;EAEX,gBAAA,GAAmB,MAAA;;EAEnB,WAAA,GAAc,MAAA;;;;;;;;;;EAUd,uBAAA;AAAA;;;;;KAmBU,oBAAA,IAAwB,GAAA;AAAA,UA8DnB,aAAA;;EAEf,aAAA,CAAc,IAAA,EAAM,MAAA;;EAEpB,cAAA,CAAe,MAAA,EAAQ,cAAA;;;;;;;;;;;EAWvB,WAAA,CAAY,OAAA,EAAS,sBAAA;;EAErB,QAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkit/mcp-apps-renderer",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.38",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Framework-agnostic MCP Apps host for CopilotKit - the app<->host protocol (ext-apps AppBridge), sandbox proxy, and shared renderer consumed by the React, Vue, and Angular frontends",
|
|
6
6
|
"keywords": [
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@copilotkit/shared": "2.0.0-rc.
|
|
54
|
+
"@copilotkit/shared": "2.0.0-rc.38",
|
|
55
55
|
"@modelcontextprotocol/ext-apps": "^1.7.5",
|
|
56
56
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
57
57
|
"zod": "^4.2.0"
|