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.
WeCom Bot MCP Server
A Model Context Protocol (MCP) compliant server implementation for WeCom (WeChat Work) bot.
Features
Support for multiple message types:
Text messages
Markdown messages
Image messages (base64)
File messages
@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
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(text/markdown),mentioned_list,mentioned_mobile_list
send_file - Send files to WeCom
Parameters:
file_path
send_image - Send images to WeCom
Parameters:
image_path(local path or URL)
For Developers: Direct API Usage
If you want to use this package directly in your Python code (not as an MCP server):
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