wechat-watch-mcp-portable
Provides read-only access to a local WeChat 4.x installation's databases, enabling AI to list accounts, initialize/check keys, query moments, contacts, sessions, messages, voice transcripts, official-account messages, solitaires, friend requests, call records, and favorites, and to manage group-chat export/watch workflows.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
wechat-watch-mcp-portable
通用便携版 Windows 微信 4.x 只读数据库 MCP(Model Context Protocol)服务
零密钥/零路径硬编码配置 · 轻量不内置依赖 · 缺依赖自动引导安装 · 确认制首次只读初始化 · 严格只读不修改微信源文件
核心特性
轻量分发(不内置依赖):仓库仅包含纯 Python 源码与 4.6 KB 的 64 位只读 SQLite VFS 驱动(
moments_vfs.dll+ 源码moments_vfs.c),不包含.venv、Python 依赖轮子或 Whisper 模型。零硬编码 3 行配置:MCP 客户端配置里不写任何
wxid_、微信目录路径或.key密钥路径,任何 Windows 用户下载后均可直接接入 WorkBuddy、Cursor、Claude Desktop、Codex CLI 等支持 MCP 的客户端。依赖分层 + 缺依赖自动检测与引导:
requirements.txt(核心 4 个依赖:mcp、sqlcipher3、zstandard、cryptography)requirements-voice.txt(可选 2 个语音依赖:silk-python、faster-whisper)缺少依赖时服务不会崩溃,
wechat_db_status及各工具会返回code: "dependency_missing"及可直接执行的安装命令,由 AI 引导用户按需补齐依赖。
确认制首次只读密钥初始化:首次查询若尚未初始化分库密钥,AI 会先向用户说明操作影响,经用户明确同意后调用
wechat_init_keys(confirm=True),以只读权限从已登录的微信 4.x 进程提取主密钥/内存密钥,经 SQLCipher 4 页 1 HMAC 校验后写入用户本机%LOCALAPPDATA%\WeChatInbox\keys\<账号>\。绝不在对话中展示密钥明文,初始化一次后后续全程离线只读。多账号自动发现与隔离:自动探测任意盘符(含盘符根目录如
E:\)、自定义目录、重定向「文档」目录与注册表中的微信 4.x 数据目录;单账号自动选中,多账号时拒绝猜测并要求显式指定account。OS 级严格只读保障:所有微信数据库(
.db/-wal/-shm)均通过随包只读 C VFS 驱动(moments_vfs.dll)结合 SQLitePRAGMA query_only=ON与 Authorizer 白名单访问,绝不写入或锁死正在运行的微信数据库。
Related MCP server: wechat-local
支持的 27 个 MCP 工具
账号发现、状态与初始化
工具名 | 功能说明 |
| 查看服务版本、便携版标识与核心/语音依赖就绪状态 |
| 自动发现本机所有微信 4.x 账号目录、加密分库数与密钥就绪数 |
| 检查 Python 核心/可选依赖、账号与各分库就绪状态(缺依赖返回安装命令) |
| 确认制首次只读密钥初始化( |
微信 4.x 全量只读数据库查询(均支持多账号参数)
工具名 | 对应数据库 | 功能说明 |
|
| 查询朋友圈动态(含微信 4.x |
|
| 查询通讯录(默认个人+企微好友,支持 |
|
| 查询最近会话列表与未读数,自动关联通讯录备注/昵称 |
|
| 跨分片查询好友或群聊记录,自动解压 zstd、解析引用/语音时长/微信转文字缓存,支持按日期与游标翻页 |
|
| 提取 SILK v3 语音,优先读微信转文字缓存,否则用本地离线 |
|
| 查询公众号/服务号历史推送与多图文文章标题、摘要、链接(本机账号用 |
|
| 查询群接龙记录与历史有效接龙数 |
|
| 查询收到的/发出的好友申请与来源场景 |
|
| 查询单聊音视频通话记录与群通话记录 |
|
| 查询微信收藏(标题、摘要、链接与来源联系人) |
群聊明文导出监控与批整理(13 个工具)
list_exports、import_export、list_chats、set_rule、history、message_image、next_batch、commit_batch、results、start_watch、watch_status、stop_watch、wechat_get_moments_ui(已停用提示)。
快速开始(3 步)
环境要求
操作系统:64 位 Windows 10 / 11
微信版本:Windows 桌面版微信 4.x(首次初始化时需处于已登录状态)
Python:64 位 Python 3.10 ~ 3.12(推荐 3.12,全依赖均有预编译 wheel,无需安装 Visual C++ 编译器;若尚未安装,运行
setup.ps1时会自动给出安装命令)
第 1 步:获取代码
任选一种方式放到本地非微信目录(例如 D:\wechat-watch-mcp-portable):
方式 A(推荐,无需 Git):在右侧 Releases 下载
wechat-watch-mcp-portable-v1.5.0.zip并解压。方式 B(Git 克隆):
git clone https://github.com/wzl20040621wzl-web/wechat-watch-mcp-portable.git D:\wechat-watch-mcp-portable cd D:\wechat-watch-mcp-portable
第 2 步:按需安装依赖
在项目目录打开 PowerShell 运行 setup.ps1:
# 1. 仅检测环境与依赖(不安装、不改动任何文件)
powershell -NoProfile -ExecutionPolicy Bypass -File .\setup.ps1 -CheckOnly
# 2. 标准安装(推荐:仅安装核心只读查询与密钥初始化依赖,速度最快)
powershell -NoProfile -ExecutionPolicy Bypass -File .\setup.ps1
# 3. 完整安装(核心依赖 + 语音 SILK 解码 + 本地离线 Whisper 语音转文字,并预下模型)
powershell -NoProfile -ExecutionPolicy Bypass -File .\setup.ps1 -WithVoice -PreloadWhisperModel -UseHFMirror国内网络加速提示:若
pip下载较慢,可追加清华源参数:powershell -NoProfile -ExecutionPolicy Bypass -File .\setup.ps1 -PipIndexUrl https://pypi.tuna.tsinghua.edu.cn/simple
运行成功后,脚本会在当前目录自动生成带本机实际路径的零密钥配置文件:
client.local.json(适用于 WorkBuddy / Cursor / Claude Desktop)codex.local.toml(适用于 Codex CLI / TOML 客户端)
第 3 步:粘贴 3 行配置并完成首次初始化
WorkBuddy / Cursor / Claude Desktop:打开刚生成的
client.local.json,将以下内容合并进客户端的 MCP 配置并重载服务:{ "mcpServers": { "wechat-watch": { "command": "D:\\wechat-watch-mcp-portable\\.venv\\Scripts\\python.exe", "args": [ "D:\\wechat-watch-mcp-portable\\server.py" ] } } }Codex CLI:将
codex.local.toml中的内容追加到~/.codex/config.toml:[mcp_servers.wechat-watch] command = 'D:\wechat-watch-mcp-portable\.venv\Scripts\python.exe' args = ['D:\wechat-watch-mcp-portable\server.py']首次初始化:确认电脑版微信 4.x 已登录,在对话中直接告诉 AI:
「帮我检查微信 MCP 状态并初始化我的微信」
AI 会先列出检测到的账号和依赖状态并征求你的确认;你回复同意后,MCP 会一次性完成分库密钥提取与只读校验。此后无需再次初始化,微信未打开时也可离线只读查询。
可选环境变量
默认零配置即可开箱使用;仅在需要覆盖默认目录或模型时才需设置:
环境变量 | 说明 |
| 手动指定非标准位置的 |
| 自定义分库密钥存放根目录(默认 |
| 自定义 WAV 语音导出目录(默认 |
| 指定本地离线语音模型(默认 |
| 自定义群聊明文导出目录(默认 |
常见问题(FAQ)
Q:提示
code: "dependency_missing"怎么办?
A:说明当前.venv缺少对应功能的可选依赖(例如仅安装了核心版但调用了wechat_get_voice导出 WAV/转文字)。直接复制返回的setup_command(如setup.ps1 -WithVoice)在 PowerShell 中执行,完成后重载 MCP 服务即可。Q:本机登录过多个微信号怎么用?
A:先让 AI 调用wechat_list_accounts查看发现的账号列表,然后在后续查询中指定account参数(查公众号推送时本机账号参数名为wechat_account)。Q:会影响正在运行的微信或导致数据损坏吗?
A:不会。本项目通过随包只读 C VFS 驱动(moments_vfs.dll)以只读内存视图读取.db/-wal/-shm,不向微信数据目录写入任何字节,也不操作微信界面。Q:如何本地运行自动化测试?
A:在安装了完整依赖(核心 + 语音)的.venv中执行:.\.venv\Scripts\python.exe -B test_workflow.py .\.venv\Scripts\python.exe -B test_moments_db.py
许可证与致谢
本项目遵循 Apache License 2.0。
vendor/wechatauto/中的数据库密钥定位辅助组件源自 wechatauto-replica(Apache-2.0),适配修改详情见 vendor/wechatauto/SOURCE.md。仅供个人合法备份、整理与只读检索本人本机微信数据使用,请勿用于任何未经授权的数据访问场景。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
WhatsApp MCP for chats you choose: read/write by default, no daily send quota, voice notes as text.
Read-only Remote MCP for externally grounded AI agent trust receipts.
Chinese company registry, litigation, IP and credit data for AI agents. Read-only remote MCP server.
Read-only WhatsApp MCP for your AI agent: it reads the chats you choose. Try the public demo.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to query local WeChat chat data through read-only MCP tools, including sessions, messages, contacts, search, and statistics, with everything processed locally.7MIT
- FlicenseNot gradedqualityBmaintenanceEnables AI clients to list chats and groups, read full group history, search across message shards, and access summaries or system events from local WeChat 4.x data through a read-only, offline MCP interface.-
- AlicenseNot gradedqualityCmaintenanceA read-only MCP server that enables AI agents to inspect specified local WeChat conversations under a controlled read budget and draft replies and files for review. It also supports exporting Windows WeChat chats and connecting through a Docker MCP gateway.Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables read-only access to WeChat 3.x and 4.x chat history, including contact search, session listing, message queries by time range, and export to txt without modifying the original databases.MIT