@isoloop/webmcp 0.1.0-next.5 → 0.1.0-next.6
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/README.md +23 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @isoloop/webmcp
|
|
2
|
+
|
|
3
|
+
**Experimental.** Registers the tools an [Isoloop](https://github.com/isoloop/isoloop) app exposes (`agents.expose`) with the browser's [WebMCP](https://webmachinelearning.github.io/webmcp/) API, so an agent built into the browser can call them ([ADR 0018](https://github.com/isoloop/isoloop/blob/main/docs/adr/0018-tools-for-agents.md)).
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install @isoloop/webmcp@next @isoloop/host@next
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { createKernel } from '@isoloop/host';
|
|
11
|
+
import { connectWebMCP } from '@isoloop/webmcp';
|
|
12
|
+
|
|
13
|
+
const kernel = createKernel({ contracts, workers, agents: { expose: ['markets.quote.v1'] } });
|
|
14
|
+
const disconnect = connectWebMCP(kernel);
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- **Each tool** from `kernel.tools()` is registered with its name, title, description, JSON Schemas and hints. A call runs `kernel.request(tool.topic, input, { timeoutMs: tool.timeoutMs, signal, via: 'webmcp' })` and resolves with the reply; a failed call rejects with the kernel's `BusError`.
|
|
18
|
+
- **Tools stay registered** while their isolates restart. The returned function unregisters them and aborts the calls still in flight.
|
|
19
|
+
- **Without WebMCP** it does nothing. There's no shim; in development, the dev MCP (`isoloop mcp`) covers other browsers.
|
|
20
|
+
- **Browsers:** WebMCP is a Community Group draft, behind a flag in Chromium (`--enable-features=WebMCP`) and behind prefs in Firefox (`dom.modelcontext.enabled`). They differ in where the API lives, which hints the agent sees, and whether a call can be cancelled; `connectWebMCP` follows the features each has, not its name.
|
|
21
|
+
- **Hints** tell the agent what a tool does. Asking the user before a consequential call is the agent's job.
|
|
22
|
+
|
|
23
|
+
How to make a topic a tool, idempotent handlers, the dev MCP and each browser's differences are in the [agents guide](https://github.com/isoloop/isoloop/blob/main/docs/guide/agents.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isoloop/webmcp",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.6",
|
|
4
4
|
"description": "Registers an Isoloop app's exposed tools with the browser's WebMCP API (document.modelContext).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@isoloop/host": "0.1.0-next.
|
|
23
|
+
"@isoloop/host": "0.1.0-next.6"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"typescript": "7.0.2"
|