Metadata-Version: 2.4
Name: wechat-desktop-mcp
Version: 1.1.0
Summary: MCP server that sends and schedules WeChat (微信) messages in the background through the Windows desktop client
Author: hhuangpanda
License: MIT License
        
        Copyright (c) 2024 WeChat-MCP-Server
        Copyright (c) 2026 hhuangpanda
        
        IMPORTANT DISCLAIMER:
        This software involves WeChat automation and carries significant risks. 
        Use at your own risk and responsibility. The developers disclaim all liability.
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        ENHANCED DISCLAIMER:
        The authors, contributors, and distributors of this software are not liable for any:
        - Account suspensions, bans, or restrictions
        - Data loss or corruption
        - Privacy breaches or security incidents
        - Legal consequences or regulatory violations
        - Commercial losses or business interruptions
        - WeChat platform policy violations
        - Automated behavior detection or penalties
        - Third-party service disruptions
        - Technical failures or system incompatibilities
        - Any direct, indirect, incidental, special, or consequential damages
        
        COMMERCIAL USE WARNING:
        This MIT license legally permits commercial use, however:
        - Commercial use of WeChat automation tools carries significant risks
        - Users must assess legal risks before commercial deployment
        - Ensure compliance with local laws and regulations
        - Respect WeChat's terms of service and commercial policies
        - Consult legal professionals for commercial applications
        - Accept full responsibility for all commercial use risks
        - The software is provided "AS IS" without warranty for commercial purposes
        
        BY USING THIS SOFTWARE, YOU ACKNOWLEDGE THAT YOU HAVE READ, UNDERSTOOD, AND 
        AGREE TO ASSUME ALL RISKS AND RESPONSIBILITIES ASSOCIATED WITH ITS USE.
Project-URL: Homepage, https://github.com/hhuangpanda/wechat-desktop-mcp
Project-URL: Issues, https://github.com/hhuangpanda/wechat-desktop-mcp/issues
Keywords: mcp,mcp-server,model-context-protocol,wechat,weixin,微信,llm,ai-agent,claude,claude-code,messaging,scheduling,automation,desktop-automation,windows
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Win32 (MS Windows)
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: Chinese (Simplified)
Classifier: Natural Language :: English
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
Classifier: Operating System :: Microsoft :: Windows :: Windows 11
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyautogui>=0.9.53
Requires-Dist: pywin32>=307
Requires-Dist: psutil>=5.9.0
Requires-Dist: comtypes>=1.2.0
Dynamic: license-file

# WeChat Desktop MCP Server

<div align="center">

[![PyPI](https://img.shields.io/pypi/v/wechat-desktop-mcp)](https://pypi.org/project/wechat-desktop-mcp/)
![Python version](https://img.shields.io/badge/python-3.9%2B-blue)
![Platform](https://img.shields.io/badge/platform-Windows-0078D6)
[![Tests](https://github.com/hhuangpanda/wechat-desktop-mcp/actions/workflows/tests.yml/badge.svg)](https://github.com/hhuangpanda/wechat-desktop-mcp/actions/workflows/tests.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-green)](https://github.com/hhuangpanda/wechat-desktop-mcp/blob/main/LICENSE)

**An MCP server that sends WeChat messages in the background from the Windows desktop client**

[简体中文](https://github.com/hhuangpanda/wechat-desktop-mcp/blob/main/README.md) | **English**

</div>

---

Lets an AI assistant send WeChat (微信 / Weixin) messages for you, now or later, through the desktop client on your PC, without taking over your mouse or keyboard. Windows 10/11 and WeChat 4.0 or later only. Works with any MCP client that runs stdio servers, such as Claude Desktop, Claude Code, Cursor, opencode, DeepSeek Harness, or Codex in the ChatGPT app.

For example: *"Send 'on my way' to File Transfer"*, or *"Remind the family group about dinner in 30 minutes"*.

<!-- mcp-name: io.github.hhuangpanda/wechat-desktop-mcp -->

## Setup

Requires the WeChat desktop client, running and logged in. The window can be minimized or covered, but not closed to the system tray.

Install [uv](https://docs.astral.sh/uv/getting-started/installation/), then add the server to your client's MCP configuration (for Claude Desktop: `%APPDATA%\Claude\claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "wechat": {
      "command": "uvx",
      "args": ["wechat-desktop-mcp"]
    }
  }
}
```

For Claude Code:

```bash
claude mcp add wechat -- uvx wechat-desktop-mcp
```

For opencode:

```bash
opencode mcp add wechat --global -- uvx wechat-desktop-mcp
```

For DeepSeek Harness (dsh), add this entry to an agent preset:

```yaml
- id: mcp-wechat
  name: '@deepseek-ai/dsh-mcp-client'
  config:
    serverName: wechat
    transport: stdio
    command: uvx
    args: ['wechat-desktop-mcp']
```

Without uv, install Python 3.9+, run `pip install wechat-desktop-mcp` and use `"command": "wechat-desktop-mcp"` with no `args`.

### From source

```bash
git clone https://github.com/hhuangpanda/wechat-desktop-mcp.git
cd wechat-desktop-mcp
pip install -e .
```

Then use `"command": "wechat-desktop-mcp"` as above.

## Tools

### send_wechat_message

| Name | Type | Description |
|------|------|-------------|
| `contact_name` | `string` | Contact or group name |
| `message` | `string` | Text to send |

The chat is opened from the chat list if it is visible there, otherwise through WeChat's search. A search picks the result whose name matches exactly, or the first result if none does, so a partial name such as `File` reaches File Transfer, but a vague name can reach the wrong chat.

Returns `Message sent and verified in chat '<chat name>'`, plus `(retried: ...)` if a step needed a retry. On failure the result has `isError: true` and text such as `Failed to send message (stage=open_chat, reason=contact_not_found_or_chat_not_opened, ...)`, where `stage` is one of `find_window`, `version_check`, `open_chat`, `set_text`, `click_send`, `verify`.

### schedule_wechat_message

Same parameters as `send_wechat_message`, plus `delay_seconds` (`number`).

Returns `Message scheduled for <local time> (in <n> seconds).` If WeChat isn't running or is in the tray at that moment, it adds `Warning (wechat_not_running)` or `Warning (wechat_window_not_found)`; the message stays scheduled, but WeChat must be open by the send time.

### show_scheduled_wechat_messages

No parameters. Returns pending messages and the results of the last 20 that fired. Only messages scheduled by this server process are listed, and they are lost when it exits.

```json
{
  "pending": [{"contact_name": "File", "message": "...", "scheduled_for": "2026-11-01T15:00:00-05:00", "seconds_remaining": 30}],
  "recent": [{"contact_name": "File", "message": "...", "scheduled_for": "2026-11-01T14:30:00-05:00", "result": "Message sent and verified in chat 'File Transfer'"}]
}
```

## Background behavior

- Clicks and typing go to WeChat as window messages, so the mouse, keyboard and other windows are left alone while a message is sent.
- WeChat itself asks to come to the front when a chat is picked from the list or the search closes. Windows usually refuses and flashes WeChat's taskbar button instead; when it allows it, focus is handed back to your window right away.
- Messages with emoji or line breaks are pasted, and the clipboard is restored afterwards and kept out of clipboard history. If the clipboard holds something that cannot be restored exactly (such as copied files), the text is typed instead.
- An unsent draft in the recipient's chat is cleared first. If WeChat is minimized, it is shown without focus during the send and minimized again.
- Clicking into WeChat yourself during a send can interrupt it; the tool then reports a failure rather than sending the wrong text.
- WeChat builds that expose no accessibility tree fall back to keyboard input, which needs the foreground and cannot verify delivery.

## Testing

`tests/test_server.py`, `tests/test_show_scheduled.py`, `tests/test_stdio.py` and `tests/test_detection.py` send nothing. These send real messages to File Transfer:

```bash
python tests/test_send_chinese.py
python examples/mcp_client_example.py
python tests/e2e_interference.py
```

The e2e test opens its own window over WeChat and sends real mouse clicks and keystrokes to it while messages are sent, to check that WeChat never takes the foreground and no keystrokes are lost. It moves your cursor, so don't use the mouse or keyboard while it runs.

## Troubleshooting

- **`stage=find_window`**: `reason=wechat_not_running` means WeChat isn't running; `wechat_window_not_found` means it's running but has no window, usually because it was closed to the tray.
- **`stage=version_check`**: WeChat is older than 4.0; update it.
- **Send failed**: `stage` shows the step. `open_chat` usually means the name matched no chat; check it as WeChat displays it.
- **Client can't connect**: check that `uvx` (or `wechat-desktop-mcp`) is on the client's PATH; the server logs to stderr.

## Disclaimer

This project has no affiliation with Tencent or WeChat. Automating WeChat may break its terms of service and get your account restricted or banned, and a WeChat update can break this project at any time. Don't use it for bulk messages, spam or harassment. You use it at your own risk.

## Acknowledgements

Based on [1052666/WeChat-MCP-Server](https://github.com/1052666/WeChat-MCP-Server), reworked here to send in the background and verify delivery.

## License

[MIT](https://github.com/hhuangpanda/wechat-desktop-mcp/blob/main/LICENSE). Bug reports and pull requests are welcome through [Issues](https://github.com/hhuangpanda/wechat-desktop-mcp/issues).
