replywizard-whatsapp-mcp 0.2.3 → 0.2.5
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 +11 -8
- package/package.json +2 -2
- package/src/daemon.js +10 -2
- package/src/wsServer.js +7 -1
package/README.md
CHANGED
|
@@ -40,10 +40,11 @@ extension** (the hub only sees tool arguments and results).
|
|
|
40
40
|
|
|
41
41
|
## Setup
|
|
42
42
|
|
|
43
|
-
> **
|
|
44
|
-
>
|
|
45
|
-
> can share one WhatsApp session
|
|
46
|
-
>
|
|
43
|
+
> **Multi-agent by default.** The `npx -y replywizard-whatsapp-mcp` config below runs the **connector**
|
|
44
|
+
> (the package's default bin), which auto-starts a shared local **daemon** — so several assistants
|
|
45
|
+
> (Claude Code + Cursor + Claude Desktop, …) can share one WhatsApp session at once, with no extra setup.
|
|
46
|
+
> See [Multiple AI assistants at once](#multiple-ai-assistants-at-once-daemon) for the architecture. Use
|
|
47
|
+
> the single-arg form above (not the older `-p <pkg> <bin>` form, which some clients fail to launch).
|
|
47
48
|
|
|
48
49
|
Published to npm as [`replywizard-whatsapp-mcp`](https://www.npmjs.com/package/replywizard-whatsapp-mcp).
|
|
49
50
|
You don't install anything by hand — your AI client runs it via `npx` (requires Node.js 18+).
|
|
@@ -73,13 +74,15 @@ claude mcp add replywizard -- npx -y replywizard-whatsapp-mcp
|
|
|
73
74
|
`RW_MCP_PORT` is optional (defaults to `7869`); set it on both sides if you change it.
|
|
74
75
|
|
|
75
76
|
> **Running from source instead?** Clone the repo, `cd mcp-host && npm install`, and point your
|
|
76
|
-
> client at `node /absolute/path/to/mcp-host/src/
|
|
77
|
+
> client at `node /absolute/path/to/mcp-host/src/connector.js` (multi-agent) — or
|
|
78
|
+
> `node .../src/index.js` for the legacy single-client, no-daemon hub.
|
|
77
79
|
|
|
78
80
|
## Multiple AI assistants at once (daemon)
|
|
79
81
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
This happens automatically with the `npx` config above: `replywizard-whatsapp-mcp` runs the connector,
|
|
83
|
+
which starts one shared daemon. (The legacy `index.js` hub — run directly via `node .../src/index.js` —
|
|
84
|
+
binds the WebSocket port itself, so **only one AI client can use it at a time**; a second launch hits
|
|
85
|
+
`EADDRINUSE`.) The daemon architecture:
|
|
83
86
|
|
|
84
87
|
```
|
|
85
88
|
client A (HTTP) ─┐
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "replywizard-whatsapp-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Local MCP server that exposes WhatsApp Web (read + value tools) to AI clients via the Reply Wizard Chrome extension.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"replywizard-whatsapp-mcp": "src/
|
|
7
|
+
"replywizard-whatsapp-mcp": "src/connector.js",
|
|
8
8
|
"rw-mcp-daemon": "src/daemon.js",
|
|
9
9
|
"rw-mcp-connector": "src/connector.js"
|
|
10
10
|
},
|
package/src/daemon.js
CHANGED
|
@@ -125,8 +125,16 @@ export function createDaemon({
|
|
|
125
125
|
});
|
|
126
126
|
transport.onclose = () => { if (sid && sessions.delete(sid)) publishClients(); };
|
|
127
127
|
const server = createMcpServer(bridge);
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
try {
|
|
129
|
+
await server.connect(transport);
|
|
130
|
+
await transport.handleRequest(req, res, body);
|
|
131
|
+
} catch (e) {
|
|
132
|
+
// A rejected initialize (e.g. DNS-rebinding block, malformed body) must not
|
|
133
|
+
// leak the freshly-connected Server/transport. close() also fires onclose →
|
|
134
|
+
// session cleanup if it had already registered. Re-throw so handle() 500s.
|
|
135
|
+
try { await transport.close(); } catch { /* noop */ }
|
|
136
|
+
throw e;
|
|
137
|
+
}
|
|
130
138
|
}
|
|
131
139
|
|
|
132
140
|
async function handle(req, res) {
|
package/src/wsServer.js
CHANGED
|
@@ -330,7 +330,13 @@ export class ExtensionBridge {
|
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
_send(obj) {
|
|
333
|
-
if
|
|
333
|
+
// Never throw out of a send: if the socket is closing mid-write, socket.send can
|
|
334
|
+
// throw and would otherwise unwind _dispatch, leaking a lane slot until timeout.
|
|
335
|
+
// Swallowing here is safe — the per-action timeout and _failAll(on-disconnect)
|
|
336
|
+
// both recover the in-flight entry.
|
|
337
|
+
try {
|
|
338
|
+
if (this.socket && this.socket.readyState === this.socket.OPEN) this.socket.send(JSON.stringify(obj));
|
|
339
|
+
} catch { /* socket closing; recovery handled by timeout / disconnect */ }
|
|
334
340
|
}
|
|
335
341
|
|
|
336
342
|
// Set the list of connected MCP clients (called by the daemon on session
|