Nutrient PDF MCP Server
OfficialThis server lets LLMs inspect and debug PDF object trees at a low level via MCP tools.
Retrieve a JSON representation of a PDF's object tree using
get_pdf_object_treeExplore the tree lazily to keep responses token-efficient, or request full parsing
Navigate to specific objects using dot notation paths (e.g.,
Pages.Kids.0)Access a specific indirect object by object ID (e.g.,
1 0) or by object and generation numbersResolve indirect objects selectively with shallow (direct properties) or deep (recursive) resolution
Perform structural analysis and debugging of PDFs in a local Python runtime
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Nutrient PDF MCP Server show the PDF object tree for document.pdf with lazy mode"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Nutrient PDF MCP Server
A powerful Model Context Protocol server for LLM-driven PDF document analysis and exploration
Which MCP Server Should I Use?
Server | Best for | Deployment | Core capabilities |
Cloud document workflows | Nutrient-hosted API (API key) | Convert, OCR, redact, sign, extract, watermark, automation | |
Self-hosted document workflows | On-prem/private cloud | Document processing with deployment control and data residency | |
Low-level PDF inspection/debugging | Local Python runtime | Object-tree exploration, indirect-object resolution, structural analysis |
You are in the PDF MCP Server repo. Choose this when you need low-level PDF object-tree inspection/debugging rather than end-to-end workflow automation.
Ecosystem overview: Nutrient AI Infrastructure
Product landing page: Nutrient MCP Server
A Model Context Protocol (MCP) server for investigating PDF object trees with lazy loading support. This tool allows LLMs to efficiently explore PDF document structure without overwhelming token limits.
Related MCP server: PDF Splitter MCP Server
Features
Lazy Loading: Explore PDF structure without loading entire object trees
Path Navigation: Navigate through PDF objects using dot notation (e.g.,
Pages.Kids.0)Selective Resolution: Resolve specific indirect objects on demand
Token Efficient: Massive reduction in response sizes compared to full tree dumps
Type Safe: Comprehensive type hints and error handling
Installation
Optional asdf setup
You'll need python and nodejs installed on your machine. You can optionally use asdf.
Finally install required tools with:
git clone https://github.com/PSPDFKit/nutrient-pdf-mcp-server.git
cd nutrient-pdf-mcp-server
asdf install
# Install pipx for Python
python -m pip install --user pipxProceed with the rest of the installation after that.
Quick Start
git clone https://github.com/PSPDFKit/nutrient-pdf-mcp-server.git
cd nutrient-pdf-mcp-server
make install-dev # Sets up development environmentThis release requires mcp>=1.0.0,<2; MCP 2.x is not yet compatible.
For Claude Code CLI
Recommended: Build and Install
pip install build
make build
pipx install dist/nutrient_pdf_mcp-1.0.0-py3-none-any.whl
claude mcp add nutrient-pdf-mcp nutrient-pdf-mcpIf using asdf, you might need to configure pipx with the following before running:
export PIPX_DEFAULT_PYTHON=$(asdf which python)
pipx install dist/nutrient_pdf_mcp-1.0.0-py3-none-any.whlDevelopment Mode
make install-dev
claude mcp add nutrient-pdf-mcp "$(pwd)/venv/bin/python" -m pdf_mcp.serverManual Configuration
{
"mcpServers": {
"nutrient-pdf-mcp": {
"command": "python",
"args": ["-m", "pdf_mcp.server"]
}
}
}Available Tools
get_pdf_object_tree
Nutrient PDF MCP Server - Get JSON representation of PDF object tree with lazy loading.
Parameters:
pdf_path(required): Path to the PDF fileobject_id(optional): Specific object ID to retrieve (e.g., '1 0')path(optional): Object path to navigate (e.g., 'Pages.Kids.0')mode(optional): Parsing mode - 'lazy' (default) or 'full'
Examples:
{
"pdf_path": "document.pdf",
"mode": "lazy"
}{
"pdf_path": "document.pdf",
"path": "Pages.Kids.0",
"mode": "lazy"
}resolve_indirect_object
Nutrient PDF MCP Server - Resolve a specific indirect object by its object and generation numbers.
Parameters:
pdf_path(required): Path to the PDF fileobjnum(required): PDF object number (e.g., 3)gennum(optional): PDF generation number (defaults to 0)depth(optional): Resolution depth - 'shallow' (default) or 'deep'
Examples:
{
"pdf_path": "document.pdf",
"objnum": 3,
"gennum": 0,
"depth": "shallow"
}Command Line Usage
# Run the server
make serve
# Or run with debug logging
make serve-debugArchitecture
Core Components
parser.py: Main PDF parsing logic with lazy loading supportserver.py: MCP server implementationtypes.py: Type definitions for PDF objects and responsesexceptions.py: Custom exception classes
Response Types
All PDF objects are serialized into a consistent JSON format:
{
"type": "dict",
"value": {
"/Type": { "type": "name", "value": "/Pages" },
"/Kids": {
"type": "array",
"value": [{ "type": "indirect_ref", "objnum": 2, "gennum": 0 }]
}
}
}Token Efficiency
The lazy loading system provides massive token savings:
Lazy mode: ~5-50 lines (minimal tokens)
Shallow resolution: ~50-100 lines (reasonable tokens)
Deep resolution: 500+ lines (use sparingly)
Examples
Exploring PDF Structure
Get overview:
get_pdf_object_tree(path="document.pdf", mode="lazy")Navigate to pages:
get_pdf_object_tree(path="document.pdf", path="Pages", mode="lazy")Resolve specific page:
resolve_indirect_object(objnum=3, gennum=0, depth="shallow")Deep dive when needed:
resolve_indirect_object(objnum=3, gennum=0, depth="deep")
Path Navigation Examples
"Pages"- Navigate to Pages object"Pages.Kids"- Get Kids array from Pages"Pages.Kids.0"- Get first page"Pages.Kids.0.MediaBox.2"- Get width from MediaBox array
Development
Quick Start
# Set up development environment
make install-dev
# Run all quality checks (format, lint, typecheck, test)
make quality
# Or run individual commands
make test # Run tests
make format # Format code
make lint # Run linter
make typecheck # Type checkingProject Structure
nutrient-pdf-mcp-server/
├── pdf_mcp/
│ ├── __init__.py
│ ├── server.py # MCP server
│ ├── parser.py # PDF parsing logic
│ ├── types.py # Type definitions
│ └── exceptions.py # Custom exceptions
├── tests/ # Test suite
├── res/ # Sample PDFs
├── pyproject.toml # Project configuration
└── README.mdPublishing to PyPI
# Build the package
make build
# Upload to test PyPI first
twine upload --repository testpypi dist/*
# Upload to production PyPI
twine upload dist/*After publishing, users can install with:
pipx install nutrient-pdf-mcp
# or
pip install --user nutrient-pdf-mcpContributing
Fork the repository
Create a feature branch
Make your changes with tests
Ensure code quality checks pass
Submit a pull request
License
MIT License - see LICENSE file for details.
Related Projects
Available Tools
2 toolsget_pdf_object_treeB
Nutrient PDF MCP Server - Get JSON representation of PDF object tree with lazy loading
Inputs: pdf_path (required), object_id, path, mode.
resolve_indirect_objectC
Nutrient PDF MCP Server - Resolve a specific indirect object by its ID
Inputs: pdf_path (required), objnum (required), gennum, depth.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
Each tool has a clearly distinct purpose: one retrieves the entire object tree structure, the other resolves a specific indirect object by ID. There is no overlap or ambiguity between them.
Both tools follow a consistent verb_noun pattern with underscore: 'get_pdf_object_tree' and 'resolve_indirect_object'. The naming is uniform and predictable.
With only 2 tools, the surface is minimal but appropriate for the narrow domain of PDF object tree inspection. It's borderline, but each tool serves a specific, complementary purpose.
For the stated purpose of exploring a PDF object tree, the tools provide tree retrieval and resolution of indirect objects. However, missing operations like filtering objects by type or searching objects limit completeness for more advanced use cases.
Maintenance
Related MCP Connectors
Read the text of any public PDF, page by page, plus page count and metadata. Free, no key.
Parse, extract, split, and ask over digital PDFs (text layer, no OCR) from Cursor and Claude.
Agent-native document parsing: PDF, scans and FR/EU invoices to structured JSON or Markdown.
Generate and read PDFs for AI agents: a generate_pdf and a read_pdf tool, priced per document.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables LLMs to chat with long PDFs using a reasoning-based, tree-structured document index that navigates content like a human would, without requiring vector databases or hitting context limits.10131 npm413MIT
- AlicenseNot gradedqualityDmaintenanceProvides random access to PDF contents with selective page extraction, text search, outline navigation, image extraction, and page rendering capabilities. Reduces token usage by allowing targeted content extraction instead of processing entire documents.4MIT
- AlicenseNot gradedqualityCmaintenanceServes read-only tools that let an agent inspect PDFs step by step: outline a document, search for text or figure values, read pages and tables in order, describe figures and chart data, and render page or block images, with every block cited to its page and bounding box. It also lists the PDFs available under a configured root folder, which it never reads outside of.MIT
- AlicenseAqualityCmaintenanceEnables clients to inspect local PDFs by searching text, rendering pages, and cropping selected regions at high resolution directly from the source document. It runs locally over stdio without requiring models, embeddings, GPUs, or API keys, and does not modify source PDFs or send network requests.6MIT