English | 中文
A Model Context Protocol (MCP) server for converting multi-format documents to Markdown using the MinerU API. Supports both URL and local file inputs.
- 🔄 Calls MinerU API via Python requests
- 📄 Multi-format support: PDF, DOC, DOCX, PPT, PPTX, PNG, JPG, JPEG, HTML
- 📁 Automatic local file upload and parsing
- 🔍 OCR, formula recognition, and table recognition
- 🧠 Smart auto-configuration (automatically selects model and parameters based on file type)
- 📦 Intelligent large file handling (>200MB auto-split, >600 pages auto page_ranges)
- ⚡ Complete conversion workflow (submit task → poll status → download result)
pip install -r requirements.txtVisit https://mineru.net/apiManage/token to register and obtain an API Token.
With uv installed, run directly via uvx without pip install:
uvx mineru-converter-mcp-server stdioEdit Claude Desktop or Cursor MCP configuration:
Windows: %APPDATA%\Claude\claude_desktop_config.json or Cursor MCP settings
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"mineru": {
"command": "uvx",
"args": ["--with", "mineru-converter-mcp-server", "python", "-m", "mineru_mcp", "stdio"],
"env": {
"MINERU_API_KEY": "your_mineru_api_token"
}
}
}
}Note: Using
-m mineru_mcpbypasses a known uvx console script compatibility issue on Windows. During development:uv pip install -e .thenmineru-converter-mcp-server stdio.
Install dependencies first: pip install -r requirements.txt
Edit the Claude Desktop configuration file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"mineru": {
"command": "python",
"args": ["src/mineru_mcp/server.py"],
"cwd": "C:/path/to/MinerU-MCP",
"env": {
"MINERU_API_KEY": "your_mineru_api_token"
}
}
}
}Replace
C:/path/to/MinerU-MCPwith your project path. Thecwdensures running from the project root.
Requires Node.js 20+ and project dependencies:
npm installCreate .mcp.json in the project root (Claude Code) or edit claude_desktop_config.json (Claude Desktop):
macOS / Linux:
{
"mcpServers": {
"mineru": {
"command": "npx",
"args": ["tsx", "src/main.ts"],
"env": {
"MINERU_API_KEY": "your_mineru_api_token"
}
}
}
}Windows:
{
"mcpServers": {
"mineru": {
"command": "cmd",
"args": ["/c", "npx", "tsx", "src/main.ts"],
"env": {
"MINERU_API_KEY": "your_mineru_api_token"
}
}
}
}Note: The TypeScript version only supports URL input. Local file upload and large file splitting are not available. Use the Python version if you need those features.
Local HTTP server (optional): npm run start:http or MINERU_API_KEY=xxx npx tsx src/server-http.ts — listens on port 10000 by default, exposes /mcp and /.well-known/mcp-config.
For both options, replace your_mineru_api_token with your MinerU API Token (obtain at https://mineru.net/apiManage/token).
Deploy the TypeScript MCP as a public HTTPS service on Render, then register it on Smithery using "Deploy via URL" for free distribution. No smithery dev required — runs as a self-hosted HTTP server.
- Fork & Push: Ensure this repo is pushed to GitHub
- Create Blueprint: Go to Render Dashboard → New → Blueprint
- Connect Repo: Select the
MinerU-MCPrepo; Render will readrender.yamlat the root - Deploy: Click Create / Apply and wait for the build to finish
- Get URL: You'll get an HTTPS URL like
https://mineru-mcp.onrender.com - Register on Smithery: At Smithery New Server, choose External MCP / Deploy via URL and enter that URL
Smithery Deploy via URL: Do not set
MINERU_API_KEY; each user enters their own API key when adding the MCP on Smithery.Self-hosted single-tenant: Set
MINERU_API_KEYin Render Environment to use one key for all requests.
| Format | Extensions | Auto Configuration |
|---|---|---|
| Uses vlm model by default | ||
| Word | .doc, .docx | Uses vlm model by default |
| PowerPoint | .ppt, .pptx | Uses vlm model by default |
| Images | .png, .jpg, .jpeg | Automatically enables OCR |
| Web Pages | .html | Automatically uses MinerU-HTML model |
The server automatically handles oversized files without manual intervention:
- Files >200MB (PDF only): Automatically splits into smaller physical chunks, processes each separately, and returns individual results
- Files >600 pages (PDF only): Automatically uses the
page_rangesparameter for segmented processing - Splitting algorithm: Considers both file size (180MB/chunk) and page count (600 pages/chunk) constraints simultaneously, using the larger value to ensure each chunk satisfies both limits
Create a document parsing task. Supports URL or local file path; local files are uploaded automatically.
Parameters:
url(required): Document URL or local file path (supports PDF, DOC, DOCX, PPT, PPTX, PNG, JPG, JPEG, HTML)model_version(optional): Model version, auto-selected based on file type (vlm / pipeline / MinerU-HTML)is_ocr(optional): Enable OCR (auto-enabled for images), defaultfalseenable_formula(optional): Enable formula recognition, defaulttrueenable_table(optional): Enable table recognition, defaulttrue
Returns:
- URL input: returns
task_id - Local file input: returns
batch_id - Large file split: returns
batch_idslist
Examples:
# PDF file
Parse this PDF: https://example.com/report.pdf
# Word document
Parse local Word document: C:/Documents/report.docx
# PowerPoint file
Parse local PPT: C:/Documents/slides.pptx
# Image (auto OCR)
Parse this image: C:/Documents/scan.png
# HTML page
Parse local HTML: C:/Documents/page.html
Query task status. Supports querying by task_id (URL parsing) or batch_id (local file upload).
Parameters:
task_id(optional): Task ID (for URL-based tasks)batch_id(optional): Batch task ID (for local file upload tasks)
At least one parameter must be provided.
Download parsing result zip file.
Parameters:
zip_url(required): Result file URLoutput_path(required): Local save path
Complete conversion workflow that automatically submits the task, waits for completion, and downloads results. Supports URLs or local file paths for all formats.
Parameters:
url(required): Document URL or local file pathoutput_path(required): Local save path for result zip filemodel_version(optional): Model version (auto-detected), defaultvlmmax_wait_seconds(optional): Maximum wait time in seconds, default 300poll_interval(optional): Polling interval in seconds, default 10
Examples:
# Convert PDF
Convert this PDF to Markdown:
url: C:/Documents/report.pdf
output_path: C:/output/result.zip
# Convert Word document
Convert this Word document to Markdown:
url: C:/Documents/report.docx
output_path: C:/output/result.zip
# Convert PPT
Convert this PPT to Markdown:
url: C:/Documents/slides.pptx
output_path: C:/output/result.zip
Note:
convert_pdf_to_markdownis still available (backward compatible) and functions identically toconvert_to_markdown.
This project provides the /convert-to-markdown skill for quick document-to-Markdown conversion in Claude Code via slash command.
/convert-to-markdown <document path or URL> [instructions]
# Convert PDF
/convert-to-markdown C:/Documents/report.pdf Analyze and summarize this document
# Convert Word document
/convert-to-markdown C:/Documents/report.docx Extract key points
# Convert PPT
/convert-to-markdown C:/Documents/slides.pptx
# Convert image
/convert-to-markdown C:/Documents/scan.png Recognize text in this image- Supports both local file paths and HTTP(S) URLs
- Supports PDF, DOC, DOCX, PPT, PPTX, PNG, JPG, JPEG, HTML formats
- Default output path is
./temp/<filename>.zipwhen not specified - Automatically extracts zip and reads Markdown content after conversion
- Append natural language instructions to have Claude analyze, summarize, or answer questions about the converted content
Per MinerU API documentation:
- Single file must not exceed 200MB (PDFs exceeding this limit are automatically split)
- Page count must not exceed 600 pages (automatically uses page_ranges when exceeded)
- 2000 high-priority pages per account per day
- GitHub, AWS, and other international URLs are not supported (network restrictions)
After conversion, a zip file is produced containing:
- Markdown file: Extracted document content
- JSON file: Structured data
- Optional formats: May include DOCX, HTML, LaTeX if
extra_formatsis specified
For details, see: https://opendatalab.github.io/MinerU/reference/output_files/
This MCP server interacts with the MinerU API using Python requests:
URL Input Flow:
- Create task:
POST https://mineru.net/api/v4/extract/task - Query status:
GET https://mineru.net/api/v4/extract/task/{task_id} - Download result:
GET {zip_url}streaming download to local
Local File Input Flow:
- Request upload URL:
POST https://mineru.net/api/v4/file-urls/batch - Upload file:
PUT {upload_url}upload file content - System auto-submits parsing task
- Query batch results:
GET https://mineru.net/api/v4/extract-results/batch/{batch_id} - Download result:
GET {zip_url}streaming download to local
Large File Processing Flow (>200MB PDF):
- Smart splitting: Considers both size (180MB) and page count (600 pages) constraints
- Upload chunks: Each chunk is uploaded and processed independently
- Download separately: Each chunk's result is downloaded independently
Ensure that:
- Token was correctly copied from the website
- No leading/trailing spaces in the token
- Token has not expired
Possible causes:
- File URL is inaccessible
- Unsupported file format (check the supported formats list)
- File is empty (0 bytes)
- Network issues (international URLs)
Possible causes:
- PyPDF2 not installed (run
pip install PyPDF2>=3.0.0) - Non-PDF large files cannot be auto-split; reduce file size manually
MIT License