JW

jlucaso1/whatsapp-mcp-ts

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

75 stars 46 forks 质量 64 趋势 14

jlucaso1/whatsapp-mcp-ts 是从 https://github.com/jlucaso1/whatsapp-mcp-ts. 导入的 MCP 服务器候选人。

概览

jlucaso1/whatsapp-mcp-ts 是从 https://github.com/jlucaso1/whatsapp-mcp-ts. 导入的 MCP 服务器候选人。

概述(AI 翻译)

这是一个基于 WhatsApp 的模型上下文协议(MCP)服务器,使用 TypeScript 构建并使用 @whiskeysockets/baileys 库。

它允许您将个人WhatsApp账户连接到AI代理(如Anthropic Claude,通过其桌面应用或光标),使其能够:

  • 搜索你的个人WhatsApp消息。
  • 搜索你的联系人(个人,非群体)。
  • 列出你最近的聊天记录。
  • 获取特定聊天记录。
  • 向个人或团体发送消息。

它通过 WhatsApp Web 多设备 API 直接连接到你的个人 WhatsApp 账户。你所有的消息和认证信息都本地存储在 SQLite 数据库(./data/)和认证缓存(./auth_info/)。只有当 AI 代理明确使用提供的 MCP 工具(你通过代理界面控制)时,数据才会发送给它。

(可选:考虑添加类似此处参考示例的截图或GIF)

示例

用户: 给“Meu amor”发个WhatsApp消息,说“Te amo”


助理: 好,我得先找到联系人。 使用工具:whatsapp.search_contacts


工具结果:


助理:

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

WhatsApp MCP Server (TypeScript/Baileys)

This is a Model Context Protocol (MCP) server for WhatsApp, built with TypeScript and using the @whiskeysockets/baileys library.

It allows you to connect your personal WhatsApp account to an AI agent (like Anthropic Claude via its desktop app or Cursor) enabling it to:

  • Search your personal WhatsApp messages.
  • Search your contacts (individuals, not groups).
  • List your recent chats.
  • Retrieve message history for specific chats.
  • Send messages to individuals or groups.

It connects directly to your personal WhatsApp account using the WhatsApp Web multi-device API. All your messages and authentication details are stored locally in a SQLite database (./data/) and authentication cache (./auth_info/). Data is only sent to the connected AI agent when it explicitly uses the provided MCP tools (which you control via the agent’s interface).

(Optional: Consider adding a screenshot or GIF similar to the reference example here)

Example

User: Send a whatsapp message to “Meu amor” in whatsapp saying “Te amo”


Assistant: Okay, I need to find the contact first. Using tool: whatsapp.search_contacts

{
  "query": "Meu amor"
}

Tool Result:

[
  {
    "jid": "[email protected]",
    "name": "Meu Amor"
  }
]

Assistant: Found the contact. Now sending the message. Using tool: whatsapp.send_message

{
  "recipient": "[email protected]",
  "message": "Te amo"
}

Tool Result:

Message sent successfully to [email protected] (ID: XXXXXXXXXXX).

Key Features (MCP Tools)

The server exposes the following tools to the connected AI agent:

  • search_contacts: Search for contacts by name or phone number part (JID).
  • list_messages: Retrieve message history for a specific chat, with pagination.
  • list_chats: List your chats, sortable by activity or name, filterable, paginated, optionally includes last message details.
  • get_chat: Get detailed information about a specific chat.
  • get_message_context: Retrieve messages sent immediately before and after a specific message ID for context.
  • send_message: Send a text message to a specified recipient JID (user or group).

Installation

Installing via Smithery

To install WhatsApp MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @jlucaso1/whatsapp-mcp-ts --client claude

Prerequisites

  • Node.js: Version 23.10.0 or higher (as specified in package.json). You can check your version with node -v. (Has initial typescript and sqlite builtin support)
  • npm (or yarn/pnpm): Usually comes with Node.js.
在 GitHub 查看完整 README

安装

npx -y @smithery/cli install @jlucaso1/whatsapp-mcp-ts --client claude
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "whatsapp": { "command": "node", "args": [ "{{PATH_TO_REPO}}/src/main.ts" ], "timeout": 15, // Optional: Adjust startup timeout if needed "disabled": false } } }