WhatsApp MCP Server

WhatsApp MCP Server

A WhatsApp MCP (Message Control Protocol) Server implementation

krusleung

通信
访问服务器

README

WhatsApp MCP Server

A Multi-Channel Platform server for WhatsApp integration that allows you to send and receive messages programmatically through a REST API.

Features

  • WhatsApp connection management with QR code authentication
  • Send and receive text messages
  • Send media messages (images, documents, etc.)
  • Contact management
  • Chat history
  • Session persistence
  • REST API for integration with other applications

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB (optional but recommended for message storage)
  • A WhatsApp account

Installation

  1. Clone the repository:
git clone https://github.com/krusleung/whatsapp-mcp-server.git
cd whatsapp-mcp-server
  1. Install dependencies:
npm install
  1. Create a .env file from the example:
cp .env.example .env
  1. Edit the .env file with your configuration

Running the Server

Start the development server:

npm run dev

For production:

npm start

API Documentation

Authentication

The server uses WhatsApp Web's QR code for authentication. When you start the server for the first time, a QR code will be displayed in the console. Scan this with your WhatsApp mobile app:

  1. Open WhatsApp on your phone
  2. Tap Menu or Settings and select WhatsApp Web
  3. Scan the QR code displayed in the terminal

API Endpoints

Auth Routes

  • GET /api/auth/status - Check authentication status
  • POST /api/auth/logout - Logout from WhatsApp
  • POST /api/auth/restart - Restart the WhatsApp client

Message Routes

  • POST /api/messages/send - Send a text message
  • POST /api/messages/send-media - Send a media message
  • GET /api/messages/history/:contact - Get chat history with a contact

Contact Routes

  • GET /api/contacts - Get all contacts
  • GET /api/contacts/:id - Get a contact by ID
  • GET /api/contacts/chats - Get all chats

Example Usage

Sending a Message

curl -X POST http://localhost:3000/api/messages/send \
  -H "Content-Type: application/json" \
  -d '{"to": "1234567890", "message": "Hello from WhatsApp MCP Server!"}'

Getting Contacts

curl -X GET http://localhost:3000/api/contacts

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

推荐服务器

graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Apple MCP Server

Apple MCP Server

通过 MCP 协议与 Apple 应用(如“信息”、“备忘录”和“通讯录”)进行交互,从而使用自然语言发送消息、搜索和打开应用内容。

精选
本地
TypeScript
@kazuph/mcp-gmail-gas

@kazuph/mcp-gmail-gas

用于 Gmail 集成的模型上下文协议 (Model Context Protocol, MCP) 服务器。它允许 Claude Desktop(或任何 MCP 客户端)通过 Google Apps Script 与您的 Gmail 帐户进行交互。

精选
JavaScript
MCP Server Trello

MCP Server Trello

通过 Trello API 促进与 Trello 看板的交互,提供速率限制、类型安全、输入验证和错误处理等功能,以实现对卡片、列表和看板活动的无缝管理。

精选
TypeScript
Linear MCP Server

Linear MCP Server

一个模型上下文协议(Model Context Protocol)服务器,它与 Linear 的问题跟踪系统集成,允许大型语言模型(LLM)通过自然语言交互来创建、更新、搜索和评论 Linear 问题。

精选
JavaScript
Composio MCP Server

Composio MCP Server

一个服务器实现,提供与 MCP 兼容的 Composio 应用(如 Gmail 和 Linear)的访问,允许通过结构化的接口与语言模型进行交互。

官方
TypeScript
Folderr

Folderr

一个模型上下文协议 (MCP) 服务器,它提供与 Folderr API 交互的工具,专门用于管理 Folderr 助手并与之通信。

官方
JavaScript
mcp-google

mcp-google

一个专门的模型上下文协议(MCP)服务器,它将 Google 服务(Gmail、日历等)集成到您的 AI 工作流程中。该服务器通过 MCP 实现对 Google 服务的无缝访问,从而允许 AI 代理与 Gmail、Google 日历和其他 Google 服务进行交互。

本地
TypeScript
MCP-JIRA-Python Server

MCP-JIRA-Python Server

一个基于 Python 的服务器,可以与 JIRA 无缝集成,并通过自定义 API 管理和交互项目。

本地
Python
Email sending MCP 💌

Email sending MCP 💌

Send emails directly from Cursor with this email sending MCP server

本地
TypeScript