Skip to main content

carrot-mcp-pdf

Carrot MCP PDF Server — convert PDFs to structured markdown or rendered page images.

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 or rendered images. Accepts pages as int (single page), str (range like '1-5,8,10-12'), list, or None. Returns list[TextContent | ImageContent]
grep Search for exact substring in PDF pages. Case-insensitive by default, or regex. Returns matches with page number, text, and surrounding context.

Architecture

Application Layer (server.py — MCP tools, thin routing)
    ↓ get_toc/get_pages
Conversion Layer (converter.py — pymupdf4llm → markdown + images)
    ↓ extract_text=False → render_page_as_image
Cache Layer (cache.py — JSON: %APPDATA%/carrot-mcp/pdf/<md5>.json)
  • server.py — MCP tool definitions only, delegates to converter/cache

  • converter.py — PDF conversion, image processing, content parsing

  • cache.py — Cache persistence, path management, parse_page_range

  • Cache: %APPDATA%/carrot-mcp/pdf/<md5>.json

  • Content blocks: each page caches ordered blocks [{type: "text", data: ...}, {type: "image", data: base64_str, mime: ...}]

  • Image return: images returned as MCP ImageContent attachments (no base64 truncation)

Development

# Run tests
uv run pytest tests/pdf/ -v

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.2.5.tar.gz (6.4 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.2.5-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: carrot_mcp_pdf-0.2.5.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for carrot_mcp_pdf-0.2.5.tar.gz
Algorithm Hash digest
SHA256 08b9c541657ff2df6efc146800e0d8b7d2a19f25598c0f348ad4da3a70772664
MD5 6be04d7cd422319e32952cef83073b7b
BLAKE2b-256 3def05282248a02e8f5175b7c4eed36f75d5ef18c60e3a56d0a54c8fc379ef20

See more details on using hashes here.

File details

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

File metadata

  • Download URL: carrot_mcp_pdf-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for carrot_mcp_pdf-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9cac487f3f6534a9f334a3f8ab41afb1ef7c3f6cb85b06a1f2250c8df6454255
MD5 ee7d770a97d87b2837518bf7dcf75cd3
BLAKE2b-256 89920f00f65f237d2cd49200d232e2788c26614854ef16526fc0d8d957109c18

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.5 This release

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.4

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page