Skip to main content
Glama
WeChat Readonly MCP
by Sereneoned

WeChat Readonly MCP (wechat-readonly-mcp)

English | 简体中文

A local-first, strictly read-only MCP server & Antigravity plugin for Windows WeChat 4.x — giving AI agents real-time access to chats, received documents (PDF/Office/ZIP/code), V2/WXGF decrypted images, offline SenseVoiceSmall voice transcription, favorites, official accounts, and moments without screenshots or copy-pasting.

Disclaimer: Intended strictly for reading your own local WeChat data on your own machine to assist personal productivity. Zero network upload, zero message sending, zero UI automation, zero client modification.


Why This Exists

When working with AI coding/research agents (Antigravity, Claude Code, Codex, Cursor), critical context constantly arrives inside WeChat: project requirements in group chats, PDFs/Excel sheets sent by collaborators, screenshots stored as encrypted .dat files, and 40-second voice notes.

Instead of manually screenshotting, exporting files, or transcribing voice memos by hand, WeChat Readonly MCP exposes a strictly read-only, real-time local MCP bridge covering text + files + images + voice end-to-end.


Related MCP server: weflow

Key Features (v1.1.0)

  • Real-time incremental SQLCipher 4 WAL sync: Tracks mtime + WAL salts and incrementally patches only new WAL frames instead of re-decrypting huge message_*.db shards on every message.

  • Automatic WeChat 4.2 V2 & WXGF (HEVC) image decryption:

    • Supports Legacy XOR, V1 AES, V2 AES+XOR, and Tencent's proprietary wxgf (HEVC-wrapped) image container.

    • Derives per-account V2 image keys 100% offline from kvcomm statistic filenames (zero memory scan needed, with read-only live fallback) and transcodes WXGF -> standard JPEG in memory via PyAV / ffmpeg.

  • 100% offline SILK v3 voice-to-text transcription:

    • Reads SILK v3 voice blobs directly from message/media_0.db, decodes to 16 kHz PCM in memory (silk-python), and transcribes locally via sherpa-onnx + SenseVoiceSmall int8 (zh / en / ja / ko / yue + punctuation).

    • Caches transcripts per (chat_id, local_id) locally so repeated reads are instantaneous and automatically inline into wechat_get_messages.

  • Full-format received document reader:

    • Directly extracts text from PDF (PyMuPDF / pypdf), DOCX (paragraphs + tables), XLSX (all sheets), PPTX (slides + speaker notes), TXT / MD / JSON / CSV / HTML / source code, and ZIP archives (with Windows CP437 -> GB18030 Chinese filename repair).

  • 15 strictly read-only MCP tools over lightweight JSON-RPC 2.0 stdio (supports both LSP Content-Length and newline framing; no heavyweight MCP SDK required).

  • Antigravity Plugin Ready: Ships with plugin.json, mcp_config.json, rules/AGENTS.md (proactive auto-query rule), and skills/wechat-readonly/SKILL.md.


15 Read-Only MCP Tools

Tool

Capability

wechat_list_sessions

List recent DMs & group chats with unread counts, timestamps, and last message

wechat_resolve_chat

Fuzzy-match contact remark, nickname, alias, or group name to exact chat_id

wechat_get_messages

Read paginated chat messages by period (today, 7d, date range) or type; parses quotes, merged forwards, files, images, and cached/on-demand voice text (transcribe_voice=true)

wechat_search_messages

Keyword search inside one chat or globally across all chats (handles zstd-compressed rows)

wechat_get_context

Fetch N messages before and after any local_id search hit

wechat_get_group_members

List group owner and all members of a @chatroom

wechat_list_files

Browse/filter received files on disk (msg/file/) by name, extension, or month

wechat_read_file

Extract full text from PDF, DOCX, XLSX, PPTX, ZIP (list or read inner entries), HTML, and source code

wechat_get_image

Decrypt .dat images (Legacy/V1/V2/WXGF -> JPEG/PNG) by MD5, path, or recent chat images

wechat_get_voice

Extract SILK v3 voice messages from media_0.db and transcribe offline via SenseVoiceSmall

wechat_get_favorites

Browse or search WeChat Favorites (收藏)

wechat_get_biz_messages

Browse or search Official Account (公众号) articles and pushes

wechat_get_moments

Browse or search Moments (朋友圈) posts

wechat_get_stats

Aggregate message counts, type breakdown, and top senders

wechat_status

Inspect unlocked DBs, ASR readiness, cache stats, and trigger refresh_keys=true after a WeChat restart


Quick Start (Windows WeChat 4.x)

Prerequisites: Windows 10/11, WeChat 4.x (tested on 4.2.0.53), Python 3.10+.

Option 1: One-Click Antigravity Plugin Install

git clone https://github.com/Sereneoned/wechat-readonly-mcp.git
cd wechat-readonly-mcp
python scripts/install.py --install-deps --download-asr
  • --install-deps installs Python dependencies from requirements.txt.

  • --download-asr downloads the ~160 MB offline SenseVoiceSmall int8 model into ~/.wechat-readonly-mcp/asr_models/ (skip this flag if you don't need voice transcription).

  • Keep WeChat logged in, restart Antigravity, and ask naturally: "Check my unread WeChat messages" or "Summarize the latest PDF received on WeChat".

Option 2: Generic MCP Client (Claude Code / Codex / Cursor)

pip install -r requirements.txt

Add to your client's MCP config:

{
  "mcpServers": {
    "wechat-readonly": {
      "command": "python",
      "args": ["-u", "/absolute/path/to/wechat-readonly-mcp/server/mcp_server.py"]
    }
  }
}

Security & Privacy Guarantees

  • Zero write / zero send surface: Only read-only SQLite URI connections (?mode=ro) and read-only OpenProcess(0x0410) / ReadProcessMemory calls for key derivation; no message-sending or UI-control APIs exist anywhere in the codebase.

  • 100% local execution: Database decryption, image decoding, document parsing, and SenseVoiceSmall ASR all run locally — no data is sent to any third-party cloud service.

  • Prompt-injection hygiene: Every tool output is wrapped with an explicit UNTRUSTED_WECHAT_DATA framing notice, and all tools declare readOnlyHint: true, destructiveHint: false.

  • Never commit local state: Local keys (all_keys.json, media_keys.json), decrypted DB caches, decoded images, and voice caches live exclusively under ${PLUGIN_DATA} / ~/.wechat-readonly-mcp/ outside the repository.


Architecture & Credits

See docs/architecture.md for the internal pipeline diagram and THIRD_PARTY_NOTICES.md for open-source acknowledgements.

Licensed under the MIT License.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides AI clients read-only access to WeChat chat history by extracting and decrypting the local Mac database, enabling search, summary, and analysis of messages.
      1
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to read local WeChat chat records, sessions, contacts, and group members through WeFlow's local HTTP API, keeping all data on localhost.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to query local WeChat chat data through read-only MCP tools, including sessions, messages, contacts, search, and statistics, with everything processed locally.
      7
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables an AI assistant to search the WeChat message history and files stored locally on a Mac, answering queries like finding a specific message or attachment. It is read-only and fully local, so it cannot send messages or contact any cloud service.
      3
      MIT