The PDF Reader MCP Server allows AI agents to securely read and extract data from PDF files.
Capabilities:
Extract full text content from PDFs
Extract text from specific pages or page ranges
Retrieve PDF metadata (author, title, creation date, etc.)
Get the total page count of a PDF
Process multiple PDF sources (local paths or URLs) in a single request
Operate securely within the defined project root directory
Provide structured JSON output for easy parsing by AI agents
Be installed and run via npm (npx) or Docker
Integrates with Codecov for code coverage reporting, as indicated by the badge showing coverage statistics for the project.
Provides Docker container deployment option, allowing users to run the PDF reader MCP server in an isolated environment with project directory mounting.
Integrates with GitHub for CI/CD pipeline execution, issue tracking, and repository management for the PDF reader MCP server.
Publishes to npm registry allowing installation via npm, with version tracking displayed through npm badge.
Future plans include PWA support for the documentation site, enabling offline access and mobile optimization.
Uses Vitest for performance benchmarking, measuring operations per second for various PDF processing scenarios.
Leverages Zod for input validation, ensuring that requests to the PDF reader MCP server are properly formatted and validated.
Click on "Install 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., "@PDF Reader MCP Serverextract text from the quarterly report PDF in the reports folder"
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.
๐ @sylphx/pdf-reader-mcp
Production-ready PDF processing server for AI agents
5-10x faster parallel processing โข Y-coordinate content ordering โข 94%+ test coverage โข 103 tests passing
๐ Overview
PDF Reader MCP is a production-ready Model Context Protocol server that empowers AI agents with enterprise-grade PDF processing capabilities. Extract text, images, and metadata with unmatched performance and reliability.
The Problem:
// Traditional PDF processing
- Sequential page processing (slow)
- No natural content ordering
- Complex path handling
- Poor error isolationThe Solution:
// PDF Reader MCP
- 5-10x faster parallel processing โก
- Y-coordinate based ordering ๐
- Flexible path support (absolute/relative) ๐ฏ
- Per-page error resilience ๐ก๏ธ
- 94%+ test coverage โ
Result: Production-ready PDF processing that scales.
Related MCP server: File Converter MCP Server
โก Key Features
Performance
๐ 5-10x faster than sequential with automatic parallelization
โก 12,933 ops/sec error handling, 5,575 ops/sec text extraction
๐จ Process 50-page PDFs in seconds with multi-core utilization
๐ฆ Lightweight with minimal dependencies
Developer Experience
๐ฏ Path Flexibility - Absolute & relative paths, Windows/Unix support (v1.3.0)
๐ผ๏ธ Smart Ordering - Y-coordinate based content preserves document layout
๐ก๏ธ Type Safe - Full TypeScript with strict mode enabled
๐ Battle-tested - 103 tests, 94%+ coverage, 98%+ function coverage
๐จ Simple API - Single tool handles all operations elegantly
๐ Performance Benchmarks
Real-world performance from production testing:
Operation | Ops/sec | Performance | Use Case |
Error handling | 12,933 | โกโกโกโกโก | Validation & safety |
Extract full text | 5,575 | โกโกโกโก | Document analysis |
Extract page | 5,329 | โกโกโกโก | Single page ops |
Multiple pages | 5,242 | โกโกโกโก | Batch processing |
Metadata only | 4,912 | โกโกโก | Quick inspection |
Parallel Processing Speedup
Document | Sequential | Parallel | Speedup |
10-page PDF | ~2s | ~0.3s | 5-8x faster |
50-page PDF | ~10s | ~1s | 10x faster |
100+ pages | ~20s | ~2s | Linear scaling with CPU cores |
Benchmarks vary based on PDF complexity and system resources.
๐ฆ Installation
Claude Code
claude mcp add pdf-reader -- npx @sylphx/pdf-reader-mcpClaude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"pdf-reader": {
"command": "npx",
"args": ["@sylphx/pdf-reader-mcp"]
}
}
}macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
VS Code
code --add-mcp '{"name":"pdf-reader","command":"npx","args":["@sylphx/pdf-reader-mcp"]}'Cursor
Open Settings โ MCP โ Add new MCP Server
Select Command type
Enter:
npx @sylphx/pdf-reader-mcp
Windsurf
Add to your Windsurf MCP config:
{
"mcpServers": {
"pdf-reader": {
"command": "npx",
"args": ["@sylphx/pdf-reader-mcp"]
}
}
}Cline
Add to Cline's MCP settings:
{
"mcpServers": {
"pdf-reader": {
"command": "npx",
"args": ["@sylphx/pdf-reader-mcp"]
}
}
}Warp
Go to Settings โ AI โ Manage MCP Servers โ Add
Command:
npx, Args:@sylphx/pdf-reader-mcp
Smithery (One-click)
npx -y @smithery/cli install @sylphx/pdf-reader-mcp --client claudeManual Installation
# Quick start - zero installation
npx @sylphx/pdf-reader-mcp
# Or install globally
npm install -g @sylphx/pdf-reader-mcp๐ฏ Quick Start
Basic Usage
{
"sources": [{
"path": "documents/report.pdf"
}],
"include_full_text": true,
"include_metadata": true,
"include_page_count": true
}Result:
โ Full text content extracted
โ PDF metadata (author, title, dates)
โ Total page count
โ Structural sharing - unchanged parts preserved
Extract Specific Pages
{
"sources": [{
"path": "documents/manual.pdf",
"pages": "1-5,10,15-20"
}],
"include_full_text": true
}Absolute Paths (v1.3.0+)
// Windows - Both formats work!
{
"sources": [{
"path": "C:\\Users\\John\\Documents\\report.pdf"
}],
"include_full_text": true
}
// Unix/Mac
{
"sources": [{
"path": "/home/user/documents/contract.pdf"
}],
"include_full_text": true
}No more "Absolute paths are not allowed" errors!
Extract Images with Natural Ordering
{
"sources": [{
"path": "presentation.pdf",
"pages": [1, 2, 3]
}],
"include_images": true,
"include_full_text": true
}Response includes:
Text and images in exact document order (Y-coordinate sorted)
Base64-encoded images with metadata (width, height, format)
Natural reading flow preserved for AI comprehension
Batch Processing
{
"sources": [
{ "path": "C:\\Reports\\Q1.pdf", "pages": "1-10" },
{ "path": "/home/user/Q2.pdf", "pages": "1-10" },
{ "url": "https://example.com/Q3.pdf" }
],
"include_full_text": true
}โก All PDFs processed in parallel automatically!
โจ Features
Core Capabilities
โ Text Extraction - Full document or specific pages with intelligent parsing
โ Image Extraction - Base64-encoded with complete metadata (width, height, format)
โ Content Ordering - Y-coordinate based layout preservation for natural reading flow
โ Metadata Extraction - Author, title, creation date, and custom properties
โ Page Counting - Fast enumeration without loading full content
โ Dual Sources - Local files (absolute or relative paths) and HTTP/HTTPS URLs
โ Batch Processing - Multiple PDFs processed concurrently
Advanced Features
โก 5-10x Performance - Parallel page processing with Promise.all
๐ฏ Smart Pagination - Extract ranges like "1-5,10-15,20"
๐ผ๏ธ Multi-Format Images - RGB, RGBA, Grayscale with automatic detection
๐ก๏ธ Path Flexibility - Windows, Unix, and relative paths all supported (v1.3.0)
๐ Error Resilience - Per-page error isolation with detailed messages
๐ Large File Support - Efficient streaming and memory management
๐ Type Safe - Full TypeScript with strict mode enabled
๐ What's New in v1.3.0
๐ Absolute Paths Now Supported!
// โ
Windows
{ "path": "C:\\Users\\John\\Documents\\report.pdf" }
{ "path": "C:/Users/John/Documents/report.pdf" }
// โ
Unix/Mac
{ "path": "/home/john/documents/report.pdf" }
{ "path": "/Users/john/Documents/report.pdf" }
// โ
Relative (still works)
{ "path": "documents/report.pdf" }Other Improvements:
๐ Fixed Zod validation error handling
๐ฆ Updated all dependencies to latest versions
โ 103 tests passing, 94%+ coverage maintained
v1.2.0 - Content Ordering
Y-coordinate based text and image ordering
Natural reading flow for AI models
Intelligent line grouping
v1.1.0 - Image Extraction & Performance
Base64-encoded image extraction
10x speedup with parallel processing
Comprehensive test coverage (94%+)
๐ API Reference
read_pdf Tool
The single tool that handles all PDF operations.
Parameters
Parameter | Type | Description | Default |
| Array | List of PDF sources to process | Required |
| boolean | Extract full text content |
|
| boolean | Extract PDF metadata |
|
| boolean | Include total page count |
|
| boolean | Extract embedded images |
|
Source Object
{
path?: string; // Local file path (absolute or relative)
url?: string; // HTTP/HTTPS URL to PDF
pages?: string | number[]; // Pages to extract: "1-5,10" or [1,2,3]
}Examples
Metadata only (fast):
{
"sources": [{ "path": "large.pdf" }],
"include_metadata": true,
"include_page_count": true,
"include_full_text": false
}From URL:
{
"sources": [{
"url": "https://arxiv.org/pdf/2301.00001.pdf"
}],
"include_full_text": true
}Page ranges:
{
"sources": [{
"path": "manual.pdf",
"pages": "1-5,10-15,20" // Pages 1,2,3,4,5,10,11,12,13,14,15,20
}]
}๐ง Advanced Usage
Content is returned in natural reading order based on Y-coordinates:
Document Layout:
โโโโโโโโโโโโโโโโโโโโโโโ
โ [Title] Y:100 โ
โ [Image] Y:150 โ
โ [Text] Y:400 โ
โ [Photo A] Y:500 โ
โ [Photo B] Y:550 โ
โโโโโโโโโโโโโโโโโโโโโโโ
Response Order:
[
{ type: "text", text: "Title..." },
{ type: "image", data: "..." },
{ type: "text", text: "..." },
{ type: "image", data: "..." },
{ type: "image", data: "..." }
]Benefits:
AI understands spatial relationships
Natural document comprehension
Perfect for vision-enabled models
Automatic multi-line text grouping
Enable extraction:
{
"sources": [{ "path": "manual.pdf" }],
"include_images": true
}Response format:
{
"images": [{
"page": 1,
"index": 0,
"width": 1920,
"height": 1080,
"format": "rgb",
"data": "base64-encoded-png..."
}]
}Supported formats: RGB, RGBA, Grayscale Auto-detected: JPEG, PNG, and other embedded formats
Absolute paths (v1.3.0+) - Direct file access:
{ "path": "C:\\Users\\John\\file.pdf" }
{ "path": "/home/user/file.pdf" }Relative paths - Workspace files:
{ "path": "docs/report.pdf" }
{ "path": "./2024/Q1.pdf" }Configure working directory:
{
"mcpServers": {
"pdf-reader-mcp": {
"command": "npx",
"args": ["@sylphx/pdf-reader-mcp"],
"cwd": "/path/to/documents"
}
}
}Strategy 1: Page ranges
{ "sources": [{ "path": "big.pdf", "pages": "1-20" }] }Strategy 2: Progressive loading
// Step 1: Get page count
{ "sources": [{ "path": "big.pdf" }], "include_full_text": false }
// Step 2: Extract sections
{ "sources": [{ "path": "big.pdf", "pages": "50-75" }] }Strategy 3: Parallel batching
{
"sources": [
{ "path": "big.pdf", "pages": "1-50" },
{ "path": "big.pdf", "pages": "51-100" }
]
}๐ง Troubleshooting
"Absolute paths are not allowed"
Solution: Upgrade to v1.3.0+
npm update @sylphx/pdf-reader-mcpRestart your MCP client completely.
"File not found"
Causes:
File doesn't exist at path
Wrong working directory
Permission issues
Solutions:
Use absolute path:
{ "path": "C:\\Full\\Path\\file.pdf" }Or configure cwd:
{
"pdf-reader-mcp": {
"command": "npx",
"args": ["@sylphx/pdf-reader-mcp"],
"cwd": "/path/to/docs"
}
}"No tools showing up"
Solution:
npm cache clean --force
rm -rf node_modules package-lock.json
npm install @sylphx/pdf-reader-mcp@latestRestart MCP client completely.
๐ HTTP Transport (Remote Access)
By default, PDF Reader MCP uses stdio transport for local use. You can also run it as an HTTP server for remote access from multiple machines.
Quick Start
# Run as HTTP server on port 8080
MCP_TRANSPORT=http npx @sylphx/pdf-reader-mcpEnvironment Variables
Variable | Default | Description |
|
| Transport type: |
|
| HTTP server port |
|
| HTTP server hostname |
| - | Optional API key for authentication |
Docker Deployment
FROM oven/bun:1
WORKDIR /app
RUN bun add @sylphx/pdf-reader-mcp
ENV MCP_TRANSPORT=http
ENV MCP_HTTP_PORT=8080
EXPOSE 8080
CMD ["bun", "node_modules/@sylphx/pdf-reader-mcp/dist/index.js"]MCP Client Configuration (HTTP)
{
"servers": {
"pdf-reader": {
"type": "http",
"url": "https://your-server.com/mcp",
"headers": {
"X-API-Key": "your-api-key"
}
}
}
}Endpoints
Endpoint | Method | Description |
| POST | JSON-RPC endpoint |
| GET | Health check |
๐๏ธ Architecture
Tech Stack
Component | Technology |
Runtime | Node.js 22+ ESM |
PDF Engine | PDF.js (Mozilla) |
Validation | Zod + JSON Schema |
Protocol | MCP SDK |
Language | TypeScript (strict) |
Testing | Vitest (103 tests) |
Quality | Biome (50x faster) |
CI/CD | GitHub Actions |
Design Principles
๐ Security First - Flexible paths with secure defaults
๐ฏ Simple Interface - One tool, all operations
โก Performance - Parallel processing, efficient memory
๐ก๏ธ Reliability - Per-page isolation, detailed errors
๐งช Quality - 94%+ coverage, strict TypeScript
๐ Type Safety - No
anytypes, strict mode๐ Backward Compatible - Smooth upgrades always
๐งช Development
Prerequisites:
Node.js >= 22.0.0
pnpm (recommended) or npm
Setup:
git clone https://github.com/SylphxAI/pdf-reader-mcp.git
cd pdf-reader-mcp
pnpm install && pnpm buildScripts:
pnpm run build # Build TypeScript
pnpm run test # Run 103 tests
pnpm run test:cov # Coverage (94%+)
pnpm run check # Lint + format
pnpm run check:fix # Auto-fix
pnpm run benchmark # Performance testsQuality:
โ 103 tests
โ 94%+ coverage
โ 98%+ function coverage
โ Zero lint errors
โ Strict TypeScript
Quick Start:
Fork repository
Create branch:
git checkout -b feature/awesomeMake changes:
pnpm testFormat:
pnpm run check:fixCommit: Use Conventional Commits
Open PR
Commit Format:
feat(images): add WebP support
fix(paths): handle UNC paths
docs(readme): update examplesSee CONTRIBUTING.md
๐ Documentation
๐ Full Docs - Complete guides
๐ Getting Started - Quick start
๐ API Reference - Detailed API
๐๏ธ Design - Architecture
โก Performance - Benchmarks
๐ Comparison - vs. alternatives
๐บ๏ธ Roadmap
โ Completed
Image extraction (v1.1.0)
5-10x parallel speedup (v1.1.0)
Y-coordinate ordering (v1.2.0)
Absolute paths (v1.3.0)
94%+ test coverage (v1.3.0)
๐ Next
OCR for scanned PDFs
Annotation extraction
Form field extraction
Table detection
100+ MB streaming
Advanced caching
PDF generation
Vote at Discussions
๐ Recognition
Featured on:
Trusted worldwide โข Enterprise adoption โข Battle-tested
๐ค Support
๐ Bug Reports
๐ฌ Discussions
๐ Documentation
๐ง Email
Show Your Support: โญ Star โข ๐ Watch โข ๐ Report bugs โข ๐ก Suggest features โข ๐ Contribute
๐ Stats
103 Tests โข 94%+ Coverage โข Production Ready
๐ License
MIT ยฉ Sylphx
๐ Credits
Built with:
Special thanks to the open source community โค๏ธ
Powered by Sylphx
This project uses the following @sylphx packages:
@sylphx/mcp-server-sdk - MCP server framework
@sylphx/vex - Schema validation
@sylphx/biome-config - Biome configuration
@sylphx/tsconfig - TypeScript configuration
@sylphx/bump - Version management
@sylphx/doctor - Project health checker