replywizard-whatsapp-mcp 0.2.4 → 0.2.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 +12 -9
- package/package.json +2 -2
- package/src/connector.js +15 -1
- package/src/daemon.js +13 -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) ─┐
|
|
@@ -104,7 +107,7 @@ claude mcp add rw --transport http http://127.0.0.1:7870/mcp --header "Authoriza
|
|
|
104
107
|
```json
|
|
105
108
|
{
|
|
106
109
|
"mcpServers": {
|
|
107
|
-
"replywizard": { "command": "npx", "args": ["-y", "
|
|
110
|
+
"replywizard": { "command": "npx", "args": ["-y", "replywizard-whatsapp-mcp"] }
|
|
108
111
|
}
|
|
109
112
|
}
|
|
110
113
|
```
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "replywizard-whatsapp-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
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/connector.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
// reserved for the MCP stdio protocol). Mirrors Kaption's `@kaptionai/mcp-extension` shim.
|
|
14
14
|
|
|
15
15
|
import { spawn } from 'node:child_process';
|
|
16
|
+
import { realpathSync } from 'node:fs';
|
|
16
17
|
import { fileURLToPath } from 'node:url';
|
|
17
18
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
18
19
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
@@ -91,6 +92,19 @@ export async function main() {
|
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
// Run only when invoked directly as the bin entry (not when imported by tests).
|
|
94
|
-
|
|
95
|
+
// process.argv[1] is the path the OS launched: when run via npx or a global/npm bin it is
|
|
96
|
+
// a SYMLINK (…/.bin/replywizard-whatsapp-mcp) while import.meta.url resolves to the real
|
|
97
|
+
// file (…/src/connector.js), so a raw === never matches and main() would silently no-op.
|
|
98
|
+
// Resolve symlinks on BOTH sides before comparing so the guard holds regardless of launcher.
|
|
99
|
+
export function invokedAsEntry() {
|
|
100
|
+
if (!process.argv[1]) return false;
|
|
101
|
+
try {
|
|
102
|
+
return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
|
|
103
|
+
} catch {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (invokedAsEntry()) {
|
|
95
109
|
main().catch((err) => { log('Fatal:', (err && err.stack) || err); process.exit(1); });
|
|
96
110
|
}
|
package/src/daemon.js
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
import http from 'node:http';
|
|
22
22
|
import { randomUUID } from 'node:crypto';
|
|
23
|
+
import { realpathSync } from 'node:fs';
|
|
23
24
|
import { fileURLToPath } from 'node:url';
|
|
24
25
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
25
26
|
import { isInitializeRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
@@ -261,6 +262,17 @@ export async function main() {
|
|
|
261
262
|
}
|
|
262
263
|
|
|
263
264
|
// Run only when invoked directly as the bin entry (not when imported by tests).
|
|
264
|
-
|
|
265
|
+
// argv[1] may be a bin SYMLINK (npx / global / `rw-mcp-daemon`) while import.meta.url is the
|
|
266
|
+
// real file — resolve symlinks on both sides before comparing, else main() silently no-ops.
|
|
267
|
+
export function invokedAsEntry() {
|
|
268
|
+
if (!process.argv[1]) return false;
|
|
269
|
+
try {
|
|
270
|
+
return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
|
|
271
|
+
} catch {
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (invokedAsEntry()) {
|
|
265
277
|
main().catch((err) => { log('Fatal:', (err && err.stack) || err); process.exit(1); });
|
|
266
278
|
}
|