replywizard-whatsapp-mcp 0.2.5 → 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 CHANGED
@@ -107,7 +107,7 @@ claude mcp add rw --transport http http://127.0.0.1:7870/mcp --header "Authoriza
107
107
  ```json
108
108
  {
109
109
  "mcpServers": {
110
- "replywizard": { "command": "npx", "args": ["-y", "-p", "replywizard-whatsapp-mcp", "rw-mcp-connector"] }
110
+ "replywizard": { "command": "npx", "args": ["-y", "replywizard-whatsapp-mcp"] }
111
111
  }
112
112
  }
113
113
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replywizard-whatsapp-mcp",
3
- "version": "0.2.5",
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": {
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
- if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
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
- if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
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
  }