Skip to main content

BensPDF

Ben's PDF tools for AI agents, exposed over the Model Context Protocol (MCP).

Your PDFs are read on your own machine and never uploaded. Works with Claude Desktop, VS Code, Kiro, Cursor, the ChatGPT desktop app, and any other MCP client, or fully offline with a local Ollama model.

Tools

Tool What it does
pdf_page_count Counts the pages in a PDF
pdf_metadata Reads document properties: title, author, dates, producer
pdf_check_text Says whether a PDF is readable text or a scan that needs OCR
pdf_page_layout Page sizes, orientation, rotation and page boxes
pdf_check_access Encryption, and what the file permits: printing, copying, editing
pdf_render_pages Renders pages to images, so a page can be looked at
create_test_pdf_file Generates a throwaway PDF, handy for trying things out
export Saves results to a real location on disk
list_artifacts Lists recent temporary results
discard Deletes temporary results now

Where results go

When a tool makes a new PDF, it goes into a scratch folder instead of your own folders, and you get back a short id like art_a1b2c3d4.pdf. Tools accept those ids anywhere they accept a file path, so several steps can be chained together.

Results carry the artifact's path as well as its id, so you can open a rendered page or an intermediate file straight away without exporting it first.

export is the only tool that writes into your folders, so nothing shows up until you ask for it. Each time the server starts it clears out scratch files older than 7 days. Set BENSTOOLS_WORKSPACE to put the scratch folder somewhere other than ~/.benstools/work.

Setup

Install uv once, then point your client at uvx benspdf-mcp and uv fetches the package, plus a suitable Python, on first run.

# macOS and Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

On macOS, brew install uv works too.

Add the server to your client with one of the configs below, then restart the server from your client's UI. Once connected, just ask in plain language:

How many pages are in ~/Downloads/report.pdf?

Claude Desktop

Edit claude_desktop_config.json, which lives at ~/Library/Application Support/Claude/ on macOS and %APPDATA%\Claude\ on Windows. You can also open it from Settings → Developer → Edit Config.

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

VS Code

.vscode/mcp.json in your workspace, or the same file in your user profile. Note VS Code uses servers rather than mcpServers, and wants an explicit type.

{
  "servers": {
    "benspdf": {
      "type": "stdio",
      "command": "uvx",
      "args": ["benspdf-mcp"]
    }
  }
}

Kiro

.kiro/settings/mcp.json in your workspace, or ~/.kiro/settings/mcp.json to enable it everywhere. autoApprove skips the confirmation prompt for tools you trust.

{
  "mcpServers": {
    "benspdf": {
      "command": "uvx",
      "args": ["benspdf-mcp"],
      "autoApprove": ["pdf_page_count"]
    }
  }
}

Cursor, Continue.dev, and most other clients

Same shape as the Claude Desktop config above, in whatever file the client uses.

ChatGPT desktop app, Codex CLI, Codex IDE extension

All three are Codex clients and share one config file, ~/.codex/config.toml, so adding the server once covers all of them.

[mcp_servers.benspdf]
command = "uvx"
args = ["benspdf-mcp"]

Fully offline with Ollama

The clients above keep your PDFs local, but they answer using a hosted model. Pair the tools with a local model instead and nothing leaves your machine.

You'll need Ollama with a model pulled, plus this package:

pip install benspdf-mcp ollama
ollama pull llama3.1

Then run the bundled CLI:

benspdf-cli                        # uses the first model you have
benspdf-cli --model llama3.1       # or pick one
BENSPDF_MODEL=llama3.1 benspdf-cli # or set it once

python -m benspdf.cli does the same thing, handy from a source checkout.

You: how many pages in ~/Downloads/report.pdf?
[Using tool: pdf_page_count]
[Result: 12 pages in report.pdf]
Assistant: The PDF has 12 pages.

Reference

Each tool's own description tells your client what it does and when to use it, so in normal use there is nothing to look up. If you want the detail — every field a tool returns, and the reasoning behind the answers it gives — see the tool reference.

To work on the code, see CONTRIBUTING.md.

License

Apache 2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

benspdf_mcp-0.1.0.tar.gz (77.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

benspdf_mcp-0.1.0-py3-none-any.whl (58.6 kB view details)

Uploaded Python 3

File details

Details for the file benspdf_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: benspdf_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 77.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for benspdf_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 18ebab672ca1e5a99f81bdab9618cbb3cc24a6f88d5068aee9a31e2113ce65f0
MD5 aa796710d262c276f1144ba08178d52e
BLAKE2b-256 387480be3bafb38aee95c122b2d61e85d47da1e34192d68afe1004064e2344b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for benspdf_mcp-0.1.0.tar.gz:

Publisher: release.yml on benbergner/BensPDF

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file benspdf_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: benspdf_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 58.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for benspdf_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a548f0fe52916fa4326845e2c7e4ef6b011072c39007b45efa2cd58f8830e25f
MD5 3e961f7b6f141ec7f182e7af4fbb25c3
BLAKE2b-256 9b6b4d8a84b9a0505da49658f1dd02723d4a1f32eb344fa6511e1988338a93ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for benspdf_mcp-0.1.0-py3-none-any.whl:

Publisher: release.yml on benbergner/BensPDF

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.1

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page