Skip to main content

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.json with 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


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.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

carrot_mcp_pdf-0.1.2-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file carrot_mcp_pdf-0.1.2.tar.gz.

File metadata

  • Download URL: carrot_mcp_pdf-0.1.2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for carrot_mcp_pdf-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1a07c734459ae0f712d51d76fe4ed5fe48d03081dea681fb6e556d8d39c91bec
MD5 3cd9f7394abb2bf650034c944c3d7795
BLAKE2b-256 c2f60d05f8175b8dedc1c005430449d1f74b8cfe2956d0a1b456bd083ae475a6

See more details on using hashes here.

File details

Details for the file carrot_mcp_pdf-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: carrot_mcp_pdf-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for carrot_mcp_pdf-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 124f0fb5da3d442fe58c8a4f20ffaa4876c293f2323e19453cc0fb4e1953ed40
MD5 55a4f530905304ae6ba0732a9e34a8e5
BLAKE2b-256 481501bafcff63fe2a741d632b990ac6cafae6428c87222b1ceac32a8559441e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page