docling-mcp
The docling-mcp server enables text-only LLMs to process documents and images by providing these capabilities:
Convert to Markdown: Transform PDF, DOCX, PPTX, HTML, or images into Markdown with tables, image placeholders, and optional VLM-generated descriptions. Supports configurable caption modes (skip, OCR text, VLM description), page range selection, and OCR language override.
Convert to Plain Text: Extract clean, linearized text (tables become text) from documents/images. Useful for token-limited models. Also supports page range and OCR languages.
Extract Tables: Retrieve structured table data, including page number, dimensions, Markdown representation, and row-major cell values.
Chunk for RAG: Segment documents into overlapping chunks with metadata (page, headings, token count) using docling’s HybridChunker. Configurable chunk size, overlap, and HuggingFace tokenizer.
Flexible Input: Accepts local file paths, HTTP(S) URLs, or Base64 data URIs.
OCR & VLM Integration: Uses OCR engines (RapidOCR, EasyOCR) for scanned content; optionally enhances images with an OpenAI-compatible VLM for rich descriptions (falls back to OCR-only if unavailable).
Deployment: Can run over stdio for local MCP clients (e.g., Claude Desktop, Cursor) or HTTP for remote integrations (e.g., DeepSeek). Configurable via environment variables (file size limits, OCR languages, VLM settings, etc.).
Enables using an OpenAI-compatible vision-language model (e.g., GPT-4o-mini) to generate image descriptions for documents, producing richer Markdown output when VLM is enabled.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@docling-mcpConvert the PDF at https://arxiv.org/pdf/2408.09869 to markdown"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
docling-mcp
把 docling 封装成 MCP 服务器,让纯文本大模型(DeepSeek 等)通过工具调用获得"文档视觉"。
docling 是 IBM 开源的高质量文档解析库(PDF / DOCX / PPTX / HTML / 图片),支持 OCR、表格识别、公式抽取、版面分析。但它只提供 Python API。本包把它包成 MCP(Model Context Protocol)服务器,暴露 4 个工具,任何 MCP 客户端都能调用。
中文用户速读
解决什么问题?
DeepSeek-v4 / pro 这类纯文本模型看不了 PDF、图片、扫描件。挂上 docling-mcp 后,模型可以调用工具:
解析 PDF → Markdown 喂回自己
把图片里的文字 OCR 出来
抽出表格结构化数据
把文档切片做 RAG
工具一览
工具 | 用途 | 输出 |
| PDF/DOCX/HTML/图片 → Markdown(含表格、图片占位) |
|
| 同上 → 纯文本(无格式标记,适合 token 受限的模型) | string |
| 只抽表格 |
|
| 用 HybridChunker 切片做 RAG |
|
所有工具的第一个参数 source 都支持:
本地路径:
"E:/docs/report.pdf"HTTP(S) URL:
"https://arxiv.org/pdf/2408.09869"Data URI:
"data:application/pdf;base64,JVBERi0xLjQ..."(适合远端 HTTP 客户端上传二进制)
安装
cd E:/ideadatabase/py_data/agent_coding/docling-mcp
pip install -e .
# 首次运行会自动下载 docling 模型(约 500MB,可能慢)⚠️ 中国大陆网络(必读)
docling 首次启动要从 HuggingFace Hub 拉约 500MB 模型,直连 huggingface.co 通常失败。本包已内置如下规避策略,只需在 .env 或环境变量中配置:
DOCLING_MCP_HF_ENDPOINT=https://hf-mirror.com # 走 HF 镜像
DOCLING_MCP_HF_BYPASS_PROXY=true # 强制绕过本地代理(Clash 等常导致 SSL 错误)__init__.py 在导入 HF 库之前会读取这两个变量并:
设置
HF_ENDPOINT=https://hf-mirror.com设置
HF_HUB_DISABLE_XET=1(关掉 Xet,否则权重文件仍走us.aws.cdn.hf.co直连失败)清空
HTTP_PROXY / HTTPS_PROXY等代理变量,设置NO_PROXY=*(本地 VPN 代理常对 hf-mirror 做 MITM 触发 SSL EOF)
如果镜像仍报超时,手动预热模型(推荐用 Python API 而非 huggingface-cli,Windows GBK 控制台对 CLI 不友好):
# 在能上 HF 的机器或 VPN 上跑
python -c "from huggingface_hub import snapshot_download; \
snapshot_download('docling-project/docling-layout-heron'); \
snapshot_download('BAAI/bge-small-en-v1.5')"
# 然后把 ~/.cache/huggingface 拷到目标机器或下载到自定义位置:
HF_HOME=E:/hf_cache python -c "from huggingface_hub import snapshot_download; \
snapshot_download('docling-project/docling-layout-heron')"转换失败时,工具会返回带可操作提示的错误信息(检查 error 字段)。
OCR 引擎
docling 支持多 OCR 引擎,本包按以下优先级自动选择:
RapidOCR(默认,推荐)—— onnxruntime 后端,无 torch 依赖,体积小,已通过 docling 自带安装。
EasyOCR —— torch 后端,语言覆盖广,需
pip install easyocr。docling 默认 —— 上述都失败时使用。
切换为 EasyOCR:pip install easyocr,然后代码会自动用上(见 converter.py:_build_pipeline_options)。
配置
复制 .env.example 为 .env,按需修改:
DOCLING_MCP_OCR_LANGS=en,zh # 默认 OCR 语言
DOCLING_MCP_VLM_URL=... # 可选:OpenAI 兼容 VLM 端点
DOCLING_MCP_VLM_API_KEY=...
DOCLING_MCP_VLM_MODEL=gpt-4o-mini
DOCLING_MCP_VLM_ENABLED=false # 默认禁用,工具入参 enable_vlm 可临时开启动(stdio 本地模式)
python -m docling_mcp # 默认 stdio
# 或
docling-mcp配置 Claude Desktop
编辑 claude_desktop_config.json(macOS: ~/Library/Application Support/Claude/,Windows: %APPDATA%\Claude\):
{
"mcpServers": {
"docling": {
"command": "docling-mcp",
"env": {
"DOCLING_MCP_OCR_LANGS": "en,zh"
}
}
}
}配置 Cursor / Cline / Continue
类似配置,使用 docling-mcp 命令作为 MCP server。
启动(HTTP 远程模式,供 DeepSeek API 调用)
DOCLING_MCP_TRANSPORT=http DOCLING_MCP_PORT=8765 python -m docling_mcp
# 或
docling-mcp-http测试:
curl -X POST http://127.0.0.1:8765/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0","id":1,"method":"tools/call",
"params":{"name":"convert_to_text",
"arguments":{"source":"https://arxiv.org/pdf/2408.09869"}}
}'给 DeepSeek 用
DeepSeek 当前不直接支持 MCP,但你可以:
把本服务跑在 HTTP 模式
在你的应用代码里,用 DeepSeek 的 function-calling 接口,把 4 个工具描述注册为 functions
当 DeepSeek 决定调用工具时,你用 HTTP 转发到本 MCP,把结果作为 user message 注入对话
参考 examples/deepseek_bridge.py(若存在)。
Related MCP server: Document Parser MCP
English Quick Reference
What
Wraps docling as an MCP server. Text-only LLMs (DeepSeek v4/pro, etc.) gain document vision by calling these tools.
Tools
convert_to_markdown(source, [ocr_languages], [enable_vlm], [page_range], [image_caption_mode])→{markdown, ...}convert_to_text(source, [ocr_languages], [page_range])→stringextract_tables(source, [ocr_languages])→[{page, index, num_rows, num_cols, markdown, rows}, ...]chunk_for_rag(source, [chunk_size=1024], [overlap=100], [tokenizer], [ocr_languages])→[{text, index, page, headings, ...}, ...]
source accepts local path, HTTP(S) URL, or data: URI.
Install
pip install -e .First run downloads docling models (~500MB).
Run
python -m docling_mcp # stdio (default, for Claude Desktop / Cursor)
python -m docling_mcp http # streamable-http (for remote LLMs)Env vars
Var | Default | Purpose |
|
| transport mode |
|
| http host |
|
| http port |
|
| comma-separated OCR langs |
| (empty) | OpenAI-compatible chat completions URL |
| (empty) | VLM bearer key |
|
| VLM model name |
|
| global VLM default |
|
| per-file size cap |
| (empty) | HuggingFace mirror, e.g. |
|
| drop local proxy env vars before HF imports |
Tests
pip install -e .[dev]
pytest tests/ -vUnit tests (sources normalization) run without docling. Smoke tests skip if docling is not installed.
Architecture
src/docling_mcp/
├── __main__.py CLI entrypoint, stdio/http switch
├── server.py FastMCP + 4 @mcp.tool() functions
├── converter.py DocumentConverter singleton, asyncio.Lock, optional VLM pipeline
├── sources.py path/URL/data-URI normalization → local file
├── config.py pydantic-settings env config
└── schemas.py Pydantic models for tool I/OKey design choices:
Lazy init — DocumentConverter (loads torch + models) only built on first call.
Lock-serialized — concurrent tool calls share one converter under a global lock.
VLM graceful degradation — tries multiple docling API shapes; falls back to OCR-only on failure and emits a
warningsfield.Three input modes — local path, HTTP(S) URL, base64 data URI; unified to a
(Path, cleanup)handle.
License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityFmaintenanceAn MCP server that exports PDF documents to markdown format optimized for LLM processing.Last updated11BSD 3-Clause
- Alicense-qualityDmaintenanceAn MCP server that uses the Docling toolkit to convert various document formats, including PDFs, Office files, images, and audio, into clean Markdown for AI processing. It supports multiple processing pipelines like VLM and ASR with intelligent auto-detection and job queue management.Last updated2MIT
- Flicense-qualityDmaintenanceAn MCP server that uses Docling to convert PDFs, Office documents, images, audio, and more into clean Markdown for AI processing and RAG pipelines.Last updated6
- Alicense-qualityDmaintenanceMCP server that gives LLMs the power to convert PDFs to Markdown on the fly using a local Ollama vision model.Last updatedApache 2.0
Related MCP Connectors
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/mk20mm/docling-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server