原型 · 预览版:收录官方注册中心里的全部服务器,每 30 分钟同步一次。使用 Google 登录即可撰写评价。原型 · 每 30 分钟更新
PopNx MCP为使用 AI 的人准备的 MCP 服务器 · 用大白话讲清楚

WhatsApp Web MCP Server

作者:mario-andreschak版本 1.2.0i★ 31i在你的电脑上运行代码仓库 ↗
注册名称io.github.mario-andreschak/mcp-whatsapp-web

安装方法

What it does

WhatsApp MCP via web.js or browserless Baileys: messages, media, chats, groups and contacts

  • Connects 在你的电脑上运行
  • Account or key No key needed · 1 setting to fill in (BROWSER_EXECUTABLE_PATH)
  • Category 聊天与邮件

为什么排在这里

列表按使用分(满分 100)排序,由以下部分组成

热度18/80GitHub 星标或每周下载量:较大的计 60,较小的计 20
新鲜度12/1230 天内有发布或代码更新得满分
仍在响应0/8上次检查时云端端点有响应
使用分30/100

质量: 基础检查通过 3/3 项(仅展示,不用于排序) · 上升势头: 暂无数据 (只用于“上升中”标签)

安装

选择你使用的 AI 应用,然后复制设置。

用一句话让 AI 帮你安装

请帮我安装 WhatsApp Web MCP Server。按照 https://mcp.popnx.com/i/mario-andreschak-mcp-whatsapp-web.md 操作,先把命令给我看,等我同意后再运行。

粘贴到能在你电脑上工作的 AI(如 Claude Code、Cursor)。它会读取我们的步骤,先给你看命令,等你同意。无需密钥,无需注册。 · 查看 AI 会读取的全文

通过 3/3 项检查 · 在你的电脑上运行 · ✓ 命令已检查 2026年11月14日

第一步:你用哪个 AI?

选择你用的应用,步骤会显示在下方。

可连接 Claude,但需要先准备

需要填写 1 项设置(BROWSER_EXECUTABLE_PATH) · 需要先在电脑上安装 Node.js(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用

让 AI 帮你安装

把这段话复制到 Claude 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。

请在这台电脑上为 Claude 安装 MCP server WhatsApp Web MCP Server,按顺序:1) 用 node -v 检查是否有 Node.js。没有的话,请让我从 https://nodejs.org/en/download 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):{ "mcpServers": { "whatsapp-web": { "command": "npx", "args": [ "-y", "mcp-whatsapp-web" ], "env": { "BROWSER_EXECUTABLE_PATH": "your-value" } } } } 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) BROWSER_EXECUTABLE_PATH 先保留 "your-value",请我自己把真实值粘贴到文件或应用的输入框里。不要让我在对话里输入密钥。5) 按约定执行,然后确认 WhatsApp Web MCP Server 的工具真的出现了。

这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 Node.js(如果还没有)

    已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter

    node -v
    • 显示版本号(例如 v26.13.1)= 已安装,可跳过这一步
    • 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
    怎么打开终端

    Mac:按 ⌘ + Space,输入 Terminal 后按 Enter

    Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”

    还没安装: 打开官方下载页,选择 LTS 版本和点选式安装程序:Mac 用 .pkg · Windows 用 .msi。双击后一路下一步即可,不需要 curl 命令

    打开 Node.js 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: node -v

    安装一次,所有需要 Node.js 的工具都能用

  2. 填写 1 项设置

    这些是程序设置,不是密钥,无需注册。按开发者的说明填写。

    • BROWSER_EXECUTABLE_PATH 仅限 webjs:浏览器可执行文件。系统会自动检测 Chrome 和 Edge;如需使用特定浏览器,请设置此项。发送视频和 GIF 需要 Chrome/Edge。
      查看英文原文webjs only: browser executable. Chrome and Edge are auto-detected; set this to use a specific browser. Chrome/Edge is required for sending videos and GIFs.

    说明为自动翻译,变量名保持原样;不确定时请查看原文。

  3. 打开电脑版 Claude 应用的设置文件

    SettingsDeveloperEdit Config

  4. 粘贴这些设置并保存文件

    {
      "mcpServers": {
        "whatsapp-web": {
          "command": "npx",
          "args": [
            "-y",
            "mcp-whatsapp-web"
          ],
          "env": {
            "BROWSER_EXECUTABLE_PATH": "your-value"
          }
        }
      }
    }
  5. 退出 Claude 再重新打开

  6. 试一试

    用 WhatsApp Web MCP Server 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 Claude 说正在使用 WhatsApp Web MCP Server,或回答中出现 WhatsApp Web MCP Server 的工具名称,就表示连接成功

15 项可选设置(不填也能用)

上面的命令不填这些也能用。想调整时再按开发者的说明添加。

  • WHATSAPP_BACKEND WhatsApp 后端:webjs 使用持久的浏览器配置文件;baileys 无需浏览器即可连接,并且需要单独配对。
    查看英文原文WhatsApp backend: webjs uses a persistent browser profile; baileys connects without a browser and requires separate pairing
    · 默认值 webjs
  • BAILEYS_SESSION_DIR Baileys 凭据及同步历史记录目录(默认值:/baileys-sessions)。请使用私有的绝对路径,且仅由一个服务器进程拥有。
    查看英文原文Baileys credentials and synchronized history directory (default: /baileys-sessions). Use a private absolute path, owned by one server process.
  • LOG_LEVEL 日志文件的日志级别(logs/mcp-whatsapp.log)。
    查看英文原文Log level for the log file (logs/mcp-whatsapp.log)
    · 默认值 info
  • LOG_STDERR_LEVEL stderr 的日志级别(在大多数 MCP 客户端日志中可见)。
    查看英文原文Log level for stderr (visible in most MCP client logs)
    · 默认值 warn
  • WHATSAPP_HEADLESS 仅限 webjs:设为 false 可显示浏览器窗口,而不是无头运行
    查看英文原文webjs only: set to false to show the browser window instead of running headless
  • WHATSAPP_NO_SANDBOX 仅限 webjs:为需要的容器显式禁用浏览器沙箱。沙箱默认启用。
    查看英文原文webjs only: explicitly disable the browser sandbox for containers that require it. The sandbox is enabled by default.
    · 默认值 false
  • WHATSAPP_SESSION_DIR 仅限 webjs:持久化浏览器配置文件目录(默认:/whatsapp-sessions)
    查看英文原文webjs only: persistent browser profile directory (default: /whatsapp-sessions)
  • WHATSAPP_PAIRING_PHONE_NUMBER 电话号码配对:设置后(国际格式,不含符号,例如 4915112345678),启动时会将 8 位配对码输出到 stderr,而不再依赖二维码。
    查看英文原文Phone number pairing: when set (international, symbol-free format, e.g. 4915112345678), an 8-character pairing code is logged to stderr on startup instead of relying on the QR code
  • FFMPEG_PATH ffmpeg 可执行文件的路径(仅在需要覆盖通过 ffmpeg-static npm 包自动安装的 ffmpeg 时才需要)
    查看英文原文Path to an ffmpeg binary (only needed to override the ffmpeg installed automatically via the ffmpeg-static npm package)
  • WA_WEB_VERSION 仅限 webjs:若 WhatsApp 端更新导致客户端失效,可固定 WhatsApp Web 版本。
    查看英文原文webjs only: pin the WhatsApp Web version if a WhatsApp-side update breaks the client.
  • HEALTH_CHECK_INTERVAL_MS webjs only: connection health check interval in milliseconds (<=0 disables) · 默认值 60000
  • TOOL_READY_TIMEOUT_MS 工具调用等待 WhatsApp 客户端就绪的时长,超时后报错。
    查看英文原文How long tool calls wait for the WhatsApp client to become ready before erroring
    · 默认值 45000
  • MCP_HTTP_PORT When set, additionally exposes the MCP endpoint at http://127.0.0.1: /mcp (Streamable HTTP) from the same process
  • MCP_HTTP_HOST HTTP 端点的绑定地址(请勿公开暴露;该端点控制您的个人 WhatsApp 账户)
    查看英文原文Bind address for the HTTP endpoint (do not expose publicly; the endpoint controls your personal WhatsApp account)
    · 默认值 127.0.0.1
  • MCP_OAUTH 为 HTTP 端点启用 OAuth:/mcp 需要 bearer token,客户端通过显示 WhatsApp 二维码/配对表单的浏览器页面进行身份验证
    查看英文原文Enable OAuth for the HTTP endpoint: /mcp requires a bearer token and clients authenticate via a browser page showing the WhatsApp QR code / pairing form

说明为自动翻译,变量名保持原样;不确定时请查看原文。

菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同

ChatGPT 暂时无法连接 WhatsApp Web MCP Server

WhatsApp Web MCP Server 需要安装在你的电脑上,而 ChatGPT 只能连接在网上运行的服务器

你可以改用这些方式

A · 使用能连接 WhatsApp Web MCP Server 的应用

  • 需要填写 1 项设置(BROWSER_EXECUTABLE_PATH) · 需要先在电脑上安装 Node.js(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用
  • 需要填写 1 项设置(BROWSER_EXECUTABLE_PATH) · 需要先在电脑上安装 Node.js(只需一次)
  • 需要填写 1 项设置(BROWSER_EXECUTABLE_PATH) · 需要先在电脑上安装 Node.js(只需一次)
  • 需要填写 1 项设置(BROWSER_EXECUTABLE_PATH) · 需要先在电脑上安装 Node.js(只需一次)

B · 聊天与邮件 类中能连接 ChatGPT 的其他服务器

从同类中使用较多的里挑选,仅限用地址即可连接、无需密钥的

可连接 Claude Code,但需要先准备

需要填写 1 项设置(BROWSER_EXECUTABLE_PATH) · 需要先在电脑上安装 Node.js(只需一次)

让 AI 帮你安装

把这段话复制到 Claude Code 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。

请在这台电脑上为 Claude Code 安装 MCP server WhatsApp Web MCP Server,按顺序:1) 用 node -v 检查是否有 Node.js。没有的话,请让我从 https://nodejs.org/en/download 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):claude mcp add --scope user whatsapp-web --env BROWSER_EXECUTABLE_PATH=your-value -- npx -y mcp-whatsapp-web 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) BROWSER_EXECUTABLE_PATH 先保留 "your-value",请我自己把真实值粘贴到文件或应用的输入框里。不要让我在对话里输入密钥。5) 按约定执行,然后确认 WhatsApp Web MCP Server 的工具真的出现了。

这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 Node.js(如果还没有)

    已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter

    node -v
    • 显示版本号(例如 v26.13.1)= 已安装,可跳过这一步
    • 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
    怎么打开终端

    Mac:按 ⌘ + Space,输入 Terminal 后按 Enter

    Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”

    还没安装: 打开官方下载页,选择 LTS 版本和点选式安装程序:Mac 用 .pkg · Windows 用 .msi。双击后一路下一步即可,不需要 curl 命令

    打开 Node.js 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: node -v

    安装一次,所有需要 Node.js 的工具都能用

  2. 填写 1 项设置

    这些是程序设置,不是密钥,无需注册。按开发者的说明填写。

    • BROWSER_EXECUTABLE_PATH 仅限 webjs:浏览器可执行文件。系统会自动检测 Chrome 和 Edge;如需使用特定浏览器,请设置此项。发送视频和 GIF 需要 Chrome/Edge。
      查看英文原文webjs only: browser executable. Chrome and Edge are auto-detected; set this to use a specific browser. Chrome/Edge is required for sending videos and GIFs.

    说明为自动翻译,变量名保持原样;不确定时请查看原文。

  3. 打开终端

    Mac:按 Command+空格,输入 Terminal · Windows:打开 PowerShell

  4. 粘贴这条命令并按 Enter

    claude mcp add --scope user whatsapp-web --env BROWSER_EXECUTABLE_PATH=your-value -- npx -y mcp-whatsapp-web
  5. 在 Claude Code 中输入 /mcp

    应能看到 WhatsApp Web MCP Server 在列表中并显示已连接

  6. 试一试

    用 WhatsApp Web MCP Server 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 Claude Code 说正在使用 WhatsApp Web MCP Server,或回答中出现 WhatsApp Web MCP Server 的工具名称,就表示连接成功

15 项可选设置(不填也能用)

上面的命令不填这些也能用。想调整时再按开发者的说明添加。

  • WHATSAPP_BACKEND WhatsApp 后端:webjs 使用持久的浏览器配置文件;baileys 无需浏览器即可连接,并且需要单独配对。
    查看英文原文WhatsApp backend: webjs uses a persistent browser profile; baileys connects without a browser and requires separate pairing
    · 默认值 webjs
  • BAILEYS_SESSION_DIR Baileys 凭据及同步历史记录目录(默认值:/baileys-sessions)。请使用私有的绝对路径,且仅由一个服务器进程拥有。
    查看英文原文Baileys credentials and synchronized history directory (default: /baileys-sessions). Use a private absolute path, owned by one server process.
  • LOG_LEVEL 日志文件的日志级别(logs/mcp-whatsapp.log)。
    查看英文原文Log level for the log file (logs/mcp-whatsapp.log)
    · 默认值 info
  • LOG_STDERR_LEVEL stderr 的日志级别(在大多数 MCP 客户端日志中可见)。
    查看英文原文Log level for stderr (visible in most MCP client logs)
    · 默认值 warn
  • WHATSAPP_HEADLESS 仅限 webjs:设为 false 可显示浏览器窗口,而不是无头运行
    查看英文原文webjs only: set to false to show the browser window instead of running headless
  • WHATSAPP_NO_SANDBOX 仅限 webjs:为需要的容器显式禁用浏览器沙箱。沙箱默认启用。
    查看英文原文webjs only: explicitly disable the browser sandbox for containers that require it. The sandbox is enabled by default.
    · 默认值 false
  • WHATSAPP_SESSION_DIR 仅限 webjs:持久化浏览器配置文件目录(默认:/whatsapp-sessions)
    查看英文原文webjs only: persistent browser profile directory (default: /whatsapp-sessions)
  • WHATSAPP_PAIRING_PHONE_NUMBER 电话号码配对:设置后(国际格式,不含符号,例如 4915112345678),启动时会将 8 位配对码输出到 stderr,而不再依赖二维码。
    查看英文原文Phone number pairing: when set (international, symbol-free format, e.g. 4915112345678), an 8-character pairing code is logged to stderr on startup instead of relying on the QR code
  • FFMPEG_PATH ffmpeg 可执行文件的路径(仅在需要覆盖通过 ffmpeg-static npm 包自动安装的 ffmpeg 时才需要)
    查看英文原文Path to an ffmpeg binary (only needed to override the ffmpeg installed automatically via the ffmpeg-static npm package)
  • WA_WEB_VERSION 仅限 webjs:若 WhatsApp 端更新导致客户端失效,可固定 WhatsApp Web 版本。
    查看英文原文webjs only: pin the WhatsApp Web version if a WhatsApp-side update breaks the client.
  • HEALTH_CHECK_INTERVAL_MS webjs only: connection health check interval in milliseconds (<=0 disables) · 默认值 60000
  • TOOL_READY_TIMEOUT_MS 工具调用等待 WhatsApp 客户端就绪的时长,超时后报错。
    查看英文原文How long tool calls wait for the WhatsApp client to become ready before erroring
    · 默认值 45000
  • MCP_HTTP_PORT When set, additionally exposes the MCP endpoint at http://127.0.0.1: /mcp (Streamable HTTP) from the same process
  • MCP_HTTP_HOST HTTP 端点的绑定地址(请勿公开暴露;该端点控制您的个人 WhatsApp 账户)
    查看英文原文Bind address for the HTTP endpoint (do not expose publicly; the endpoint controls your personal WhatsApp account)
    · 默认值 127.0.0.1
  • MCP_OAUTH 为 HTTP 端点启用 OAuth:/mcp 需要 bearer token,客户端通过显示 WhatsApp 二维码/配对表单的浏览器页面进行身份验证
    查看英文原文Enable OAuth for the HTTP endpoint: /mcp requires a bearer token and clients authenticate via a browser page showing the WhatsApp QR code / pairing form

说明为自动翻译,变量名保持原样;不确定时请查看原文。

菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同

可连接 Cursor,但需要先准备

需要填写 1 项设置(BROWSER_EXECUTABLE_PATH) · 需要先在电脑上安装 Node.js(只需一次)

让 AI 帮你安装

把这段话复制到 Cursor 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。

请在这台电脑上为 Cursor 安装 MCP server WhatsApp Web MCP Server,按顺序:1) 用 node -v 检查是否有 Node.js。没有的话,请让我从 https://nodejs.org/en/download 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):{ "mcpServers": { "whatsapp-web": { "command": "npx", "args": [ "-y", "mcp-whatsapp-web" ], "env": { "BROWSER_EXECUTABLE_PATH": "your-value" } } } } 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) BROWSER_EXECUTABLE_PATH 先保留 "your-value",请我自己把真实值粘贴到文件或应用的输入框里。不要让我在对话里输入密钥。5) 按约定执行,然后确认 WhatsApp Web MCP Server 的工具真的出现了。

这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 Node.js(如果还没有)

    已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter

    node -v
    • 显示版本号(例如 v26.13.1)= 已安装,可跳过这一步
    • 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
    怎么打开终端

    Mac:按 ⌘ + Space,输入 Terminal 后按 Enter

    Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”

    还没安装: 打开官方下载页,选择 LTS 版本和点选式安装程序:Mac 用 .pkg · Windows 用 .msi。双击后一路下一步即可,不需要 curl 命令

    打开 Node.js 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: node -v

    安装一次,所有需要 Node.js 的工具都能用

  2. 填写 1 项设置

    这些是程序设置,不是密钥,无需注册。按开发者的说明填写。

    • BROWSER_EXECUTABLE_PATH 仅限 webjs:浏览器可执行文件。系统会自动检测 Chrome 和 Edge;如需使用特定浏览器,请设置此项。发送视频和 GIF 需要 Chrome/Edge。
      查看英文原文webjs only: browser executable. Chrome and Edge are auto-detected; set this to use a specific browser. Chrome/Edge is required for sending videos and GIFs.

    说明为自动翻译,变量名保持原样;不确定时请查看原文。

  3. 点击这个按钮打开 Cursor

    在 Cursor 中打开

    Cursor 会请你确认安装,点击 Install

  4. 填写你的密钥

    在 WhatsApp Web MCP Server 的设置中,BROWSER_EXECUTABLE_PATH 还是空的,填入你的密钥并保存

  5. 在 Cursor 中以 Agent 模式打开 AI 聊天

  6. 试一试

    用 WhatsApp Web MCP Server 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 Cursor 说正在使用 WhatsApp Web MCP Server,或回答中出现 WhatsApp Web MCP Server 的工具名称,就表示连接成功

15 项可选设置(不填也能用)

上面的命令不填这些也能用。想调整时再按开发者的说明添加。

  • WHATSAPP_BACKEND WhatsApp 后端:webjs 使用持久的浏览器配置文件;baileys 无需浏览器即可连接,并且需要单独配对。
    查看英文原文WhatsApp backend: webjs uses a persistent browser profile; baileys connects without a browser and requires separate pairing
    · 默认值 webjs
  • BAILEYS_SESSION_DIR Baileys 凭据及同步历史记录目录(默认值:/baileys-sessions)。请使用私有的绝对路径,且仅由一个服务器进程拥有。
    查看英文原文Baileys credentials and synchronized history directory (default: /baileys-sessions). Use a private absolute path, owned by one server process.
  • LOG_LEVEL 日志文件的日志级别(logs/mcp-whatsapp.log)。
    查看英文原文Log level for the log file (logs/mcp-whatsapp.log)
    · 默认值 info
  • LOG_STDERR_LEVEL stderr 的日志级别(在大多数 MCP 客户端日志中可见)。
    查看英文原文Log level for stderr (visible in most MCP client logs)
    · 默认值 warn
  • WHATSAPP_HEADLESS 仅限 webjs:设为 false 可显示浏览器窗口,而不是无头运行
    查看英文原文webjs only: set to false to show the browser window instead of running headless
  • WHATSAPP_NO_SANDBOX 仅限 webjs:为需要的容器显式禁用浏览器沙箱。沙箱默认启用。
    查看英文原文webjs only: explicitly disable the browser sandbox for containers that require it. The sandbox is enabled by default.
    · 默认值 false
  • WHATSAPP_SESSION_DIR 仅限 webjs:持久化浏览器配置文件目录(默认:/whatsapp-sessions)
    查看英文原文webjs only: persistent browser profile directory (default: /whatsapp-sessions)
  • WHATSAPP_PAIRING_PHONE_NUMBER 电话号码配对:设置后(国际格式,不含符号,例如 4915112345678),启动时会将 8 位配对码输出到 stderr,而不再依赖二维码。
    查看英文原文Phone number pairing: when set (international, symbol-free format, e.g. 4915112345678), an 8-character pairing code is logged to stderr on startup instead of relying on the QR code
  • FFMPEG_PATH ffmpeg 可执行文件的路径(仅在需要覆盖通过 ffmpeg-static npm 包自动安装的 ffmpeg 时才需要)
    查看英文原文Path to an ffmpeg binary (only needed to override the ffmpeg installed automatically via the ffmpeg-static npm package)
  • WA_WEB_VERSION 仅限 webjs:若 WhatsApp 端更新导致客户端失效,可固定 WhatsApp Web 版本。
    查看英文原文webjs only: pin the WhatsApp Web version if a WhatsApp-side update breaks the client.
  • HEALTH_CHECK_INTERVAL_MS webjs only: connection health check interval in milliseconds (<=0 disables) · 默认值 60000
  • TOOL_READY_TIMEOUT_MS 工具调用等待 WhatsApp 客户端就绪的时长,超时后报错。
    查看英文原文How long tool calls wait for the WhatsApp client to become ready before erroring
    · 默认值 45000
  • MCP_HTTP_PORT When set, additionally exposes the MCP endpoint at http://127.0.0.1: /mcp (Streamable HTTP) from the same process
  • MCP_HTTP_HOST HTTP 端点的绑定地址(请勿公开暴露;该端点控制您的个人 WhatsApp 账户)
    查看英文原文Bind address for the HTTP endpoint (do not expose publicly; the endpoint controls your personal WhatsApp account)
    · 默认值 127.0.0.1
  • MCP_OAUTH 为 HTTP 端点启用 OAuth:/mcp 需要 bearer token,客户端通过显示 WhatsApp 二维码/配对表单的浏览器页面进行身份验证
    查看英文原文Enable OAuth for the HTTP endpoint: /mcp requires a bearer token and clients authenticate via a browser page showing the WhatsApp QR code / pairing form

说明为自动翻译,变量名保持原样;不确定时请查看原文。

菜单名称已于 2026年11月11日 对照 Cursor 帮助页面核实 · 你的界面可能因版本略有不同

可连接 VS Code,但需要先准备

需要填写 1 项设置(BROWSER_EXECUTABLE_PATH) · 需要先在电脑上安装 Node.js(只需一次)

让 AI 帮你安装

把这段话复制到 VS Code 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。

请在这台电脑上为 VS Code 安装 MCP server WhatsApp Web MCP Server,按顺序:1) 用 node -v 检查是否有 Node.js。没有的话,请让我从 https://nodejs.org/en/download 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):{ "servers": { "whatsapp-web": { "type": "stdio", "command": "npx", "args": [ "-y", "mcp-whatsapp-web" ], "env": { "BROWSER_EXECUTABLE_PATH": "your-value" } } } } 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) BROWSER_EXECUTABLE_PATH 先保留 "your-value",请我自己把真实值粘贴到文件或应用的输入框里。不要让我在对话里输入密钥。5) 按约定执行,然后确认 WhatsApp Web MCP Server 的工具真的出现了。

这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 Node.js(如果还没有)

    已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter

    node -v
    • 显示版本号(例如 v26.13.1)= 已安装,可跳过这一步
    • 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
    怎么打开终端

    Mac:按 ⌘ + Space,输入 Terminal 后按 Enter

    Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”

    还没安装: 打开官方下载页,选择 LTS 版本和点选式安装程序:Mac 用 .pkg · Windows 用 .msi。双击后一路下一步即可,不需要 curl 命令

    打开 Node.js 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: node -v

    安装一次,所有需要 Node.js 的工具都能用

  2. 填写 1 项设置

    这些是程序设置,不是密钥,无需注册。按开发者的说明填写。

    • BROWSER_EXECUTABLE_PATH 仅限 webjs:浏览器可执行文件。系统会自动检测 Chrome 和 Edge;如需使用特定浏览器,请设置此项。发送视频和 GIF 需要 Chrome/Edge。
      查看英文原文webjs only: browser executable. Chrome and Edge are auto-detected; set this to use a specific browser. Chrome/Edge is required for sending videos and GIFs.

    说明为自动翻译,变量名保持原样;不确定时请查看原文。

  3. 点击这个按钮打开 VS Code

    在 VS Code 中打开

    VS Code 会请你确认安装,点击 Install

  4. 填写你的密钥

    在 WhatsApp Web MCP Server 的设置中,BROWSER_EXECUTABLE_PATH 还是空的,填入你的密钥并保存

  5. 在 VS Code 中以 Agent 模式打开 AI 聊天

  6. 试一试

    用 WhatsApp Web MCP Server 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 VS Code 说正在使用 WhatsApp Web MCP Server,或回答中出现 WhatsApp Web MCP Server 的工具名称,就表示连接成功

15 项可选设置(不填也能用)

上面的命令不填这些也能用。想调整时再按开发者的说明添加。

  • WHATSAPP_BACKEND WhatsApp 后端:webjs 使用持久的浏览器配置文件;baileys 无需浏览器即可连接,并且需要单独配对。
    查看英文原文WhatsApp backend: webjs uses a persistent browser profile; baileys connects without a browser and requires separate pairing
    · 默认值 webjs
  • BAILEYS_SESSION_DIR Baileys 凭据及同步历史记录目录(默认值:/baileys-sessions)。请使用私有的绝对路径,且仅由一个服务器进程拥有。
    查看英文原文Baileys credentials and synchronized history directory (default: /baileys-sessions). Use a private absolute path, owned by one server process.
  • LOG_LEVEL 日志文件的日志级别(logs/mcp-whatsapp.log)。
    查看英文原文Log level for the log file (logs/mcp-whatsapp.log)
    · 默认值 info
  • LOG_STDERR_LEVEL stderr 的日志级别(在大多数 MCP 客户端日志中可见)。
    查看英文原文Log level for stderr (visible in most MCP client logs)
    · 默认值 warn
  • WHATSAPP_HEADLESS 仅限 webjs:设为 false 可显示浏览器窗口,而不是无头运行
    查看英文原文webjs only: set to false to show the browser window instead of running headless
  • WHATSAPP_NO_SANDBOX 仅限 webjs:为需要的容器显式禁用浏览器沙箱。沙箱默认启用。
    查看英文原文webjs only: explicitly disable the browser sandbox for containers that require it. The sandbox is enabled by default.
    · 默认值 false
  • WHATSAPP_SESSION_DIR 仅限 webjs:持久化浏览器配置文件目录(默认:/whatsapp-sessions)
    查看英文原文webjs only: persistent browser profile directory (default: /whatsapp-sessions)
  • WHATSAPP_PAIRING_PHONE_NUMBER 电话号码配对:设置后(国际格式,不含符号,例如 4915112345678),启动时会将 8 位配对码输出到 stderr,而不再依赖二维码。
    查看英文原文Phone number pairing: when set (international, symbol-free format, e.g. 4915112345678), an 8-character pairing code is logged to stderr on startup instead of relying on the QR code
  • FFMPEG_PATH ffmpeg 可执行文件的路径(仅在需要覆盖通过 ffmpeg-static npm 包自动安装的 ffmpeg 时才需要)
    查看英文原文Path to an ffmpeg binary (only needed to override the ffmpeg installed automatically via the ffmpeg-static npm package)
  • WA_WEB_VERSION 仅限 webjs:若 WhatsApp 端更新导致客户端失效,可固定 WhatsApp Web 版本。
    查看英文原文webjs only: pin the WhatsApp Web version if a WhatsApp-side update breaks the client.
  • HEALTH_CHECK_INTERVAL_MS webjs only: connection health check interval in milliseconds (<=0 disables) · 默认值 60000
  • TOOL_READY_TIMEOUT_MS 工具调用等待 WhatsApp 客户端就绪的时长,超时后报错。
    查看英文原文How long tool calls wait for the WhatsApp client to become ready before erroring
    · 默认值 45000
  • MCP_HTTP_PORT When set, additionally exposes the MCP endpoint at http://127.0.0.1: /mcp (Streamable HTTP) from the same process
  • MCP_HTTP_HOST HTTP 端点的绑定地址(请勿公开暴露;该端点控制您的个人 WhatsApp 账户)
    查看英文原文Bind address for the HTTP endpoint (do not expose publicly; the endpoint controls your personal WhatsApp account)
    · 默认值 127.0.0.1
  • MCP_OAUTH 为 HTTP 端点启用 OAuth:/mcp 需要 bearer token,客户端通过显示 WhatsApp 二维码/配对表单的浏览器页面进行身份验证
    查看英文原文Enable OAuth for the HTTP endpoint: /mcp requires a bearer token and clients authenticate via a browser page showing the WhatsApp QR code / pairing form

说明为自动翻译,变量名保持原样;不确定时请查看原文。

菜单名称已于 2026年11月11日 对照 VS Code 帮助页面核实 · 你的界面可能因版本略有不同

其他支持 MCP 的应用(如 Windsurf、Zed、Gemini CLI)添加方式各不相同,请在应用列表中查看

查看所有支持 MCP 的应用 →

JSON 设置在下方“开发者专用”中

卡住了?问问正在用 WhatsApp Web MCP Server 的人💬 讨论 →
开发者专用:终端命令和 JSON 设置

安装在电脑上

Claude Code

claude mcp add --scope user whatsapp-web --env BROWSER_EXECUTABLE_PATH=your-value -- npx -y mcp-whatsapp-web

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "whatsapp-web": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-whatsapp-web"
      ],
      "env": {
        "BROWSER_EXECUTABLE_PATH": "your-value"
      }
    }
  }
}

Cursor (~/.cursor/mcp.json)

{
  "mcpServers": {
    "whatsapp-web": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-whatsapp-web"
      ],
      "env": {
        "BROWSER_EXECUTABLE_PATH": "your-value"
      }
    }
  }
}

VS Code (mcp.json)

{
  "servers": {
    "whatsapp-web": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "mcp-whatsapp-web"
      ],
      "env": {
        "BROWSER_EXECUTABLE_PATH": "your-value"
      }
    }
  }
}

需要你填写的值

  • WHATSAPP_BACKEND env
    WhatsApp 后端:webjs 使用持久的浏览器配置文件;baileys 无需浏览器即可连接,并且需要单独配对。
    查看英文原文WhatsApp backend: webjs uses a persistent browser profile; baileys connects without a browser and requires separate pairing
  • BAILEYS_SESSION_DIR env
    Baileys 凭据及同步历史记录目录(默认值:/baileys-sessions)。请使用私有的绝对路径,且仅由一个服务器进程拥有。
    查看英文原文Baileys credentials and synchronized history directory (default: /baileys-sessions). Use a private absolute path, owned by one server process.
  • LOG_LEVEL env
    日志文件的日志级别(logs/mcp-whatsapp.log)。
    查看英文原文Log level for the log file (logs/mcp-whatsapp.log)
  • LOG_STDERR_LEVEL env
    stderr 的日志级别(在大多数 MCP 客户端日志中可见)。
    查看英文原文Log level for stderr (visible in most MCP client logs)
  • WHATSAPP_HEADLESS env
    仅限 webjs:设为 false 可显示浏览器窗口,而不是无头运行
    查看英文原文webjs only: set to false to show the browser window instead of running headless
  • WHATSAPP_NO_SANDBOX env
    仅限 webjs:为需要的容器显式禁用浏览器沙箱。沙箱默认启用。
    查看英文原文webjs only: explicitly disable the browser sandbox for containers that require it. The sandbox is enabled by default.
  • BROWSER_EXECUTABLE_PATH 必填 env
    仅限 webjs:浏览器可执行文件。系统会自动检测 Chrome 和 Edge;如需使用特定浏览器,请设置此项。发送视频和 GIF 需要 Chrome/Edge。
    查看英文原文webjs only: browser executable. Chrome and Edge are auto-detected; set this to use a specific browser. Chrome/Edge is required for sending videos and GIFs.
  • WHATSAPP_SESSION_DIR env
    仅限 webjs:持久化浏览器配置文件目录(默认:/whatsapp-sessions)
    查看英文原文webjs only: persistent browser profile directory (default: /whatsapp-sessions)
  • WHATSAPP_PAIRING_PHONE_NUMBER env
    电话号码配对:设置后(国际格式,不含符号,例如 4915112345678),启动时会将 8 位配对码输出到 stderr,而不再依赖二维码。
    查看英文原文Phone number pairing: when set (international, symbol-free format, e.g. 4915112345678), an 8-character pairing code is logged to stderr on startup instead of relying on the QR code
  • FFMPEG_PATH env
    ffmpeg 可执行文件的路径(仅在需要覆盖通过 ffmpeg-static npm 包自动安装的 ffmpeg 时才需要)
    查看英文原文Path to an ffmpeg binary (only needed to override the ffmpeg installed automatically via the ffmpeg-static npm package)
  • WA_WEB_VERSION env
    仅限 webjs:若 WhatsApp 端更新导致客户端失效,可固定 WhatsApp Web 版本。
    查看英文原文webjs only: pin the WhatsApp Web version if a WhatsApp-side update breaks the client.
  • HEALTH_CHECK_INTERVAL_MS env
    webjs only: connection health check interval in milliseconds (<=0 disables)
  • TOOL_READY_TIMEOUT_MS env
    工具调用等待 WhatsApp 客户端就绪的时长,超时后报错。
    查看英文原文How long tool calls wait for the WhatsApp client to become ready before erroring
  • MCP_HTTP_PORT env
    When set, additionally exposes the MCP endpoint at http://127.0.0.1: /mcp (Streamable HTTP) from the same process
  • MCP_HTTP_HOST env
    HTTP 端点的绑定地址(请勿公开暴露;该端点控制您的个人 WhatsApp 账户)
    查看英文原文Bind address for the HTTP endpoint (do not expose publicly; the endpoint controls your personal WhatsApp account)
  • MCP_OAUTH env
    为 HTTP 端点启用 OAuth:/mcp 需要 bearer token,客户端通过显示 WhatsApp 二维码/配对表单的浏览器页面进行身份验证
    查看英文原文Enable OAuth for the HTTP endpoint: /mcp requires a bearer token and clients authenticate via a browser page showing the WhatsApp QR code / pairing form

说明为自动翻译,变量名保持原样;不确定时请查看原文。

这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。

一览

每周下载量i
76/周
连接方式
在你的电脑上运行
最新版本i
1.2.0
发布到注册中心i
2026年9月6日
代码最后更新i
2026年11月11日
作者
mario-andreschak
软件包
npm: mcp-whatsapp-web
注册状态
活跃

哪些应用可以使用它

依据这个服务器的连接方式和各应用自己的文档,检查于 2026年11月10日。

在你的电脑上运行,适用于

ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast

全部应用及其优缺点 →

它能做什么

它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。

基础检查i

我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月19日

  • ✓ 通过

    作者与仓库一致

    注册名称已通过 GitHub 账户 mario-andreschak 验证,该账户拥有此仓库

  • ✓ 通过

    仍在维护

    代码最后更新于8天前

  • ✓ 通过

    有许可证

    使用 MIT

  • – 不适用

    端点有响应

    它在你的电脑上运行,没有互联网端点

  • – 不适用

    使用 OAuth 登录

    在你的电脑上运行,改用本地设置

  • … 尚未检查

    工具描述中没有隐藏指令

    它在你的电脑上运行;我们只能读取互联网端点的工具列表

已公开的漏洞(OSV.dev)

OSV.dev 中没有 mcp-whatsapp-web@1.2.0 的记录

只检查这个版本的包本身,不包括所有依赖 · 检查于 2026年11月15日

我们检查什么 → · JSON

作者:申请重新检查或报告信息错误
给作者:在 README 中加徽章

如果你是作者,可把这段代码贴到 README。徽章会链接回本页。

[![Featured on PopNx MCP](https://mcp.popnx.com/badge/mario-andreschak-mcp-whatsapp-web.svg)](https://mcp.popnx.com/en/servers/mario-andreschak-mcp-whatsapp-web)

讨论

提问、分享技巧或报告无法使用。按“有帮助”数量排序。

还没有帖子,欢迎第一个提问或分享。

此处内容由用户撰写,不代表 PopNx 团队。

登录后发帖

用户评价

还没有评价

登录后写评价

与“聊天与邮件”中的其他服务器比较i

  • 星标数多于此分类中其他 2027 个服务器的 97%
  • 发布到注册中心的时间比此分类中其他 2027 个服务器的 23% 更新
  • 基础检查结果等于或优于此分类中其他 2027 个服务器的 99%

与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。

常见问题

WhatsApp Web MCP Server 安全吗?

它在 3 项适用的基础检查中通过了 3 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。

它需要哪些密钥或代码?

注册中心没有列出必需的密钥,不过有些服务器会在首次使用时要求你登录。

它在我的电脑上运行还是在云端?

它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。

它还在维护吗?

GitHub 仓库最后更新于8天前,最新版本(1.2.0)于2个月前进入注册中心。

哪些应用可以使用它?

支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Node.js。

有什么可以替代它?

同一分类中有:emailmd, Kite Discord Bot Builder, e2a — email for AI agents, Infobip MCP, kernelCAD

功能相近的其他选择

同一分类、其他作者、命令已通过检查。官方的排在前面,再按星标排序。

如何看卡片:↓ 每周下载量i★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i

emailmd

Render markdown into email-safe HTML, lint drafts for deliverability problems, and preview emails.

作者:anypost广泛使用↓ 5432/周★ 13945天前更新

电脑或云端✓ 服务方 · emailmd.dev

Infobip MCP

Infobip MCP server for omnichannel communication and messaging. SMS, RCS, WhatsApp, Viber and more.

作者:infobip起步阶段★ 3613个月前更新

在云端运行✓ 服务方 · infobip.com

kernelCAD

CAD in ChatGPT and Claude: editable parts, STEP/STL/drawings, in-chat 3D, automatic checks.

作者:w1ne起步阶段★ 3523天前更新

在云端运行✓ 服务方 · kernelcad.com
与相似项目对比
本项
WhatsApp Web MCP Server
emailmdKite Discord Bot Buildere2a — email for AI agentsInfobip MCPkernelCAD
运行位置需要安装在电脑上云端或安装在电脑上都可以在云端运行,无需安装在云端运行,无需安装在云端运行,无需安装在云端运行,无需安装
需要密钥否否否否否否
可在 Claude 中按 + 添加否否否否是否
基础检查3/35/54/44/44/44/4
许可证MITMITAGPL-3.0Apache-2.0MITMIT
价格登记中未列出费用登记中未列出费用登记中未列出费用登记中未列出费用登记中未列出费用登记中未列出费用

作者的 README

打开 README

按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。

Very Important

Automation of Whatsapp Messages without Meta (Business-)API is against WhatsApp' Terms of Service! You take full responsibility for everything you do with this MCP-Server. It is possible that your account will be flagged/restricted.

MCP WhatsApp Web (TypeScript)

A Model Context Protocol (MCP) server for WhatsApp Web, implemented in TypeScript. This project is a TypeScript port of the original whatsapp-mcp repository.

With this MCP server, you can:

  • Search and read your personal WhatsApp messages (including media)
  • Search your contacts
  • Send messages to individuals or groups
  • Send and receive media files (images, videos, documents, audio)

Features

  • TypeScript Implementation: Fully typed codebase for better developer experience and code reliability
  • Selectable WhatsApp Backend: Uses whatsapp-web.js by default, with an optional Baileys backend that runs without a browser
  • MCP Server: Implements the Model Context Protocol for seamless integration with AI assistants
  • Media Support: Send and receive images, videos, documents, and audio messages
  • Webhooks (Baileys): signed notifications for new messages and for incoming calls, including who is calling
  • Multiple Transport Options: Supports stdio and Streamable HTTP transports — even both at once from a single process (start with stdio and set MCP_HTTP_PORT to additionally expose http://127.0.0.1: /mcp, or run HTTP-only with --http)
  • Flexible Authentication: QR code (as an MCP image tool), pairing code (request_pairing_code tool, or automatically printed to stderr at startup via WHATSAPP_PAIRING_PHONE_NUMBER), and an optional OAuth flow for HTTP clients (MCP_OAUTH=true) where the browser authorization page shows the WhatsApp QR code — unlinking WhatsApp revokes tokens so clients automatically re-authenticate

Architecture

This MCP server consists of:

  1. TypeScript MCP Server: Implements the Model Context Protocol to provide standardized tools for AI assistants to interact with WhatsApp
  2. WhatsApp Backend: A shared service interface selects web.js/Puppeteer or Baileys/WebSocket, handles authentication, and manages message sending/receiving
  3. Tool Implementations: Provides various tools for contacts, chats, messages, media, and authentication

Prerequisites

  • Node.js >= 22.0.0 (Node 22 or 24 recommended for the Baileys SQLite dependency)
  • npm or yarn
  • For the default webjs backend: Google Chrome or Microsoft Edge (auto-detected; needed for video/GIF codec support; other operations can use Puppeteer's bundled Chromium)
  • For baileys: install optional dependencies, including the native better-sqlite3 module. No Chrome, Edge, or Chromium is needed at runtime.

FFmpeg is bundled automatically via the ffmpeg-static npm package — no manual installation needed. You can point the FFMPEG_PATH environment variable at your own binary to override it.

Installation

npx
   npx mcp-whatsapp-web
Manual Installation
  1. Clone this repository
   git clone https://github.com/mario-andreschak/mcp-whatsapp-web.git

cd mcp-whatsapp-web

  1. Install dependencies
   npm install
  1. Build the project
   npm run build
  1. Configure environment variables (optional)

Copy the example environment file and modify as needed:

   cp .env.example .env

You can select the backend with WHATSAPP_BACKEND, adjust logging levels, pin the WhatsApp Web version, or override the auto-detected browser (BROWSER_EXECUTABLE_PATH) and ffmpeg binary (FFMPEG_PATH). WHATSAPP_HEADLESS=false shows the web.js browser window, and WHATSAPP_SESSION_DIR relocates its persistent profile. Without these settings the sign-in is kept in a fixed place for your user account, so it no longer matters which folder a program starts the server from (see Keeping the link).

Choosing a backend

WHATSAPP_BACKEND=webjs is the default and preserves existing sessions and MCP tool names. It uses a dedicated persistent LocalAuth profile, not your personal Chrome profile. It now keeps the browser's native user agent and graphics defaults, omits Puppeteer's automation banner flag, and leaves the browser sandbox enabled. Containers that require disabling the sandbox can explicitly set WHATSAPP_NO_SANDBOX=true. These settings do not guarantee that automation is undetectable.

To use the optional Baileys backend, set these variables in your MCP client configuration or .env, then restart the server:

WHATSAPP_BACKEND=baileys

Optional: where the sign-in lives. Leave it out to use the standard place.

#BAILEYS_SESSION_DIR=C:/path/to/your/baileys-sessions

BAILEYS_SESSION_DIR is optional; without it the sign-in lives in the standard place described in Keeping the link. Pair this backend separately with get_qr_code or request_pairing_code. The existing WHATSAPP_PAIRING_PHONE_NUMBER option also works. Baileys cannot reuse the web.js browser profile. You can switch back to webjs and resume its existing session.

Baileys links as a Chrome device (shown as "Chrome (Windows)" or "Chrome (Mac OS)" under Linked devices). WhatsApp currently ends new links that claim to be the Desktop app with status 428 ("Connection Terminated") before a QR code appears. Desktop would request the full chat history; Chrome receives recent history, and live messages are stored from then on. BAILEYS_BROWSER=Desktop restores the old behaviour. At startup the backend also looks up the current WhatsApp Web version from web.whatsapp.com, because WhatsApp refuses clients that report an outdated one; WA_WEB_VERSION pins it, and a failed lookup falls back to the version bundled with Baileys.

Baileys and SQLite are pinned optional dependencies installed by normal npm install. If your package manager omitted them, run npm install --include=optional. SQLite uses a native addon; a supported prebuilt binary or a local native build toolchain is required. To avoid downloading Chromium when installing for Baileys or an existing system browser, use:

$env:PUPPETEER_SKIP_DOWNLOAD = 'true'

npm install --include=optional npm run build

On macOS/Linux, the equivalent installation command is PUPPETEER_SKIP_DOWNLOAD=true npm install --include=optional. Selecting Baileys loads only its driver and never starts or cleans up browser processes. An unavailable backend produces an error; it never silently switches drivers or retries a send through another backend.

Baileys sessions and history
  • Credentials, Signal keys, contacts, chats and messages persist in session.sqlite inside the sign-in folder. Keep the whole folder private and out of version control. Only one running server may own a sign-in folder. Use separate folders for independent accounts.
  • Normal shutdown and lost connections keep the sign-in. Only a clear "this device was removed" from WhatsApp, or the logout tool, ends it; both revoke the OAuth access tokens. Baileys HTTP OAuth state is stored separately from web.js in oauth-store.json inside the sign-in folder.
  • get_backend_status reports the active backend, authentication, stored record counts and history synchronization state. Being connected does not mean history has finished arriving. An available history state means local data is available, not that WhatsApp supplied a complete archive.
  • Contact and history tools query the local synchronized store. Initial full-history sync is requested and can take time on large accounts. list_messages may request up to 100 additional older messages when a known chat has fewer than requested, with a bounded wait and a per-chat cooldown. Late history batches are persisted for subsequent queries. WhatsApp may still supply only part of an account's history.
  • Treat returned message IDs as opaque and use IDs from the active backend. Legacy @c.us phone-number inputs, @s.whatsapp.net, groups and @lid identifiers are supported; known LID/phone mappings are persisted. Message IDs from web.js cannot be passed to Baileys or vice versa.
  • Text, media, downloads, voice notes and the existing authentication tools use the same MCP interface. Voice-note inputs must be local files or base64; FFmpeg converts them to mono Opus/Ogg before sending. If conversion fails, the tool reports an error without sending a different message type.

The Baileys backend is opt-in and pinned to 7.0.0-rc14. Review upstream changes before upgrading, especially authentication and message-format migrations. See the Baileys documentation and release history.

Keeping the link

You should only need to scan the QR code once. After that the server stays linked, even when it is restarted, started by a different program, or loses its internet connection for a while.

Where the sign-in lives. By default the sign-in is kept in one fixed place for your user account, whatever folder a program starts the server from:

SystemBaileysweb.js
Windows%LOCALAPPDATA%\mcp-whatsapp-web\baileys-sessions%LOCALAPPDATA%\mcp-whatsapp-web\whatsapp-sessions
macOS~/Library/Application Support/mcp-whatsapp-web/baileys-sessions~/Library/Application Support/mcp-whatsapp-web/whatsapp-sessions
Linux~/.local/share/mcp-whatsapp-web/baileys-sessions (or under $XDG_DATA_HOME)~/.local/share/mcp-whatsapp-web/whatsapp-sessions
  • If you set BAILEYS_SESSION_DIR (or WHATSAPP_SESSION_DIR for web.js), that folder is always used.
  • Older versions kept the sign-in in a baileys-sessions (or whatsapp-sessions) folder inside the folder the server was started from. If such a sign-in exists and no folder is set, the server keeps using it and says so in its log.
  • At start the log says which folder is used and whether it holds a sign-in. get_backend_status shows it too, as connection.signInFolder.

Moving the sign-in. Stop every program that runs the server, move the whole folder (all files in it) to the new place, then either put it in the standard place above or point BAILEYS_SESSION_DIR at it, and start the server again.

Using it from more than one program. Two programs cannot share one sign-in at the same time. The second one waits and takes over by itself when the first one closes. If both should run at the same time, give the second program its own folder (BAILEYS_SESSION_DIR) and link it as its own device by scanning a new QR code. WhatsApp allows several linked devices per phone. Never copy a sign-in folder to a second program: the two copies would keep pushing each other off.

When the connection drops. The server reconnects by itself: quickly at first, then every five minutes for as long as it runs, so it recovers on its own when the network comes back. Asking for WhatsApp (for example check_auth_status or any tool) makes it try again at once. get_backend_status tells you in plain words what is going on: connection.state is linked, reconnecting, waiting_for_link, waiting_for_other_program or stopped, with since, lastReason and the next attempt.

What really ends a link. Only these need a new QR code:

  • The device was removed under Settings > Linked devices on the phone, or with the logout tool.
  • The phone was offline for a long time (WhatsApp ends linked devices after about 14 days without the phone).
  • WhatsApp itself ends the link, for examp

只显示了开头部分;其余内容请在仓库中阅读