Sandbox
@BiboyQG/WeChat-MCP

MCP server for WeChat on macOS

WeChat MCP Server connects an agent to the WeChat desktop app on macOS. It uses Accessibility and screen capture so the agent can fetch messages, reply in chats, add contacts, and publish text-only Moments.

254 stars78 forksPythonUpdated 6mo ago
Who it's for

Builders who want an agent to read and answer WeChat messages for them.

What it delivers

You can have your agent handle WeChat conversations without doing the copy, paste, and switching yourself.

What it does

Fetch chat messages

Reads recent messages from a contact or group chat with the `fetch_messages_by_chat` tool.

Send replies

Generates and sends chat replies with `reply_to_messages_by_chat`.

Add contacts by WeChat ID

Adds a contact and sends a friend request with configurable privacy settings.

Publish Moments text posts

Creates text-only Moments posts, with an option to prepare a draft instead of posting.

Claude Code sub-agents

Includes five sub-agents for summarizing chats, auto-replying, searching messages, checking multiple chats, and analyzing chat patterns.

Multiple transport options

Runs over stdio, streamable HTTP, or SSE for different MCP setups.

How to get it

  1. 1Run
    pip install wechat-mcp-server
  2. 2Run
    # 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
  3. 3Run
    # 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
  4. 4Run
    # 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

README

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

Files in the repo

Repository payload12 top-level entries
  • .claude
  • .github
  • docs
  • src
  • tests
  • .gitignore
  • AGENTS.md
  • CLAUDE.md
  • LICENSE
  • pyproject.toml
  • README.md
  • uv.lock

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface

86k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
noskillish/
bankmcp

BankMCP™: your AI can now read your bank. Self-hosted, read-only MCP server for your own bank accounts via open banking (Enable Banking). Standard MCP; tested with Claude and Ollama.

177

Open-source auth gateway connecting 1400+ SaaS providers to AI agents through SDK, CLI, MCP, HTTP, and OpenAPI.

5.7k

Open-source 3D architectural editor with a local CLI, MCP tools, and practical workflows for humans and AI agents.

23k
cinderline/
northcinder

Open-source MCP server for comparing products and asking the buyer before purchase.

1.2k