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 "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., "@Doc2x MCP Serverconvert 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。
目录
项目定位
面向 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:退化全部公式(\\(...\\)、$...$、\\[...\\]、$$...$$)
常见工作流
工作流 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”。
不需要 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。
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.