WeCom MCP Server
Provides tools for interacting with WeChat Work (WeCom) self-built applications, enabling AI agents to send messages (text, Markdown, files), query contacts, receive and store messages, and search historical messages via WeCom APIs and callbacks.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@WeCom MCP ServerSend a text message to zhangsan: 'Please check the report.'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
WeCom MCP Server

A Python-based MCP (Model Context Protocol) Server for WeCom (WeChat Work / ไผไธๅพฎไฟก) self-built applications.
Provides a standard set of MCP tools that enable AI Agents (e.g., Trae Work, Claude Desktop) to send messages to WeCom users/departments, query contacts, receive and store messages, and more.
๐ ไธญๆ็ (Chinese)
โจ Features
Core Capabilities
๐จ Message Sending: Text, Markdown, generic message bodies, file sending, and
@allmass messaging๐ Contact Lookup: Quickly find UserIDs by member name, or batch-retrieve members by department
๐ฅ Message Reception: In HTTP mode, automatically listens for WeCom callbacks and persists received messages to SQLite in real time
๐ History Query: Query historical messages by time, type, sender, keywords, and more
๐๏ธ File Management: Received images/voice/video/files are automatically downloaded to local disk with metadata stored in the database
Technical Highlights
Pure-Python AES-256-CBC: No dependency on the
cryptographylibrary, avoiding native compilation issues on certain platformsMultiple Transport Support:
stdio(single Agent),streamable-http(shared by multiple Agents),sse(legacy compatibility)SQLite Yearly Partitioning: Automatically splits data tables by calendar year to prevent single-table bloat
Managed by
uv: Ultra-fast package manager and virtual environment
Related MCP server: WeCom MCP
๐ ๏ธ MCP Tool List
Universal Tools (Stdio & HTTP/SSE)
Tool Name | Description |
| Send a text message |
| Send a Markdown message |
| Send any type of message (text/markdown/news, etc.) |
| Send a local file (auto-upload) |
| Mass message all members in the app's visible scope ( |
| Find UserID by member name |
| List all members in a department (including sub-departments) |
| Check current WeCom configuration status |
HTTP/SSE Exclusive Tools
Tool Name | Description |
| Health check (Webhook status, database status, etc.) |
| Query historical messages (filter by time/type/sender/keywords) |
| Get details of a single message |
| Get the local file path associated with a message |
| List years that have historical data |
| Historical message statistics (by type/sender/month) |
๐ Quick Start
1. Requirements
Python >= 3.14
uv package manager
2. Installation & Configuration
# Clone the project
git clone <your-repo-url>
cd wecom-mcp-server
# Create virtual environment and install dependencies
uv sync
# Copy the environment variable template
cp .env.example .env3. Configuration
Edit .env and fill in your WeCom self-built application credentials:
# Corp ID
WECOM_CORP_ID=ww1234567890abcdef
# Self-built App Secret
WECOM_CORP_SECRET=your_app_secret
# Self-built App AgentId (number)
WECOM_AGENT_ID=1000002
# ====== Optional ======
# Contacts Sync Secret (recommended for full-directory access)
WECOM_CONTACTS_SECRET=your_contacts_secret
# Message callback (only needed for receiving messages / history query)
WECOM_CALLBACK_TOKEN=your_callback_token
WECOM_CALLBACK_ENCODING_AES_KEY=your_aes_key_43_chars_long
# MCP service mode
# stdio: default, single-client local calls
# streamable-http: HTTP service, shared by multiple Agents
# sse: legacy SSE mode
WECOM_MCP_TRANSPORT=streamable-http
WECOM_MCP_HOST=0.0.0.0
WECOM_MCP_PORT=9000
# Data persistence directory
WECOM_DATA_DIR=data4. Run
Mode 1: Stdio (for Trae Work)
Add to your Trae Work MCP configuration:
{
"mcpServers": {
"wecom": {
"command": "uv",
"args": ["run", "--directory", "/path/to/wecom-mcp-server", "wecom-mcp-server"]
}
}
}Mode 2: HTTP Service (shared by multiple Agents)
# Run in foreground
uv run wecom-mcp-server --transport streamable-http --host 0.0.0.0 --port 9000
# Or use .env configuration
WECOM_MCP_TRANSPORT=streamable-http WECOM_MCP_PORT=9000 uv run wecom-mcp-serverCallers interact with the MCP Server via HTTP:
curl -X POST http://localhost:9000/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "send_text_message", "arguments": {"to_user": "zhangsan", "content": "Hello!"}}}'โ๏ธ Supervisor Deployment
To keep the service running in the background, use supervisord.
Config file: /usr/local/etc/supervisor.d/wecom-mcp-server.conf
[program:wecom-mcp-server]
command=/usr/local/bin/uv run wecom-mcp-server --transport streamable-http --host 0.0.0.0 --port 9000
directory=/path/to/wecom-mcp-server
user=your_username
autostart=true
autorestart=true
startretries=3
stopasgroup=true
killasgroup=true
stderr_logfile=/path/to/logs/wecom-mcp-server.err.log
stdout_logfile=/path/to/logs/wecom-mcp-server.out.log
environment=LANG="en_US.UTF-8",PATH="/usr/local/bin:/usr/bin:/bin"Common commands:
supervisorctl reread # Reload configuration
supervisorctl update # Update process groups
supervisorctl status # View all service statuses
supervisorctl restart wecom-mcp-server # Restart service๐ Project Structure
wecom-mcp-server/
โโโ src/
โ โโโ wecom_mcp_server/
โ โโโ __init__.py
โ โโโ server.py # MCP Server entry point, tool registration
โ โโโ config.py # Configuration management (pydantic-settings)
โ โโโ aes.py # Pure-Python AES-256-CBC implementation
โ โโโ crypto.py # WeCom message encryption/decryption logic
โ โโโ wecom_client.py # WeCom API async client
โ โโโ webhook.py # Message reception webhook service
โ โโโ storage.py # SQLite message persistence & file management
โโโ .env.example # Environment variable example
โโโ pyproject.toml # Project dependencies & build config
โโโ README.md # This document๐ Configuration Notes
WeCom App Permissions
Basic Sending Permission: Create a self-built app in the WeCom admin backend and obtain
CorpID,Secret, andAgentId.Contact Reading Permission (optional): Enable
API Interface Syncin "Management Tools โ Contact Sync" to getcontacts_secret. Without it, only members within the app's visible scope can be read.Message Reception (optional): Enable API reception in the app's "Receive Messages" settings to get
TokenandEncodingAESKey. For local development, use an intranet tunnel tool (e.g., ngrok, cloudflared) to expose the callback address.
Data Storage Structure
data/
โโโ wecom_messages.db # SQLite database (yearly partitioned tables)
โโโ files/
โโโ 2026/
โ โโโ 07/
โ โ โโโ image_xxx.jpg
โ โ โโโ report.pdf
โ โโโ ...
โโโ ...๐ License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/atttx123/wecom-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server