@developmentseed/mcp-view 0.1.2 → 0.1.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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +65 -0
  3. package/package.json +1 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Development Seed
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # @developmentseed/mcp-view
2
+
3
+ The view-side bridge for [MCP Apps](https://github.com/modelcontextprotocol/ext-apps)
4
+ UI views: the `ui/*` postMessage protocol as two small functions.
5
+
6
+ An MCP tool can ship a UI view — an HTML bundle the server exposes as a
7
+ `ui://<toolset>/<id>` resource, which the host renders inline in the chat
8
+ instead of raw JSON. The bundle runs in a sandboxed iframe and talks to its host
9
+ over `ui/*` JSON-RPC-over-postMessage. This package wraps the
10
+ [official SDK](https://www.npmjs.com/package/@modelcontextprotocol/ext-apps)
11
+ so your view never has to know which host it landed in.
12
+
13
+ ```bash
14
+ npm install @developmentseed/mcp-view
15
+ ```
16
+
17
+ ## Use
18
+
19
+ ```ts
20
+ import { onData, sendMessage } from "@developmentseed/mcp-view";
21
+
22
+ // The tool's structuredContent, delivered by the host once the tool has run.
23
+ onData((data) => render(data));
24
+
25
+ // A user turn back into the conversation, so the model calls the next tool.
26
+ button.onclick = () => sendMessage("clip this to the Severn catchment");
27
+ ```
28
+
29
+ That's the whole surface. `onData` registers your handler and connects to the
30
+ host; `sendMessage` posts a message as if the user had typed it.
31
+
32
+ Optionally identify your view during the `ui/initialize` handshake — call it
33
+ before the first `onData` or `sendMessage`:
34
+
35
+ ```ts
36
+ import { configure } from "@developmentseed/mcp-view";
37
+
38
+ configure({ name: "dataset-gallery", version: "1.2.0" });
39
+ ```
40
+
41
+ ## Hosts
42
+
43
+ The same bundle works unchanged in any MCP Apps host — Claude.ai, ChatGPT,
44
+ Goose, VS Code — and in the Chainlit chat agent bundled with
45
+ [`mcp-toolsets-runtime`](https://github.com/developmentseed/mcp-toolsets-runtime),
46
+ which implements the host end of this protocol.
47
+
48
+ Views are progressive enhancement: a tool's `message` and structured content
49
+ still stand on their own in a plain MCP client that can't render them, so
50
+ shipping a view never makes a tool unusable anywhere.
51
+
52
+ ## Serving the view
53
+
54
+ Building and serving the bundle is the server's job, not this package's. If
55
+ you're using `mcp-toolsets-runtime`, declare `VIEWS = {tool_name: view_id}` in
56
+ your toolset and ship the built bundle at `<package>/views/<view_id>.html` — see
57
+ [CONSUMING.md](https://github.com/developmentseed/mcp-toolsets-runtime/blob/main/docs/CONSUMING.md).
58
+
59
+ ## Notes
60
+
61
+ - ESM only, with TypeScript types included.
62
+ - Versioned in lockstep with the Python `mcp-toolsets-runtime` distribution, from
63
+ the same repository.
64
+
65
+ MIT © Development Seed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@developmentseed/mcp-view",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "View-side bridge for MCP Apps UI views: the ui/* postMessage protocol as two tiny functions (onData / sendMessage).",
5
5
  "license": "MIT",
6
6
  "type": "module",