pdf-mcp: Agentic RAG over your PDFs, one file or a whole folder
pdf-mcp is an open-source MCP (Model Context Protocol) server that gives AI agents agentic RAG over your PDFs, one file or a whole folder of them. The agent decides when to search; pdf-mcp does the retrieval and hands back excerpts rather than whole documents. It ships as a Python package and connects to Claude Desktop, Claude Code, Cursor, VS Code Copilot, Codex CLI, Kiro, and any MCP-compatible client with a single command.
What pdf-mcp solves
Large PDFs are hard for AI coding assistants to use well. Claude Code, for example, now reads PDFs natively, but a read returns a window of up to 20 pages, so a 300-page standard is fifteen blind reads when you do not already know where the answer sits. Reading pages you did not need is also wasteful: the agent spends its limited attention on pages it will never use. A folder of PDFs is harder still, because there is no native way to ask which of forty documents even mentions the thing you are looking for. pdf-mcp replaces the all-at-once approach with retrieval: the agent inspects structure, searches one document or the whole folder, and reads only the pages that matter. There is no vector database to run and nothing is shipped to a hosted index; the index is a local SQLite cache, built the first time a document is read or warmed up front with pdf_corpus_warm.
How agents use pdf-mcp
The server exposes thirteen tools, but a typical workflow uses two or three. For a single document, pdf_info returns page count, table of contents, per-page text coverage, and estimated token count, so the agent knows the shape of the document before it commits to reading anything. pdf_search then runs hybrid semantic + BM25 search by default (keyword-only and semantic-only modes are one argument away) and returns structural paragraph excerpts, the bullet, paragraph, or heading that matched rather than a fixed-width window. These excerpts are often enough to answer directly. When deeper context is needed, pdf_read_pages extracts full text, images, and tables from specific pages. For a folder, pdf_corpus_warm indexes it within a time budget, pdf_corpus_overview returns a triage card per document, and pdf_corpus_search ranks matches across every document at once. Each corpus hit carries the path and title of the document it came from, so the agent can follow up with the single-document tools and hit the warm cache. The remaining seven tools (pdf_read_all, pdf_get_toc, pdf_render_pages, pdf_extract_chart, pdf_cache_stats, pdf_cache_clear, and server_info) cover full-document reads, visual inspection of scanned pages, chart-data extraction, cache management, and discovery of which optional features are installed.
What the browser demo shows
This page is a faithful in-browser simulation of six of pdf-mcp's tools, presented as a single live document view. The JSON returned by each tool matches the real server's response shape field-for-field, so developers can see exactly what the server would wire into their agent. Everything runs client-side using PDF.js: no backend, no uploads, no data leaving the tab. Features the browser cannot replicate honestly (SQLite caching, Tesseract OCR for scanned PDFs, hybrid semantic search, image extraction, structured table parsing) are stubbed with empty fields and clearly labeled as server-only. The point of the demo is to show the agent workflow, not to be a hosted PDF service.
Install
pdf-mcp is MIT-licensed and published on PyPI. Install with pip install pdf-mcp, then add it to your MCP client's config. Full instructions for Claude Desktop, Claude Code, Cursor, VS Code, Codex, Kiro, and generic MCP clients are in the README. The source code is on GitHub, and the Python package is on PyPI. For a detailed write-up of the design decisions, see the blog post on how it was built.