OpenWA MCP Server

OpenWA MCP Server

Enables AI assistants to manage WhatsApp sessions, send multi-format messages, control group participants, and configure webhooks by wrapping the OpenWA REST API with 44 tools.

Category
访问服务器

README

🟢 OpenWA MCP Server

<p align="center"> <a href="https://github.com/rmyndharis/OPENWA"><img src="https://img.shields.io/badge/OpenWA_API-Integration-25D366?style=for-the-badge&logo=whatsapp&logoColor=white" alt="OpenWA Integration"></a> <img src="https://img.shields.io/badge/MCP_Tools-44-blue?style=for-the-badge&logo=android" alt="44 MCP Tools"> <img src="https://img.shields.io/badge/TypeScript-5.x-blue?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript 5.x"> <img src="https://img.shields.io/badge/Node.js-22%2B-green?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js 22+"> <img src="https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge" alt="License MIT"> </p>

An enterprise-grade Model Context Protocol (MCP) server that seamlessly wraps the powerful OpenWA WhatsApp REST API. It exposes 44 robust tools over standard I/O (stdio) transport, enabling any MCP-compatible AI assistant (such as Cursor, Claude Desktop, Cline, and Antigravity) to securely manage WhatsApp sessions, dispatch multi-format messages, control group participants, search contacts, manage tag labels, and setup callbacks in real-time.


🧱 System Architecture

┌─────────────────────────────────────────────────────────────────┐
│             1. AI CLIENT (Cursor, Claude, Cline, etc.)          │
│  User: "Send a promotional flyer to my active VIP groups..."    │
└─────────────────────────────────────────────────────────────────┘
                                │
                                ▼ [JSON-RPC over stdio]
┌─────────────────────────────────────────────────────────────────┐
│                 2. OPENWA MCP SERVER (TypeScript)               │
│  • Matches user request to the `send_image` tool schema         │
│  • Validates payload boundaries using declarative Zod schemas    │
│  • Authenticates securely via local dotenv environment configs   │
└─────────────────────────────────────────────────────────────────┘
                                │
                                ▼ [REST API Request with X-API-Key]
┌─────────────────────────────────────────────────────────────────┐
│                 3. OPENWA WHATSAPP REST DAEMON                  │
│  • Translates API payloads into native WhatsApp Web calls       │
│  • Manages multi-session state machines & SQLite indexes        │
└─────────────────────────────────────────────────────────────────┘
                                │
                                ▼ [WhatsApp Network Protocol]
┌─────────────────────────────────────────────────────────────────┐
│                     4. TARGET WHATSAPP DEVICES                  │
│  • Bulk promotional flyers delivered safely and instantly       │
└─────────────────────────────────────────────────────────────────┘

✨ Features

  • 44 Built-in Tools: Comprehensive control over the entire WhatsApp ecosystem.
  • Robust Zod Validation: Pure, declarative parameter validation on every request.
  • Zero-Poll Webhooks: Simple callbacks to receive instant WhatsApp events directly.
  • Multi-Session Native Engine: Manage multiple phone accounts under a single server wrapper.
  • Strict Separation of Concerns: Highly modular, human-written TypeScript architecture.

🛠️ Installation & Setup

Prerequisites

  • Node.js: v22.0.0 or higher
  • TypeScript: v5.0.0 or higher
  • A running and accessible OpenWA REST API instance
  • A secure API Key generated from your OpenWA server configuration

1. Clone & Build

# Clone the repository
git clone https://github.com/ExoCubeYT/openwa-mcp.git
cd openwa-mcp

# Install dependencies
npm install

# Configure environment variables
cp .env.example .env

2. Configure Environment

Edit your local .env file to match your active OpenWA REST API backend:

OPENWA_BASE_URL=http://localhost:2785/api
OPENWA_API_KEY=your_secure_api_key_here

3. Build Production Targets

npm run build

The production output will compile cleanly into the dist/index.js bundle directory.


🚀 AI Agent Integrations

To load the OpenWA MCP server into your favorite developer environment, reference the standard JSON-RPC launch config.

Note: Replace C:/path/to/openwa-mcp with the absolute local filesystem path of your cloned workspace directory.

Claude Desktop

Edit your global configuration file:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "openwa": {
      "command": "node",
      "args": ["C:/path/to/openwa-mcp/dist/index.js"],
      "env": {
        "OPENWA_BASE_URL": "http://localhost:2785/api",
        "OPENWA_API_KEY": "your_secure_api_key_here"
      }
    }
  }
}

Cursor

Add to .cursor/mcp.json in your project root (or set globally via Settings > Features > MCP):

{
  "mcpServers": {
    "openwa": {
      "command": "node",
      "args": ["C:/path/to/openwa-mcp/dist/index.js"],
      "env": {
        "OPENWA_BASE_URL": "http://localhost:2785/api",
        "OPENWA_API_KEY": "your_secure_api_key_here"
      }
    }
  }
}

Cline (VS Code Extension)

Edit your global extension state configurations in cline_mcp_settings.json:

{
  "mcpServers": {
    "openwa": {
      "command": "node",
      "args": ["C:/path/to/openwa-mcp/dist/index.js"],
      "env": {
        "OPENWA_BASE_URL": "http://localhost:2785/api",
        "OPENWA_API_KEY": "your_secure_api_key_here"
      },
      "disabled": false
    }
  }
}

Claude Code

Add .mcp.json to your project workspace root:

{
  "mcpServers": {
    "openwa": {
      "command": "node",
      "args": ["C:/path/to/openwa-mcp/dist/index.js"],
      "env": {
        "OPENWA_BASE_URL": "http://localhost:2785/api",
        "OPENWA_API_KEY": "your_secure_api_key_here"
      }
    }
  }
}

VS Code (Copilot / Continue / Open Code)

Create .vscode/mcp.json inside your local workspace:

{
  "servers": {
    "openwa": {
      "command": "node",
      "args": ["C:/path/to/openwa-mcp/dist/index.js"],
      "env": {
        "OPENWA_BASE_URL": "http://localhost:2785/api",
        "OPENWA_API_KEY": "your_secure_api_key_here"
      }
    }
  }
}

🧰 WhatsApp Tool Catalog (44 Total)

All tool schemas are structured logically using modular TypeScript domains under src/tools/.

📱 Sessions & Authentication (7)

Tool Params Description
get_sessions None Lists all active WhatsApp web browser sessions
create_session sessionKey Launches a new browser instance for authentication
start_session sessionKey Resumes a stopped session container
stop_session sessionKey Safely shuts down a running browser instance
delete_session sessionKey Wipes the credentials and directory of a session
get_session_qr sessionKey Generates a base64 pairing QR code for WhatsApp link
get_session_status sessionKey Returns CONNECTED, STARTING, or DISCONNECTED

💬 Messaging Services (8)

Tool Params Description
send_text chatId, text Dispatches a plaintext message to a contact/group
send_image chatId, url, caption Fetches and sends an image from a URL
send_file chatId, url, fileName Sends document files (PDFs, docs) from a URL
send_audio chatId, url Sends audio file streams directly to a target chat
send_video chatId, url, caption Sends high-definition videos from web URLs
react_to_message messageId, emoji Attaches a quick emoji reaction to a message
get_messages chatId, count Retrieves historical context and message logs
delete_message messageId Deletes/revokes a message for everyone

🚀 Bulk Campaigns (2)

Tool Params Description
send_bulk_text chatIds, text Delivers text announcements to target chats
send_bulk_image chatIds, url, caption Broadcasts promotional flyers to multiple contacts

👥 Group Orchestration (10)

Tool Params Description
get_groups None Returns a list of all groups the session is in
create_group name, participants Provisions a new group with custom contacts
get_group_info chatId Resolves admins, descriptions, and metadata
add_group_member chatId, participant Adds a contact to an existing group
remove_group_member chatId, participant Removes/kicks a participant from the group
promote_member chatId, participant Grants admin permissions to a participant
demote_member chatId, participant Strips admin privileges from a group manager
send_group_message chatId, text Targeted message relay for group channels
leave_group chatId Exits the specified group safely
update_group_subject chatId, subject Renames the group conversation title

📇 Contact Management (6)

Tool Params Description
get_contacts None Lists all saved contacts and known numbers
get_contact contactId Returns metadata, status, and profile information
check_number phone Verifies if a raw phone number is on WhatsApp
get_profile_picture contactId Resolves high-resolution avatar display URLs
block_contact contactId Instantly blocks incoming chats from a number
unblock_contact contactId Restores normal chat capabilities to a number

🔔 Webhook Configs (4)

Tool Params Description
list_webhooks None Lists active callback URLs configured for events
create_webhook url, events Subscribes a server URL to WhatsApp events
delete_webhook webhookId Removes an active event callback listener
update_webhook webhookId, events Mutates subscribed events on an active webhook

🏷️ Chat Labels (5)

Tool Params Description
get_labels None Fetches all custom label classifications
create_label name, color Creates a new colored tag label
delete_label labelId Removes a custom label classification
add_label_to_chat chatId, labelId Adds a label classification to a chat thread
remove_label_from_chat chatId, labelId Removes a label classification from a chat thread

📦 Media Assets (2)

Tool Params Description
get_media messageId Downloads media files stored inside a message
upload_media fileContentBase64 Caches media on the server to prevent redelivery

🛠️ Local Development

To run the codebase in live-refresh watch mode during extensions, run:

# Spawns tsx to track active source code files directly
npm run dev

To run standard test transport handshakes, build the module and execute the diagnostic listener:

npm run build
node dist/index.js

🤝 Contributing

We welcome contributions of all shapes and sizes! To keep codebases pristine and secure, please adhere to our strict project design conventions.

Step-by-Step Contribution Flow

  1. Fork the Repository: Set up your workspace branch on GitHub.
  2. Implement Your Logic: Maintain strict separation of concerns. Keep your tools and clients isolated.
  3. No AI Comments: Adhere to our zero AI-style commenting standard. Use short, human-like annotations where needed, and document details in .explanation files only.
  4. Build & Test: Ensure npm run build generates zero TypeScript errors.
  5. Create a Pull Request: Submit your pull request for review against our development branch.

See CONTRIBUTING.md for deeper details on our design paradigms.


📄 License

Distributed under the MIT License. See the LICENSE file for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选