Skip to main content
Glama

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

Related MCP server: Better Fetch

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

PDF

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.

Knowledge Planet QR Code

License

MIT

Available Tools

4 tools
distill_fileA

Distill content from a local file into HTML article + Obsidian note.

Supports:

  • PDF files (.pdf)

  • HTML files (.html, .htm)

  • Text/Markdown files (.txt, .md)

  • Audio/Video files (.mp3, .m4a, .wav, .mp4 - returns guidance)

Output:

  • HTML distillation article saved to ~/Documents/蒸馏文稿/

  • Obsidian note saved to ~/Documents/obsidian/{subdir}/

ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to local file (PDF, HTML, TXT, MD, etc.)
async_modeNoIf true, return task_id for large files
obsidian_subdirNoSubdirectory under Obsidian vault for the note

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full disclosure burden. It does specify outputs (HTML saved to ~/Documents/蒸馏文稿/ and Obsidian note to ~/Documents/obsidian/{subdir}/) and calls out that audio/video returns guidance. But it does not mention permissions, side effects on the source file, or how async_mode changes behavior or return values.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear opening statement, bulleted supported formats, and a separate output section. It is concise, scannable, and every sentence adds relevant information without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a file-processing tool with no output schema, the description covers supported inputs, output destinations, and a special case (media returns guidance). It lacks explicit return-value details for the normal path and does not describe the async workflow, though the schema provides some of that for async_mode. Overall, it is reasonably complete for an agent to invoke correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds slight value by showing obsidian_subdir maps to a path placeholder ({subdir}), but file_path and async_mode are not enriched beyond their schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource: 'Distill content from a local file into HTML article + Obsidian note.' It clearly distinguishes from sibling tools like distill_url by emphasizing 'local file' and enumerating supported file types.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The scope is clearly implied through 'local file' and the supported file extension list, making it clear this is for local inputs rather than URLs. However, it never explicitly names alternatives (e.g., 'use distill_url for web pages') or states when not to use this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

distill_urlA

Distill content from a URL into HTML article + Obsidian note.

Supports:

  • Feishu documents (feishu.cn, larkoffice.com)

  • Webpages (any HTTP/HTTPS URL)

  • PDF files (.pdf URLs)

  • Video/podcast URLs (YouTube, Bilibili, etc. - returns guidance)

Output:

  • HTML distillation article saved to ~/Documents/蒸馏文稿/

  • Obsidian note saved to ~/Documents/obsidian/{subdir}/

For large documents, set async_mode=true and poll with get_distill_status.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesDocument URL (Feishu, webpage, PDF, video)
async_modeNoIf true, return task_id immediately for large documents
obsidian_subdirNoSubdirectory under Obsidian vault for the note (e.g., '飞书蒸馏')

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure. It reveals that video/podcast URLs 'returns guidance' (not a full distillation), specifies the output directories, and explains the async task behavior. This goes beyond the basic action and helps set expectations, though it could mention error handling or permissions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with bullet points, concise and front-loaded. The first line states the core purpose, followed by a clean 'Supports' list and 'Output' list, closing with an async tip. Every sentence adds value with no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the essential aspects: supported inputs, outputs, and async behavior. Given the tool's moderate complexity and lack of an output schema, it effectively communicates what the agent needs to know. A minor gap is the lack of detail on the response format for the normal (non-async) case, but this is not critical.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the description adds meaning beyond the schema: it explains when to set async_mode=true (large documents), gives an example for obsidian_subdir ('飞书蒸馏'), and elaborates on the url parameter by listing supported types. This enriches the agent's understanding of how to use each parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Distill content from a URL into HTML article + Obsidian note.' The verb 'distill' is specific, and the resource is the URL. It distinguishes from sibling tools like distill_file (likely for local files) by emphasizing URL-based input, and from get_distill_status/list_distillations by focusing on the distillation action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear usage context by enumerating supported URL types (Feishu, webpages, PDFs, video/podcast) and explains when to use async_mode ('For large documents, set async_mode=true and poll with get_distill_status'). However, it does not explicitly state when not to use this tool or mention alternatives like distill_file, leaving some implicit inference to the agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_distill_statusA

Check the status of an async distillation task.

Returns the task status, progress, and result (if completed). Poll this periodically until status is 'completed' or 'failed'.

ParametersJSON Schema
NameRequiredDescriptionDefault
task_idYesTask ID from distill_url or distill_file

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description carries the full burden. It discloses that the tool returns status, progress, and result (if completed), and indicates the terminal states. This provides useful context about the async nature and what to expect, though it doesn't mention any potential errors or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, front-loaded, and every sentence earns its place. It states the purpose, return contents, and polling guidance in just two short sentences without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple with one parameter, no annotations, and no output schema. The description covers the essential behavioral aspects: what it returns and when to poll. It's complete enough for a status-check tool, though it could optionally mention the exact status values or error behavior, but these are not critical.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 100% coverage for the single parameter, and the parameter description in the schema adds meaning: 'Task ID from distill_url or distill_file.' This clarifies the expected input. The main description complements this by explaining the purpose of the status check.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: 'Check the status of an async distillation task.' This is a specific verb+resource combination that distinguishes it from siblings like distill_url (start a task) or list_distillations (list tasks).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear usage context: 'Poll this periodically until status is completed or failed.' This implies when to use the tool (after starting an async task) and how to use it (repeatedly). It doesn't explicitly address alternatives, but the sibling tools are distinct enough that no exclusion is needed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_distillationsA

List all completed distillations.

Returns a list of completed distillation tasks with metadata. Use get_distill_status with a task_id to get full content.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the tool returns only metadata for completed tasks and points to get_distill_status for full content, which is useful. It doesn't mention pagination or ordering, but the output schema likely covers return details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two concise sentences, front-loaded with the primary purpose followed by a helpful pointer to a sibling tool. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple list tool with no parameters and an output schema, the description covers essential behavior (listing completed tasks with metadata), mentions a complement tool for full content, and is complete relative to its complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so the baseline is 4. The description confirms the scope is 'all completed' distillations, consistent with the empty schema, and adds no unnecessary parameter details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool lists all completed distillations, using a specific verb and resource. It distinguishes itself from siblings like distill_url/distill_file (creation tools) and get_distill_status (which retrieves a single task's status).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly directs users to get_distill_status for full content, making the tool's scope clear relative to that sibling. It doesn't explicitly say when not to use it for the other siblings, but the context is sufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updatesv0.1.0
    • First observeddistill_file
    • First observeddistill_url
    • First observedget_distill_status
    • First observedlist_distillations

TDQS

A4.4/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: distill_url and distill_file differ by input source (remote vs local), while get_distill_status and list_distillations handle task monitoring and history respectively. No overlapping responsibilities.

Naming Consistency5/5

All tools follow a consistent verb_noun snake_case pattern: distill_url, distill_file, get_distill_status, list_distillations. The verbs appropriately reflect the action, and naming is uniform.

Tool Count5/5

4 tools is a well-scoped set for a distillation service. It covers initiation (URL/file), status checking, and listing results without excess or deficiency.

Completeness4/5

Core distillation workflow is covered: create via URL/file, check async status, and list completed tasks. Minor gaps like lack of delete/cancel or retrieval of a specific completed task's content via a dedicated getter, but agents can work around using get_distill_status.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/shawnwei512/doc-distillation-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server