The WeCom Bot MCP Server enables interaction with WeCom (WeChat Work) bots through a Model Context Protocol (MCP) compliant interface. With this server, you can:
Send Messages: Text, markdown, images (base64/URL), and file attachments
Mention Users: By user ID or phone number in messages
Track History: Access message history for reference
API Methods: Use
send_message,send_wecom_file, andsend_wecom_imageto interact with WeCom botsContext Handling: Utilize FastMCP context for logging, progress reporting, and resource access
Custom Deployment: Configure with environment variables for webhook URLs and logging preferences
Provides a Model Context Protocol (MCP) server implementation for WeCom (WeChat Work) bot, enabling sending of text, markdown, image and file messages to WeCom groups, with support for @mentions and message history tracking.
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 Bot MCP Serversend a markdown message to the CI bot: 'Build #123 passed successfully'"
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 Bot MCP Server
A Model Context Protocol (MCP) compliant server implementation for WeCom (WeChat Work) bot.
Features
Support for multiple message types:
Markdown messages (with @mentions and font colors)
Markdown V2 messages (with tables, lists, embedded images)
Image messages (base64/local file/URL)
File messages
Template card messages (text_notice and news_notice)
Multi-bot support: Configure and use multiple WeCom bots
@mention support (via user ID or phone number)
Message history tracking
Configurable logging system
Full type annotations
Pydantic-based data validation
Related MCP server: MCP Webhook Server
Requirements
Python 3.10+
WeCom Bot Webhook URL (obtained from WeCom group settings)
Installation
There are several ways to install WeCom Bot MCP Server:
1. Automated Installation (Recommended)
Using Smithery (For Claude Desktop):
Using VSCode with Cline Extension:
Install Cline Extension from VSCode marketplace
Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
Search for "Cline: Install Package"
Type "wecom-bot-mcp-server" and press Enter
2. Manual Configuration
Add the server to your MCP client configuration file:
Configuration
Setting Environment Variables
Single Bot (Default)
Multiple Bots Configuration
You can configure multiple bots using any of these methods:
Method 1: JSON Configuration (Recommended)
Method 2: Individual Environment Variables
Method 3: Combined Mode
MCP Client Configuration with Multiple Bots
Log Management
The logging system uses platformdirs.user_log_dir() for cross-platform log file management:
Windows:
C:\Users\<username>\AppData\Local\hal\wecom-bot-mcp-server\LogsLinux:
~/.local/state/hal/wecom-bot-mcp-server/logmacOS:
~/Library/Logs/hal/wecom-bot-mcp-server
The log file is named mcp_wecom.log and is stored in the above directory.
You can customize the log level and file path using environment variables:
MCP_LOG_LEVEL: Set to DEBUG, INFO, WARNING, ERROR, or CRITICALMCP_LOG_FILE: Set to a custom log file path
Usage
Once configured, the MCP server runs automatically when your MCP client starts. You can interact with it through natural language in your AI assistant.
Usage Examples
Scenario 1: Send weather information to WeCom
Scenario 2: Send meeting reminder and @mention relevant people
Scenario 3: Send a file
Scenario 4: Send an image
Available MCP Tools
The server provides the following tools that your AI assistant can use:
send_message - Send text or markdown messages
Parameters:
content,msg_type(markdown/markdown_v2),mentioned_list,mentioned_mobile_list,bot_idmarkdown: Use when content contains<@userid>mentions or font colors. The<@userid>syntax is WeCom's official mention format, which avoids conflicts with email addresses like@user@email.commarkdown_v2: Use for tables, lists, embedded images, or general content (default)
send_wecom_file - Send files to WeCom
Parameters:
file_path,bot_id
send_wecom_image - Send images to WeCom
Parameters:
image_path(local path or URL),bot_id
send_wecom_template_card_text_notice - Send text notice template card
Parameters:
template_card_source,template_card_main_title,template_card_card_action,bot_id, and optional fieldsUse for notifications with emphasis content, quotes, and action buttons
send_wecom_template_card_news_notice - Send news notice template card
Parameters:
template_card_source,template_card_main_title,template_card_card_action,template_card_image,bot_id, and optional fieldsUse for news-style notifications with images and rich content
list_wecom_bots - List all configured bots
Returns: List of available bots with their IDs, names, and descriptions
Multi-Bot Usage Examples
Scenario 5: Send alert to specific bot
Scenario 6: List available bots
Scenario 7: Send CI notification
Scenario 8: Send template card notification
Scenario 9: Send news-style notification
For Developers: Direct API Usage
If you want to use this package directly in your Python code (not as an MCP server):
Multi-Bot Configuration in Code
Development
Setup Development Environment
Clone the repository:
Create a virtual environment and install dependencies:
Testing
Code Style
Building and Publishing
Continuous Integration
The project uses GitHub Actions for CI/CD:
MR Checks: Runs on all pull requests, tests on Ubuntu, Windows, and macOS with Python 3.10, 3.11, and 3.12
Code Coverage: Uploads coverage reports to Codecov
Import Tests: Ensures the package can be imported correctly after installation
All dependencies are automatically tested during CI to catch issues early.
Project Structure
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contact
Author: longhao
Email: hal.long@outlook.com