Doc2x MCP Server
The Doc2x MCP Server wraps the Doc2x API into composable MCP tools, enabling AI agents to parse, convert, and download PDF and image documents programmatically.
PDF Parsing & Export
Submit local PDF files for parsing (v2 or v3-2026 models), query task status, and retrieve merged text or detailed layout JSON (block structures and coordinates)
Export parsed PDFs to Markdown, LaTeX (TeX), or DOCX with configurable formula handling options
Image OCR & Layout
Perform synchronous or asynchronous OCR and layout analysis on PNG/JPG files, returning text or raw JSON results
File Download & Materialization
Download export results to local files, unpack base64-encoded ZIP archives into output directories, and save layout JSON for figure/table cropping and structural analysis
Async Task Management
Submit, monitor, and wait for long-running tasks with configurable timeouts and polling intervals
Diagnostics & Configuration
Inspect resolved server configuration and API key sources via
doc2x_debug_configConfigure API keys, base URLs, timeouts, and secure download URL allowlists via environment variables
Converts PDF documents and images into Markdown format, utilizing Doc2x's semantic analysis to preserve complex layouts, tables, and mathematical formulas.
Click on "Deploy 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., "@Doc2x MCP Server convert this PDF to Markdown and wait for the result"
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.
Doc2x MCP Server
简体中文 | English
将 Doc2x v2 PDF/图片能力封装为基于 stdio 的 MCP Server,提供稳定、可组合的语义化 tools。
目录
Related MCP server: document-parser
项目定位
面向 MCP 客户端(Codex CLI / Claude Code / 自定义 Agent)提供 Doc2x 能力。
以 submit/status/wait 统一异步任务模型,便于自动化编排。
提供可控超时、轮询、下载白名单等运行时安全边界。
版本与环境
本地运行:Node.js
>=18即可。CI 校验:Node.js
18、20都会跑构建。发布环境:GitHub Actions 中发布任务使用 Node.js
24。包管理器:统一用 pnpm(锁文件
pnpm-lock.yaml)。
快速开始
方式 A:通过 npx(推荐)
在 MCP client 配置中添加:
{
"command": "npx",
"args": ["-y", "@noedgeai-org/doc2x-mcp@latest"],
"env": {
"DOC2X_API_KEY": "sk-xxx",
"DOC2X_BASE_URL": "https://v2.doc2x.noedgeai.com"
}
}方式 B:本地源码运行
cd doc2x-mcp
pnpm install --frozen-lockfile
pnpm run build
DOC2X_API_KEY=sk-xxx pnpm startMCP client 指向本地构建产物:
{
"command": "node",
"args": ["<ABS_PATH>/doc2x-mcp/dist/index.js"],
"env": {
"DOC2X_API_KEY": "sk-xxx",
"DOC2X_BASE_URL": "https://v2.doc2x.noedgeai.com"
}
}配置参考
环境变量 | 必填 | 默认值 | 说明 |
| 是 | - | Doc2x API Key( |
| 否 |
| Doc2x API 基础地址 |
| 否 |
| 单次 HTTP 超时(毫秒) |
| 否 |
| 轮询间隔(毫秒) |
| 否 |
| wait 类工具最大等待时长(毫秒) |
| 否 |
|
|
| 否 |
|
|
| 否 |
| 下载 URL 白名单; |
Tool API 总览
阶段 | Tools | 说明 |
PDF 解析 |
| 提交任务、查询状态、等待并取文本,或将 v3 layout 结果落盘为本地 JSON |
结果导出 |
| 发起导出、查结果、等待导出完成 |
下载落盘 |
| 下载 URL 到本地、解包 convert zip |
图片版面解析 |
| 同步/异步图片 OCR 与版面解析 |
诊断 |
| 返回配置解析与 API key 来源,便于排错 |
PDF 解析模型(doc2x_parse_pdf_submit / doc2x_parse_pdf_wait_text)
可选参数:
model可选值:
v2(默认) /v3-2026(最新模型)不传时默认
v2
{
"model": "v3-2026"
}PDF Layout JSON 落盘(doc2x_materialize_pdf_layout_json)
必选参数:
output_pathuid与pdf_path二选一v2不支持layout;需要pages[].layout时请使用v3-2026若传
pdf_path但不传model,该工具默认使用v3-2026成功时将原始
resultJSON 写到本地
layout 是页面块结构和坐标信息,适合 figure/table 裁剪、区域高亮、结构化抽取和版面分析;如果只想看正文内容,优先使用 Markdown / DOCX 导出。
{
"pdf_path": "/absolute/path/to/input.pdf",
"output_path": "/absolute/path/to/input_v3.layout.json"
}导出公式参数(doc2x_convert_export_submit / doc2x_convert_export_wait)
必选参数:
formula_mode(normal/dollar)可选参数:
formula_level(仅源解析任务为model=v3-2026时生效)取值说明:
0:保留公式1:仅退化行内公式(\\(...\\)、$...$)2:退化全部公式(\\(...\\)、$...$、\\[...\\]、$$...$$)
导出文件名
filename 是 API 内部导出文件的名称,不影响下载时指定的本地路径。默认 filename_mode="auto" 先取 basename、去掉对应格式的扩展名,再将超过 50 个 Unicode 字符的名称缩短为前缀加稳定哈希后缀,避免服务端文件名校验失败。同名前缀的不同长标题会使用不同后缀。
filename_mode="raw" 保留 basename 及扩展名;超过 50 个 Unicode 字符时,在发送请求前返回不可重试的 invalid_argument。请缩短名称或改用 auto。这些规则也适用于 doc2x_convert_export_wait 的自动提交。
等待导出同时支持当前 API 的不透明下载地址和旧格式地址。同一 uid 的不同格式导出请按顺序进行,避免读取到另一笔导出的结果。
常见工作流
工作流 1:PDF -> Markdown 本地文件
doc2x_parse_pdf_submit提交 PDF 解析。doc2x_convert_export_wait等待导出(to=md,并指定formula_mode)。doc2x_convert_export_result获取下载 URL。doc2x_download_url_to_file下载到目标路径。
工作流 2:图片版面 OCR 快速结果
doc2x_parse_image_layout_sync直接同步解析。若需要稳态轮询,改用 submit/status/wait 组合。
工作流 3:PDF -> v3 layout JSON 本地文件
调用
doc2x_materialize_pdf_layout_json,传入pdf_path和output_path。工具会等待 parse 成功,并将原始
resultJSON 落到本地。该 JSON 可直接提供给后续 figure/table 裁剪脚本使用。
本地开发
环境要求
Node.js
>=18pnpm(与仓库锁文件一致)
常用命令
pnpm install --frozen-lockfile
pnpm run build
pnpm run test
pnpm run format:check运行服务:
DOC2X_API_KEY=sk-xxx pnpm startCI / 发布流水线
仓库使用 GitHub Actions:
CI:
.github/workflows/ci.yml触发:
push到main、pull_request、workflow_dispatch、每周一 UTC03:17文档-only 变更(
**/*.md、LICENSE)自动跳过任务:
dependency-review(仅 PR)build(Node.js18/20矩阵)package-smoke(npm pack --dry-run)security-audit(仅手动/定时)
Publish:
.github/workflows/publish.ymldev分支 push:发布 npmdevtagv*.*.*tag push:发布 npmlatest发布前校验 tag 版本与
package.json版本一致发布命令:
npm publish --provenance
建议提交前本地对齐:
pnpm install --frozen-lockfile
pnpm run build
npm pack --dry-run
pnpm audit --prod --audit-level high如何发布
开发预发布(
dev):push 到dev分支后自动发布到 npmdevtag。版本会自动改成x.y.z-dev.<run>.<attempt>。正式发布(
latest):pushv*.*.*tag 后发布到 npmlatest。tag 版本必须和package.json版本一致。
安装本仓库 Skill(可选)
用于给 Codex CLI / Claude Code 增加一个"教大模型如何使用 doc2x-mcp tools 的 Skill"。
提示: 每次升级
doc2x-mcp版本后,建议重新运行安装命令以更新 Skill,确保大模型使用最新的 tool 描述与工作流。
不需要 clone 仓库的一键安装(推荐):
curl -fsSL https://raw.githubusercontent.com/NoEdgeAI/doc2x-mcp/main/scripts/install-skill.sh | sh在本仓库源码目录安装:
pnpm run skill:install默认安装目录:
Codex CLI:
~/.codex/skills/public/doc2x-mcp(可用CODEX_HOME覆盖)Claude Code:
~/.claude/skills/doc2x-mcp(可用CLAUDE_HOME覆盖)
说明:
--target auto(默认)会同时安装到 Codex + Claude。PowerShell 7+:
irm https://raw.githubusercontent.com/NoEdgeAI/doc2x-mcp/main/scripts/install-skill.ps1 | iexWindows PowerShell 5.1:
irm https://raw.githubusercontent.com/NoEdgeAI/doc2x-mcp/main/scripts/install-skill-winps.ps1 | iex
安全与排错
不要在仓库提交真实
DOC2X_API_KEY。白名单默认限制下载域名;如需放开,评估风险后再使用
DOC2X_DOWNLOAD_URL_ALLOWLIST=*。配置异常时优先调用
doc2x_debug_config定位环境变量来源与解析结果。
问题反馈
使用问题或缺陷反馈:GitHub Issues
https://github.com/NoEdgeAI/doc2x-mcp/issues建议在 issue 中附上最小复现输入、触发的 tool 名称、以及
doc2x_debug_config结果(可脱敏)。
License
MIT License,详见 LICENSE。
Available Tools
14 toolsdoc2x_convert_export_resultB
Get the latest export (convert) result for a parsed PDF uid (may contain an escaped URL).
Inputs: uid (required).
doc2x_convert_export_submitA
Start an export (convert) job for a parsed PDF uid. After this, poll with doc2x_convert_export_wait or doc2x_convert_export_result. Do NOT call doc2x_convert_export_submit twice for the same uid+format in parallel.
Inputs: to (required), uid (required), formula_mode (required), filename, +3 more.
doc2x_convert_export_waitA
Wait for an export job to finish. Prefer calling doc2x_convert_export_submit first, then wait with uid+to. For backward compatibility, if formula_mode is provided and this job was not submitted in-process, this tool will submit once then wait.
Inputs: to (required), uid (required), filename, max_wait_ms, +5 more.
doc2x_debug_configA
Debug helper: return resolved config and API key source for troubleshooting.
Inputs: no named parameters.
doc2x_download_url_to_fileB
Download a Doc2x-provided URL (e.g. from doc2x_convert_export_result) to a local file path.
Inputs: url (required), output_path (required).
doc2x_materialize_convert_zipB
Materialize convert_zip (base64) into output_dir. Best-effort: tries system unzip first; otherwise writes the zip file.
Inputs: output_dir (required), convert_zip_base64 (required).
doc2x_materialize_pdf_layout_jsonA
Wait for a PDF parse task and write the raw Doc2x result JSON (with page layout) to output_path. Prefer passing uid. If only pdf_path is provided, this tool reuses a cached uid or submits a new parse with model='v3-2026' by default.
Inputs: output_path (required), uid, model, pdf_path, +2 more.
doc2x_parse_image_layout_statusA
Get status/result for an existing async image-layout parse task by uid.
Inputs: uid (required).
doc2x_parse_image_layout_submitA
Create an async image-layout parse task and return {uid}. After this, call doc2x_parse_image_layout_wait_text (with uid) or doc2x_parse_image_layout_status.
Inputs: image_path (required).
doc2x_parse_image_layout_syncA
Parse an image layout synchronously and return the raw Doc2x result JSON (including convert_zip when present).
Inputs: image_path (required).
doc2x_parse_image_layout_wait_textA
Wait for an image-layout parse task until success, returning first page markdown. Prefer passing uid (no re-submit). If only image_path is provided, it will (a) reuse an in-process cached uid if available, otherwise (b) submit a new async task then wait.
Inputs: uid, image_path, max_wait_ms, poll_interval_ms.
doc2x_parse_pdf_statusA
Query parse task status by uid. Returns {status, progress, detail}. status is one of processing/failed/success; progress is an integer 0..100; detail is populated only when status=failed. Fetch parsed content via doc2x_convert_export_*.
Inputs: uid (required).
doc2x_parse_pdf_submitA
Create a Doc2x PDF parse task for a local file and return {uid}. Prefer calling doc2x_parse_pdf_status to monitor progress/result; only call doc2x_parse_pdf_wait_text if the user explicitly asks to wait/return merged text.
Inputs: pdf_path (required), model.
doc2x_parse_pdf_wait_textA
Wait for a PDF parse task until success and return merged text. Prefer passing uid (no re-submit). If only pdf_path is provided, it will (a) reuse an in-process cached uid if available, otherwise (b) submit a new task then wait.
Inputs: uid, model, pdf_path, join_with, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
The PDF-parse, image-layout, and convert-export domains are broadly distinguishable, but several tools overlap heavily: doc2x_parse_pdf_wait_text and doc2x_materialize_pdf_layout_json both wait on a PDF parse, while doc2x_convert_export_result and doc2x_convert_export_wait both retrieve export output. Descriptions clarify preferred usage, but an agent must still choose carefully among multiple convenience wrappers.
All tools use the doc2x_ prefix and snake_case, and core lifecycle tools follow grouped patterns like parse_pdf_submit/status/wait_text and convert_export_submit/wait/result. A few helper tools use verb-first naming (materialize_convert_zip, download_url_to_file, debug_config), which is a minor deviation.
The 14-tool surface is well-scoped for a document parsing/export server, covering PDF parsing, image-layout parsing, export lifecycle, materialization/download, and debugging. The count is neither thin nor bloated, and each tool maps to a recognizable role.
The set covers submission, status polling, waiting, export conversion, materialization, download, and config debugging, so core document-parsing workflows are supported. Minor lifecycle gaps remain, such as task cancellation/listing or deletion/cleanup operations.
Maintenance
Related MCP Connectors
Document conversion and OCR for AI agents: PDF, Office docs, images to text.
Convert PDF, Word, Excel and scanned documents to Markdown, tables and RAG chunks. OCR.
Convert, create and edit Word, PowerPoint, Excel and PDF documents from any AI agent.
Hosted document tools for agents: extract, parse, classify, convert, OCR, sign, and redact.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to extract and structure content from documents (PDFs, images, Office files) using Upstage AI's document digitization and information extraction APIs.23MIT
- AlicenseNot gradedqualityNot gradedmaintenanceProvides AI agents with comprehensive document parsing capabilities including PDF text extraction, OCR, HTML-to-markdown conversion, table extraction, and summarization, optimized for agent workflows.72 npmMIT

docuprox-mcpofficial
AlicenseAqualityDmaintenanceEnables AI clients like Claude to process documents (invoices, passports, etc.) via the DocuProx API, with tools for submitting jobs, checking status, and retrieving results.519 npmMIT- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to parse and search documents including PDF, Word, Excel, PowerPoint, and images via OCR, with support for semantic search and batch processing.2MIT