Metadata-Version: 2.5
Name: hhc-doc-mineru-mcp
Version: 0.1.0
Summary: MCP server that converts documents (PDF/Office/images/HTML) to markdown with LaTeX formulas, tables, and extracted images, powered by MinerU.
Project-URL: Homepage, https://github.com/opendatalab/MinerU
Project-URL: Issues, https://github.com/opendatalab/MinerU/issues
Author: hhc
License-Expression: MIT
License-File: LICENSE
Keywords: document,formula,latex,markdown,mcp,mineru,model-context-protocol,ocr,pdf
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: <3.15,>=3.11
Requires-Dist: mcp<3.0.0,>=2.1.1
Requires-Dist: mineru<5,>=4.0
Description-Content-Type: text/markdown

# hhc-doc-mineru-mcp

An MCP server that converts documents to **LLM-ready markdown** using
[MinerU](https://github.com/opendatalab/MinerU) — with **LaTeX formulas**,
tables, and **extracted images**.

Unlike lighter converters (e.g. MarkItDown), MinerU runs a real parsing
pipeline (layout detection + OCR + formula recognition), so it handles
formulas and scanned/image content properly.

> **Provenance.** This is a thin MCP wrapper around OpenDataLab MinerU
> (MinerU Open Source License, based on Apache 2.0). It does not repackage
> MinerU's code — MinerU is a runtime dependency.

## Install

```bash
pip install hhc-doc-mineru-mcp
```

Requires Python 3.11–3.14. The first parse downloads MinerU's models
(~1–2 GB, from ModelScope) and caches them.

Run the STDIO server (default):

```bash
hhc-doc-mineru-mcp
```

## Tool

- `convert_to_markdown(uri, tier="standard")`
  - `uri`: an `http:`, `https:`, `file:`, or `data:` URI, or a local file path.
  - `tier`: `flash` (fast, no OCR) | `basic` (CPU, light) | `standard`
    (recommended) | `advanced` (best, uses a VLM).
  - Returns markdown. Formulas become LaTeX, tables become markdown/HTML, and
    embedded images are saved to files and referenced (not inlined as base64).

Extracted images are saved under `~/.cache/hhc-doc-mineru-mcp/` (override with
`$HH_DOC_MINERU_OUT`).

## Use via `npx` (no uvx needed)

The companion npm package `hhc-doc-mineru-mcp` is a thin launcher: it finds a
local Python 3.11+, builds a cached venv, installs this package, and runs the
server. Register with:

```json
{
  "mcpServers": {
    "hhc-doc-mineru": {
      "command": "npx",
      "args": ["-y", "hhc-doc-mineru-mcp"]
    }
  }
}
```

Requirements: Node.js + a local Python 3.11+. First run is slow (installs
MinerU + downloads models); later runs are fast.

## Tiers (MinerU)

| Tier | Best for |
|------|----------|
| `flash` | quick extraction, born-digital docs, no OCR |
| `basic` | CPU-friendly baseline |
| `standard` | **recommended** — best quality/cost balance, good formulas |
| `advanced` | hard cases (uses a VLM) |

## License

MIT (this wrapper). See `LICENSE`. MinerU is under its own license.
