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
ImageContentattachments (no base64 truncation)
Development
# Run tests
uv run pytest tests/pdf/ -v
Metadata
Release files for carrot-mcp-pdf 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| carrot_mcp_pdf-0.2.5.tar.gz | 6.4 kB | Without provenance | Details for carrot_mcp_pdf-0.2.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| carrot_mcp_pdf-0.2.5-py3-none-any.whl | Python 3 | none | any | Details for carrot_mcp_pdf-0.2.5-py3-none-any.whl |
Total release size: 14.9 kB
Release files / carrot_mcp_pdf-0.2.5.tar.gz
| Download URL | carrot_mcp_pdf-0.2.5.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08b9c541657ff2df6efc146800e0d8b7d2a19f25598c0f348ad4da3a70772664
|
|
BLAKE2b-256 checksum How to use checksums |
3def05282248a02e8f5175b7c4eed36f75d5ef18c60e3a56d0a54c8fc379ef20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / carrot_mcp_pdf-0.2.5-py3-none-any.whl
| Download URL | carrot_mcp_pdf-0.2.5-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9cac487f3f6534a9f334a3f8ab41afb1ef7c3f6cb85b06a1f2250c8df6454255
|
|
BLAKE2b-256 checksum How to use checksums |
89920f00f65f237d2cd49200d232e2788c26614854ef16526fc0d8d957109c18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for carrot-mcp-pdf 0.2.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.