@toon-protocol/client-mcp 0.2.0 → 0.3.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/README.md CHANGED
@@ -9,8 +9,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, optionally over a managed `.anyone`
13
- SOCKS5h proxy) and a **town-relay Nostr-WS** subscription (free reads) — live in
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 + managed anon + 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 anon boots; holds no keys. |
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
@@ -68,6 +68,10 @@ npx -y -p @toon-protocol/client-mcp toon-mcp # MCP stdio server
68
68
  npx -y -p @toon-protocol/client-mcp toon-clientd # daemon
69
69
  ```
70
70
 
71
+ > **Trying the public devnet?** See [docs/devnet-mcp-quickstart.md](../../docs/devnet-mcp-quickstart.md)
72
+ > for a known-good, end-to-end-verified proxy-mode config (the explicit settlement maps the core
73
+ > devnet preset still omits), faucet funding, and the Windows/WSL bridge.
74
+
71
75
  ## First run (zero-config onboarding)
72
76
 
73
77
  On the **first** `toon-clientd run`/`start` (including the auto-spawn from
@@ -80,8 +84,7 @@ On the **first** `toon-clientd run`/`start` (including the auto-spawn from
80
84
  `TOON_CLIENT_KEYSTORE_PASSWORD` when set, otherwise a default password so the
81
85
  identity reloads on every restart with **no env var required**.
82
86
  - **Transport scaffolding** — it writes a starter `~/.toon-client/config.json`
83
- carrying the `btpUrl`/`relayUrl`/`managedAnonProxy` knobs plus a `_help`
84
- block documenting direct-vs-`.anyone` selection.
87
+ carrying the `btpUrl`/`relayUrl` knobs plus a `_help` block documenting them.
85
88
 
86
89
  The one thing you must supply is the apex you pay: set **`btpUrl`** (and usually
87
90
  `relayUrl`) in the scaffolded config, then publish. Everything below is for
@@ -99,12 +102,12 @@ can supply your own via env or an imported keystore.
99
102
  {
100
103
  "network": "testnet", // settlement presets (#209)
101
104
  "keystorePath": "~/.toon-client/keystore.json",
102
- "btpUrl": "ws://<apex-host>.anyone:3000/btp",
103
- "relayUrl": "wss://<relay-host>.anyone/", // free reads
105
+ "btpUrl": "ws://<apex-host>:3000/btp",
106
+ "relayUrl": "ws://<relay-host>:7100", // free reads
104
107
  "destination": "g.townhouse.town",
105
108
  "feePerEvent": "1",
106
109
  "httpPort": 8787,
107
- // HS / direct-apex mode: bootstrap finds 0 peers, so name the apex's
110
+ // Direct-apex mode: bootstrap finds 0 peers, so name the apex's
108
111
  // settlement address directly (mirrors the docker entrypoint):
109
112
  "apex": {
110
113
  "destination": "g.townhouse.town",
@@ -120,26 +123,12 @@ can supply your own via env or an imported keystore.
120
123
  ```
121
124
 
122
125
  Environment overrides: `TOON_CLIENT_MNEMONIC`, `TOON_CLIENT_KEYSTORE_PASSWORD`,
123
- `TOON_CLIENT_BTP_URL`, `TOON_CLIENT_RELAY_URL`, `TOON_CLIENT_SOCKS`,
126
+ `TOON_CLIENT_BTP_URL`, `TOON_CLIENT_RELAY_URL`,
124
127
  `TOON_CLIENT_HTTP_PORT`, `TOON_CLIENT_NETWORK`, `TOON_CLIENT_HOME`.
125
128
 
126
- **Transport is inferred from the URLs no separate "direct vs hidden-service"
127
- switch.** The daemon parses the host of each URL independently:
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.
129
+ `btpUrl` (paid writes over BTP) and `relayUrl` (free reads over Nostr-WS) are
130
+ dialed directly as-is. The first bootstrap brings up the BTP session **once**
131
+ the detached daemon then stays up.
143
132
 
144
133
  ### Create an encrypted keystore
145
134
 
@@ -197,7 +186,7 @@ Add to `claude_desktop_config.json`:
197
186
 
198
187
  Then restart Claude Desktop. The TOON tools appear in the tool list; the first
199
188
  `toon_publish` after a cold start may report "bootstrapping — retry" while the
200
- anon proxy + BTP session come up.
189
+ BTP session comes up.
201
190
 
202
191
  ## Usage example
203
192
 
@@ -213,8 +202,8 @@ The agent runs:
213
202
  { "ready": true, "bootstrapping": false, "settlementChain": "evm",
214
203
  "relay": { "connected": true }, "identity": { "evmAddress": "0x99ed…" } }
215
204
  ```
216
- (If it returns `bootstrapping: true` or a "retry shortly" message, wait ~30–90s
217
- for the anon proxy + BTP session, then retry.)
205
+ (If it returns `bootstrapping: true` or a "retry shortly" message, wait a few
206
+ seconds for the BTP session, then retry.)
218
207
 
219
208
  2. **`toon_subscribe`** for its own author so it can read the note back:
220
209
  ```json
@@ -273,14 +262,10 @@ receive a target-chain claim.
273
262
 
274
263
  ```bash
275
264
  pnpm --filter @toon-protocol/client-mcp test # unit
276
- RUN_LIVE_HS_E2E=1 …env… \
277
- pnpm --filter @toon-protocol/client-mcp test:integration # gated live-HS round-trip
265
+ pnpm --filter @toon-protocol/client-mcp test:integration # gated integration suite
278
266
  ```
279
267
 
280
- The gated integration test boots the daemon against a live `.anyone` HS apex,
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__/`.
268
+ The integration suite lives in `src/__integration__/`.
284
269
 
285
270
  ## Publishing
286
271
 
@@ -295,7 +280,7 @@ are **bundled into `dist`** at build time (tsup `noExternal`), so the published
295
280
  `package.json` carries **zero `@toon-protocol/*` runtime deps** — only npm
296
281
  packages (`fastify`, `@modelcontextprotocol/sdk`, `nostr-tools`, `viem`, `ws`,
297
282
  `@toon-format/toon`) plus optional chain libs (`o1js`, `mina-signer`,
298
- `@solana/web3.js`, `socks-proxy-agent`) installed only when you use those chains.
283
+ `@solana/web3.js`) installed only when you use those chains.
299
284
  A guard test (`src/package-structure.test.ts`) fails the build if a
300
285
  `@toon-protocol/*` runtime dep ever leaks in.
301
286