noedgeai/doc2x-mcp/doc2x-mcp
Claude Code and agent skill by noedgeai/doc2x-mcp
- community
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install noedgeai/doc2x-mcp/doc2x-mcpSKILL.md
doc2x-mcp 开发指南
项目概览
@noedgeai-org/doc2x-mcp 是一个 MCP(Model Context Protocol)服务器,通过 stdio 提供 Doc2x PDF/图片解析、格式导出和文件落盘能力。
- 语言:TypeScript(ESM,Node ≥18)
- 包管理:pnpm
- 入口:
src/index.ts→ 构建产物dist/index.js - 发布包名:
@noedgeai-org/doc2x-mcp
目录结构
常用命令
环境变量
| 变量 | 说明 | 默认值 | |
|---|---|---|---|
DOC2X_API_KEY | API Key(也可内嵌在 src/config/index.ts 的 INLINE_DOC2X_API_KEY) | — | |
DOC2X_BASE_URL | API Base URL | https://v2.doc2x.noedgeai.com | |
DOC2X_HTTP_TIMEOUT / DOC2X_HTTP_TIMEOUT_MS | HTTP 超时(s 或 ms) | 60s | |
DOC2X_POLL_INTERVAL_MS | 轮询间隔 | 2000ms | |
DOC2X_MAX_WAIT_MS | 最大等待时长 | 600000ms | |
DOC2X_PARSE_PDF_MAX_OUTPUT_CHARS | 文本预览最大字符数 | 5000 | |
DOC2X_PARSE_PDF_MAX_OUTPUT_PAGES | 文本预览最大页数 | 10 | |
DOC2X_DOWNLOAD_URL_ALLOWLIST | 下载域名白名单(逗号分隔,* 表示全放行) | .amazonaws.com.cn,.aliyuncs.com,.noedgeai.com |
本地开发可在根目录创建 .env 文件,just 命令会自动加载(set dotenv-load := true)。
核心架构
MCP Tool 注册
所有 tool 在 registerTools(server) 中统一挂载,分为四组:
registerPdfTools— PDF 提交、状态、等待文本、layout JSONregisterConvertTools— 导出(md/tex/docx)、下载、convert_zip 落盘registerImageTools— 图片同步解析、异步提交、等待文本registerMiscTools— debug_config
内存缓存(LRU)
RegisterToolsContext 持有三个 LRU 缓存,在 MCP 服务器生命周期内共享:
pdfUidCache—(absPath + model)→uid,TTL 12h,避免重复提交同一文件imageUidCache— 同上,针对图片convertSubmitCache+convertSubmitInflight— 防止同一uid+参数组合并发重复提交导出
路径别名(imports)
package.json 中配置了 #config、#errors、#utils、#doc2x/*、#mcp/* 等别名,对应 src/ 下的子目录。新增文件时同步维护 tsconfig.json 的 paths 配置。
添加新 Tool 的步骤
- 在对应的
registerXxxTools.ts中用server.tool(name, schema, handler)注册 - Zod schema 复用
registerToolsShared.ts中已有的pdfPathSchema、outputPathSchema等 - Handler 用
withToolErrorHandling包裹,统一处理ToolError - 在
skills/doc2x-mcp/SKILL.md的"按目标选 Tool"和"标准流程"中补充说明
CI / 发布
| 触发条件 | 动作 | |
|---|---|---|
| PR / push to main | ci.yml:依赖审查、多版本 build、package smoke test | |
push to dev 分支 | publish.yml:发布 dev 标签版本到 npm(版本号加 -dev.<run>.<attempt>) | |
push v*.*.* tag | publish.yml:正式发布 latest 到 npm,需 tag 与 package.json version 一致 | |
| 手动触发 | recreate-dev.yml:将 dev 分支重置为 main |
发布前必须通过 just check(fmt-check + build),CI 中 Node 版本矩阵为 18 / 20。
开发注意事项
- 绝对路径:所有文件路径参数(
pdf_path、output_path等)必须是绝对路径,Zod schema 已做校验 - 不要伪造 uid/url:uid 来自 API 响应,url 来自导出结果,不能手动构造
- 同一 uid 的同种导出不要并发:
runConvertSubmitAtomically已做 inflight 去重,但调用侧仍需注意 - 不要打印 API Key:调试只用
doc2x_debug_config返回的摘要字段 - formula_level 类型:必须传数字
0 | 1 | 2,仅在v3-2026解析结果上有效
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingSKILL.md
Popularity
- Repository stars
- 3
- Repository npm downloads, 7 days
- 52
- 7-day trend score
- 17
Stars and forks are for the whole GitHub repository, not this skill alone. Downloads are for the repository's npm package. Refreshed 21 May 2026, 5 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/noedgeai/doc2x-mcp/doc2x-mcp)