Content
# MCP Server WeChat
A server that provides WeChat chat record retrieval and message sending functionality using MCP technology and the [pywechat](https://github.com/Hello-Mr-Crab/pywechat) tool.
## Features
This server provides the following main functions:
- Retrieve WeChat chat records (for a specified date)
- Send a single message to a single friend
- Send multiple messages to a single friend
- Send messages to multiple friends
## Available Tools
- `wechat_get_chat_history` - Retrieve WeChat chat records for a specific date
- Required parameters:
- `to_user` (string): Friend or group chat remark or nickname
- `target_date` (string): Target date, in the format YY/M/D, e.g., 25/3/22
- `wechat_send_message` - Send a single message to a single WeChat friend
- Required parameters:
- `to_user` (string): Friend or group chat remark or nickname
- `message` (string): Message to be sent
- `wechat_send_multiple_messages` - Send multiple messages to a single WeChat friend
- Required parameters:
- `to_user` (string): Friend or group chat remark or nickname
- `messages` (array): List of messages to be sent (input as a string separated by commas)
- `wechat_send_to_multiple_friends` - Send a single or multiple messages to multiple WeChat friends
- Required parameters:
- `to_user` (array): List of friend or group chat remarks or nicknames (input as a string separated by commas)
- `message` (string/array): Message(s) to be sent (a single message will be sent to all friends; multiple messages separated by commas and matching the number of friends will be sent to corresponding friends)
## Installation
### stdio version
```bash
pip install mcp_server_wechat
# Get the latest version
pip install --upgrade mcp_server_wechat
```
### sse version/Streamable_HTTP version
```bash
python -m venv venv # Create a virtual environment
venv/scripts/activate # Activate the environment
pip install -r requirements.txt
```
## Usage Examples
### Configure as an MCP Service
Add the following to your MCP configuration:
stdio version
```json
{
"mcpServers": {
"wechat": {
"command": "python",
"args": ["-m", "mcp_server_wechat","--folder-path=directory to store chat history"]
}
}
}
```
sse version
Start command
```bash
python -m mcp_server_wechat_sse --folder-path=x:\xxxxx #Default folder can be modified in the code
```
```json
{
"mcpServers": {
"wechat": {
"url": "http://localhost:3000/sse"
}
}
}
```
Streamable_HTTP version
Start command
```bash
python -m mcp_server_wechat_Streamable_HTTP --folder-path=x:\xxxxx #Default folder can be modified in the code
```
```json
{
"mcpServers": {
"wechat": {
"url": "http://localhost:3000/mcp"
}
}
}
```
### Invocation Examples
1. Retrieve chat records:
```json
{
"name": "wechat_get_chat_history",
"arguments": {
"to_user": "John Doe",
"target_date": "25/3/22"
}
}
```
2. Send a single message:
```json
{
"name": "wechat_send_message",
"arguments": {
"to_user": "John Doe",
"message": "Hello, this is a test message"
}
}
```
3. Send multiple messages:
```json
{
"name": "wechat_send_multiple_messages",
"arguments": {
"to_user": "John Doe",
"messages": "Hello","This is the first message","This is the second message"
}
}
```
4. Send to multiple friends (single message):
```json
{
"name": "wechat_send_to_multiple_friends",
"arguments": {
"to_user": ["John Doe", "Jane Doe", "Bob Smith"],
"message": "Hello everyone, this is a group message" or "Hello, John","Hello, Jane","Hello, Bob"
}
}
```
## Debugging
You can use the MCP inspector to debug the server:
```bash
npx @modelcontextprotocol/inspector python -m mcp_server_wechat
```
## Actual Effect Display
<table>
<tr>
<td align="center" width="33%">
<img src="https://raw.githubusercontent.com/panxingfeng/mcp_server_wechat/main/test.png" width="330" /><br>
<em>inspector test</em>
</td>
<td align="center" width="33%">
<img src="https://raw.githubusercontent.com/panxingfeng/mcp_server_wechat/main/multi-tool test.gif" width="330" /><br>
<em>Test based on my own UI (similar to Cherry Studio)</a></em>
</td>
<td align="center" width="34%">
<img src="https://raw.githubusercontent.com/panxingfeng/mcp_server_wechat/main/Streamable_HTTP_test.png" width="330" /><br>
<em>Test based on Cherry Studio's Streamable_HTTP</a></em>
</td>
</tr>
</table>
## Precautions
- Using this tool requires keeping the WeChat desktop version logged in
- Retrieving chat records and sending messages require ensuring the WeChat window can be normally operated
- During use, please do not manually operate the WeChat window to avoid interfering with automated operations
- Please do not use this tool for any behavior that violates WeChat service agreements
## License
mcp_server_wechat uses the MIT license. This means you can freely use, modify, and distribute this software, but you must comply with the terms and conditions of the MIT license. See the LICENSE file in the project repository for details.
Connection Info
You Might Also Like
awesome-mcp-servers
A collection of MCP servers.
git
A Model Context Protocol server for Git automation and interaction.
cc-switch
All-in-One Assistant for Claude Code, Codex & Gemini CLI across platforms.
oh-my-opencode
Background agents · Curated agents like oracle, librarians, frontend...
TrendRadar
TrendRadar: Your hotspot assistant for real news in just 30 seconds.
Appwrite
Build like a team of hundreds