WhatsApp机器人服务

MCP服务器提供WhatsApp机器人功能,支持多种适配器。

  • by daedalus
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 daedalus/mcp-whatsapp

使用说明

mcp whatsapp

MCP服务器公开WhatsApp机器人功能,支持多个适配器。

安装

pip install mcp-whatsapp

WhatsApp适配器

此软件包支持两个WhatsApp适配器:

  • pywhatkit:使用WhatsApp Web(默认设置,更容易设置)
  • whatsapp业务:使用WhatsApp Business API(生产就绪)

使用适配器依赖项进行安装:

# For pywhatkit (WhatsApp Web)
pip install mcp-whatsapp[pywhatkit]

# For WhatsApp Business API
pip install mcp-whatsapp[whatsapp-business]

用法

设置适配器

使用设置适配器 WHATSAPP_ADAPTER 环境变量:

export WHATSAPP_ADAPTER=pywhatkit       # Default
export WHATSAPP_ADAPTER=whatsapp-business

WhatsApp Business API配置

对于WhatsApp Business API,请设置以下环境变量:

export WHATSAPP_PHONE_NUMBER_ID=your_phone_number_id
export WHATSAPP_ACCESS_TOKEN=your_access_token
export WHATSAPP_VERIFY_TOKEN=your_verify_token

作为MCP服务器运行

mcp-whatsapp

MCP工具

工具 说明
send_message 向电话号码发送短信
send_media 将媒体(图像、文档)发送到电话号码
send_location 向电话号码发送位置
connect_whatsapp 连接到WhatsApp服务
disconnect_whatsapp 断开与WhatsApp服务的连接

MCP资源

资源 描述
whatsapp://status 获取当前连接状态
whatsapp://config 获取适配器配置

mcp名称

io.github.daedalus/mcp-whatsapp

发展

git clone https://github.com/daedalus/mcp-whatsapp.git
cd mcp-whatsapp
pip install -e ".[test]"

# run tests
pytest

# format
ruff format src/ tests/

# lint
ruff check src/ tests/

# type check
mypy src/

许可证

麻省理工学院