@handsforbots/mcp-apps 0.0.0-stage → 2.0.0-alpha.1

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/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright © 2024 Alex Lana and Hands for Bots contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,21 @@
1
- # Temporary Holding Version
1
+ # @handsforbots/mcp-apps
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Plugin. Renders MCP Apps (ui:// resources) in sandboxed iframes inside Hands for Bots conversations, bridging their tool calls to H4B actions.
4
+
5
+ Part of [Hands for Bots](https://github.com/handsforbots/handsforbots), a headless multimodal and action layer between users, GUIs and agents.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @handsforbots/mcp-apps@alpha @handsforbots/core@alpha
11
+ ```
12
+
13
+ ## Documentation
14
+
15
+ - [This package](https://github.com/handsforbots/handsforbots/blob/main/docs/en-us/plugins.md#mcp-apps)
16
+ - [Getting started](https://github.com/handsforbots/handsforbots/blob/main/docs/en-us/getting-started.md)
17
+ - [Documentação em português](https://github.com/handsforbots/handsforbots/blob/main/docs/pt-br/README.md)
18
+
19
+ ## License
20
+
21
+ MIT
@@ -0,0 +1,44 @@
1
+ import type { H4B } from '@handsforbots/core';
2
+ /** What a backend (acting as MCP client) sends in `ui.render` with component 'mcp-app'. */
3
+ export type McpAppProps = {
4
+ /** HTML of the `ui://` resource (mimeType text/html;profile=mcp-app). */
5
+ html: string;
6
+ /** Tool that produced it, its arguments and result (sent to the app after it initializes). */
7
+ toolName?: string;
8
+ input?: Record<string, unknown>;
9
+ result?: {
10
+ content?: unknown[];
11
+ structuredContent?: unknown;
12
+ isError?: boolean;
13
+ } | unknown;
14
+ /** From the resource `_meta.ui.csp`. */
15
+ csp?: {
16
+ connectDomains?: string[];
17
+ resourceDomains?: string[];
18
+ frameDomains?: string[];
19
+ };
20
+ title?: string;
21
+ };
22
+ export type McpAppOptions = {
23
+ /** H4B actions the app may call with tools/call (origin 'agent'). Default: none. */
24
+ allowTools?: string[];
25
+ /** Let the app add messages to the conversation (ui/message). Default true. */
26
+ allowMessages?: boolean;
27
+ maxHeight?: number;
28
+ initialHeight?: number;
29
+ };
30
+ export declare const PROTOCOL_VERSION = "2026-01-26";
31
+ /** Builds the CSP for the app document (MCP Apps default when no domains are declared). */
32
+ export declare function buildCsp(csp?: McpAppProps['csp']): string;
33
+ /** Injects the CSP as the first element of <head>. */
34
+ export declare function withCsp(html: string, policy: string): string;
35
+ /**
36
+ * Mounts an MCP App in a sandboxed iframe and acts as its host. Returns the
37
+ * element; the bridge is torn down when it is removed from the document.
38
+ */
39
+ export declare function mountMcpApp(h4b: H4B, props: McpAppProps, options?: McpAppOptions): HTMLElement;
40
+ /** Renderer for the widget: `widget({ renderers: { 'mcp-app': mcpAppRenderer({ allowTools: [...] }) } })`. */
41
+ export declare function mcpAppRenderer(options?: McpAppOptions): (props: McpAppProps, context: {
42
+ h4b: H4B;
43
+ }) => HTMLElement;
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AAE7C,2FAA2F;AAC3F,MAAM,MAAM,WAAW,GAAG;IACxB,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAA;IACZ,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,MAAM,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;QAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAA;IAC1F,wCAAwC;IACxC,GAAG,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;IACxF,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,+EAA+E;IAC/E,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,gBAAgB,eAAe,CAAA;AAI5C,2FAA2F;AAC3F,wBAAgB,QAAQ,CAAC,GAAG,GAAE,WAAW,CAAC,KAAK,CAAM,GAAG,MAAM,CAc7D;AAED,sDAAsD;AACtD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAK5D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,GAAE,aAAkB,GAAG,WAAW,CAwGlG;AAWD,8GAA8G;AAC9G,wBAAgB,cAAc,CAAC,OAAO,GAAE,aAAkB,WACzC,WAAW,WAAW;IAAE,GAAG,EAAE,GAAG,CAAA;CAAE,iBAClD"}
package/dist/index.js ADDED
@@ -0,0 +1,155 @@
1
+ export const PROTOCOL_VERSION = '2026-01-26';
2
+ /** Builds the CSP for the app document (MCP Apps default when no domains are declared). */
3
+ export function buildCsp(csp = {}) {
4
+ const list = (domains) => (domains?.length ? ` ${domains.join(' ')}` : '');
5
+ const resources = list(csp.resourceDomains);
6
+ return [
7
+ `default-src 'none'`,
8
+ `script-src 'unsafe-inline'${resources}`,
9
+ `style-src 'unsafe-inline'${resources}`,
10
+ `img-src data: blob:${resources}`,
11
+ `font-src data:${resources}`,
12
+ `media-src data: blob:${resources}`,
13
+ `connect-src${list(csp.connectDomains) || " 'none'"}`,
14
+ `frame-src${list(csp.frameDomains) || " 'none'"}`,
15
+ `base-uri 'none'`,
16
+ ].join('; ');
17
+ }
18
+ /** Injects the CSP as the first element of <head>. */
19
+ export function withCsp(html, policy) {
20
+ const meta = `<meta http-equiv="Content-Security-Policy" content="${policy.replace(/"/g, '&quot;')}">`;
21
+ if (/<head[^>]*>/i.test(html))
22
+ return html.replace(/<head[^>]*>/i, (head) => `${head}${meta}`);
23
+ if (/<html[^>]*>/i.test(html))
24
+ return html.replace(/<html[^>]*>/i, (tag) => `${tag}<head>${meta}</head>`);
25
+ return `<!doctype html><html><head>${meta}</head><body>${html}</body></html>`;
26
+ }
27
+ /**
28
+ * Mounts an MCP App in a sandboxed iframe and acts as its host. Returns the
29
+ * element; the bridge is torn down when it is removed from the document.
30
+ */
31
+ export function mountMcpApp(h4b, props, options = {}) {
32
+ const iframe = document.createElement('iframe');
33
+ iframe.setAttribute('sandbox', 'allow-scripts allow-forms');
34
+ iframe.setAttribute('title', props.title ?? props.toolName ?? 'App');
35
+ iframe.setAttribute('referrerpolicy', 'no-referrer');
36
+ iframe.style.cssText = `width:100%;border:0;display:block;height:${options.initialHeight ?? 200}px;border-radius:10px;background:transparent`;
37
+ iframe.srcdoc = withCsp(props.html, buildCsp(props.csp));
38
+ const maxHeight = options.maxHeight ?? 600;
39
+ const allowTools = new Set(options.allowTools ?? []);
40
+ let initialized = false;
41
+ let delivered = false;
42
+ const post = (message) => iframe.contentWindow?.postMessage({ jsonrpc: '2.0', ...message }, '*');
43
+ const respond = (id, result) => post({ id, result });
44
+ const fail = (id, code, message) => post({ id, error: { code, message } });
45
+ const deliverToolData = () => {
46
+ if (delivered || !initialized)
47
+ return;
48
+ delivered = true;
49
+ post({ method: 'ui/notifications/tool-input', params: { arguments: props.input ?? {} } });
50
+ if (props.result !== undefined)
51
+ post({ method: 'ui/notifications/tool-result', params: toCallToolResult(props.result) });
52
+ };
53
+ const hostContext = () => ({
54
+ theme: typeof matchMedia === 'function' && matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light',
55
+ displayMode: 'inline',
56
+ availableDisplayModes: ['inline'],
57
+ containerDimensions: { width: iframe.clientWidth || undefined, maxHeight },
58
+ locale: typeof navigator !== 'undefined' ? navigator.language : 'en',
59
+ timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
60
+ platform: 'web',
61
+ });
62
+ const onMessage = async (event) => {
63
+ if (event.source !== iframe.contentWindow)
64
+ return;
65
+ const message = event.data;
66
+ if (message?.jsonrpc !== '2.0' || !message.method)
67
+ return;
68
+ const { id, method, params } = message;
69
+ try {
70
+ switch (method) {
71
+ case 'ui/initialize':
72
+ return respond(id, {
73
+ protocolVersion: PROTOCOL_VERSION,
74
+ hostCapabilities: { openLinks: {}, serverTools: allowTools.size ? {} : undefined, logging: {} },
75
+ hostInfo: { name: 'handsforbots', version: '2' },
76
+ hostContext: hostContext(),
77
+ });
78
+ case 'ui/notifications/initialized':
79
+ initialized = true;
80
+ return deliverToolData();
81
+ case 'ui/notifications/size-changed':
82
+ if (typeof params?.height === 'number')
83
+ iframe.style.height = `${Math.min(Math.max(params.height, 40), maxHeight)}px`;
84
+ return;
85
+ case 'tools/call': {
86
+ const name = String(params?.name ?? '');
87
+ if (!allowTools.has(name))
88
+ return fail(id, -32601, `Tool "${name}" is not available to this app`);
89
+ const outcome = await h4b.runAction(name, params?.arguments ?? {}, { origin: 'agent' });
90
+ return respond(id, outcome.error ? toCallToolResult({ error: outcome.error }, true) : toCallToolResult(outcome.result));
91
+ }
92
+ case 'ui/message': {
93
+ if (options.allowMessages === false)
94
+ return fail(id, -32601, 'Messages are disabled');
95
+ const text = params?.content?.type === 'text' ? String(params.content.text ?? '') : '';
96
+ if (text)
97
+ h4b.signal({ modality: 'text', source: 'mcp-app', parts: [{ type: 'text', text }], meta: { tool: props.toolName } });
98
+ return respond(id, {});
99
+ }
100
+ case 'ui/open-link': {
101
+ const url = String(params?.url ?? '');
102
+ if (!/^https?:\/\//i.test(url))
103
+ return fail(id, -32602, 'Only http(s) links can be opened');
104
+ window.open(url, '_blank', 'noopener,noreferrer');
105
+ return respond(id, {});
106
+ }
107
+ case 'ui/update-model-context':
108
+ h4b.signal({
109
+ kind: 'context',
110
+ key: `mcp-app.${props.toolName ?? 'app'}`,
111
+ modality: 'gui-event',
112
+ source: 'mcp-app',
113
+ parts: [{ type: 'data', name: props.toolName ?? 'app', value: params?.structuredContent ?? params?.content ?? params }],
114
+ });
115
+ return respond(id, {});
116
+ case 'ui/request-display-mode':
117
+ return respond(id, { mode: 'inline' });
118
+ case 'notifications/message':
119
+ case 'ui/notifications/log':
120
+ return;
121
+ default:
122
+ if (id !== undefined)
123
+ fail(id, -32601, `Method not found: ${method}`);
124
+ }
125
+ }
126
+ catch (error) {
127
+ if (id !== undefined)
128
+ fail(id, -32603, error?.message ?? 'Internal error');
129
+ }
130
+ };
131
+ window.addEventListener('message', onMessage);
132
+ // Tear down when the element leaves the document (message re-render, thread reset).
133
+ const observer = typeof MutationObserver !== 'undefined' ? new MutationObserver(() => {
134
+ if (!iframe.isConnected && observer) {
135
+ window.removeEventListener('message', onMessage);
136
+ observer.disconnect();
137
+ }
138
+ }) : undefined;
139
+ queueMicrotask(() => observer?.observe(document.body, { childList: true, subtree: true }));
140
+ return iframe;
141
+ }
142
+ function toCallToolResult(result, isError = false) {
143
+ if (result && typeof result === 'object' && Array.isArray(result.content))
144
+ return result;
145
+ return {
146
+ content: [{ type: 'text', text: typeof result === 'string' ? result : JSON.stringify(result ?? null) }],
147
+ ...(result !== null && typeof result === 'object' ? { structuredContent: result } : {}),
148
+ ...(isError ? { isError: true } : {}),
149
+ };
150
+ }
151
+ /** Renderer for the widget: `widget({ renderers: { 'mcp-app': mcpAppRenderer({ allowTools: [...] }) } })`. */
152
+ export function mcpAppRenderer(options = {}) {
153
+ return (props, context) => mountMcpApp(context.h4b, props, options);
154
+ }
155
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAA;AAI5C,2FAA2F;AAC3F,MAAM,UAAU,QAAQ,CAAC,GAAG,GAAuB,EAAE;IACnD,MAAM,IAAI,GAAG,CAAC,OAAkB,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IACrF,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;IAC3C,OAAO;QACL,oBAAoB;QACpB,6BAA6B,SAAS,EAAE;QACxC,4BAA4B,SAAS,EAAE;QACvC,sBAAsB,SAAS,EAAE;QACjC,iBAAiB,SAA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AK;IACxD,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAE,MAAc,CAAC,OAAO,CAAC;QAAE,OAAO,MAAM,CAAA;IACjG,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC,EAAE,CAAC;QACvG,GAAG,CAAC,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvF,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtC,CAAA;AACH,CAAC;AAED,8GAA8G;AAC9G,MAAM,UAAU,cAAc,CAAC,OAAO,GAAkB,EAAE;IACxD,OAAO,CAAC,KAAkB,EAAE,OAAqB,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AAChG,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
2
  "name": "@handsforbots/mcp-apps",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "2.0.0-alpha.1",
4
+ "description": "Plugin. Renders MCP Apps (ui:// resources) in sandboxed iframes inside Hands for Bots conversations, bridging their tool calls to H4B actions.",
5
+ "keywords": [
6
+ "handsforbots",
7
+ "h4b",
8
+ "h4b-plugin"
9
+ ],
10
+ "license": "MIT",
11
+ "homepage": "https://github.com/handsforbots/handsforbots/blob/main/docs/en-us/plugins.md#mcp-apps",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/handsforbots/handsforbots.git",
15
+ "directory": "packages/mcp-apps"
16
+ },
17
+ "bugs": {
18
+ "url": "https://github.com/handsforbots/handsforbots/issues"
19
+ },
20
+ "type": "module",
21
+ "sideEffects": false,
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "import": "./dist/index.js"
26
+ }
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "files": [
32
+ "dist"
33
+ ],
34
+ "peerDependencies": {
35
+ "@handsforbots/core": "^2.0.0-alpha.1"
36
+ },
37
+ "devDependencies": {
38
+ "jsdom": "^27.0.0",
39
+ "@handsforbots/core": "^2.0.0-alpha.1"
40
+ },
41
+ "scripts": {
42
+ "build": "tsc -p tsconfig.build.json",
43
+ "typecheck": "tsc -p tsconfig.json --noEmit"
44
+ }
6
45
  }