Skip to content

Navigation Menu

Toggle navigation Sign in

Search or jump to...

Search code, repositories, users, issues, pull requests...

Search Clear Search syntax tips

Provide feedback

We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Cancel Submit feedback

Saved searches

Use saved searches to filter your results more quickly

Name Query To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up Reseting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} lharries / **whatsapp-mcp ** Public

WhatsApp MCP server x.com/LukeHarries_/status/1905986562388635913 1.2k stars 179 forks Branches Tags Activity

lharries/whatsapp-mcp

main BranchesTags

Code

Folders and files

Name| Name| Last commit message| Last commit date ---|---|---|---

Latest commit

History

8 Commits whatsapp-bridge| whatsapp-bridge whatsapp-mcp-server| whatsapp-mcp-server .gitignore| .gitignore README.md| README.md example-use.png| example-use.png View all files

Repository files navigation

WhatsApp MCP Server

这是一个用于 WhatsApp 的 Model Context Protocol (MCP) 服务器。 通过它,您可以搜索您的个人 WhatsApp 消息、搜索您的联系人,以及向个人或群组发送消息。 它直接通过 WhatsApp web multidevice API(使用 whatsmeow 库)连接到您的个人 WhatsApp 帐户。您的所有消息都本地存储在 SQLite 数据库中,只有当 agent 通过工具(您控制的)访问它们时,才会发送到 LLM(例如 Claude)。

这是一个连接到 Claude 后您可以执行的操作的示例。

WhatsApp MCP

若要获取关于此项目和我正在做的其他项目的更新,请在此处输入您的电子邮件

Installation

Prerequisites

Steps

  1. Clone this repository
git clone https://github.com/lharries/whatsapp-mcp.git
cd whatsapp-mcp
  1. Run the WhatsApp bridge

导航到 whatsapp-bridge 目录并运行 Go 应用程序:

cd whatsapp-bridge
go run main.go

首次运行时,系统将提示您扫描二维码。使用您的 WhatsApp 移动应用程序扫描二维码进行身份验证。 大约 20 天后,您可能需要重新进行身份验证。

  1. Connect to the the MCP server

复制下面的 JSON,并填入正确的 {{PATH}} 值:

{
 "mcpServers": {
  "whatsapp": {
   "command": "{{PATH}}/.local/bin/uv", // 运行 `which uv` 并将输出放在这里
   "args": [
    "--directory",
    "{{PATH}}/whatsapp-mcp/whatsapp-mcp-server", // cd 进入 repo,运行 `pwd` 并输入输出 + "/whatsapp-mcp-server"
    "run",
    "main.py"
   ]
  }
 }
}

对于 Claude,将其另存为 claude_desktop_config.json,并放置在 Claude Desktop 的配置目录中:

~/Library/Application Support/Claude/claude_desktop_config.json

对于 Cursor,将其另存为 mcp.json,并放置在 Cursor 的配置目录中:

~/.cursor/mcp.json

  1. Restart Claude Desktop / Cursor

打开 Claude Desktop,您现在应该看到 WhatsApp 作为一个可用的集成。 或者重启 Cursor。

Architecture Overview

此应用程序由两个主要组件组成:

  1. Go WhatsApp Bridge (whatsapp-bridge/):一个 Go 应用程序,它连接到 WhatsApp 的 Web API,通过 QR 码处理身份验证,并将消息历史记录存储在 SQLite 中。它充当 WhatsApp 和 MCP 服务器之间的桥梁。

  2. Python MCP Server (whatsapp-mcp-server/):一个 Python 服务器,它实现了 Model Context Protocol (MCP),该协议提供了标准化工具,供 Claude 与 WhatsApp 数据交互并发送/接收消息。

Data Storage

Usage

连接后,您可以通过 Claude 与您的 WhatsApp 联系人互动,在您的 WhatsApp 对话中利用 Claude 的 AI 功能。

MCP Tools

Claude 可以访问以下工具来与 WhatsApp 互动:

Technical Details

  1. Claude 向 Python MCP 服务器发送请求
  2. MCP 服务器查询 Go bridge 以获取 WhatsApp 数据或直接查询 SQLite 数据库
  3. Go 访问 WhatsApp API 并保持 SQLite 数据库的最新状态
  4. 数据通过链条返回到 Claude
  5. 发送消息时,请求从 Claude 通过 MCP 服务器流向 Go bridge 并流向 WhatsApp

Troubleshooting

Authentication Issues

有关其他 Claude Desktop 集成故障排除信息,请参阅 MCP 文档。该文档包括检查日志和解决常见问题的有用提示。

About

WhatsApp MCP server x.com/LukeHarries_/status/1905986562388635913

Topics

ai mcp whatsapp whatsapp-api

Resources

Readme Activity

Stars

1.2k stars

Watchers

12 watching

Forks

179 forks Report repository

Releases

No releases published

Packages 0

No packages published

Contributors 2

Languages

Footer

© 2025 GitHub, Inc.

Footer navigation

You can’t perform that action at this time.