@toon-protocol/client-mcp 0.1.0 → 0.3.0
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 +19 -38
- package/dist/app/index.html +166 -0
- package/dist/{chunk-5KFXUT5Q.js → chunk-CQ2QIZ6Z.js} +864 -604
- package/dist/chunk-CQ2QIZ6Z.js.map +1 -0
- package/dist/{chunk-FSS45ZX3.js → chunk-DLYE6U2Z.js} +1516 -316
- package/dist/chunk-DLYE6U2Z.js.map +1 -0
- package/dist/{chunk-3NAWISI5.js → chunk-QFHCXJ2V.js} +348 -101
- package/dist/chunk-QFHCXJ2V.js.map +1 -0
- package/dist/chunk-XV52IHVR.js +977 -0
- package/dist/chunk-XV52IHVR.js.map +1 -0
- package/dist/daemon.js +3 -4
- package/dist/daemon.js.map +1 -1
- package/dist/e2e/run-journey.d.ts +1 -0
- package/dist/e2e/run-journey.js +19953 -0
- package/dist/e2e/run-journey.js.map +1 -0
- package/dist/{ed25519-2QVPINLS.js → ed25519-2LFQXLYS.js} +6 -2
- package/dist/index.d.ts +282 -68
- package/dist/index.js +380 -5
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +39 -6
- package/dist/mcp.js.map +1 -1
- package/package.json +11 -7
- package/dist/anon-proxy-W3KMM7GU-FN7ZJY7P.js +0 -25
- package/dist/chunk-3NAWISI5.js.map +0 -1
- package/dist/chunk-5KFXUT5Q.js.map +0 -1
- package/dist/chunk-FSS45ZX3.js.map +0 -1
- package/dist/chunk-SKQTKZIH.js +0 -278
- package/dist/chunk-SKQTKZIH.js.map +0 -1
- package/dist/chunk-ZQKYZJWT.js +0 -359
- package/dist/chunk-ZQKYZJWT.js.map +0 -1
- package/dist/ed25519-2QVPINLS.js.map +0 -1
- package/dist/gateway-QOK47RKS-SEGTXBR3.js +0 -16
- package/dist/gateway-QOK47RKS-SEGTXBR3.js.map +0 -1
- package/dist/socks5-WTJBYGME-6COK4LXW.js +0 -139
- package/dist/socks5-WTJBYGME-6COK4LXW.js.map +0 -1
- /package/dist/{anon-proxy-W3KMM7GU-FN7ZJY7P.js.map → ed25519-2LFQXLYS.js.map} +0 -0
package/README.md
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Let a Claude agent — **Claude Desktop or Claude Code** — act as a full TOON
|
|
4
4
|
Protocol client: **pay-to-write** publishing, **free** reads/subscriptions,
|
|
5
|
-
payment-channel/balance management, and
|
|
5
|
+
payment-channel/balance management, and swaps.
|
|
6
6
|
|
|
7
7
|
The agent surface is an **MCP server** — bin **`toon-mcp`**, which registers
|
|
8
8
|
with the host under the server name **`toon-client`** (this is the name that
|
|
9
9
|
appears in Claude's MCP server list and in the `initialize` handshake;
|
|
10
10
|
`mcpServers.toon` in config is just your local alias). The two long-lived
|
|
11
11
|
connections that can't live in an ephemeral agent session — a **BTP** session
|
|
12
|
-
(paid writes via the connector/apex
|
|
13
|
-
|
|
12
|
+
(paid writes via the connector/apex) and a **town-relay Nostr-WS** subscription
|
|
13
|
+
(free reads) — live in
|
|
14
14
|
an **always-on detached daemon** (`toon-clientd`). The MCP server is a thin
|
|
15
15
|
stdio proxy that auto-spawns the daemon and never holds chain keys.
|
|
16
16
|
|
|
@@ -34,8 +34,8 @@ Claude (Desktop / Code)
|
|
|
34
34
|
|
|
35
35
|
| Layer | Bin / module | Responsibility |
|
|
36
36
|
|---|---|---|
|
|
37
|
-
| **Daemon** | `toon-clientd` | Owns one `ToonClient` (BTP +
|
|
38
|
-
| **MCP server** | `toon-mcp` | `@modelcontextprotocol/sdk` stdio server. Maps tools → daemon HTTP; auto-spawns the daemon detached if down; reports "bootstrapping — retry" while
|
|
37
|
+
| **Daemon** | `toon-clientd` | Owns one `ToonClient` (BTP + channels + mnemonic keystore + network targeting) **plus** a persistent town-relay subscription. Loopback HTTP control API, single-instance PID lock, channel nonce-watermark persistence, graceful shutdown. |
|
|
38
|
+
| **MCP server** | `toon-mcp` | `@modelcontextprotocol/sdk` stdio server. Maps tools → daemon HTTP; auto-spawns the daemon detached if down; reports "bootstrapping — retry" while the BTP session comes up; holds no keys. |
|
|
39
39
|
| **Skill** | `.claude/skills/toon-client/` | Teaches the agent pay-to-write / free-read / settlement semantics. |
|
|
40
40
|
|
|
41
41
|
## Tools
|
|
@@ -80,8 +80,7 @@ On the **first** `toon-clientd run`/`start` (including the auto-spawn from
|
|
|
80
80
|
`TOON_CLIENT_KEYSTORE_PASSWORD` when set, otherwise a default password so the
|
|
81
81
|
identity reloads on every restart with **no env var required**.
|
|
82
82
|
- **Transport scaffolding** — it writes a starter `~/.toon-client/config.json`
|
|
83
|
-
carrying the `btpUrl`/`relayUrl
|
|
84
|
-
block documenting direct-vs-`.anyone` selection.
|
|
83
|
+
carrying the `btpUrl`/`relayUrl` knobs plus a `_help` block documenting them.
|
|
85
84
|
|
|
86
85
|
The one thing you must supply is the apex you pay: set **`btpUrl`** (and usually
|
|
87
86
|
`relayUrl`) in the scaffolded config, then publish. Everything below is for
|
|
@@ -99,12 +98,12 @@ can supply your own via env or an imported keystore.
|
|
|
99
98
|
{
|
|
100
99
|
"network": "testnet", // settlement presets (#209)
|
|
101
100
|
"keystorePath": "~/.toon-client/keystore.json",
|
|
102
|
-
"btpUrl": "ws://<apex-host
|
|
103
|
-
"relayUrl": "
|
|
101
|
+
"btpUrl": "ws://<apex-host>:3000/btp",
|
|
102
|
+
"relayUrl": "ws://<relay-host>:7100", // free reads
|
|
104
103
|
"destination": "g.townhouse.town",
|
|
105
104
|
"feePerEvent": "1",
|
|
106
105
|
"httpPort": 8787,
|
|
107
|
-
//
|
|
106
|
+
// Direct-apex mode: bootstrap finds 0 peers, so name the apex's
|
|
108
107
|
// settlement address directly (mirrors the docker entrypoint):
|
|
109
108
|
"apex": {
|
|
110
109
|
"destination": "g.townhouse.town",
|
|
@@ -120,26 +119,12 @@ can supply your own via env or an imported keystore.
|
|
|
120
119
|
```
|
|
121
120
|
|
|
122
121
|
Environment overrides: `TOON_CLIENT_MNEMONIC`, `TOON_CLIENT_KEYSTORE_PASSWORD`,
|
|
123
|
-
`TOON_CLIENT_BTP_URL`, `TOON_CLIENT_RELAY_URL`,
|
|
122
|
+
`TOON_CLIENT_BTP_URL`, `TOON_CLIENT_RELAY_URL`,
|
|
124
123
|
`TOON_CLIENT_HTTP_PORT`, `TOON_CLIENT_NETWORK`, `TOON_CLIENT_HOME`.
|
|
125
124
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
- `btpUrl`/`relayUrl` on a normal host (`ws://1.2.3.4:3000/btp`, `wss://…`) →
|
|
130
|
-
**direct**, dialed as-is.
|
|
131
|
-
- `btpUrl` on a `.anyone` host → the ToonClient auto-starts a managed `anon`
|
|
132
|
-
SOCKS5h proxy and routes paid writes (and reads) through it.
|
|
133
|
-
- `btpUrl` **direct** but `relayUrl` on a `.anyone` host → the daemon starts its
|
|
134
|
-
own managed `anon` proxy just for the free-read subscription; paid writes stay
|
|
135
|
-
direct. (Mixed transports — a direct apex with a hidden-service relay — work
|
|
136
|
-
out of the box.)
|
|
137
|
-
|
|
138
|
-
No explicit `socksProxy` is needed for any of these. Set `socksProxy` only to
|
|
139
|
-
point at your own external proxy, or `managedAnonProxy: false` to opt out of the
|
|
140
|
-
managed proxy entirely. The first bootstrap pays the anon warm-up cost (~30–90s)
|
|
141
|
-
**once** — the detached daemon then stays up. A read-proxy failure surfaces under
|
|
142
|
-
`relay.proxyError` in `toon_status` and never blocks direct paid writes.
|
|
125
|
+
`btpUrl` (paid writes over BTP) and `relayUrl` (free reads over Nostr-WS) are
|
|
126
|
+
dialed directly as-is. The first bootstrap brings up the BTP session **once** —
|
|
127
|
+
the detached daemon then stays up.
|
|
143
128
|
|
|
144
129
|
### Create an encrypted keystore
|
|
145
130
|
|
|
@@ -197,7 +182,7 @@ Add to `claude_desktop_config.json`:
|
|
|
197
182
|
|
|
198
183
|
Then restart Claude Desktop. The TOON tools appear in the tool list; the first
|
|
199
184
|
`toon_publish` after a cold start may report "bootstrapping — retry" while the
|
|
200
|
-
|
|
185
|
+
BTP session comes up.
|
|
201
186
|
|
|
202
187
|
## Usage example
|
|
203
188
|
|
|
@@ -213,8 +198,8 @@ The agent runs:
|
|
|
213
198
|
{ "ready": true, "bootstrapping": false, "settlementChain": "evm",
|
|
214
199
|
"relay": { "connected": true }, "identity": { "evmAddress": "0x99ed…" } }
|
|
215
200
|
```
|
|
216
|
-
(If it returns `bootstrapping: true` or a "retry shortly" message, wait
|
|
217
|
-
for the
|
|
201
|
+
(If it returns `bootstrapping: true` or a "retry shortly" message, wait a few
|
|
202
|
+
seconds for the BTP session, then retry.)
|
|
218
203
|
|
|
219
204
|
2. **`toon_subscribe`** for its own author so it can read the note back:
|
|
220
205
|
```json
|
|
@@ -273,14 +258,10 @@ receive a target-chain claim.
|
|
|
273
258
|
|
|
274
259
|
```bash
|
|
275
260
|
pnpm --filter @toon-protocol/client-mcp test # unit
|
|
276
|
-
|
|
277
|
-
pnpm --filter @toon-protocol/client-mcp test:integration # gated live-HS round-trip
|
|
261
|
+
pnpm --filter @toon-protocol/client-mcp test:integration # gated integration suite
|
|
278
262
|
```
|
|
279
263
|
|
|
280
|
-
The
|
|
281
|
-
publishes a paid event, reads it back through the subscription, verifies the
|
|
282
|
-
channel nonce advanced, restarts the daemon, and confirms the nonce watermark
|
|
283
|
-
persisted. See `src/__integration__/`.
|
|
264
|
+
The integration suite lives in `src/__integration__/`.
|
|
284
265
|
|
|
285
266
|
## Publishing
|
|
286
267
|
|
|
@@ -295,7 +276,7 @@ are **bundled into `dist`** at build time (tsup `noExternal`), so the published
|
|
|
295
276
|
`package.json` carries **zero `@toon-protocol/*` runtime deps** — only npm
|
|
296
277
|
packages (`fastify`, `@modelcontextprotocol/sdk`, `nostr-tools`, `viem`, `ws`,
|
|
297
278
|
`@toon-format/toon`) plus optional chain libs (`o1js`, `mina-signer`,
|
|
298
|
-
`@solana/web3.js
|
|
279
|
+
`@solana/web3.js`) installed only when you use those chains.
|
|
299
280
|
A guard test (`src/package-structure.test.ts`) fails the build if a
|
|
300
281
|
`@toon-protocol/*` runtime dep ever leaks in.
|
|
301
282
|
|