Skip to main content
Glama
README.md
# pdf-mcp

An MCP server for reading, rendering, and searching PDF files. Built with [PyMuPDF](https://pymupdf.readthedocs.io/) and [PyMuPDF4LLM](https://pymupdf.readthedocs.io/en/latest/pymupdf4llm/).

Designed for use with LLMs that need to read datasheets and other PDFs containing diagrams, tables, and technical content.

## Tools

| Tool | Description |
|---|---|
| `get_pdf_info` | Get metadata about a PDF (page count, author, title, etc.) |
| `get_table_of_contents` | Get the outline/bookmarks with page numbers for each section |
| `get_page_text` | Extract text from a page range in `json` (default), `text`, `markdown`, or `html` format. Optionally exclude headers/footers |
| `get_page_image` | Render a single page as a PNG image, returned as base64 or written to a temp file. Configurable DPI (default 150) |
| `search_text` | Case-insensitive text search across the entire PDF, returning page numbers and surrounding context |

All requests are stateless and take the PDF filename as a parameter.

## Setup

Add the following to your `.mcp.json`:

```json
{
  "mcpServers": {
    "pdf-mcp": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/I-CAN-hack/pdf-mcp.git", "pdf-mcp"]
    }
  }
}
```

Or for codex run `codex mcp add pdf-mcp -- uvx --from git+https://github.com/I-CAN-hack/pdf-mcp.git pdf-mcp`.

This will automatically install and run the server using `uvx`.

## Development

```bash
# Install dependencies
uv sync

# Generate test PDFs
uv run python assets/generate.py

# Run tests
uv run pytest tests/ -v

# Run the server locally
uv run pdf-mcp
```

TDQS

A4/5.0

Scored across 5 tools

Disambiguation5/5

Each tool has a clearly distinct purpose with no overlap: get_page_image renders visual content, get_page_text extracts textual content, get_pdf_info provides metadata, get_table_of_contents retrieves structural outline, and search_text performs text search. The descriptions reinforce these distinct functions, making tool selection unambiguous.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern with 'get_' or 'search_' prefixes (get_page_image, get_page_text, get_pdf_info, get_table_of_contents, search_text). The naming convention is perfectly uniform across all five tools, using snake_case throughout without any deviations.

Tool Count5/5

Five tools is well-scoped for a PDF processing server, covering core operations without bloat. Each tool serves a specific, essential function (rendering, text extraction, metadata, navigation, and search), making the count appropriate and efficient for the domain.

Completeness4/5

The toolset covers most fundamental PDF operations well, including reading, extracting, navigating, and searching. A minor gap exists in write/modify operations (e.g., merging, splitting, or annotating PDFs), but the provided tools are sufficient for common agent workflows involving PDF analysis and content retrieval.

Maintenance

ActivitySlowing
ResponsivenessNo issues