Pdf Mcp

io.github.jztan由 GitHub 账号 jztan 发布v3.7.0更新于 Nov 7, 2026

Agentic RAG over one PDF or a whole folder: hybrid search, selective page reads, tables, OCR.

概览

AI 生成的概览

本地 MCP 服务器,让 AI 助手搜索、阅读并提取单个 PDF 或整个文件夹中 PDF 的内容,只返回真正相关的页面。

可以做什么
  • 查看文档信息:页数、元数据、目录摘要、扫描页检测
  • 按关键词与语义混合搜索,返回段落摘录与来源坐标
  • 读取指定页面或范围、整份文档,并把页面渲染为图片供视觉模型使用
  • 提取表格、内嵌图片、图表数据点,以及对扫描页做 OCR
  • 对整个文件夹做概览与跨文档搜索,并预热到缓存
  • 查看与清理本地缓存,并报告当前启用的可选功能
适用场景
适合需要就长篇 PDF、报告或扫描件回答问题、又不想把全文塞进上下文的场景;也适合把一整个 PDF 文件夹当作可搜索知识库使用,而无需搭建入库流程。
运行要求
以本地进程运行:可用 Claude Desktop 扩展包,或用 uv、pipx 安装 pdf-mcp 命令(Python 3.11 至 3.14)。首次启动会下载约 250 MB 组件。OCR 需另装 Tesseract;可选的 CUDA 向量化需 NVIDIA 显卡。缓存可通过 PDF_MCP_CACHE_DIR、PDF_MCP_CACHE_MAX_MB、PDF_MCP_CACHE_TTL 配置。
安装前请注意
从 PDF 提取的文本被视为不可信内容,隐藏或注入的文字只会被标记而不会被清除,提示注入风险仍然存在。读取工具会把文档内容交给模型;可选的 HTTP 模式可抓取 URL 并提供白名单目录下的文件,且为单租户,缺少认证令牌或路径白名单时会直接退出。缓存会写入本地磁盘。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Pdf Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

pdf-mcp

[PyPI version] [Python 3.11 to 3.14] [License: MIT] [GitHub Issues] [CI] [codecov] [Downloads]

Agentic RAG over your PDFs, one file or a whole folder, as a single MCP tool.

The agent decides when to search; pdf-mcp does the retrieval and hands back excerpts. It is an MCP server that lets Claude Code and other AI agents search one PDF or a whole folder 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, with optional CUDA acceleration for warming large corpora.

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

Try it in your browser

See what your AI agent sees →

Drop in any PDF, or a whole folder of them, and watch an agent triage the corpus, search across every document at once, and read only the pages that matter, using a fraction of the tokens. 100% client-side, no install required.

[pdf-mcp browser demo: an AI agent warms a 6-PDF corpus, triages it, searches across all six documents, and reads only the matching page, with 97.3% of the corpus never entering the context window]

Why pdf-mcp?

Without pdf-mcpWith pdf-mcp
Large PDFsContext overflowRead only the pages you need
Finding contentLoad everythingHybrid search: BM25 keyword + semantic
Folders of PDFsOne document at a timeWarm, triage, and search a whole folder
Warming a big folderMinutes of CPU embeddingLength-sorted small-batch CPU encode; optional CUDA embedding, one to two orders of magnitude faster on an NVIDIA card
Tables and chartsLost in raw textStructured rows, and (x, y) data from vector charts
Multi-column and vertical layoutsColumns interleavedCorrect reading order, including Japanese tategaki
Scanned PDFsNo text at allOCR via Tesseract, parallel across pages
Repeated accessRe-parse every timeSQLite cache that survives restarts
Hidden or injected textSilently ingestedFlagged as untrusted, nothing stripped

Installation

Claude Desktop: nothing to install first

  1. Download pdf-mcp.mcpb.
  2. In Claude Desktop, open Settings > Extensions, drag the file onto that page, and click Install.
  3. Ask Claude about a PDF by its location, for example "Use pdf-mcp to summarize C:\Users\me\Downloads\report.pdf", or about a whole folder.

The first start downloads pdf-mcp's components (about 250 MB) and can take a few minutes; later starts take seconds. OCR for scanned pages is included: the first scanned page downloads an English-only Tesseract (about 14 MB). Needs Windows 10 or later, or macOS 13 or later (14 on Apple Silicon), and works in Claude Desktop's Chat. Updating, uninstalling and other details are in docs/clients.md.

Claude Code and other MCP clients

Needs Python 3.11 to 3.14. On 3.15 the installer falls back to a very old release, because a dependency has no 3.15 build yet. Install the pdf-mcp command with uv or pipx:

bash
uv tool install pdf-mcp     # or: pipx install pdf-mcp

pip install pdf-mcp works inside a virtual environment; Homebrew's Python and recent Debian and Ubuntu refuse a system-wide pip install.

Then add it to your client. For Claude Code:

bash
claude mcp add pdf-mcp -- pdf-mcp

For VS Code, Cursor, Codex CLI, Kiro or any other MCP client, see docs/clients.md. Then ask your agent to read a PDF.

Search, the corpus tools, tables and multi-column and CJK reading order work out of the box. For non-English documents, see language support. OCR on scanned pages also needs Tesseract:

bash
brew install tesseract                             # macOSsudo apt install tesseract-ocr                     # Ubuntu/Debianwinget install -e --id UB-Mannheim.TesseractOCR    # Windows

Optional: CUDA embedding on an NVIDIA card warms large folders one to two orders of magnitude faster; see docs/configuration.md.

From Python

pdf-mcp's tools are also plain Python functions, so you can import them and hand a PDF to the Anthropic SDK without running a server. Two runnable scripts, for a question and for a whole document: examples/.

Why this exists, and what broke along the way: Claude's 100-page PDF limit and how I got around it

Tools

13 specialized tools rather than one monolithic one. Typical pattern: pdf_info to plan, pdf_search to locate (its paragraph excerpts often answer the question outright), pdf_read_pages when you need more. For a folder, pdf_corpus_overview to triage, then pdf_corpus_search.

ToolWhat it does
pdf_infoPage count, metadata, TOC summary, scanned-page detection. Call first.
pdf_searchHybrid search (keyword + semantic) by page or section; hits carry an excerpt, source coordinates, the enclosing outline section and a table's lead-in sentence
pdf_read_pagesRead specific pages or ranges, with OCR on demand, tables, and embedded images
pdf_read_allRead a whole document in one call, byte-capped
pdf_get_tocFull table of contents for documents with many bookmarks
pdf_render_pagesRender pages as PNG for vision models: diagrams, handwriting, scans
pdf_extract_chartChart data as exact (x, y) tables, read from plot geometry
pdf_corpus_warmWarm a folder of PDFs into the cache within a time budget
pdf_corpus_overviewPer-document triage cards for a folder
pdf_corpus_searchSearch across a folder; hits carry document and page provenance
pdf_cache_statsPer-document cache breakdown and total size
pdf_cache_clearClear expired or all cache entries
server_infoWhich optional features and config are active

Text returned by any of these is untrusted content extracted from a PDF. pdf_info(content_trust=True) reports hidden text a human reader cannot see, and the read tools flag it per page.

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"

Full reference, every parameter and response shape: docs/tool-reference.md. Embedding model selection: 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

Remote / HTTP transport

STDIO is the default and is what every example above uses. pdf-mcp-http serves the same tools over HTTP, for clients that cannot spawn a process (the Anthropic API MCP connector, claude.ai custom connectors) and for a warm corpus shared by several clients.

bash
export PDF_MCP_AUTH_TOKEN="$(openssl rand -hex 32)"pdf-mcp-http

Paths resolve on the server, so an HTTP agent reads what is already there: files under an allow-listed root, or a URL the server fetches. It cannot hand over a file from its own machine. It is single-tenant and fails closed: with no auth token and no [paths] allow list, the process exits rather than serving an open endpoint.

Docker images are published to GHCR for amd64 and arm64, with everything baked in, so every tool works on the first request:

bash
./deploy.sh              # token, image, start, health-checkcp your.pdf documents/   # this folder is the server's /data/pdfs

Read docs/remote-access.md for the trust boundary and threat model before deploying, and docs/configuration.md for setup, client config, and token rotation.

Configuration

pdf-mcp works out of the box. To restrict which paths and URL hosts the server may touch, tune cache and worker settings, or add your own content-trust phrases, see docs/configuration.md.

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.

Contributors

Thank you to everyone who has helped improve this project through code, reviews, testing, and feature requests:

@Summer907 · @ebbsanchez · @VooDisss · @DerDennisOP · @deepdmk · @TheSOV · @janLo · @bbulkow · @HillsCloud · @phinnphace

[Contributors]

Per-release contributor credits are listed in the Changelog.

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

The story behind the releases. Building pdf-mcp keeps surprising me: benchmarks that go the wrong way, formats that break everything, features I had to remove. I write about that thinking in The Dispatch. Come along if that's your kind of thing.

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

Getting started

Corpus & multi-document search

  • A Knowledge Base Is Just a Folder: Turning a folder of PDFs into an agent knowledge base with the corpus tools, no ingestion pipeline or vector store
  • Cross-Document Retrieval for AI Agents Without a Vector Database: Why BM25 scores don't merge across per-document indexes but ranks do, and how two-stage RRF puts a gold document in the top 3 on 84.8% of 184 graded queries over a 100-PDF corpus
  • How Amazon Bedrock Helped Me Make My RAG Better: Benchmarking pdf_corpus_search against Bedrock Knowledge Bases at an equal 2,000-token budget for four cents surfaced two bugs eight months of self-testing missed: an excerpt picker discarding answers from pages it had already retrieved, and one embedding per page hiding short answers
  • Does a PDF Search Tool Still Matter for AI Agents?: Claude Code with and without pdf-mcp on 53 multi-paper questions over 120 papers: answer quality tied, but the search tool read 7.5 pages per question instead of 187 and answered in 25 seconds instead of 92

Search & retrieval

Engineering & security

来源:README.md,提交 47fb2fd

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

6
  1. v3.7.0最新Nov 7, 2026
  2. v3.6.0Oct 31, 2026
  3. v3.5.0Oct 3, 2026
  4. v3.4.0Sep 26, 2026
  5. v3.3.0Sep 19, 2026
  6. v3.2.0Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分