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 Installation
Install from PyPI:
Configure MCP manually:
Create or update your MCP 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-serverLinux:
~/.local/share/hal/wecom-bot-mcp-servermacOS:
~/Library/Application Support/hal/wecom-bot-mcp-server
The log file is named mcp_wecom.log and is stored in the above directory.
Usage
Starting the Server
Usage Examples (With MCP)
Direct API Usage
Send Messages
Send Files
Send Images
Development
Setup Development Environment
Clone the repository:
Create a virtual environment and install dependencies:
Testing
Code Style
Building and Publishing
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