doc-distillation-mcp
A Model Context Protocol server that distills documents from multiple sources into HTML articles and Obsidian notes, with features like key element detection, image filtering, and async task management.
README
Doc Distillation MCP Server
A Model Context Protocol server for document distillation with multi-source support, producing dual output: HTML distillation articles and Obsidian notes.
Features
- Multi-source support: Feishu documents, webpages, PDFs, video/podcast transcripts, and local files
- Dual output format: HTML distillation articles + Obsidian notes with frontmatter
- Five-stage workflow: Source extraction → Integrity safeguard → Image filtering → HTML generation → Obsidian generation
- Three-layer image filtering: Automatic rule filtering → Context prediction → Safety net
- Key element detection: Formulas, data, templates, checklists, frameworks, tables, warnings, quotes
- Structure skeleton: Heading-based document outline for integrity verification
- Sync & Async modes: Direct results for small documents, task polling for large ones
- Structured output: Pydantic-validated results with segments, images, and metadata
Quick Start
Install
pip install doc-distillation-mcp
# With dev tools (MCP Inspector, testing, linting)
pip install 'doc-distillation-mcp[dev]'
Run
# Direct run
doc-distillation-mcp
# Or with uvx (no install needed)
uvx doc-distillation-mcp
# Debug with MCP Inspector
mcp dev doc_distillation_mcp.server:mcp
Prerequisites (optional)
For PDF text extraction:
pip install pdfplumber
MCP Client Configuration
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"doc-distillation": {
"command": "uvx",
"args": ["doc-distillation-mcp"]
}
}
}
Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"doc-distillation": {
"command": "uvx",
"args": ["doc-distillation-mcp"]
}
}
}
Trae
Add to Trae MCP settings:
{
"mcpServers": {
"doc-distillation": {
"command": "python3",
"args": ["-m", "doc_distillation_mcp.server"]
}
}
}
Claude Code
claude mcp add doc-distillation -- uvx doc-distillation-mcp
Tools
distill_url
Distill content from a URL into an HTML article + Obsidian note.
# Webpage (sync mode - direct result)
distill_url(url="https://example.com/article")
# With Obsidian subdirectory
distill_url(
url="https://example.com/deep-dive",
obsidian_subdir="飞书蒸馏"
)
# Large document (async mode - returns task_id)
distill_url(
url="https://example.com/long-report.pdf",
async_mode=True
)
# Then poll:
get_distill_status(task_id="abc12345")
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
url |
str | required | Document URL (Feishu, webpage, PDF, video) |
obsidian_subdir |
str? | null | Subdirectory under Obsidian vault |
async_mode |
bool | false | Return task_id for polling |
distill_file
Distill content from a local file.
# Text file (sync mode)
distill_file(file_path="/path/to/notes.txt")
# PDF file with Obsidian subdirectory
distill_file(
file_path="/path/to/report.pdf",
obsidian_subdir="PDF蒸馏"
)
# Large file (async mode)
distill_file(
file_path="/path/to/large.pdf",
async_mode=True
)
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
file_path |
str | required | Path to local file |
obsidian_subdir |
str? | null | Subdirectory under Obsidian vault |
async_mode |
bool | false | Return task_id for polling |
get_distill_status
Poll the status of an async distillation task.
get_distill_status(task_id="abc12345")
# Returns: {status: "completed", progress: 1.0, result: {...}}
list_distillations
List all completed distillations.
list_distillations()
# Returns: [{task_id, title, source_type, method, segment_count, ...}]
Five-Stage Workflow
URL / File Input
│
├─ Stage 1: Source Detection & Content Extraction
│ ├─ Feishu: Returns guidance (use lark-doc skill)
│ ├─ Webpage: HTML parsing (text, headings, images)
│ ├─ PDF: pdfplumber text extraction
│ ├─ Video/Podcast: Returns guidance (use video-transcript-mcp)
│ └─ Local file: Type-based extraction
│
├─ Stage 2: Integrity Safeguard
│ ├─ Structure skeleton (heading hierarchy)
│ └─ Key element detection (8 categories)
│
├─ Stage 2.5: Image Filtering (three-layer)
│ ├─ Layer 1: Automatic rules (size, URL keywords, duplicates, alt keywords)
│ ├─ Layer 2: Context prediction (nearby text indicates value)
│ └─ Layer 3: Safety net (near key elements)
│
├─ Stage 3: HTML Distillation Article Generation
│ └─ Styled HTML with header, content sections, footer
│
└─ Stage 4: Obsidian Note Generation
├─ Frontmatter (title, source, author, date, tags)
├─ Summary callout
├─ Content sections
├─ Image distillation callouts
└─ Key element statistics table
Key Element Detection
The distiller detects and counts 8 types of key elements to ensure content completeness:
| Element | Description | Example Patterns |
|---|---|---|
formula |
Calculation formulas | ROI =, = 销售额, division |
data |
Numeric data | Percentages, amounts, multiples |
template |
Templates & scripts | Title formulas, word lists |
checklist |
Actionable lists | Numbered items, checkboxes |
framework |
Mental models | Matrices, quadrants, methodologies |
table |
Tabular data | Markdown tables, comparison |
warning |
Cautions & pitfalls | "Don't", "Avoid", "Pitfall" |
quote |
Notable quotes | Long quoted text, key phrases |
Environment Variables
| Variable | Default | Description |
|---|---|---|
DISTILL_HTML_DIR |
~/Documents/蒸馏文稿 |
HTML output directory |
DISTILL_OBSIDIAN_DIR |
~/Documents/obsidian |
Obsidian vault directory |
Supported Sources
| Source | URL | Local File | Notes |
|---|---|---|---|
| Webpage | ✅ | ✅ | HTML parsing with image extraction |
| ✅ | ✅ | Requires pdfplumber |
|
| Feishu | ✅ | N/A | Returns guidance (use lark-doc skill) |
| YouTube | ✅ | N/A | Returns guidance (use video-transcript-mcp) |
| Bilibili | ✅ | N/A | Returns guidance (use video-transcript-mcp) |
| Douyin | ✅ | N/A | Returns guidance (use video-transcript-mcp) |
| Xiaohongshu | ✅ | N/A | Returns guidance (mini-program) |
| Text/Markdown | N/A | ✅ | Direct text extraction |
| Audio/Video | N/A | ✅ | Returns guidance (use video-transcript-mcp) |
Community
Join our AI Tool Monetization Circle (AI 工具变现实战圈) on Knowledge Planet (知识星球):
- Weekly MCP tutorials and real-world case studies
- Deep-dive source code analysis of this project
- AI tool monetization strategies and playbooks
- 1-on-1 technical Q&A
Scan the QR code below or search "AI 工具变现实战圈" on Knowledge Planet to join.

License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。