wechat-mcp
Provides tools for automating WeChat on macOS, including sending and receiving messages, adding contacts via Excel-driven workflows, checking contact statuses, and publishing Moments posts.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@wechat-mcpAdd contacts from the Excel file and check friend request status"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
WeChat MCP Excel Contact Server
中文 | English
An MCP server that automates WeChat on macOS using Accessibility APIs and screen capture. This package focuses on Excel-driven contact requests, reusable add-friend flows, and friend-request status checks for local outreach workflows.
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
📊 Read selected Excel rows into WeChat contact request payloads
🔁 Monitor pending friend requests, classify whether they were accepted, and persist local state for later processing
🧾 Write operator-friendly CSV state plus JSONL audit events
🔍 Smart chat search with exact name matching
🤖 5 specialized Claude Code sub-agents for smart WeChat automation
Related MCP server: WinAutoWx
Quick Start
Installation
uv tool install git+https://github.com/zbvxbb622-code/wechat-mcp-friend-automation.gitAfter installation, initialize the local state files and print the exact first-run commands:
wechat-mcp-bootstrap
wechat-mcp-doctorwechat-mcp-bootstrap safely creates the default wechat-followup-state/
directory, monitor_state.csv, monitor_events.jsonl, the production
wechat-outreach-state/ directory, and the default logs/ directory without
overwriting existing files. wechat-mcp-doctor reports
PASS or ACTION REQUIRED for the Python/uv runtime boundary, WeChat
installation and login, macOS Accessibility readiness, writable state, and MCP
registration guidance. The installed console scripts run directly; uv is
needed for this install command and for the source-checkout workflow below,
not for the already-installed wechat-mcp command.
Setup with Claude Code
# If installed as a uv tool
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// If installed as a uv tool
{
"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"
],
}
}
}# If installed as a uv tool
codex mcp add wechat-mcp -- wechat-mcp
# If using uv for development
codex mcp add wechat-mcp -- uv --directory $(pwd) run wechat-mcpmacOS Permissions
⚠️ Important: Grant Accessibility permissions to your terminal:
Open WeChat for Mac and sign in with the QR code or phone login.
Open System Settings → Privacy & Security → Accessibility
Add and enable the terminal/IDE that launches the MCP command (Terminal.app, iTerm2, etc.)
Run
wechat-mcp-doctorand resolve everyACTION REQUIREDcheck before using the server.
The bootstrap command prints these one-time steps and both exact registration commands:
# Claude Code
claude mcp add --transport stdio wechat-mcp -- wechat-mcp
# Codex
codex mcp add wechat-mcp -- wechat-mcpUsage
Basic Commands
# Re-run first-run checks at any time
wechat-mcp-doctor
# Run one production outreach scheduling pass
wechat-outreach-run --input-xlsx /path/to/contacts.xlsx --sheet-name 独家达人 --once
# 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
# Poll pending friend requests once and write monitor_state.csv / monitor_events.jsonl
wechat-followup-monitor --workbook /path/to/contacts.xlsx --sheet-name 独家达人 --rows 3-6 --onceAvailable MCP Tools
fetch_messages_by_chat- Get recent messages from a chatreply_to_messages_by_chat- Send a reply to a chatadd_contact_by_wechat_id- Add a new contact using a WeChat ID and send a friend requestread_wechat_contacts_from_excel- Read selected Excel rows into friend-request payloadsadd_contacts_from_excel_rows- Read selected Excel rows and add contactscheck_contact_status- Classify a contact asadded,waiting,not_added,not_found, orunknownpublish_moment_without_media- Publish a text-only Moments post (no photos or videos); optionally only prepare a draft without posting viapublish=False
See detailed API documentation for full tool specifications.
The repository also includes local follow-up helpers and runner scripts for stateful workflows, but the default MCP registry intentionally keeps direct accepted-contact send tools hidden.
Excel Contact Workflow
Defaults match the tested creator resource sheet:
nickname_col:Bredbook_id_col:Cwechat_id_col:AZstart_row:3request_message:你好,想和你沟通商务合作remark_template:小红书-{nickname}-{redbook_id}Batch add delay:
delay_seconds=10by default between contactsCooldown: after every 20 contacts, wait 10 minutes before continuing
Cooldown check: re-check pending contacts after cooldown, update local state files, and record unresolved contacts for later processing
Optional shared QR image: pass one
followup_image_path/--followup-imageand the same QR image is sent to every accepted contact after the text message
Example MCP arguments for a preview:
{
"workbook_path": "/path/to/contacts.xlsx",
"sheet_name": "独家达人",
"rows": "3,5-8"
}Example MCP arguments for a dry run:
{
"workbook_path": "/path/to/contacts.xlsx",
"sheet_name": "独家达人",
"rows": "3-6",
"dry_run": true
}When running a real batch, the server spaces out add attempts and cools down after every 20 contacts by default:
{
"workbook_path": "/path/to/contacts.xlsx",
"sheet_name": "独家达人",
"rows": "3-42",
"delay_seconds": 10,
"cooldown_after_contacts": 20,
"cooldown_seconds": 600,
"followup_image_path": "/path/to/wecom-qr.png"
}Follow-Up Monitor
This repository includes local follow-up helpers for operator-run workflows. Direct accepted-contact send helpers are not registered as default MCP tools.
wechat-followup-monitor keeps the post-request workflow running without leaving a Codex chat open.
Defaults:
Check interval: 30 minutes
Max wait: 72 hours
State files:
wechat-followup-state/monitor_state.csvandwechat-followup-state/monitor_events.jsonlFollow-up message:
你好,想和你进一步沟通商务合作,方便时请回复这条消息Send failures are recorded as
send_failedand are not retried automatically
Run wechat-mcp-bootstrap --state-dir /path/to/wechat-followup-state to create
these state files before the first batch or monitor run. Existing CSV/JSONL
files are preserved.
Example:
wechat-followup-monitor \
--workbook /path/to/contacts.xlsx \
--sheet-name 独家达人 \
--rows 3-6 \
--followup-image /path/to/wecom-qr.pngFor a safe test without touching WeChat:
wechat-followup-monitor \
--workbook /path/to/contacts.xlsx \
--rows 3 \
--once \
--dry-run \
--dry-run-status waitingProduction Outreach Runner
wechat-outreach-run is the production closed-loop entrypoint. It keeps an
internal queue in wechat-outreach-state/run_state.json, exports operator
views as:
wechat-outreach-state/输入快照.xlsxwechat-outreach-state/待处理表.xlsxwechat-outreach-state/成功表.xlsxwechat-outreach-state/失败表.xlsx
Default behavior:
Work window:
10:00-24:00local timeOne WeChat action at a time
Global deduplication by
wechat_idFixed follow-up delay:
5-15minutes after acceptanceSingle-instance lock:
wechat-outreach-state/.wechat-outreach.lockCircuit-breaker evidence:
wechat-outreach-state/evidence/
Resume after a pause:
wechat-outreach-run --state-dir /path/to/wechat-outreach-state --resumeWhen a circuit breaker pauses the run, resume only continues unfinished people from
待处理表.xlsx.成功表.xlsxand失败表.xlsxare never retried automatically.
Example:
wechat-outreach-run \
--input-xlsx /path/to/contacts.xlsx \
--sheet-name 独家达人 \
--rows 3-40 \
--followup-image /path/to/wecom-qr.pngClaude 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
Chat-summarizer - Summarize chat history and extract key information
Auto-replier - Auto-generate and send appropriate replies
Message-searcher - Search chat history for specific content
Multi-chat-checker - Monitor multiple chats and prioritize messages
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/zbvxbb622-code/wechat-mcp-friend-automation.git
cd wechat-mcp-friend-automation
uv sync
# Run locally
uv run wechat-mcp --transport stdio
# Run the install checks from a source checkout
uv run wechat-mcp-bootstrap
uv run wechat-mcp-doctorDocumentation
📘 Detailed Guide - Complete API documentation and architecture
🤖 Sub-Agents Guide - How to use Claude Code sub-agents
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
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceEnables AI assistants to send WeChat messages and take screenshots through ADB automation with LDPlayer emulator. Supports automated WeChat replies to multiple contacts with personalized messages for business and personal use.Last updated18MIT
- Flicense-qualityDmaintenanceEnables automated WeChat operations on Windows through pywinauto, allowing users to send messages to multiple friends or groups programmatically. Provides tools for searching contacts, sending bulk messages, and controlling WeChat interface elements via MCP protocol.Last updated16
- Alicense-qualityBmaintenanceEnables automation of WeChat on macOS through the Accessibility API, allowing LLMs to fetch recent messages from contacts and send replies based on conversation history.Last updated228MIT
- Flicense-qualityCmaintenanceAutomates job searching and initial communication on the Boss Zhipin platform by parsing resumes and matching them with relevant job listings. It includes anti-bot detection features and supports automated messaging to HR representatives through various MCP clients.Last updated10
Related MCP Connectors
MCP connector for iMessage & Contacts via a local Mac agent + Vercel relay
Let ChatGPT, Claude & Cursor use your Mac: email, calendar, iMessage, Teams, files. Local, free.
Managed LinkedIn MCP server for AI agents: search, connect, message and enrich on accounts you own.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/zbvxbb622-code/wechat-mcp-friend-automation'
If you have feedback or need assistance with the MCP directory API, please join our Discord server