Back to Browse

Pdf MCP Server

by Jztan
Developer ToolsUse Caution4.8MCP RegistryLocal
Free

Server data from the Official MCP Registry

Production-ready MCP server for PDF processing with intelligent caching.

About

Production-ready MCP server for PDF processing with intelligent caching.

Security Report

4.8
Use Caution4.8High Risk

pdf-mcp is a well-engineered MCP server for PDF processing with comprehensive security considerations. The codebase demonstrates strong authentication practices (no auth required—appropriate for a local tool), careful permission scoping, and proactive security features like SSRF protection and hidden-text detection. Code quality is high with proper input validation, error handling, and dependency management. Minor quality issues around broad exception handling and type strictness do not materially impact security. Supply chain analysis found 6 known vulnerabilities in dependencies (1 critical, 3 high severity). Package verification found 1 issue.

4 files analyzed · 12 issues found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

File System Read

Reads files on your machine. Normal for tools that analyze or process local data.

File System Write

Writes or modifies files on your machine. Check that this is expected for the tool.

HTTP Network Access

Connects to external APIs or services over the internet.

env_vars

Check that this permission is expected for this type of plugin.

system_info

Check that this permission is expected for this type of plugin.

What You'll Need

Set these up before or after installing:

Directory for storing PDF cache (default: ~/.cache/pdf-mcp)Optional

Environment variable: PDF_MCP_CACHE_DIR

Cache time-to-live in hours (default: 24)Optional

Environment variable: PDF_MCP_CACHE_TTL

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "io-github-jztan-pdf-mcp": {
      "env": {
        "PDF_MCP_CACHE_DIR": "your-pdf-mcp-cache-dir-here",
        "PDF_MCP_CACHE_TTL": "your-pdf-mcp-cache-ttl-here"
      },
      "args": [
        "-y",
        "pdf-mcp-demo-recorder"
      ],
      "command": "npx"
    }
  }
}

Documentation

View on GitHub

From the project's GitHub README.

pdf-mcp

PyPI version Python 3.10+ License: MIT GitHub Issues CI codecov Downloads

Surgical PDF access for AI agents — search, read, and extract without flooding context.

An MCP server that lets Claude Code and other AI agents search a PDF by meaning or keyword, read only the pages that matter, and cleanly pull out tables, images, and scanned text — even from multi-column and Japanese layouts.

mcp-name: io.github.jztan/pdf-mcp

Try it in your browser

See what your AI agent sees →

Drop in any PDF and watch an agent skim it, search it, and read only the pages that matter — using a fraction of the tokens. 100% client-side, no install required.

Why pdf-mcp?

Without pdf-mcpWith pdf-mcp
Large PDFsContext overflowChunked reading
Token budgetingGuess and overflowEstimated tokens before reading
Finding contentLoad everythingHybrid search (BM25 keyword + semantic)
TablesLost in raw textExtracted and inlined per page
ChartsTrapped in the plot imageExtracted as (x, y) data tables
Multi-column PDFsColumns interleaved in extracted textColumn-aware reading order (pdf-mcp[multicolumn])
Vertical scripts (Japanese)Columns scrambled / glyph soupGeometric reorder of vertical text (tategaki / 縦書き); CJK keyword search works on unspaced Japanese/Chinese/Korean text via a char-split FTS index
ImagesIgnoredExtracted as PNG files
Repeated accessRe-parse every timeSQLite cache
Scanned PDFsNo text extractedOCR via Tesseract, parallelized across pages (pdf_read_pages(ocr=True))
Visual contentMust describe in wordsRender page as image (pdf_render_pages)
Hidden / injected textSilently ingested as if a human vetted itFlagged as untrusted — hidden-text detection (content_trust=True)
Folders of PDFsOne document at a timeCorpus tools: warm, triage, and search across a whole folder
Tool designSingle monolithic tool13 specialized tools

Features

  • Hybrid search — find relevant pages with a question, not a page range. Combines BM25 keyword and semantic search via Reciprocal Rank Fusion
  • Corpus search — point the server at a folder of PDFs: warm them into the cache, get per-document triage cards, and search across all documents at once with ranked, document-attributed hits
  • Paginated reading — fetch only the pages your agent needs; large documents don't blow your context window
  • OCR — scanned and image-based PDFs are fully readable and searchable via Tesseract, parallelized across pages for ~2–3x faster extraction on typical scans
  • Structured extraction — tables, embedded images, and table of contents returned as structured data, not text soup
  • Chart data extraction — pull exact (x, y) tables from vector charts, read from the plot geometry rather than guessed from the image; declines with a rendered image when a chart can't be read reliably
  • Vertical-script reading order — Japanese tategaki (縦書き) reconstructed from glyph geometry into correct top-to-bottom, right-to-left order; article segmentation for dense magazine layouts; mojibake filtered
  • Persistent cache — SQLite-backed; re-reads are instant and survive server restarts
  • Secure URL fetching — HTTPS-only with SSRF protection; local network ranges are blocked
  • Content-trust / hidden-text detection — flags text a human reader can't see (invisible render mode, sub-point fonts, transparent or white-on-white fill, off-page) so an agent treats it as untrusted rather than vetted. Flag-only — nothing is stripped

Contents

Installation

pip install pdf-mcp

Semantic search is included by default (hybrid auto search is built on it; ~67 MB embedding model download on first use). The former [semantic] and [cjk] extras remain as no-op aliases. Platform note: the bundled onnxruntime has no wheels for Intel macOS on Python 3.14+ or Alpine/musl; use Python ≤ 3.13 there.

For correct reading order on multi-column PDFs (adds pymupdf4llm, which pulls pymupdf_layout/onnxruntime):

pip install 'pdf-mcp[multicolumn]'

Without it, multi-column pages fall back to positional-sort extraction, which can interleave columns.

Japanese/Chinese/Korean PDFs work out of the box: keyword search uses a char-split FTS index that matches unspaced CJK terms, and semantic CJK search is covered by the default install.

For OCR on scanned PDFs (requires system Tesseract):

# macOS
brew install tesseract

# Ubuntu/Debian
apt install tesseract-ocr

# Windows — download the installer from:
# https://github.com/UB-Mannheim/tesseract/wiki
# Then add the install directory to your PATH.

Quick Start

Choose your MCP client below to get started:

claude mcp add pdf-mcp -- pdf-mcp

Or add to ~/.claude.json:

{
  "mcpServers": {
    "pdf-mcp": {
      "command": "pdf-mcp"
    }
  }
}

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "pdf-mcp": {
      "command": "pdf-mcp"
    }
  }
}

Config file location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Restart Claude Desktop after updating the config.

Requires VS Code 1.101+ with GitHub Copilot.

CLI:

code --add-mcp '{"name":"pdf-mcp","command":"pdf-mcp"}'

Command Palette:

  1. Open Command Palette (Cmd/Ctrl+Shift+P)
  2. Run MCP: Open User Configuration (global) or MCP: Open Workspace Folder Configuration (project-specific)
  3. Add the configuration:
    {
      "servers": {
        "pdf-mcp": {
          "command": "pdf-mcp"
        }
      }
    }
    
  4. Save. VS Code will automatically load the server.

Manual: Create .vscode/mcp.json in your workspace:

{
  "servers": {
    "pdf-mcp": {
      "command": "pdf-mcp"
    }
  }
}
codex mcp add pdf-mcp -- pdf-mcp

Or configure manually in ~/.codex/config.toml:

[mcp_servers.pdf-mcp]
command = "pdf-mcp"

Create or edit .kiro/settings/mcp.json in your workspace:

{
  "mcpServers": {
    "pdf-mcp": {
      "command": "pdf-mcp",
      "args": [],
      "disabled": false
    }
  }
}

Save and restart Kiro.

Most MCP clients use a standard configuration format:

{
  "mcpServers": {
    "pdf-mcp": {
      "command": "pdf-mcp"
    }
  }
}

With uvx (for isolated environments):

{
  "mcpServers": {
    "pdf-mcp": {
      "command": "uvx",
      "args": ["pdf-mcp"]
    }
  }
}

Verify Installation

pdf-mcp --help

Tools

The typical pattern: call pdf_info first to plan, then pdf_search to locate — its paragraph excerpts are often enough to answer directly. Use pdf_read_pages or pdf_read_all when you need deeper context. For a folder of PDFs, start with pdf_corpus_overview to triage, then pdf_corpus_search to search across documents.

ToolWhat it does
pdf_infoPage count, metadata, TOC summary, scanned-page detection. Call first. Pass content_trust=True for a content_trust block (suspicious, hidden_text_runs, hidden_chars, injection_in_hidden, pages_flagged, signals); add detail=True for per-span spans.
pdf_get_tocFull table of contents for documents with >50 bookmarks
pdf_corpus_warmWarm a folder (or list) of PDFs into the cache, text and optional embeddings, within a time budget. Returns per-doc status plus unprocessed/skipped.
pdf_corpus_overviewPer-document triage cards for a folder: title, page count, top TOC entries, text coverage. Auto-warms within the budget.
pdf_corpus_searchSearch across a folder of PDFs (keyword, semantic, or hybrid), returning ranked hits with document and page provenance, excerpts, and coverage.
pdf_read_pagesRead specific pages or ranges; OCR-on-demand; embedded images + tables, each with source bbox + clip coordinates. Always returns hidden_text_detected (response level) and per-page hidden_text; hidden_text_detected: true means some returned text was invisible to a human reader and should be treated as especially untrusted.
pdf_read_allRead entire document in one call (byte-capped for safety). Always returns hidden_text_detected; hidden_text_detected: true means some returned text was invisible to a human reader and should be treated as especially untrusted.
pdf_render_pagesRender pages as PNG for vision models — diagrams, handwriting, scans
pdf_extract_chartExtract chart data as exact (x, y) tables from vector charts; declines with a rendered image when not reliably extractable
pdf_searchHybrid RRF search (keyword + semantic), page or section granularity, optional paragraph excerpts (paragraph hits also carry bbox + clip coordinates)
pdf_cache_statsPer-document cache breakdown + total size
pdf_cache_clearClear expired or all cache entries
server_infoWhich optional features (column-aware, OCR, semantic) and config are active. Call before feature-dependent calls.

Example prompts:

"Read the PDF at /path/to/document.pdf"
"Which pages discuss supply chain risks?"
"Find sections about the training process"
"Show me what page 5 looks like"
"OCR pages 3-5 of the scanned PDF"

See docs/tool-reference.md for the complete reference — every parameter, response shape, security contract, and example. For semantic-search model selection, see docs/embedding-models.md.

Example Workflow

For a large document (e.g., a 200-page annual report):

User: "Summarize the risk factors in this annual report"

Agent workflow:
1. pdf_info("report.pdf")
   → 200 pages, TOC shows "Risk Factors" on page 89

2. pdf_search("report.pdf", "risk factors")
   → Matches with structural paragraph excerpts — each excerpt
     is the bullet, paragraph, or heading that matched, not a
     fixed-width window. Often enough to answer directly.

3. If excerpts are sufficient → synthesize answer

4. If more context needed:
   pdf_read_pages("report.pdf", "89-95")
   → Full page text for deeper reading

Configuration

pdf-mcp works out of the box with no configuration. To restrict which paths and URL hosts the server can access, tune cache and worker settings, or understand what's cached, see docs/configuration.md.

  • Access control~/.config/pdf-mcp/config.toml allow/deny rules for paths and URLs, plus response byte caps
  • Content-trust phrases — extend the hidden-text injection_in_hidden hint with your own (including non-English) phrases via [content_trust].injection_phrases
  • Environment variables — cache directory, TTL, and parallel OCR/render worker count
  • Caching — SQLite-backed persistence, what's cached, and invalidation

Roadmap

See ROADMAP.md for planned features and release history.

Contributing

Contributions are welcome. See docs/contributing.md for setup, checks, the coherence eval harness, and quality-loop guidelines.

Security

Found a vulnerability? See SECURITY.md for the threat model, reporting channel, and expected response timeline. Please do not open a public GitHub issue for unpatched security reports.

License

MIT — see LICENSE.

Links

Blog posts

Background, benchmarks, and design notes from building pdf-mcp:

Getting started

Search & retrieval

Engineering & security

Reviews

No reviews yet

Be the first to review this server!