pdf-asset-extractor
БесплатноБез исполняемых скриптовНе проверенMCP tools for PDF ingestion → extract figures, tables, sections → build knowledge graph. Transforms PDF into queryable assets (images, tables, text) with…
от u9401066★ 30 звёзд на GitHubОб этом скилле
PDF Asset Extractor (MCP Tools)
描述
將 PDF 文件分解為可查詢的資產(圖片、表格、章節),並建立跨文獻知識圖譜。
核心能力:
- 📄 PDF 匯入 → 雙引擎(PyMuPDF 快速 / Marker 高精度)自動提取圖片、表格、文字
- 🖼️ 圖片提取 → 以 base64 返回,支援 Vision AI 分析
- 📊 表格提取 → 轉換為 Markdown 格式
- 🧭 章節導航 → 動態層級 Section Tree(支援任意深度)
- 🔍 知識圖譜 → 跨文獻關係查詢 (LightRAG)
- 📈 圖譜視覺化 → 導出 Mermaid 圖表
觸發條件
- 「ingest PDF」、「匯入 PDF」、「解析文件」、「分析論文」
- 「看 manifest」、「文件結構」、「有什麼圖表」
- 「取得圖片」、「fetch figure」、「拿表格」、「extract」
- 「知識圖譜」、「cross-document」、「比較文獻」、「RAG」
- 「視覺化圖譜」、「export graph」、「mermaid」
- 「章節」、「section」、「導航」、「樹狀結構」
🔧 雙引擎策略
| 引擎 | 強項 | 弱項 | 觸發方式 |
|---|---|---|---|
| PyMuPDF (預設) | 快速、輕量 (~50MB) | 版面分析精度較低 | ingest_documents() |
| Marker (高精度) | 精確 bbox、section hierarchy | 重模型 (~1GB)、較慢 | ingest_documents(use_marker=True) 或 parse_pdf_structure() |
Marker 產出額外資料
blocks.json— 結構化區塊(含 bbox、polygon、section_hierarchy)- 支援 Section Navigation 動態層級導航
⚠️ 重要警告
🖼️ 圖片 Context 限制
Base64 圖片非常大,一次只處理一張!
- 一張圖片 ≈ 200KB base64 ≈ ~270K tokens
- 對話 context 有限,多張圖片會快速耗盡
- 建議流程:先
inspect_document_manifest→ 選定目標圖 → 一次 fetch 一張
👁️ 視覺能力提醒
如果 AI 有視覺能力(Vision),可直接分析返回的圖片 如果是純文字 AI,應誠實告知無法分析圖片內容
📸 圖片 ID 命名規則
系統以
fig_{page}_{index}命名,非解析圖說文字 需手動對照 manifest 頁碼與實際 Figure 編號
🔧 可用 MCP Tools
文件處理
| Tool | 用途 | 參數 |
|---|---|---|
ingest_documents |
匯入 PDF(ETL 流程) | file_paths: list[str], async_mode: bool, use_marker: bool |
parse_pdf_structure |
Marker 結構化解析(單檔) | file_path: str |
get_job_status |
查詢 ETL 進度 | job_id: str |
list_jobs |
列出所有工作 | active_only: bool |
cancel_job |
取消 ETL 工作 | job_id: str |
資產查詢
| Tool | 用途 | 參數 |
|---|---|---|
list_documents |
列出所有已處理文件 | 無 |
inspect_document_manifest |
查看文件結構(圖/表/章節清單) | doc_id: str |
fetch_document_asset |
取得特定資產 | doc_id, asset_type, asset_id |
Section Navigation 🧭 (需 Marker blocks.json)
| Tool | 用途 | 參數 |
|---|---|---|
list_section_tree |
顯示完整 section hierarchy 樹狀結構 | doc_id: str |
get_section_detail |
取得特定 section 的詳細資訊 | doc_id: str, section_path: str |
get_section_blocks |
提取特定 section 的所有 blocks | doc_id: str, section_path: str |
search_sections |
搜尋 section 名稱 | doc_id: str, query: str |
區塊搜尋 (Marker blocks)
| Tool | 用途 | 參數 |
|---|---|---|
search_source_location |
在 blocks.json 中搜尋特定內容 | doc_id: str, query: str, block_types: list |
知識圖譜
| Tool | 用途 | 參數 |
|---|---|---|
consult_knowledge_graph |
跨文獻 RAG 查詢 | query: str, mode: str |
export_knowledge_graph |
導出圖譜(JSON/Mermaid) | format: str, limit: int |
📂 MCP Resources(動態更新)
Resources 會自動更新,可直接瀏覽文件大綱:
| Resource URI | 說明 |
|---|---|
documents://list |
所有已處理文件列表 |
document://{doc_id}/outline |
📋 文件完整大綱(推薦起點) |
document://{doc_id}/manifest |
完整 manifest JSON |
document://{doc_id}/figures |
圖片清單(ID、頁碼、尺寸) |
document://{doc_id}/tables |
表格清單 |
document://{doc_id}/sections |
章節層級結構 |
knowledge-graph://summary |
知識圖譜統計概覽 |
Resource 使用範例
# 瀏覽已處理的文件
→ documents://list
# 查看文件大綱(推薦起點)
→ document://abc123def/outline
# 列出所有圖片
→ document://abc123def/figures
# 知識圖譜概覽
→ knowledge-graph://summary
📋 標準操作流程
1️⃣ PDF 匯入(ETL)
使用者:「幫我匯入這份 PDF」/ 「分析這份論文」
步驟:
1. 取得 PDF 絕對路徑
2. 呼叫 ingest_documents(預設 async_mode=True)
3. 使用 get_job_status 追蹤進度
4. 完成後提供 doc_id
範例呼叫:
# 異步匯入(推薦,大檔案用)
ingest_documents(file_paths=["/papers/study.pdf"])
# 返回 job_id,用 get_job_status 追蹤
# 同步匯入(小檔案)
ingest_documents(file_paths=["/papers/small.pdf"], async_mode=False)
2️⃣ 查看文件結構
使用者:「這份文件有什麼圖表?」
步驟:
1. 呼叫 list_documents 找到 doc_id
2. 呼叫 inspect_document_manifest
3. 列出所有 figures/tables/sections
範例呼叫:
list_documents()
inspect_document_manifest(doc_id="abc123def")
Manifest 內容:
- 📊 Tables:
tab_1,tab_2...(ID、頁碼) - 🖼️ Figures:
fig_2_1,fig_3_1...(ID、尺寸、頁碼) - 📑 Sections:
sec_intro,sec_methods...(標題、行號)
3️⃣ 取得特定資產
取得圖片(⚠️ 一次一張)
fetch_document_asset(
doc_id="abc123def",
asset_type="figure",
asset_id="fig_3_1"
)
# 返回 ImageContent (base64) + metadata
取得表格
fetch_document_asset(
doc_id="abc123def",
asset_type="table",
asset_id="tab_1"
)
# 返回 Markdown 格式表格
取得章節/全文
# 特定章節
fetch_document_asset(doc_id="abc123def", asset_type="section", asset_id="sec_methods")
# 全文 Markdown
fetch_document_asset(doc_id="abc123def", asset_type="full_text", asset_id="full")
4️⃣ 知識圖譜查詢
使用者:「比較這兩篇文獻的發現」/ 「AlphaFold 是什麼?」
步驟:
1. 確認文件已 ingest 且已建立索引
2. 選擇查詢模式
3. 呼叫 consult_knowledge_graph
查詢模式:
| Mode | 用途 | 適合場景 |
|---|---|---|
local |
細節查詢 | 特定藥物劑量、具體數據 |
global |
全局模式 | 跨文獻趨勢、主題歸納 |
hybrid |
混合模式(推薦) | 一般問答 |
範例呼叫:
consult_knowledge_graph(
query="What is Al
Установить pdf-asset-extractor в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл pdf-asset-extractor?
MCP tools for PDF ingestion → extract figures, tables, sections → build knowledge graph. Transforms PDF into queryable assets (images, tables, text) with cross-document RAG. Triggers: PDF, ingest, extract, 圖片, 表格, figure, table, manifest, knowledge graph, 知識圖譜, RAG, 文獻分析.
Как установить скилл pdf-asset-extractor?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pdf-asset-extractor запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic