wechat-mcp
Provides a shared WeChat connection via the iLink protocol, enabling multiple agents to receive @mention-routed messages and to send messages, list contacts, check connection/agent status, and read queued messages through a local daemon.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
@paean-ai/wechat-mcp
WeChat MCP middleware — shared WeChat connection for multiple AI agents with @mention routing and multi-mode message delivery.
Problem
WeChat's official iLink protocol only allows one bot per WeChat account. If you use multiple AI agents (Claude Code, OpenClaw, Paean CLI, etc.), you're forced to choose which one gets WeChat access.
wechat-mcp solves this by providing a shared middleware layer: one WeChat connection, many agents.
Related MCP server: weixin-mcp
How It Works
WeChat iLink API
│
┌────────┴────────┐
│ wechat-mcp │
│ daemon │
│ (background) │
└───┬────┬────┬───┘
│ │ │ HTTP IPC (localhost)
┌──────┘ │ └──────┐
▼ ▼ ▼
MCP Server MCP Server MCP Server
(claude) (openclaw) (paean)
channel gateway poll
▲ ▲ ▲
│ │ │ stdio MCP
Claude Code OpenClaw Paean CLIA background daemon manages the single WeChat connection (QR login, message polling, token cache)
Each agent connects via its own MCP stdio server (thin client)
Incoming messages are routed by @mention:
@claude hellogoes to Claude,@openclaw run taskgoes to OpenClawMessages are delivered differently based on agent mode (channel / gateway / poll)
Any agent can send messages through the shared connection
Message Delivery Modes
Different agents consume messages differently. The --mode flag controls how incoming WeChat messages reach your agent:
Mode | How It Works | Best For |
channel | Push via Claude Code's proprietary channel protocol. Messages appear in the agent's active conversation automatically. | Claude Code |
gateway | Daemon POSTs message to agent's HTTP endpoint, collects SSE response, sends it back through WeChat. Fully automatic bridging. | OpenClaw, 0claw, any HTTP-based agent |
poll | Agent calls | Generic MCP agents, custom bots |
Quick Start
1. Install
npm install -g @paean-ai/wechat-mcp2. Authenticate
wechat-mcp setupScan the QR code with WeChat. Credentials are saved to ~/.wechat-mcp/.
3. Add to Your Agent
Choose the configuration that matches your agent type:
Claude Code (channel mode — messages arrive automatically):
{
"mcpServers": {
"wechat": {
"command": "npx",
"args": ["@paean-ai/wechat-mcp", "serve", "--agent", "claude", "--mode", "channel"]
}
}
}OpenClaw / 0claw (gateway mode — auto-bridges to HTTP endpoint):
{
"mcpServers": {
"wechat": {
"command": "npx",
"args": [
"@paean-ai/wechat-mcp", "serve",
"--agent", "openclaw",
"--mode", "gateway",
"--gateway-url", "http://localhost:3000"
]
}
}
}For OpenAI-compatible endpoints, add --gateway-type openai.
Generic MCP agent (poll mode — agent reads messages via tool):
{
"mcpServers": {
"wechat": {
"command": "npx",
"args": ["@paean-ai/wechat-mcp", "serve", "--agent", "my-agent"]
}
}
}Each agent uses a different --agent name. The daemon auto-starts when any agent connects.
How Each Mode Works in Detail
Channel Mode (Claude Code)
Claude Code supports a proprietary notifications/claude/channel protocol. The MCP server long-polls the daemon for messages and pushes them as channel notifications into Claude's active conversation. Claude sees the message and can reply using wechat_send.
Gateway Mode (OpenClaw, HTTP agents)
The daemon acts as a bridge (similar to AnyClaw):
WeChat user sends
@openclaw help me with codeDaemon POSTs
{ message: "help me with code" }tohttp://localhost:3000/api/chatReads the SSE response stream from the agent
Sends the complete response back to the WeChat user
Supported gateway types:
claw (default) —
POST /api/chat, SSE response with{type: "content", text: "..."}eventsopenai —
POST /v1/chat/completions, SSE response with OpenAI chunk format
The daemon maintains per-user conversation IDs so the agent can track multi-turn conversations.
Poll Mode (Generic)
The MCP server exposes an extra tool wechat_read_messages that returns any queued messages. The agent decides when and how often to check. Messages queue up in the daemon (bounded to 200 per agent) until read.
Message Routing
WeChat Message | Routed To | Agent Receives |
| agent "claude" |
|
| agent "openclaw" |
|
| default agent (first registered) |
|
| default agent |
|
CLI Commands
wechat-mcp setup # QR login
wechat-mcp serve --agent X [opts] # Start MCP server (used in agent config)
wechat-mcp daemon # Start daemon in foreground
wechat-mcp stop # Stop daemon
wechat-mcp status # Show status (with mode info)
wechat-mcp contacts # List known contacts
wechat-mcp send --to X --text Y # One-shot send
wechat-mcp logout # Remove credentials & stop daemonserve Options
Flag | Description | Default |
| Agent identifier (required) | — |
| Delivery mode: |
|
| Agent's HTTP endpoint (required for gateway mode) | — |
| Gateway protocol: |
|
MCP Tools
When connected as an MCP server, agents can use these tools:
Tool | Description | Available In |
| Send a text message to a WeChat user | All modes |
| List known WeChat contacts | All modes |
| Get connection status and registered agents | All modes |
| Read pending messages (non-blocking) | Poll mode only |
Proactive Messaging
Agents can send messages proactively (e.g., from cron jobs or scheduled tasks) using the shared WeChat connection:
# CLI
wechat-mcp send --to "friend@im.wechat" --text "Task completed!"
# Or via MCP tool: agents call wechat_send at any timeArchitecture
Daemon (
~/.wechat-mcp/daemon.json): Auto-started background process that owns the WeChat connection. Listens on127.0.0.1only. Handles gateway bridging for HTTP-based agents.MCP Server: Thin stdio process spawned per-agent. Connects to daemon over local HTTP. Mode determines message delivery strategy.
Gateway Adapters: Protocol translators for different agent types (claw SSE, OpenAI completions).
Credentials: Stored in
~/.wechat-mcp/credentials.jsonwith0600permissions.
Programmatic API
import {
ensureDaemon,
DaemonClient,
loadCredentials,
parseMention,
getAdapter,
} from "@paean-ai/wechat-mcp";
// Connect to daemon
const daemon = await ensureDaemon();
const client = new DaemonClient(daemon.port);
// Register with mode
await client.registerAgent("my-bot", "My Bot", "poll");
// Poll for messages
const messages = await client.pollMessages("my-bot");
// Send
await client.send("user@wxid", "Hello from my bot!", "my-bot");
// Or use a gateway adapter directly
const adapter = getAdapter("claw");
const result = await adapter.send("http://localhost:3000", "Hello");Security
Credentials stored with
0600file permissionsDaemon listens only on
127.0.0.1(no network exposure)No secrets in environment variables or logs
Token stored locally, never transmitted to third parties
Gateway connections are local only (localhost)
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
WhatsApp and Telegram for AI agents, behind a policy gateway. OAuth or access key.
Agent-to-agent network for teams: dm, who-knows-X routing, shared rooms. Human-in-the-loop.
Connect any AI agent to 11+ social platforms: schedule, publish & track posts via hosted MCP.
Social media, DMs, blog syndication & E.164 telecom for AI agents across 18+ networks.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to send WeChat messages through automation, supporting both immediate and scheduled message delivery to contacts and groups using the Model Context Protocol standard.39-
- FlicenseAqualityCmaintenanceEnables AI assistants to send and receive WeChat messages through the official ClawBot API, supporting text, images, files, and videos.718-
- FlicenseAqualityDmaintenanceEnables AI agents to control WeChat through MCP protocol, including sending messages, managing contacts, and searching messages.10-
- AlicenseNot gradedqualityBmaintenanceEnables connecting chat channels to an Agent you control, letting authorized people assign work, steer ongoing tasks, and receive results directly from their chat app.3 npmApache 2.0