replywizard-whatsapp-mcp 0.3.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
@@ -84,15 +84,36 @@ always an option.
84
84
  Antigravity is a VS Code fork and inherits both `--add-mcp` and the `mcp/install` URL handler,
85
85
  but **it keeps two MCP lists** and they are not the same one:
86
86
 
87
- | List | Path | Key | Written by |
87
+ | List | Path | Key | Reaches the agent? |
88
88
  |---|---|---|---|
89
- | The editor's | `~/.config/Antigravity IDE/User/mcp.json` | `servers` | `antigravity-ide --add-mcp` |
90
- | The agent's | `~/.gemini/config/mcp_config.json` | `mcpServers` | by hand, and it is the config above |
91
-
92
- The **Copy Antigravity command** button hands you the `--add-mcp` line. If the agent panel does
93
- not list Reply Wizard afterwards, put the JSON above into `~/.gemini/config/mcp_config.json`
94
- instead. There is deliberately no deeplink button: the handler ships in the build, but nothing
95
- registers the `antigravity-ide:` scheme on Linux, so the click would do nothing and say nothing.
89
+ | The editor's | `~/.config/Antigravity IDE/User/mcp.json` | `servers` | **No.** Written by `antigravity-ide --add-mcp` |
90
+ | The agent's | `~/.gemini/config/mcp_config.json` | `mcpServers` | **Yes.** Edited by hand, and it is the config above |
91
+
92
+ **Use the agent's file.** That ordering was measured rather than assumed: a traced entry was
93
+ left in the editor's list, whose command appends a line to a log file before starting the real
94
+ server, and it sat there across an IDE restart two and a half hours later without the log ever
95
+ being written. Nothing started it. In that same session the agent answered live WhatsApp
96
+ questions, configured only in the agent's file. So `--add-mcp` reports success and changes
97
+ nothing the agent reads. The **Copy Antigravity config** button gives you the JSON above; the
98
+ `--add-mcp` line is still printed on the tab, labelled for what it does, for anyone who wants
99
+ the entry in the editor's own MCP panel as well.
100
+
101
+ **The bridge names its own version on the handshake** as of 0.3.1, so the extension can tell a
102
+ current host from a stale one and say so on its WhatsApp MCP tab. An absent version is itself
103
+ the signal: a host old enough to matter is exactly one that does not send the field, which is
104
+ why `/healthz` carrying it since 0.3.0 was not enough on its own. The commonest cause of a
105
+ stale host is a **global install shadowing `npx`** -- run
106
+ `npm uninstall -g replywizard-whatsapp-mcp` and the next client start fetches the current one.
107
+
108
+ **Configured is not the same as loaded.** Antigravity caches each loaded server's tool schemas
109
+ under `~/.gemini/antigravity-ide/mcp/<name>/`. On that restart six of the seven configured
110
+ servers had their schemas rewritten within the minute, and Reply Wizard's directory kept a
111
+ two-week-old timestamp, so the agent had no Reply Wizard tools that session. If the agent panel
112
+ does not list Reply Wizard after you edit the file, switch it on there. The connector is not
113
+ the usual cause: five consecutive stdio launches all came up in about 1.7 seconds.
114
+
115
+ There is deliberately no deeplink button: the handler ships in the build, but nothing registers
116
+ the `antigravity-ide:` scheme on Linux, so the click would do nothing and say nothing.
96
117
 
97
118
  ## The command line
98
119
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replywizard-whatsapp-mcp",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Local MCP server and command line that expose WhatsApp Web (read + value tools) to AI clients via the Reply Wizard Chrome extension.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/daemon.js CHANGED
@@ -28,6 +28,7 @@ import { ExtensionBridge } from './wsServer.js';
28
28
  import { createMcpServer } from './mcpServer.js';
29
29
  import { DEFAULT_PORT } from './protocol.js';
30
30
  import { loadOrCreateToken, tokenMatches, bearerFrom } from './daemonAuth.js';
31
+ import { hostVersion } from './hostVersion.js';
31
32
 
32
33
  // Daemon-only (not part of the extension wire contract, so it lives here rather than
33
34
  // in protocol.js). Overridable via env for users who run more than one profile.
@@ -46,16 +47,11 @@ const HOST = '127.0.0.1';
46
47
  * first question in a support thread has an answer the user can read off their own machine.
47
48
  *
48
49
  * Read once, and a failure is `null` rather than a throw: a missing package.json must not
49
- * take the health endpoint down with it.
50
+ * take the health endpoint down with it. The read itself lives in `hostVersion.js` since
51
+ * ledger row 48, because the WebSocket handshake needs the same answer and two readers would
52
+ * be two things to keep true.
50
53
  */
51
- export const HOST_VERSION = (() => {
52
- try {
53
- const here = fileURLToPath(new URL('../package.json', import.meta.url));
54
- return JSON.parse(readFileSync(here, 'utf8')).version || null;
55
- } catch {
56
- return null;
57
- }
58
- })();
54
+ export const HOST_VERSION = hostVersion();
59
55
 
60
56
  const log = (...args) => console.error('[replywizard-mcp]', ...args);
61
57
 
@@ -0,0 +1,37 @@
1
+ // hostVersion.js: this package's own version, read once, for anything that reports it.
2
+ //
3
+ // WHY IT IS ITS OWN MODULE
4
+ // Three places want it and each had a different answer: `/healthz` read it at daemon start,
5
+ // the CLI printed what `/healthz` gave it, and the WebSocket handshake said nothing at all.
6
+ // That last gap is the one that cost something. Measured on the owner's laptop 2026-09-10: a
7
+ // globally installed 0.2.7 was shadowing `npx`, so every client on that machine ran a bridge
8
+ // two versions behind a published 0.3.0, and the extension's MCP tab said "paired" with no
9
+ // hint. `/healthz` carries the version since 0.3.0, which does not help here at all, because
10
+ // the host too old to report it is exactly the host you need to detect.
11
+ //
12
+ // So the version travels on the handshake as well, where the EXTENSION sees it, and an
13
+ // ABSENT value is itself the signal: any host that does not send one predates this field.
14
+ //
15
+ // Read with a try/catch and cached: a packaging accident that moves package.json must degrade
16
+ // to `null` rather than stop the daemon from starting.
17
+
18
+ import { readFileSync } from 'node:fs';
19
+ import { fileURLToPath } from 'node:url';
20
+
21
+ let cached;
22
+
23
+ /** @returns {string|null} e.g. '0.3.1', or null if it cannot be read. */
24
+ export function hostVersion() {
25
+ if (cached !== undefined) return cached;
26
+ try {
27
+ const path = fileURLToPath(new URL('../package.json', import.meta.url));
28
+ const parsed = JSON.parse(readFileSync(path, 'utf8'));
29
+ cached = typeof parsed.version === 'string' ? parsed.version : null;
30
+ } catch {
31
+ cached = null;
32
+ }
33
+ return cached;
34
+ }
35
+
36
+ /** Test seam: forget the cached read. */
37
+ export function resetHostVersionCache() { cached = undefined; }
package/src/wsServer.js CHANGED
@@ -28,6 +28,7 @@ import { join } from 'node:path';
28
28
  import { mkdirSync, readFileSync, writeFileSync, rmSync } from 'node:fs';
29
29
  import { spawn } from 'node:child_process';
30
30
  import { CONTROL, DEFAULT_PORT, PROTOCOL_VERSION, VALUE_ACTIONS } from './protocol.js';
31
+ import { hostVersion } from './hostVersion.js';
31
32
 
32
33
  const log = (...args) => console.error('[replywizard-mcp]', ...args);
33
34
 
@@ -319,7 +320,7 @@ export class ExtensionBridge {
319
320
  const token = msg.params && msg.params.session_token;
320
321
  if (token && this.sessionToken && token === this.sessionToken) {
321
322
  this.paired = true;
322
- this._send({ method: CONTROL.AUTH_SUCCESS, params: { protocol: PROTOCOL_VERSION } });
323
+ this._send({ method: CONTROL.AUTH_SUCCESS, params: { protocol: PROTOCOL_VERSION, host_version: hostVersion() } });
323
324
  this._sendClients(); // sync current assistants to a freshly reconnected extension
324
325
  log('Reconnected with a valid session token (no pairing needed).');
325
326
  } else if (this._pairingCodeIsLive()) {
@@ -364,7 +365,8 @@ export class ExtensionBridge {
364
365
  clearPairingCode();
365
366
  this._resetPairing();
366
367
  this._send({ method: CONTROL.PAIRING_COMPLETE, params: { session_id: randomUUID(), session_token: this.sessionToken } });
367
- this._send({ method: CONTROL.AUTH_SUCCESS, params: {} });
368
+ // Row 48: the extension cannot otherwise tell a current bridge from a stale one.
369
+ this._send({ method: CONTROL.AUTH_SUCCESS, params: { protocol: PROTOCOL_VERSION, host_version: hostVersion() } });
368
370
  this._sendClients(); // sync current assistants right after pairing
369
371
  log('Pairing approved.');
370
372
  } else {