feat: init media-center skill
资源中心——从多渠道获取资源链接,转存到夸克网盘并整理归档。 - sources/tencent-doc: 腾讯文档读取 - sources/search: 网盘搜索 - storage/quark: 夸克网盘操作 - ref/: 来源 skill 参考归档 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
# 腾讯文档 MCP — 安装配置
|
||||
|
||||
## 前置依赖
|
||||
|
||||
- Node.js >= 18
|
||||
- npm(随 Node 自带)
|
||||
- mcporter(MCP 客户端)
|
||||
|
||||
```bash
|
||||
# 检查 mcporter 是否已安装
|
||||
mcporter --version
|
||||
|
||||
# 如未安装则全局安装
|
||||
npm i -g mcporter
|
||||
```
|
||||
|
||||
## 安装 MCP Server
|
||||
|
||||
腾讯文档的 MCP 通过远程 API 调用,无需本地安装服务端,只需配置 mcporter。
|
||||
|
||||
### 1. 授权认证
|
||||
|
||||
```bash
|
||||
bash ref/tencent-docs/setup.sh tdoc_check_and_start_auth
|
||||
```
|
||||
|
||||
输出 `AUTH_REQUIRED:<url>` 时,在浏览器打开该链接,用 QQ/微信扫码授权。
|
||||
|
||||
### 2. 获取 Token
|
||||
|
||||
授权完成后回复"已完成授权",然后执行:
|
||||
|
||||
```bash
|
||||
bash ref/tencent-docs/setup.sh tdoc_fetch_token
|
||||
```
|
||||
|
||||
输出 `TOKEN_READY` 表示成功。
|
||||
|
||||
### 3. 验证
|
||||
|
||||
```bash
|
||||
mcporter list tencent-docs
|
||||
```
|
||||
|
||||
列出 98 个工具即配置成功。
|
||||
|
||||
## 快速验证
|
||||
|
||||
```bash
|
||||
# 查看个人空间
|
||||
mcporter call tencent-docs query_space_list
|
||||
|
||||
# 正常返回即一切就绪
|
||||
```
|
||||
@@ -0,0 +1,49 @@
|
||||
# 腾讯文档 — 维护
|
||||
|
||||
## 信息来源
|
||||
|
||||
本文档来源于以下参考项目。当工具调用方式变更时,查阅 `ref/` 中对应副本获取最新用法:
|
||||
|
||||
| 当前模块内容 | 来源(ref/ 路径) | 说明 |
|
||||
|-------------|------------------|------|
|
||||
| 安装流程 | `ref/tencent-docs/SKILL.md`、`ref/tencent-docs/references/auth.md` | 腾讯文档 OAuth 授权 |
|
||||
| 大文档读取(tencentdoc) | `ref/tx-doc-large-reader/SKILL.md` | `doc.resolve_document_structure` 替代方案 |
|
||||
| Smartcanvas 读取 | `ref/tencent-docs/SKILL.md` | 官方分页读取 |
|
||||
|
||||
## 常见故障
|
||||
|
||||
### 1. Token 过期
|
||||
|
||||
**现象**:`mcporter call tencent-docs` 返回 `400006`
|
||||
|
||||
**解决**:重新授权
|
||||
|
||||
```bash
|
||||
bash ref/tencent-docs/setup.sh tdoc_check_and_start_auth
|
||||
```
|
||||
|
||||
→ 浏览器授权 → `bash ref/tencent-docs/setup.sh tdoc_fetch_token`
|
||||
|
||||
### 2. 工具调用报错 `-32603`
|
||||
|
||||
**现象**:`tool execution failed`
|
||||
|
||||
**解决**:
|
||||
- 检查参数名和类型是否匹配
|
||||
- `mcporter list tencent-docs --schema` 查看当前工具参数定义
|
||||
|
||||
### 3. 大文档读取超时
|
||||
|
||||
**现象**:`get_content` 5 秒超时
|
||||
|
||||
**解决**:改用 `doc.resolve_document_structure`(见 usage.md)
|
||||
|
||||
## 更新检查
|
||||
|
||||
腾讯文档 MCP 会更新版本。参考 `ref/tencent-docs/SKILL.md` 中的更新检查流程:
|
||||
|
||||
```bash
|
||||
mcporter call "https://docs.qq.com/openapi/mcp" "check_skill_update" --args '{"version": "<当前版本>"}'
|
||||
```
|
||||
|
||||
当 `ref/tencent-docs/` 有更新时,同步到本模块的 `v2/` 版本。
|
||||
@@ -0,0 +1,71 @@
|
||||
# 腾讯文档 — 使用
|
||||
|
||||
## 读取文档内容
|
||||
|
||||
### 从 URL 提取 file_id
|
||||
|
||||
URL 格式:`https://docs.qq.com/doc/DR2xUcFdrSVhJTkZu`
|
||||
|
||||
提取 `DR2xUcFdrSVhJTkZu` 部分即为 file_id。
|
||||
|
||||
### 第一步:判断文档类型
|
||||
|
||||
```bash
|
||||
mcporter call tencent-docs smartcanvas.read file_id=<FILE_ID> size=10
|
||||
```
|
||||
|
||||
- 报错 `file is tencentdoc, not smartcanvas` → 传统文档,走第二步 A
|
||||
- 返回正常 JSON → smartcanvas 文档,走第二步 B
|
||||
|
||||
### 第二步 A:tencentdoc 类型(大文档推荐)
|
||||
|
||||
```bash
|
||||
# 获取完整文档结构
|
||||
mcporter call tencent-docs doc.resolve_document_structure file_id=<FILE_ID> > doc_raw.json
|
||||
|
||||
# 提取纯文本
|
||||
python -X utf8 -c "
|
||||
import json
|
||||
with open('doc_raw.json','r',encoding='utf-8') as f:
|
||||
data=json.load(f)
|
||||
texts=[]
|
||||
for n in data.get('nodes',[]):
|
||||
p=n.get('text_preview','')
|
||||
hl=n.get('heading_level',0)
|
||||
if p:
|
||||
texts.append(('#'*hl+' '+p) if hl>0 else p)
|
||||
with open('doc_content.txt','w',encoding='utf-8') as f:
|
||||
f.write('\n'.join(texts))
|
||||
print(f'Done: {len(texts)} paragraphs')
|
||||
"
|
||||
|
||||
# 清理中间文件(可选)
|
||||
rm doc_raw.json
|
||||
```
|
||||
|
||||
### 第二步 B:smartcanvas 类型(支持分页)
|
||||
|
||||
```bash
|
||||
# 首次读取
|
||||
mcporter call tencent-docs smartcanvas.read file_id=<FILE_ID> size=50
|
||||
|
||||
# 翻页(用上一页返回的 next_token)
|
||||
mcporter call tencent-docs smartcanvas.read file_id=<FILE_ID> next_token=<TOKEN> size=50
|
||||
```
|
||||
|
||||
## 搜索关键字获取资源链接
|
||||
|
||||
```bash
|
||||
# 在导出的文本中搜索
|
||||
grep -n "关键词" doc_content.txt
|
||||
```
|
||||
|
||||
链接格式参考:
|
||||
- `[普通链接: https://pan.quark.cn/s/xxx]` — 夸克分享链接
|
||||
- `[腾讯文档链接: https://docs.qq.com/doc/...]` — 其他腾讯文档
|
||||
|
||||
## 注意事项
|
||||
|
||||
- **超大文档**(>10万字)不要用 `get_content`,必超时
|
||||
- **Windows 编码**:带 emoji 的文档必须用 `python -X utf8`
|
||||
- **链接格式**:提取出的链接在 `text_preview` 中带 `[普通链接: ...]` 包裹,直接用中间的真实 URL
|
||||
Reference in New Issue
Block a user