Carrot MCP PDF Server
Project description
carrot-mcp-pdf
Carrot MCP PDF Server — convert PDFs to structured markdown with optional OCR.
Installation
uv sync --all-packages
Usage
# Run as MCP server
uv run carrot-mcp-pdf
# Or via main CLI
uv run carrot-mcp pdf
# Or as Python module
uv run python -m carrot_mcp_pdf
Tools
| Tool | Description |
|---|---|
version |
Get server version info |
get_toc |
Get table of contents with page ranges |
get_pages |
Convert specific pages to markdown (supports multimodal/OCR) |
create_task |
Start background full PDF conversion (multimodal option) |
get_status |
Check progress of background conversion task |
Architecture
Application Layer (MCP tools: get_toc, get_pages, create_task, get_status)
↓ pymupdf4llm
Conversion Layer (markdown + images)
↓
Cache Layer (JSON: %APPDATA%/carrot-mcp/pdf/<md5>.json)
↓ multimodal=False
OCR Layer (litellm vision API)
- Cache:
%APPDATA%/carrot-mcp/pdf/<md5(pdf_path)>.json - Content blocks: ordered
[{type: "text", data: "..."}, {type: "image", base64: "...", mime: "..."}] - Background tasks: separate
<hash>_tasks.jsonwith progress tracking
Environment Variables
| Variable | Default | Description |
|---|---|---|
CARROT_MCP_MODEL |
— | Vision model name for OCR (must be configured if using OCR) |
CARROT_MCP_APIKEY |
— | API key for the vision model (must be configured if using OCR) |
CARROT_MCP_PROXY |
— | HTTP proxy URL for API calls |
CARROT_MCP_FORCE_MULTIMODAL |
— | true = always return images as base64; false = always run OCR. When not set, uses tool parameter. |
Development
# Run tests
uv run pytest tests/pdf/ -v
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
carrot_mcp_pdf-0.1.1.tar.gz
(6.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file carrot_mcp_pdf-0.1.1.tar.gz.
File metadata
- Download URL: carrot_mcp_pdf-0.1.1.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c293ed1bade342872c4289e97ad28a459d4fcbb4868c0e22d337ca70f8732df
|
|
| MD5 |
6dada2ff15616d8af5f17c8b1f58c1ed
|
|
| BLAKE2b-256 |
6e7cc274e07d06cb78c00276c8b3b0b29012ecef37f7f6a363bd4a27a89193c5
|
File details
Details for the file carrot_mcp_pdf-0.1.1-py3-none-any.whl.
File metadata
- Download URL: carrot_mcp_pdf-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3185aca1361e5c7c398cb2de3076d7327284704c3f326d3a7c7582071085e481
|
|
| MD5 |
607e7a8b1cc5085ca430731e4483e607
|
|
| BLAKE2b-256 |
3abc50b3a0e5f0f4934866a3023a32ca09dbd3910fb6609aae8455bd9afb0380
|