Skip to main content
Glama
pdf-mcp
by jkp

pdf-mcp

An MCP server that gives LLMs searchable access to your PDF filing cabinet.

Point it at a folder of PDFs and it indexes every document — extracting text page by page, building a full-text search index, and embedding content for semantic similarity search. Works with Claude.ai, Claude Code, and any MCP-compatible client.

Features

  • Hybrid search — FTS5 keyword matching + semantic vector search (e5-large via sqlite-vec), cross-encoder reranking (bge-reranker-v2-m3), and LLM relevance filtering

  • Handles scanned PDFs — pymupdf extracts text from OCR'd documents

  • Incremental indexing — SHA256 hash tracking means restarts only process new or changed files

  • Single-file database — everything stored in one portable SQLite file (FTS5 + vectors)

  • Zero external services — runs fully local; Together API optional for faster bulk embedding

Related MCP server: pdf2mcp

Quick start

# Install
git clone https://github.com/jkp/pdf-mcp.git
cd pdf-mcp
uv sync

# Point at your PDFs
export PDF_MCP_VAULT_PATH=~/Documents/PDFs

# Run (stdio mode — for Claude Code, Cursor, etc.)
uv run pdf-mcp

Configuration

All settings use the PDF_MCP_ prefix and can be set via environment variables or a .env file.

Variable

Default

Description

VAULT_PATH

~/Documents/PDFs

Directory containing your PDFs

DB_PATH

~/.local/share/pdf-mcp/pdf.db

SQLite database location

TRANSPORT

stdio

stdio or http

PORT

10201

HTTP server port

MCP_PATH

/mcp

MCP endpoint path (set to / behind a path-stripping proxy)

TOGETHER_API_KEY

Optional — enables faster bulk embedding and LLM relevance scoring

LOG_LEVEL

INFO

Logging level

OAuth (for HTTP transport)

Variable

Description

GITHUB_CLIENT_ID

GitHub OAuth app client ID

GITHUB_CLIENT_SECRET

GitHub OAuth app client secret

OAUTH_BASE_URL

Public URL of the server

OAUTH_ALLOWED_USERS

Comma-separated GitHub usernames

OAUTH_STATE_DIR

Directory for OAuth state persistence

MCP tools

Tool

Description

search_pdfs

Hybrid full-text + semantic search with reranking and relevance filtering

list_pdfs

List/filter PDFs by filename pattern

read_pdf

Extract text from a PDF (all pages or specific range)

get_pdf_info

PDF metadata — page count, author, title, file size

rename_pdf

Rename a PDF with automatic reindex

reindex_pdfs

Manually trigger reindexing of all PDFs

Search pipeline

query
  │
  ├─► Vector search (e5-large embeddings, sqlite-vec KNN)
  ├─► FTS5 keyword search (porter stemming)
  │
  └─► Union + deduplicate
        │
        ├─► Cross-encoder reranker (bge-reranker-v2-m3)
        └─► LLM relevance filter (scores 1-5, drops noise)
              │
              └─► Results

Deployment

Docker / Podman

docker build -t pdf-mcp .
docker run -v ~/Documents/PDFs:/data/vault -v pdf-mcp-data:/data \
  -e PDF_MCP_VAULT_PATH=/data/vault \
  -e PDF_MCP_DB_PATH=/data/pdf.db \
  -e PDF_MCP_TRANSPORT=http \
  -p 10201:10201 \
  pdf-mcp

Claude Code (stdio)

Add to your MCP config:

{
  "mcpServers": {
    "pdf": {
      "command": "uv",
      "args": ["--directory", "/path/to/pdf-mcp", "run", "pdf-mcp"],
      "env": {
        "PDF_MCP_VAULT_PATH": "~/Documents/PDFs"
      }
    }
  }
}

Claude.ai (remote HTTP)

Add as a remote MCP server using the HTTP URL (e.g., https://your-server/mcp). OAuth will handle authentication.

Performance

First startup indexes and embeds all PDFs:

  • Text extraction: ~2s per PDF (~30 min for 800 PDFs)

  • Embedding: ~50 PDFs/min local, ~500 PDFs/min via Together API

  • Search: <1s per query (vector + FTS5 + reranking)

Subsequent startups are instant — hash-based skip.

Development

uv sync
uv run pytest -v

License

MIT

Available Tools

6 tools
get_pdf_infoGet PDF InfoB
Read-only

Get metadata about a PDF without extracting full text.

Args: filename: PDF filename

Inputs: filename (required). Returns: object

list_pdfsList PDFsB
Read-only

List PDFs in the filing cabinet, optionally filtered by filename pattern.

Args: pattern: Optional filename substring to filter by (e.g., "mortgage", "2024") limit: Maximum number of results

Inputs: limit, pattern. Returns: result

read_pdfRead PDFA
Read-only

Extract text from a PDF, optionally specific pages.

Args: filename: PDF filename (e.g., "2024-01-15 Invoice.pdf") pages: Optional page range (e.g., "1-3", "5", "1,3,5"). Omit for all pages.

Inputs: filename (required), pages. Returns: object

reindex_pdfsReindex PDFsA
Read-only

Reindex all PDFs in the filing cabinet.

Use this after adding new PDFs or if search results seem stale.

Inputs: no named parameters. Returns: object

rename_pdfRename PDFC

Rename a PDF file in the filing cabinet.

Args: old_filename: Current filename new_filename: New filename

Inputs: new_filename (required), old_filename (required). Returns: object

search_pdfsSearch PDFsA
Read-only

Search across all indexed PDFs using full-text and semantic search.

Combines FTS5 keyword matching with vector similarity search, reranks with a cross-encoder, and filters by LLM relevance scoring.

Args: query: Search query (natural language or keywords) limit: Maximum number of results

Inputs: query (required), limit. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool targets a distinct action on a distinct aspect of the PDF domain: rename, reindex, read (text extraction), info (metadata), search, and list. The closest pair, read_pdf vs get_pdf_info, is clearly separated by their descriptions (full text vs metadata without extraction), and list_pdfs vs search_pdfs differ by enumeration vs query.

    Naming Consistency5/5

    All six tools follow a consistent verb_noun snake_case pattern (rename_pdf, reindex_pdfs, read_pdf, get_pdf_info, search_pdfs, list_pdfs) with no style mixing or vague names.

    Tool Count5/5

    Six tools is well within the ideal 3-15 range and each earns its place across file management, retrieval, and maintenance. No redundant or trivial tools are present.

    Completeness4/5

    The surface covers reading, metadata, search, listing, rename, and reindexing, but lacks a delete/remove operation despite having rename, and no add/import tool (likely handled externally given reindex_pdfs). These are minor gaps an agent can work around for the stated purpose.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables any MCP-compatible AI assistant to search, filter, and retrieve information from a local document collection using a hybrid search pipeline with vector, BM25, reranking, and LLM enrichment.
      4
      -
    • A
      license
      A
      quality
      C
      maintenance
      Turn any PDF folder into a searchable MCP server with semantic, hybrid, or keyword search.
      6
      2
      MIT