@isoloop/webmcp 0.1.0-next.5 → 0.1.0-next.7
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/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- 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/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ import { Kernel } from "@isoloop/host";
|
|
|
7
7
|
* only when true). A call runs
|
|
8
8
|
* `kernel.request(tool.topic, input, { timeoutMs: tool.timeoutMs, signal, via: 'webmcp' })`
|
|
9
9
|
* and resolves with the reply; a failed call rejects with the kernel's
|
|
10
|
-
* `BusError` (its `code` and `message`), for example `timeout
|
|
11
|
-
* `no_responder`. Chromium shows the agent its own generic error; Firefox
|
|
10
|
+
* `BusError` (its `code` and `message`), for example `timeout`,
|
|
11
|
+
* `no_responder` or `dropped`. Chromium shows the agent its own generic error; Firefox
|
|
12
12
|
* passes the message on.
|
|
13
13
|
*
|
|
14
14
|
* - Where neither exists (no WebMCP, or the flag off), it does nothing and
|
package/dist/index.js
CHANGED
|
@@ -39,8 +39,8 @@ function follow(target, signals) {
|
|
|
39
39
|
* only when true). A call runs
|
|
40
40
|
* `kernel.request(tool.topic, input, { timeoutMs: tool.timeoutMs, signal, via: 'webmcp' })`
|
|
41
41
|
* and resolves with the reply; a failed call rejects with the kernel's
|
|
42
|
-
* `BusError` (its `code` and `message`), for example `timeout
|
|
43
|
-
* `no_responder`. Chromium shows the agent its own generic error; Firefox
|
|
42
|
+
* `BusError` (its `code` and `message`), for example `timeout`,
|
|
43
|
+
* `no_responder` or `dropped`. Chromium shows the agent its own generic error; Firefox
|
|
44
44
|
* passes the message on.
|
|
45
45
|
*
|
|
46
46
|
* - Where neither exists (no WebMCP, or the flag off), it does nothing and
|
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.7",
|
|
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.7"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"typescript": "7.0.2"
|