@lizzythelizard/whatsapp-mcp 0.1.5 → 0.1.7

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/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env node
2
- export {};
2
+ import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
3
+ export declare function startServer(transport: Transport): Promise<() => Promise<void>>;
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAA;AAWzE,wBAAsB,WAAW,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAcpF"}
package/dist/index.js CHANGED
@@ -1,12 +1,40 @@
1
1
  #!/usr/bin/env node
2
2
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
+ import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
3
4
  import pkg from '../package.json' with { type: 'json' };
4
5
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
6
  import { createStore } from './store.js';
6
7
  import { createHandler } from './sync.js';
7
8
  import { promises as fsp } from 'fs';
8
- import { registerWhatsAppTools } from './tools.js';
9
+ import { createServer } from 'node:http';
10
+ import { randomUUID } from 'node:crypto';
11
+ import { parseArgs } from 'node:util';
12
+ import { registerContactResources } from './tools/contactTools.js';
13
+ import { registerChatTools } from './tools/chatTools.js';
14
+ import { registerMessageTools } from './tools/messageTools.js';
15
+ import { registerAuthTools } from './tools/authTools.js';
16
+ import { fileURLToPath } from 'node:url';
17
+ import { resolve } from 'node:path';
9
18
  const dataDir = process.env.DATA_DIR ?? './data';
19
+ const cliOptions = {
20
+ host: { type: 'string', short: 'h', multiple: false },
21
+ port: { type: 'string', short: 'p', multiple: false },
22
+ };
23
+ export async function startServer(transport) {
24
+ const inputData = await readDataFromFile();
25
+ const store = createStore(writeDataToFile, inputData);
26
+ const sync = createHandler(store);
27
+ const server = new McpServer({ name: pkg.name, version: pkg.version });
28
+ registerContactResources(server, store, sync);
29
+ registerChatTools(server, store, sync);
30
+ registerMessageTools(server, store, sync);
31
+ registerAuthTools(server, store, sync);
32
+ await server.connect(transport);
33
+ return async () => {
34
+ sync.close();
35
+ await server.close();
36
+ };
37
+ }
10
38
  async function readDataFromFile() {
11
39
  const canAccess = await fsp.access(dataDir).then(() => true).catch(() => false);
12
40
  if (!canAccess)
@@ -25,17 +53,37 @@ async function writeDataToFile(data) {
25
53
  await fsp.writeFile(`${dataDir}/auth.json`, data.auth, 'utf-8');
26
54
  }
27
55
  async function main() {
28
- const server = new McpServer({ name: pkg.name, version: pkg.version });
29
- const transport = new StdioServerTransport();
30
- const inputData = await readDataFromFile();
31
- const whatsappStore = createStore(writeDataToFile, inputData);
32
- const whatsappSync = createHandler(whatsappStore);
33
- registerWhatsAppTools(server, whatsappStore, whatsappSync);
34
- await server.connect(transport);
35
- console.info('whatsapp-mcp server running on stdio');
56
+ const { values } = parseArgs({
57
+ options: cliOptions,
58
+ args: process.argv.slice(2),
59
+ allowPositionals: false,
60
+ });
61
+ if (values.host || values.port) {
62
+ const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: () => randomUUID() });
63
+ const httpServer = createServer((req, res) => { void transport.handleRequest(req, res); });
64
+ const closeCB = await startServer(transport);
65
+ httpServer.on('close', () => { void closeCB(); });
66
+ const port = values.port ? parseInt(values.port, 10) : 3100;
67
+ if (Number.isNaN(port)) {
68
+ console.error('Invalid port number');
69
+ process.exit(1);
70
+ }
71
+ const host = (values.host ?? 'localhost');
72
+ httpServer.listen(port, host);
73
+ console.info(`whatsapp-mcp server running on http://${host}:${String(port)}`);
74
+ }
75
+ else {
76
+ const transport = new StdioServerTransport();
77
+ const closeCB = await startServer(transport);
78
+ process.on('exit', () => { void closeCB(); });
79
+ console.info('whatsapp-mcp server running on stdio');
80
+ }
81
+ }
82
+ const isMain = resolve(fileURLToPath(import.meta.url)) === resolve(process.argv[1]);
83
+ if (isMain) {
84
+ main().catch((error) => {
85
+ console.error('Server error:', error);
86
+ process.exit(1);
87
+ });
36
88
  }
37
- main().catch((error) => {
38
- console.error('Server error:', error);
39
- process.exit(1);
40
- });
41
89
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,GAAG,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,WAAW,EAAa,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,QAAQ,IAAI,GAAG,EAAE,MAAM,IAAI,CAAA;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,QAAQ,CAAA;AAEhD,KAAK,UAAU,gBAAgB;IAC7B,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAA;IAC/E,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAA;IAChC,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,GAAG,OAAO,aAAa,EAAE,OAAO,CA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,CAAC,CAAA;QAC7B,OAAO,CAAC,IAAI,CAAC,yCAAyC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC/E,CAAC;SACI,CAAC;QACJ,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;QAC5C,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,SAAS,CAAC,CAAA;QAC5C,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,EAAE,CAAA,CAAC,CAAC,CAAC,CAAA;QAC5C,OAAO,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAA;IACtD,CAAC;AACH,CAAC;AAED,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;AACnF,IAAI,MAAM,EAAE,CAAC;IACX,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QAC9B,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAA;QACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { WhatsAppStore } from '../store.js';
3
+ import { WhatsAppHandler } from '../sync.js';
4
+ export declare function registerAuthTools(server: McpServer, store: WhatsAppStore, sync: WhatsAppHandler): void;
5
+ //# sourceMappingURL=authTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authTools.d.ts","sourceRoot":"","sources":["../../src/tools/authTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAI5C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,QAqC/F"}
@@ -0,0 +1,44 @@
1
+ import { toCallError } from './common.js';
2
+ import QRCode from 'qrcode';
3
+ export function registerAuthTools(server, store, sync) {
4
+ server.registerTool('get_auth_qr', { description: 'Get a QR code for WhatsApp authentication.' }, async () => {
5
+ try {
6
+ const status = sync.getStatus();
7
+ if (status.type !== 'needAuth')
8
+ throw new Error('Authentication is not required at this time.');
9
+ const pngBuffer = await QRCode.toBuffer(status.qr, { type: 'png', width: 400, margin: 2 });
10
+ return {
11
+ content: [
12
+ { type: 'text', text: qrExplanation },
13
+ { type: 'image', data: pngBuffer.toString('base64'), mimeType: 'image/png' },
14
+ { type: 'text', text: status.qr },
15
+ ],
16
+ isError: false,
17
+ };
18
+ }
19
+ catch (e) {
20
+ return toCallError(e);
21
+ }
22
+ });
23
+ server.registerTool('get_status', { description: 'Get the current server status.' }, () => {
24
+ try {
25
+ const status = sync.getStatus();
26
+ return { content: [{ type: 'text', text: status.type }], isError: false };
27
+ }
28
+ catch (e) {
29
+ return toCallError(e);
30
+ }
31
+ });
32
+ }
33
+ const qrExplanation = `⚠️ Authentication Required
34
+
35
+ To use this WhatsApp MCP server, you need to link it to your WhatsApp account.
36
+
37
+ 1. Open WhatsApp on your phone
38
+ 2. Tap the three dots menu (⋮) or Settings
39
+ 3. Select "Linked Devices"
40
+ 4. Tap "Link a Device"
41
+ 5. Scan the QR code below with your phone
42
+
43
+ The raw QR code string is also provided below for clients that render QR codes themselves.`;
44
+ //# sourceMappingURL=authTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authTools.js","sourceRoot":"","sources":["../../src/tools/authTools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGzC,OAAO,MAAM,MAAM,QAAQ,C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EAAE,KAAK,EAAE,CAAA;QAC3E,CAAC;QACD,OAAO,CAAC,EAAE,CAAC;YACT,OAAO,WAAW,CAAC,CAAU,CAAC,CAAA;QAChC,CAAC;IACH,CAAC,CACF,CAAA;AACH,CAAC;AAED,MAAM,aAAa,GAAG;;;;;;;;;;2FAUqE,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { type WhatsAppStore } from '../store.js';
3
+ import { WhatsAppHandler } from '../sync.js';
4
+ export declare function registerChatTools(server: McpServer, store: WhatsAppStore, sync: WhatsAppHandler): void;
5
+ //# sourceMappingURL=chatTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatTools.d.ts","sourceRoot":"","sources":["../../src/tools/chatTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAI5C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,QA2B/F"}
@@ -0,0 +1,18 @@
1
+ import z from 'zod';
2
+ import { JidSchema, registerEntityResources, registerTool } from './common.js';
3
+ export function registerChatTools(server, store, sync) {
4
+ registerEntityResources(server, 'chats', 'chat', () => store.getChats(), id => store.getChat(id), c => `chats://app/${c.id}`, c => c.name ?? c.id, () => sync.getStatus());
5
+ registerTool(server, 'set_chat_archived', ArchiveChatSchema, 'Set a WhatsApp chat as archived or unarchived.', async (args) => { await sync.setArchived(args.jid, args.archived); return `Chat ${args.jid} archived status set to ${String(args.archived)}`; }, () => sync.getStatus());
6
+ registerTool(server, 'set_chat_read', ReadChatSchema, 'Set a WhatsApp chat as read or unread.', async (args) => { await sync.setRead(args.jid, args.read); return `Chat ${args.jid} read status set to ${String(args.read)}`; }, () => sync.getStatus());
7
+ }
8
+ const ArchiveChatSchema = z.object({
9
+ jid: JidSchema,
10
+ archived: z.boolean()
11
+ .describe('Whether the chat should be archived (true) or unarchived (false).'),
12
+ });
13
+ const ReadChatSchema = z.object({
14
+ jid: JidSchema,
15
+ read: z.boolean()
16
+ .describe('Whether the chat should be marked as read (true) or unread (false).'),
17
+ });
18
+ //# sourceMappingURL=chatTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatTools.js","sourceRoot":"","sources":["../../src/tools/chatTools.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,KAAK,CAAA;AACnB,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE9E,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,KAAoB,EAAE,IAAqB;IAC9F,uBAAuB,CACrB,MAAM,EAAE,OAAO,EAAE,MAAM,EACvB,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,EACtB,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,EACvB,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,EAAE,EAAE,EAC1B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,EACnB,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CACvB,CAAA;IAED,YAAY,CACV,MAAM,EACN,mBAAmB,EACnB,iBAAiB,EACjB,gDAAgD,EAChD,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,QAAQ,IAAI,CAAC,GAAG,2BAA2B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAA,CAAC,CAAC,EAC9I,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CACvB,CAAA;IAED,YAAY,CACV,MAAM,EACN,eAAe,EACf,cAAc,EACd,wCAAwC,EACxC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,QAAQ,IAAI,CAAC,GAAG,uBAAuB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAA,CAAC,CAAC,EAC9H,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CACvB,CAAA;AACH,CAAC;AAED,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,GAAG,EAAE,SAAS;IACd,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;SAClB,QAAQ,CAAC,mEAAmE,CAAC;CACjF,CAAC,CAAA;AAEF,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;SACd,QAAQ,CAAC,qEAAqE,CAAC;CACnF,CAAC,CAAA"}
@@ -0,0 +1,52 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { type CallToolResult, type ListResourcesResult, type ReadResourceResult } from '@modelcontextprotocol/sdk/types.js';
3
+ import { type SyncStatus } from '../sync.js';
4
+ import z, { ZodType } from 'zod';
5
+ export declare const JidSchema: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
6
+ export declare function registerEntityResources<T>(server: McpServer, pluralType: string, singularType: string, getAll: () => T[], get: (id: string) => T | undefined, toUri: (entity: T) => string, toName: (entity: T) => string, getStatus: () => SyncStatus): void;
7
+ export declare function registerTool<I>(server: McpServer, name: string, inputSchema: ZodType<I>, description: string, action: (args: I) => Promise<string>, getStatus: () => SyncStatus): void;
8
+ export declare function withErrorHandling<R>(getStatus: () => SyncStatus, action: () => R | Promise<R>, onError: (error: Error) => R | Promise<R>): Promise<R>;
9
+ export declare const toCallError: (error: Error) => CallToolResult;
10
+ export declare const toReadResource: (contents: ReadResourceResult["contents"]) => {
11
+ contents: ({
12
+ uri: string;
13
+ text: string;
14
+ mimeType?: string | undefined;
15
+ _meta?: {
16
+ [x: string]: unknown;
17
+ } | undefined;
18
+ } | {
19
+ uri: string;
20
+ blob: string;
21
+ mimeType?: string | undefined;
22
+ _meta?: {
23
+ [x: string]: unknown;
24
+ } | undefined;
25
+ })[];
26
+ };
27
+ export declare const toListResource: (resources: ListResourcesResult["resources"]) => {
28
+ resources: {
29
+ uri: string;
30
+ name: string;
31
+ description?: string | undefined;
32
+ mimeType?: string | undefined;
33
+ size?: number | undefined;
34
+ annotations?: {
35
+ audience?: ("user" | "assistant")[] | undefined;
36
+ priority?: number | undefined;
37
+ lastModified?: string | undefined;
38
+ } | undefined;
39
+ _meta?: {
40
+ [x: string]: unknown;
41
+ } | undefined;
42
+ icons?: {
43
+ src: string;
44
+ mimeType?: string | undefined;
45
+ sizes?: string[] | undefined;
46
+ theme?: "light" | "dark" | undefined;
47
+ }[] | undefined;
48
+ title?: string | undefined;
49
+ }[];
50
+ };
51
+ export declare const toCallResult: (text: string) => CallToolResult;
52
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/tools/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,yCAAyC,CAAA;AACrF,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAC3H,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAGhC,eAAO,MAAM,SAAS,iDAG6H,CAAA;AAEnJ,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,MAAM,EAAE,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z.union([
4
+ z.string().min(1, 'JID is required').endsWith('@s.whatsapp.net', 'JID not a valid WhatsApp JID)'),
5
+ z.string().min(1, 'JID is required').endsWith('@g.us', 'JID not a valid WhatsApp JID)'),
6
+ ]).describe('The JID of the recipient or chat. For example 41791234567@s.whatsapp.net for an individual or 1234567890-1234567890@g.us for a group');
7
+ export function registerEntityResources(server, pluralType, singularType, getAll, get, toUri, toName, getStatus) {
8
+ const toResource = (entity) => entity ? [{ uri: toUri(entity), mimeType: 'application/json', text: JSON.stringify(entity) }] : [];
9
+ server.registerResource(pluralType, `${pluralType}://app`, { title: `All WhatsApp ${pluralType}`, description: `List WhatsApp ${pluralType}`, mimeType: 'application/json' }, async () => withErrorHandling(getStatus, () => toReadResource(getAll().flatMap(e => toResource(e))), (error) => { throw error; }));
10
+ const resourceTemplate = new ResourceTemplate(`${pluralType}://app/{${singularType}Id}`, {
11
+ list: async () => withErrorHandling(getStatus, () => toListResource(getAll().map(e => ({ uri: toUri(e), name: toName(e) }))), (error) => { throw error; }),
12
+ });
13
+ server.registerResource(singularType, resourceTemplate, { title: `A single WhatsApp ${singularType}`, description: `Details of a single WhatsApp ${singularType}`, mimeType: 'application/json' }, async (_, params) => withErrorHandling(getStatus, () => toReadResource(toResource(get(params[`${singularType}Id`]))), (error) => { throw error; }));
14
+ }
15
+ export function registerTool(server, name, inputSchema, description, action, getStatus) {
16
+ server.registerTool(name, { description, inputSchema }, async (args) => withErrorHandling(() => getStatus(), () => action(args).then(toCallResult), e => toCallError(e)));
17
+ }
18
+ export async function withErrorHandling(getStatus, action, onError) {
19
+ try {
20
+ const status = getStatus();
21
+ if (status.type === 'needAuth')
22
+ throw new Error('Authentication required, please call the "get_auth_qr" tool to get a QR code for authentication');
23
+ if (status.type === 'connecting')
24
+ throw new Error('Server still connecting, please wait');
25
+ if (status.type === 'closed')
26
+ throw new Error('Connection closed, please restart server');
27
+ return await action();
28
+ }
29
+ catch (error) {
30
+ return await onError(error);
31
+ }
32
+ }
33
+ export const toCallError = (error) => ({ content: [{ type: 'text', text: `Error: ${error.message}` }], isError: true });
34
+ export const toReadResource = (contents) => ({ contents });
35
+ export const toListResource = (resources) => ({ resources });
36
+ export const toCallResult = (text) => ({ content: [{ type: 'text', text }], isError: false });
37
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/tools/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAGrF,OAAO,CAAc,MAAM,KAAK,CAAA;AAGhC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC;IAC/B,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,QAAQ,CAAC,iBAAiB,EAAE,+BAA+B,CAAC;IACjG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,+BAA+B,CAAC;CACxF,CAAC,CAAC,QAAQ,CAAC,sIAAsI,CAAC,CAAA;AAEnJ,MAAM,UAAU,uBAAuB,CACrC,MAAiB,EACjB,UAAkB,EAClB,YAAoB,EACpB,MAAiB,EACjB,GAAkC,EAClC,KAA4B,EAC5B,MAA6B,EAC7B,SAA2B;IAE3B,MAAM,UAAU,GAAG,CAAC,MAAqB,EAAE,EAAE,CAC3C,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,kBAA2B,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAE7G,MAAM,CAAC,gBAAgB,CACrB,UAAU,EACV,GAAG,UAAU,QAAQ,EACrB,EAAE,KAAK,EAAE,gBAAgB,UAAU,EAAE,EAAE,WAAW,EAAE,i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AAC,QAAwC,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;AAC1F,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAA2C,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAA;AAC9F,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAY,EAAkB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { type WhatsAppStore } from '../store.js';
3
+ import { type WhatsAppHandler } from '../sync.js';
4
+ export declare function registerContactResources(server: McpServer, store: WhatsAppStore, sync: WhatsAppHandler): void;
5
+ //# sourceMappingURL=contactTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contactTools.d.ts","sourceRoot":"","sources":["../../src/tools/contactTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAA;AAGjD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,QAOtG"}
@@ -0,0 +1,5 @@
1
+ import { registerEntityResources } from './common.js';
2
+ export function registerContactResources(server, store, sync) {
3
+ registerEntityResources(server, 'contacts', 'contact', () => store.getContacts(), id => store.getContact(id), c => `contacts://app/${c.id}`, c => c.name ?? c.id, () => sync.getStatus());
4
+ }
5
+ //# sourceMappingURL=contactTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contactTools.js","sourceRoot":"","sources":["../../src/tools/contactTools.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,UAAU,wBAAwB,CAAC,MAAiB,EAAE,KAAoB,EAAE,IAAqB;IACrG,uBAAuB,CACrB,MAAM,EAAE,UAAU,EAAE,SAAS,EAC7B,GAAG,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,EACrD,CAAC,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,EAClD,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CACvB,CAAA;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { type WhatsAppStore } from '../store.js';
3
+ import { WhatsAppHandler } from '../sync.js';
4
+ export declare function registerMessageTools(server: McpServer, store: WhatsAppStore, sync: WhatsAppHandler): void;
5
+ //# sourceMappingURL=messageTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messageTools.d.ts","sourceRoot":"","sources":["../../src/tools/messageTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAI5C,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,QAgBlG"}
@@ -0,0 +1,13 @@
1
+ import z from 'zod';
2
+ import { JidSchema, registerEntityResources, registerTool } from './common.js';
3
+ export function registerMessageTools(server, store, sync) {
4
+ registerEntityResources(server, 'messages', 'message', () => store.getMessages(), id => store.getMessage(id), m => `messages://app/${m.key.id}`, m => m.key.id, () => sync.getStatus());
5
+ registerTool(server, 'send_message', SendMessageSchema, 'Send a WhatsApp-Message to a given JID.', async (args) => { await sync.sendMessage(args.jid, args.message); return `Message sent to ${args.jid}: "${args.message}"`; }, () => sync.getStatus());
6
+ }
7
+ const SendMessageSchema = z.object({
8
+ jid: JidSchema,
9
+ message: z.string()
10
+ .min(1, 'Message body is required')
11
+ .describe('The body of the message to be sent. Can contain unicode characters like emojis.'),
12
+ });
13
+ //# sourceMappingURL=messageTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messageTools.js","sourceRoot":"","sources":["../../src/tools/messageTools.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,KAAK,CAAA;AACnB,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE9E,MAAM,UAAU,oBAAoB,CAAC,MAAiB,EAAE,KAAoB,EAAE,IAAqB;IACjG,uBAAuB,CACrB,MAAM,EAAE,UAAU,EAAE,SAAS,EAC7B,GAAG,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,EACrD,CAAC,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAChD,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CACvB,CAAA;IAED,YAAY,CACV,MAAM,EACN,cAAc,EACd,iBAAiB,EACjB,yCAAyC,EACzC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,mBAAmB,IAAI,CAAC,GAAG,MAAM,IAAI,CAAC,OAAO,GAAG,CAAA,CAAC,CAAC,EAC3H,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CACvB,CAAA;AACH,CAAC;AAED,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,GAAG,EAAE,SAAS;IACd,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;SAChB,GAAG,CAAC,CAAC,EAAE,0BAA0B,CAAC;SAClC,QAAQ,CAAC,iFAAiF,CAAC;CAC/F,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@lizzythelizard/whatsapp-mcp",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "MCP server for WhatsApp integration",
5
+ "author": { "name": "Matthias Graf" },
5
6
  "type": "module",
6
7
  "main": "dist/index.js",
7
8
  "files": [
@@ -28,11 +29,15 @@
28
29
  "build": "tsc",
29
30
  "start": "node dist/index.js",
30
31
  "dev": "tsx watch src/index.ts",
32
+ "dev:http": "tsx watch src/index.ts -h localhost",
31
33
  "test": "vitest run",
32
34
  "test:watch": "vitest",
33
35
  "lint": "eslint src/",
34
36
  "lint:fix": "eslint src/ --fix",
35
- "typecheck": "tsc --noEmit"
37
+ "typecheck": "tsc --noEmit",
38
+ "mcpb:manifest": "node scripts/create-mcpb-manifest.mjs",
39
+ "mcpb:pack": "npx mcpb pack",
40
+ "mcpb": "npm run mcpb:manifest && npm run mcpb:pack"
36
41
  },
37
42
  "keywords": [
38
43
  "mcp",
@@ -44,13 +49,17 @@
44
49
  "@modelcontextprotocol/sdk": "^1.29.0",
45
50
  "@stylistic/eslint-plugin": "^5.10.0",
46
51
  "@whiskeysockets/baileys": "^7.0.0-rc13",
52
+ "qrcode": "^1.5.4",
47
53
  "zod": "^4.4.3"
48
54
  },
49
55
  "devDependencies": {
56
+ "@anthropic-ai/mcpb": "^2.1.2",
50
57
  "@eslint/js": "^10.0.1",
51
58
  "@types/node": "^26.0.1",
59
+ "@types/qrcode": "^1.5.6",
52
60
  "@typescript-eslint/eslint-plugin": "^8.62.0",
53
61
  "eslint": "^10.5.0",
62
+ "eslint-plugin-import-x": "^4.17.0",
54
63
  "tsx": "^4.22.4",
55
64
  "typescript": "^6.0.3",
56
65
  "typescript-eslint": "^8.62.0",
package/dist/tools.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
2
- import { WhatsAppStore } from './store.js';
3
- import { WhatsAppHandler } from './sync.js';
4
- export declare function registerWhatsAppTools(server: McpServer, store: WhatsAppStore, sync: WhatsAppHandler): void;
5
- //# sourceMappingURL=tools.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,sCAAsC,CAAA;AAClF,OAAO,EAA4C,aAAa,EAAE,MAAM,YAAY,CAAA;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAK3C,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,QAMnG"}
package/dist/tools.js DELETED
@@ -1,74 +0,0 @@
1
- import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp';
2
- import z from 'zod';
3
- export function registerWhatsAppTools(server, store, sync) {
4
- registerChatsResources(server, store);
5
- registerContactsResources(server, store);
6
- registerMessagesResources(server, store);
7
- registerMessageTools(server, sync);
8
- registerChatTools(server, sync);
9
- }
10
- function registerChatsResources(server, store) {
11
- server.registerResource('chats', 'chats://app', { title: 'All WhatsApp Chats', description: 'List WhatsApp chats', mimeType: 'application/json' }, () => toReadResource(store.getChats().flatMap(chatToReadResource)));
12
- server.registerResource('chat', new ResourceTemplate('chats://app/{chatId}', { list: () => toListResource(store.getChats().flatMap(chatToListResource)) }), { title: 'A single WhatsApp Chat', description: 'Details of a single WhatsApp chat', mimeType: 'application/json' }, (_, { chatId }) => toReadResource(chatToReadResource(store.getChat(chatId))));
13
- }
14
- const chatToReadResource = (chat) => chat
15
- ? [{ uri: `chats://app/${chat.id}`, mimeType: 'application/json', text: JSON.stringify(chat) }]
16
- : [];
17
- const chatToListResource = (chat) => chat
18
- ? [{ uri: `chats://app/${chat.id}`, name: chat.name ?? chat.id }]
19
- : [];
20
- function registerContactsResources(server, store) {
21
- server.registerResource('contacts', 'contacts://app', { title: 'All WhatsApp Contacts', description: 'List WhatsApp contacts', mimeType: 'application/json' }, () => toReadResource(store.getContacts().flatMap(contactToReadResource)));
22
- server.registerResource('contact', new ResourceTemplate('contacts://app/{contactId}', { list: () => toListResource(store.getContacts().flatMap(contactToListResource)) }), { title: 'A single WhatsApp Contact', description: 'Details of a single WhatsApp contact', mimeType: 'application/json' }, (_, { contactId }) => toReadResource(contactToReadResource(store.getContact(contactId))));
23
- }
24
- const contactToReadResource = (contact) => contact
25
- ? [{ uri: `contacts://app/${contact.id}`, mimeType: 'application/json', text: JSON.stringify(contact) }]
26
- : [];
27
- const contactToListResource = (contact) => contact
28
- ? [{ uri: `contacts://app/${contact.id}`, name: contact.name ?? contact.id }]
29
- : [];
30
- function registerMessagesResources(server, store) {
31
- server.registerResource('messages', 'messages://app', { title: 'All WhatsApp Messages', description: 'List WhatsApp messages', mimeType: 'application/json' }, () => toReadResource(store.getMessages().flatMap(messageToReadResource)));
32
- server.registerResource('message', new ResourceTemplate('messages://app/{messageId}', { list: () => toListResource(store.getMessages().flatMap(messageToListResource)) }), { title: 'A single WhatsApp Message', description: 'Details of a single WhatsApp message', mimeType: 'application/json' }, (_, { messageId }) => toReadResource(messageToReadResource(store.getMessage(messageId))));
33
- }
34
- const messageToReadResource = (message) => message
35
- ? [{ uri: `messages://app/${message.key.id}`, mimeType: 'application/json', text: JSON.stringify(message) }]
36
- : [];
37
- const messageToListResource = (message) => message
38
- ? [{ uri: `messages://app/${message.key.id}`, name: message.key.id }]
39
- : [];
40
- const toReadResource = (t) => ({ contents: t });
41
- const toListResource = (t) => ({ resources: t });
42
- function registerMessageTools(server, sync) {
43
- server.registerTool('send_message', { description: 'Send a WhatsApp-Message to a given JID.', inputSchema: SendMessageSchema }, args => sync.sendMessage(args.jid, args.message).then(messageToText).then(toCallResult).catch(toCallError));
44
- }
45
- const messageToText = (message) => {
46
- return `Message sent to ${message.key.remoteJid ?? 'unknown'}: "${message.message?.conversation ?? 'unknown'}"`;
47
- };
48
- function registerChatTools(server, sync) {
49
- server.registerTool('set_chat_archived', { description: 'Set a WhatsApp chat as archived or unarchived.', inputSchema: ArchiveChatSchema }, args => sync.setArchived(args.jid, args.archived).then(() => `Chat ${args.jid} archived status set to ${args.archived.toString()}`).then(toCallResult).catch(toCallError));
50
- server.registerTool('set_chat_read', { description: 'Set a WhatsApp chat as read or unread.', inputSchema: ReadChatSchema }, args => sync.setRead(args.jid, args.read).then(() => `Chat ${args.jid} read status set to ${args.read.toString()}`).then(toCallResult).catch(toCallError));
51
- }
52
- const JidSchema = z.union([
53
- z.string().min(1, 'JID is required').endsWith('@s.whatsapp.net', 'JID not a valid WhatsApp JID)'),
54
- z.string().min(1, 'JID is required').endsWith('@g.us', 'JID not a valid WhatsApp JID)'),
55
- ]).describe('The JID of the recipient or chat. For example 41791234567@s.whatsapp.net for an individual or 1234567890-1234567890@g.us for a group');
56
- const SendMessageSchema = z.object({
57
- jid: JidSchema,
58
- message: z.string()
59
- .min(1, 'Message body is required')
60
- .describe('The body of the message to be sent. Can contain unicode characters like emojis.'),
61
- });
62
- const ArchiveChatSchema = z.object({
63
- jid: JidSchema,
64
- archived: z.boolean()
65
- .describe('Whether the chat should be archived (true) or unarchived (false).'),
66
- });
67
- const ReadChatSchema = z.object({
68
- jid: JidSchema,
69
- read: z.boolean()
70
- .describe('Whether the chat should be marked as read (true) or unread (false).'),
71
- });
72
- const toCallResult = (t) => ({ content: [{ type: 'text', text: t }], isError: false });
73
- const toCallError = (error) => ({ content: [{ type: 'text', text: `Error: ${error.message}` }], isError: true });
74
- //# sourceMappingURL=tools.js.map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