Skip to main content
Glama
README.md
# wechat-sync-kit

本地优先的微信数据采集与项目信号工具包,将 **MCP Server (`wechat-sync-mcp`) + CLI (`wechat-sync`) + Agent Skill (`skill/SKILL.md`)** 整合在同一仓库中,直接对接开源 [`im-mcp`](https://github.com/im-mcp/im-mcp)(MIT License)完成本机微信群的定时同步、项目风险/截止/行动提取与可播放语音归档。

## 核心能力

- **全自动 `im-mcp` 同步链路**:对接 `im-mcp` 运行时执行 `decrypt_all -> WAL 回退校验 -> database.sync_data -> PRAGMA quick_check -> project.db 增量入库`,完整记录发言人名称 (`sender`)、`sender_id`、`is_self` 与复核状态 (`pending`/`reviewed`/`dismissed`)。
- **标准 MCP Server (`wechat-sync-mcp`)**:支持 Claude Code / Codex 直接通过 stdio 接入,提供 7 个工具:
  - `get_sync_status`
  - `refresh_wechat_signals`
  - `list_tracked_projects`
  - `get_project_signals`
  - `add_or_update_tracked_group`
  - `mark_signal_status`
  - `export_session_chat`
- **零依赖离线 HTML 看板 + `signals.json`**:每次同步自动原子写入权限为 `0600` 的 `board.html`(离线可交互)和标准化 `signals.json`(可直接被 [`claude-command-board`](https://github.com/cq-dong/claude-command-board) 消费)。
- **单会话聊天 + 原声语音导出**:支持 SILK (`pilk`) 与微信 4.x `OPUS_RAW_V1`(系统 `libopus`),生成内嵌 `<audio>` 播放器的 HTML、TXT、CSV(防公式注入)与 `summary.json`,**绝不擅自上传或自动转写**。

## 快速开始

### 1. 安装依赖与 Skill

```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
# 如需语音解码与 im-mcp 运行时依赖:
pip install -e ".[all]"

# 软链安装 Skill 到 ~/.claude/skills 与 ~/.codex/skills
chmod +x install.sh && ./install.sh
```

### 2. 零隐私 Demo 快速体验

无需微信密钥即可生成脱敏样例、`signals.json` 与交互式 `board.html`:

```bash
wechat-sync --root /tmp/wechat-sync-demo demo
open /tmp/wechat-sync-demo/board.html
```

### 3. 对接 `im-mcp` 同步真实工作群

1. 先使用上游 `im-mcp` 在本机完成授权密钥获取,将 `keys.json` 放入受保护目录(权限 `0600`)。
2. 初始化工作区并配置 `projects.json`(格式见 `examples/projects.example.json`):

```bash
export WECHAT_SYNC_ROOT="$HOME/Library/Application Support/WeChat Sync Kit"
export WECHAT_IM_MCP_SRC="/path/to/im-mcp/src"

wechat-sync init-config
wechat-sync add-group --group-id "10000000001@chatroom" --group-name "核心项目群" --project "示例项目"
wechat-sync refresh --days 7
```

### 4. 接入 Claude Code / Codex MCP

参考 `mcp/mcp-config.example.json` 将 `wechat-sync-mcp` 加入宿主 MCP 配置:

```json
{
  "mcpServers": {
    "wechat-sync": {
      "command": "/path/to/.venv/bin/wechat-sync-mcp",
      "env": {
        "WECHAT_SYNC_ROOT": "/Users/<you>/Library/Application Support/WeChat Sync Kit",
        "WECHAT_IM_MCP_SRC": "/path/to/im-mcp/src"
      }
    }
  }
}
```

## 隐私与安全边界

- **纯本地运行**:不向任何云端或第三方 API 发送聊天记录、语音或密钥。
- **敏感文件隔离**:`.gitignore` 默认拦截 `*.db`、`*keys*.json`、`projects.json`、`signals.json`、`board.html`;运行时目录权限为 `0700`,产物文件权限为 `0600` 且使用原子替换写入。
- **诚实汇报缺口**:若底层 `im-mcp` 发生 WAL 合并回退,状态会自动标为 `部分 WAL 回退` 并在看板与 `status.json` 中显式告警。

## 开源致谢与关联项目

- 底层微信解密与 SQLite ETL 能力基于开源 [`im-mcp`](https://github.com/im-mcp/im-mcp)(MIT License)。
- 配合 [`prompt-craft-skill`](https://github.com/cq-dong/prompt-craft-skill) 与 [`claude-command-board`](https://github.com/cq-dong/claude-command-board) 组成完整的个人 AI 工作流套件。

## License

MIT

TDQS

B3.3/5.0

Scored across 8 tools

Disambiguation4/5

Each tool has a distinct verb+resource target: status reads, ETL refresh, group discovery, tracked-group listing, signal querying, config writes, triage updates, and export. The only mild overlap is between discover_wechat_groups (available groups from snapshot) and list_tracked_projects (configured groups), but the descriptions make the snapshot-vs-config distinction clear.

Naming Consistency5/5

All eight tools use consistent snake_case verb_noun naming (get_*, refresh_*, discover_*, list_*, add_or_update_*, mark_*, export_*). The compound 'add_or_update_tracked_group' is a minor stylistic deviation but remains predictable and readable.

Tool Count5/5

Eight tools is well within the ideal 3-15 range and each maps to a distinct stage of the sync/triage/export workflow. No tool feels redundant or like filler.

Completeness4/5

The surface covers discovery, configuration, ETL refresh, status, signal querying/triage, and export, which is strong lifecycle coverage for this domain. The notable gap is the absence of a remove/untrack operation for tracked groups (add_or_update exists but no delete), and there is no explicit transcription trigger, though the export description suggests that is intentional.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues