Skip to content

Commit bd5cfaf

Browse files
committed
docs(mcp): 同步 Copilot Skill 只读接入说明
1 parent b221b6f commit bd5cfaf

10 files changed

Lines changed: 25 additions & 104 deletions

File tree

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -161,31 +161,28 @@ npm run dev
161161

162162
## MCP 服务
163163

164-
后端提供 MCP JSON-RPC over HTTP 服务,默认只监听 `127.0.0.1`。手机接入局域网时,在应用内打开 **设置 -> MCP 接入 -> 允许手机局域网接入 MCP**,后端会切换为监听 `0.0.0.0` 并重启。
164+
后端提供 MCP JSON-RPC over HTTP 服务,默认只监听 `127.0.0.1`。手机接入局域网时,在应用内打开 **设置 -> MCP 接入 -> 允许手机局域网接入 MCP**,后端会切换为监听 `0.0.0.0` 并重启;设置页展示和复制的接入地址会使用电脑实际局域网 IP,例如 `http://192.168.x.x:10392/mcp`,而不是不可被其他设备访问的 `127.0.0.1`
165165

166166
MCP 入口需要 token 鉴权。设置页提供 **MCP Token****AI 接入提示词****Skill Markdown** 三个独立复制区;token 可一键复制或重置,重置后旧 token 立即失效。手机端或外部 AI 客户端访问 `/mcp``/mcp/skill/bundle``/mcp/skill` 时,都应带上 `Authorization: Bearer <MCP_TOKEN>`。兼容客户端也可以使用 `X-MCP-Token` 请求头或 `?token=` 查询参数,但推荐使用 Bearer token。
167167

168168
通用客户端可以通过 `GET /mcp/skill/bundle` 读取同一份 bundle,通过 `GET /mcp/skill` 读取 markdown 版本,这两个 skill 入口同样需要 MCP token。
169169

170170
工具调用成功时,客户端优先读取 `result.structuredContent``content[0].text` 只是给通用 MCP 客户端展示的 JSON 文本副本。业务未就绪时仍可能返回 JSON-RPC success,但 `result.isError=true`;协议错误或参数错误则返回 JSON-RPC `error`
171171

172+
MCP 仅暴露读取数据与获取媒体资源 URL/参数的能力;系统设置、索引与缓存构建、数据准备、导出、实时同步、本地修订、数据删除等操作类能力不通过 MCP 暴露,请在桌面/网页应用内使用。
173+
172174
工具按包分层:
173175

174176
- `wechat.core`: 状态、工具目录、账号列表、账号信息
175-
- `wechat.setup`: 密钥读取、数据库解密、已解密目录导入、媒体密钥保存、批量媒体处理入口
176-
- `wechat.system`: 健康检查、后端端口、日志路径、大图辅助插件状态等系统能力
177177
- `wechat.mobile`: 面向手机和外部代理的聚合入口,默认返回小结果和下一步建议
178-
- `wechat.contacts`: 联系人列表、模糊解析、联系人导出
178+
- `wechat.contacts`: 联系人列表、模糊解析
179179
- `wechat.chat`: 会话、消息、搜索、发送者筛选、上下文、锚点、合并转发/AppMsg 解析、统计
180-
- `wechat.moments`: 朋友圈时间线、用户、同步、图片/视频/文章封面 URL
181-
- `wechat.media`: 聊天/朋友圈图片、视频、表情、头像、语音文件 URL、远程图片代理与资源辅助
180+
- `wechat.moments`: 朋友圈时间线、用户、图片/视频/文章封面 URL
181+
- `wechat.media`: 聊天/朋友圈图片、视频、表情、头像、语音文件 URL、远程图片代理与资源辅助;只返回 URL 或资源参数,不提供下载缓存或打开本机目录操作
182182
- `wechat.biz`: 公众号/服务号与微信支付记录
183-
- `wechat.analytics`: 年度总结与卡片懒加载
184-
- `wechat.export`: 聊天、朋友圈、账号归档导出任务、下载 URL 与进度 SSE URL
185-
- `wechat.admin`: 微信检测、索引、实时同步等管理能力
186-
- `wechat.editing`: 消息编辑、修复、恢复与审计
183+
- `wechat.analytics`: 年度总结与聚合分析读取;年度总结只读取应用内已生成的缓存,未生成时请先在应用内打开年度总结
187184

188-
媒体、视频、SSE 进度和 ZIP 导出不会直接塞进 MCP JSON 响应;相关工具返回可访问 URL`streamUrl`、任务状态或资源参数
185+
媒体和视频不会直接塞进 MCP JSON 响应;相关工具返回可访问 URL 或资源参数
189186

190187
配套 skill 可通过 HTTP 加载,访问时需要带 MCP token:
191188

skills/wechat-mcp-copilot/SKILL.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: wechat-mcp-copilot
33
version: "1.0.0"
4-
description: Use WeChatDataAnalysis MCP to inspect local WeChat accounts, contacts, sessions, messages, Moments, media, exports, and analytics through a small routed playbook. Trigger when the user asks to search, summarize, export, diagnose, or reason over local WeChat data.
4+
description: Use WeChatDataAnalysis MCP to inspect local WeChat accounts, contacts, sessions, messages, Moments, media, and analytics through a small routed playbook. Trigger when the user asks to search, summarize, diagnose, or reason over local WeChat data.
55
---
66

77
# WeChat MCP Copilot
@@ -12,7 +12,7 @@ Use WeChatDataAnalysis MCP like an investigator: start broad, resolve fuzzy targ
1212

1313
1. Start with `references/routing.md`.
1414
2. Load only one domain reference after routing.
15-
3. Load `references/pagination-budget.md` before broad searches, exports, or multi-page scans.
15+
3. Load `references/pagination-budget.md` before broad searches or multi-page scans.
1616
4. Use `references/failure-recovery.md` when MCP, database readiness, or empty results are unclear.
1717
5. For phone, ScreenMemo, or external MCP clients, prefer `wechat.mobile.*` facade tools before low-level tools.
1818
6. Do not load the full tool catalog unless the user asks about available tools.
@@ -21,12 +21,10 @@ Use WeChatDataAnalysis MCP like an investigator: start broad, resolve fuzzy targ
2121

2222
- `references/routing.md`: first-hop intent routing.
2323
- `references/mobile.md`: phone-friendly facade tools and compact response rules.
24-
- `references/setup-system.md`: setup, keys, decrypt, import, health, and system operations.
2524
- `references/target-resolution.md`: fuzzy contact/session resolution.
2625
- `references/chats.md`: chat sessions, messages, search, and context.
2726
- `references/moments.md`: Moments timeline, posters, likes, comments, media.
2827
- `references/media.md`: images, videos, emoji, files, voice resources without transcription.
29-
- `references/export.md`: chat, Moments, and account archive export jobs.
3028
- `references/analytics.md`: wrapped cards, counts, rankings, and aggregate analysis.
3129
- `references/pagination-budget.md`: limits, cursors, result clipping, stopping rules.
3230
- `references/failure-recovery.md`: empty result, not-ready database, ambiguous targets, retries.

skills/wechat-mcp-copilot/references/analytics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Use this for annual summaries, rankings, counts, and aggregate questions.
1313
## Rules
1414

1515
- Prefer `get_wrapped_meta` then `get_wrapped_card` for mobile or constrained contexts.
16+
- Wrapped annual tools read existing generated cache only; if a cache is missing, ask the user to open Wrapped in the desktop/web app first.
1617
- Use `get_wrapped_annual` only when the user needs the whole annual dataset.
1718
- For broad statistics, prefer aggregate tools or targeted searches over full message pagination.
1819
- Always state the account, time range, and metric basis when answering.
19-

skills/wechat-mcp-copilot/references/export.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

skills/wechat-mcp-copilot/references/failure-recovery.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ Use this when MCP status, DB readiness, or results are suspicious.
88
2. `wechat.core.get_status`
99
3. `wechat.core.list_accounts`
1010
4. `wechat.core.get_account_info`
11-
5. Search index status with `wechat.chat.get_search_index_status` when message search fails.
12-
6. Moments availability by checking account info and `wechat.moments.list_users`.
13-
7. Setup readiness: load `setup-system.md` for keys, decrypt, import, health, or media-key problems.
11+
5. Moments availability by checking account info and `wechat.moments.list_users`.
12+
6. For backend diagnostics, MCP LAN access, data preparation, index/cache build, export, realtime sync, local editing, or system settings, direct the user to the desktop/web app.
1413

1514
## Empty Results
1615

1716
- Do not conclude "no data" after one failed query.
1817
- Try contact/session resolution with a simpler keyword.
1918
- Try session search before global message search when a target is known.
2019
- For Moments, resolve poster identity before timeline filtering.
21-
- If setup is not ready, stop content tools and explain the missing readiness condition.
20+
- If data is not ready, stop content tools and explain that data preparation is handled in the desktop app, not through MCP.

skills/wechat-mcp-copilot/references/media.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Use this for image, video, emoji, file, link, and voice resources.
1313
- `wechat.media.get_decrypted_resource_url`
1414
- `wechat.media.get_proxy_image_url`
1515
- `wechat.media.get_favicon_url`
16-
- `wechat.media.open_chat_media_folder`
1716
- `wechat.biz.get_proxy_image_url`
1817
- `wechat.moments.get_media_url`
1918
- `wechat.moments.get_article_thumb_url`
@@ -25,6 +24,6 @@ Use this for image, video, emoji, file, link, and voice resources.
2524
- Media tools return URLs or resource metadata; they do not inline large binary payloads.
2625
- Voice resources are files only. Do not transcribe voice messages.
2726
- For phone clients, prefer `wechat.mobile.get_media_links` first.
28-
- `open_chat_media_folder` is a desktop-host action; do not use it for phone-only flows.
27+
- MCP does not open local folders or download media into cache; use returned URLs in the client.
2928
- Locate the message first, then fetch media URL by message fields such as `server_id`, `username`, `md5`, or returned media references.
3029
- For Moments, prefer local media URL fields from timeline records. Use remote video/article helpers only when the timeline record has a remote URL or article URL.

skills/wechat-mcp-copilot/references/mobile.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ Use this for phone, ScreenMemo, and external MCP clients unless the user needs a
1313
- `wechat.mobile.search_moments`: compact Moments search.
1414
- `wechat.mobile.get_media_links`: URL-only media lookup.
1515
- `wechat.mobile.get_analytics`: compact analytics by metric.
16-
- `wechat.mobile.export_job`: preview/create/status/download/cancel export jobs.
1716

1817
## Budget Rules
1918

2019
- Keep `limit` at 10-20 for first calls.
2120
- Use `offset` or returned cursor fields for paging.
22-
- Do not call full annual analytics by default; use `metric=digest` or a single card.
21+
- Do not call full annual analytics by default; use `metric=digest` or a single card. Wrapped annual data is cache-only through MCP.
2322
- Do not fetch binary media through MCP. Use returned URLs in the app.
24-
- Use low-level tools only for debugging, editing, raw fields, unusual media, or exact export control.
23+
- Use low-level tools only for debugging, raw fields, or unusual media URL construction.
24+
- Data preparation, index/cache build, export, realtime sync, local editing, system settings, and data deletion tools are not exposed through MCP.
2525

2626
## Recovery
2727

28-
- If `ready=false`, load `setup-system.md`.
28+
- If `ready=false`, stop content tools and direct the user to the desktop/web app for data preparation or backend diagnostics.
2929
- If target resolution is ambiguous, ask for one clarifying clue or show top candidates.
3030
- If search returns nothing, try `resolve_target` and then `get_chat_context` before declaring no data.

skills/wechat-mcp-copilot/references/moments.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@ Use this for 朋友圈, posts, likes, comments, shared links, and Moments media.
1414
- Person names must be resolved to username before filtering timeline by `usernames`.
1515
- Keyword search is for post content/topic, not poster identity.
1616
- Do not request raw XML by default.
17-
- Use `wechat.moments.sync_latest` only when the user explicitly wants fresh local sync or status indicates data is stale.
18-
17+
- Realtime/local sync tools are not exposed through MCP; ask the user to refresh data in the app when Moments data looks stale.

skills/wechat-mcp-copilot/references/routing.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@ Use this first for every WeChatDataAnalysis MCP task.
88
- Status, readiness, "why can't I find anything": `wechat.core.get_status`, or `wechat.mobile.get_overview` for phone clients.
99
- Available tools or packages: `wechat.core.list_tools`.
1010
- Account selection: `wechat.core.list_accounts`, then `wechat.core.get_account_info`.
11-
- Key/decrypt/import/backend health problems: load `setup-system.md`.
11+
- Backend health, logs, MCP LAN access, port, system settings, key/decrypt/import/data preparation, index/cache build, export, realtime sync, local editing, or data deletion requests: explain that these operations are not exposed through MCP and should be handled in the desktop/web app.
1212
- Fuzzy person/group/official account: load `target-resolution.md`.
1313
- Chat content, recent messages, keyword search: load `chats.md`.
1414
- Moments / 朋友圈 / likes / comments / post media: load `moments.md`.
1515
- Images, videos, emoji, files, voice resources: load `media.md`.
16-
- Export requests: load `export.md`.
17-
- Rankings, yearly summary, activity stats: load `analytics.md`.
18-
- Empty results or setup errors: load `failure-recovery.md`.
16+
- Rankings, yearly summary, activity stats: load `analytics.md`; if Wrapped cache is missing, ask the user to generate it in the app.
17+
- Empty results or readiness errors: load `failure-recovery.md`.
1918

2019
## Mixed Intent
2120

22-
Resolve the target first, then load only the main domain reference. Do not load chats, moments, media, export, and analytics together unless the user explicitly asks for a broad audit.
21+
Resolve the target first, then load only the main domain reference. Do not load chats, moments, media, and analytics together unless the user explicitly asks for a broad audit.
2322

24-
For phone clients, keep using `mobile.md` until the user needs a low-level fallback such as editing, raw fields, special media URL construction, or exact export options.
23+
For phone clients, keep using `mobile.md` until the user needs a low-level fallback such as raw fields or special media URL construction.

skills/wechat-mcp-copilot/references/setup-system.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)