Skip to main content

WeChat MCP server for reading and replying to messages via macOS Accessibility APIs

Project description

WeChat MCP Server

Python 3.12+ PyPI version License: MIT

中文 | English

An MCP server that automates WeChat on macOS using the Accessibility API and screen capture. It enables LLMs to interact with WeChat chats programmatically.

Features

  • 📨 Fetch recent messages from any chat (contact or group)
  • ✍️ Send automated replies based on chat history
  • 📷 Publish text-only Moments posts, with optional draft-only mode
  • 👥 Add contacts using WeChat ID with configurable privacy
  • 🔍 Smart chat search with exact name matching
  • 🤖 5 specialized Claude Code sub-agents for smart WeChat automation

Quick Start

Installation

pip install wechat-mcp-server

Setup with Claude Code

# If installed via pip
claude mcp add --transport stdio wechat-mcp -- wechat-mcp

# If using uv for development
claude mcp add --transport stdio wechat-mcp -- uv --directory $(pwd) run wechat-mcp
Setup with Claude Desktop
// If installed via pip
{
  "mcpServers": {
    "wechat-mcp": {
      "type": "stdio",
      "command": "wechat-mcp"
    }
  }
}

// If using uv for development
{
  "mcpServers": {
    "wechat-mcp": {
      "type": "stdio",
      "command": "uv",
      "args": [
        "--directory",
        "{path/to/wechat-mcp}",
        "run",
        "wechat-mcp"
      ],
    }
  }
}
Setup with Codex
# If installed via pip
codex mcp add wechat-mcp -- wechat-mcp

# If using uv for development
codex mcp add wechat-mcp -- uv --directory $(pwd) run wechat-mcp

macOS Permissions

⚠️ Important: Grant Accessibility permissions to your terminal:

  1. Open System Settings → Privacy & Security → Accessibility
  2. Add your terminal application (Terminal.app, iTerm2, etc.)
  3. Ensure WeChat is running before using the server

Usage

Basic Commands

# Run with default stdio transport
wechat-mcp --transport stdio

# Run with HTTP transport
wechat-mcp --transport streamable-http

# Run with SSE transport
wechat-mcp --transport sse

Available MCP Tools

  • fetch_messages_by_chat - Get recent messages from a chat
  • reply_to_messages_by_chat - Send a reply to a chat
  • add_contact_by_wechat_id - Add a new contact using a WeChat ID and send a friend request
  • publish_moment_without_media - Publish a text-only Moments post (no photos or videos); optionally only prepare a draft without posting via publish=False

See detailed API documentation for full tool specifications.

Claude Code Sub-Agents

This project includes 5 intelligent sub-agents designed specifically for WeChat automation. They enable natural language control of WeChat through Claude Code.

Available Sub-Agents

  1. Chat-summarizer - Summarize chat history and extract key information
  2. Auto-replier - Auto-generate and send appropriate replies
  3. Message-searcher - Search chat history for specific content
  4. Multi-chat-checker - Monitor multiple chats and prioritize messages
  5. Chat-insights - Analyze relationship dynamics and communication patterns

📖 View complete sub-agents guide

Development

Local Setup with uv

# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone and setup
git clone https://github.com/yourusername/WeChat-MCP.git
cd WeChat-MCP
uv sync

# Run locally
uv run wechat-mcp --transport stdio

Documentation

Requirements

  • macOS (uses Accessibility API)
  • WeChat for Mac installed and running
  • Python 3.12+
  • Accessibility permissions for terminal

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wechat_mcp_server-0.2.0.tar.gz (154.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wechat_mcp_server-0.2.0-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file wechat_mcp_server-0.2.0.tar.gz.

File metadata

  • Download URL: wechat_mcp_server-0.2.0.tar.gz
  • Upload date:
  • Size: 154.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wechat_mcp_server-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1309811d63ee23c96206ed4ffbc5b2fdbb18024f38d1d625da28170651b7491d
MD5 bc27e60ade172f414478b84ab072f3bd
BLAKE2b-256 05a408b259075ce742f29757b7a301c6b685079f25fee245711c5fb9fa2f370d

See more details on using hashes here.

Provenance

The following attestation bundles were made for wechat_mcp_server-0.2.0.tar.gz:

Publisher: publish.yml on BiboyQG/WeChat-MCP

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wechat_mcp_server-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for wechat_mcp_server-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 940bcc507ed6f8b90af83da7810ecf6f3664e431027c396ee1b47bf2bb686625
MD5 6de40cbeb342ec8447cf794cd3451797
BLAKE2b-256 3ae2ae291b2c5728bfa72d7ecf8e098135f41f4c35791bb78708d1dfe647e918

See more details on using hashes here.

Provenance

The following attestation bundles were made for wechat_mcp_server-0.2.0-py3-none-any.whl:

Publisher: publish.yml on BiboyQG/WeChat-MCP

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page