PDF Reader logo

PDF Reader

Organization
sylphxltd

πŸ“„ Production-ready MCP server for PDF processing - 5-10x faster with parallel processing and 94%+ test coverage

Publishersylphxltd
Repositorypdf-reader-mcp
LanguageTypeScript
Forks
66
Stars
704
Available tools
1
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    PDF Reader exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 1 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    704 stars and 66 forks from the linked repository.

πŸ“„ @sylphx/pdf-reader-mcp

Production-ready PDF processing server for AI agents

npm version License CI/CD codecov coverage TypeScript Downloads

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:

typescript
// Traditional PDF processing
- Sequential page processing (slow)
- No natural content ordering
- Complex path handling
- Poor error isolation

The Solution:

typescript
// 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.


⚑ 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:

OperationOps/secPerformanceUse Case
Error handling12,933⚑⚑⚑⚑⚑Validation & safety
Extract full text5,575⚑⚑⚑⚑Document analysis
Extract page5,329⚑⚑⚑⚑Single page ops
Multiple pages5,242⚑⚑⚑⚑Batch processing
Metadata only4,912⚑⚑⚑Quick inspection

Parallel Processing Speedup

DocumentSequentialParallelSpeedup
10-page PDF~2s~0.3s5-8x faster
50-page PDF~10s~1s10x faster
100+ pages~20s~2sLinear scaling with CPU cores

Benchmarks vary based on PDF complexity and system resources.


πŸ“¦ Installation

Claude Code

bash
claude mcp add pdf-reader -- npx @sylphx/pdf-reader-mcp

Claude Desktop

Add to claude_desktop_config.json:

json
{
  "mcpServers": {
    "pdf-reader": {
      "command": "npx",
      "args": ["@sylphx/pdf-reader-mcp"]
    }
  }
}
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

VS Code

bash
code --add-mcp '{"name":"pdf-reader","command":"npx","args":["@sylphx/pdf-reader-mcp"]}'

Cursor

  1. Open Settings β†’ MCP β†’ Add new MCP Server
  2. Select Command type
  3. Enter: npx @sylphx/pdf-reader-mcp

Windsurf

Add to your Windsurf MCP config:

json
{
  "mcpServers": {
    "pdf-reader": {
      "command": "npx",
      "args": ["@sylphx/pdf-reader-mcp"]
    }
  }
}

Cline

Add to Cline's MCP settings:

json
{
  "mcpServers": {
    "pdf-reader": {
      "command": "npx",
      "args": ["@sylphx/pdf-reader-mcp"]
    }
  }
}

Warp

  1. Go to Settings β†’ AI β†’ Manage MCP Servers β†’ Add
  2. Command: npx, Args: @sylphx/pdf-reader-mcp

Ontheia

Add the server in Settings β†’ MCP Servers β†’ Add Server with command npx and args @sylphx/pdf-reader-mcp. See Ontheia's compatible MCP servers for the full list.

Smithery (One-click)

bash
npx -y @smithery/cli install @sylphx/pdf-reader-mcp --client claude

Manual Installation

bash
# Quick start - zero installation
npx @sylphx/pdf-reader-mcp

# Or install globally
npm install -g @sylphx/pdf-reader-mcp

🎯 Quick Start

Basic Usage

json
{
  "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

json
{
  "sources": [{
    "path": "documents/manual.pdf",
    "pages": "1-5,10,15-20"
  }],
  "include_full_text": true
}

Absolute Paths (v1.3.0+)

json
// 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

json
{
  "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

json
{
  "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!

json
// βœ… 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%+)

View Full Changelog β†’


πŸ“– API Reference

read_pdf Tool

The single tool that handles all PDF operations.

Parameters

ParameterTypeDescriptionDefault
sourcesArrayList of PDF sources to processRequired
include_full_textbooleanExtract full text contentfalse
include_metadatabooleanExtract PDF metadatatrue
include_page_countbooleanInclude total page counttrue
include_imagesbooleanExtract embedded imagesfalse

Source Object

typescript
{
  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):

json
{
  "sources": [{ "path": "large.pdf" }],
  "include_metadata": true,
  "include_page_count": true,
  "include_full_text": false
}

From URL:

json
{
  "sources": [{
    "url": "https://arxiv.org/pdf/2301.00001.pdf"
  }],
  "include_full_text": true
}

Page ranges:

json
{
  "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:

json
{
  "sources": [{ "path": "manual.pdf" }],
  "include_images": true
}

Response format:

json
{
  "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:

json
{ "path": "C:\\Users\\John\\file.pdf" }
{ "path": "/home/user/file.pdf" }

Relative paths - Workspace files:

json
{ "path": "docs/report.pdf" }
{ "path": "./2024/Q1.pdf" }

Configure working directory:

json
{
  "mcpServers": {
    "pdf-reader-mcp": {
      "command": "npx",
      "args": ["@sylphx/pdf-reader-mcp"],
      "cwd": "/path/to/documents"
    }
  }
}

Strategy 1: Page ranges

json
{ "sources": [{ "path": "big.pdf", "pages": "1-20" }] }

Strategy 2: Progressive loading

json
// 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

json
{
  "sources": [
    { "path": "big.pdf", "pages": "1-50" },
    { "path": "big.pdf", "pages": "51-100" }
  ]
}

πŸ”’ Security & Sandboxing

By default the server can read any local file the host process can access and fetch any HTTP(S) URL. When running outside a sandbox you should restrict it to a specific working set.

Restricting filesystem access

Use --allow-dir (repeatable) or the MCP_PDF_ALLOWED_DIRS env var (: or , separated). Once set, all path sources must resolve inside one of the allowed directories β€” relative paths, absolute paths, and .. traversal are all checked after resolution.

bash
# CLI flags
npx @sylphx/pdf-reader-mcp --allow-dir=/srv/pdfs --allow-dir=/data/reports

# Environment
MCP_PDF_ALLOWED_DIRS="/srv/pdfs:/data/reports" npx @sylphx/pdf-reader-mcp
json
{
  "mcpServers": {
    "pdf-reader": {
      "command": "npx",
      "args": ["@sylphx/pdf-reader-mcp", "--allow-dir=/srv/pdfs"]
    }
  }
}

Disabling or restricting HTTP

bash
# Block all URL sources
npx @sylphx/pdf-reader-mcp --no-http
MCP_PDF_ALLOW_HTTP=false npx @sylphx/pdf-reader-mcp

# Allowlist hosts (everything else rejected)
npx @sylphx/pdf-reader-mcp --allow-host=cdn.example.com --allow-host=files.internal
MCP_PDF_ALLOWED_HOSTS="cdn.example.com,files.internal" npx @sylphx/pdf-reader-mcp
SettingCLI flagEnvironment variableDefault
Filesystem allowlist--allow-dir=<path> (repeatable)MCP_PDF_ALLOWED_DIRS (: or , separated)unrestricted
Disable HTTP--no-httpMCP_PDF_ALLOW_HTTP=falseenabled
HTTP host allowlist--allow-host=<host> (repeatable)MCP_PDF_ALLOWED_HOSTS (, separated)any host

Denied requests fail fast with an Access denied error before any disk read or network call.


πŸ”§ Troubleshooting

"Absolute paths are not allowed"

Solution: Upgrade to v1.3.0+

bash
npm update @sylphx/pdf-reader-mcp

Restart your MCP client completely.


"File not found"

Causes:

  • File doesn't exist at path
  • Wrong working directory
  • Permission issues

Solutions:

Use absolute path:

json
{ "path": "C:\\Full\\Path\\file.pdf" }

Or configure cwd:

json
{
  "pdf-reader-mcp": {
    "command": "npx",
    "args": ["@sylphx/pdf-reader-mcp"],
    "cwd": "/path/to/docs"
  }
}

"No tools showing up"

Solution:

bash
npm cache clean --force
rm -rf node_modules package-lock.json
npm install @sylphx/pdf-reader-mcp@latest

Restart 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

bash
# Run as HTTP server on port 8080
MCP_TRANSPORT=http npx @sylphx/pdf-reader-mcp

Environment Variables

VariableDefaultDescription
MCP_TRANSPORTstdioTransport type: stdio or http
MCP_HTTP_PORT8080HTTP server port
MCP_HTTP_HOST0.0.0.0HTTP server hostname
MCP_API_KEY-Optional API key for authentication

Docker Deployment

dockerfile
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)

json
{
  "servers": {
    "pdf-reader": {
      "type": "http",
      "url": "https://your-server.com/mcp",
      "headers": {
        "X-API-Key": "your-api-key"
      }
    }
  }
}

Endpoints

EndpointMethodDescription
/mcpPOSTJSON-RPC endpoint
/mcp/healthGETHealth check

πŸ—οΈ Architecture

Tech Stack

ComponentTechnology
RuntimeNode.js 22+ ESM
PDF EnginePDF.js (Mozilla)
ValidationZod + JSON Schema
ProtocolMCP SDK
LanguageTypeScript (strict)
TestingVitest (103 tests)
QualityBiome (50x faster)
CI/CDGitHub 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 any types, strict mode
  • πŸ”„ Backward Compatible - Smooth upgrades always

πŸ§ͺ Development

Prerequisites:

  • Node.js >= 22.0.0
  • pnpm (recommended) or npm

Setup:

bash
git clone https://github.com/SylphxAI/pdf-reader-mcp.git
cd pdf-reader-mcp
pnpm install && pnpm build

Scripts:

bash
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 tests

Quality:

  • βœ… 103 tests
  • βœ… 94%+ coverage
  • βœ… 98%+ function coverage
  • βœ… Zero lint errors
  • βœ… Strict TypeScript

Quick Start:

  1. Fork repository
  2. Create branch: git checkout -b feature/awesome
  3. Make changes: pnpm test
  4. Format: pnpm run check:fix
  5. Commit: Use Conventional Commits
  6. Open PR

Commit Format:

feat(images): add WebP support
fix(paths): handle UNC paths
docs(readme): update examples

See CONTRIBUTING.md


πŸ“š Documentation


πŸ—ΊοΈ 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

GitHub Issues Discord

Show Your Support: ⭐ Star β€’ πŸ‘€ Watch β€’ πŸ› Report bugs β€’ πŸ’‘ Suggest features β€’ πŸ”€ Contribute


πŸ“Š Stats

Stars Forks Downloads Contributors

103 Tests β€’ 94%+ Coverage β€’ Production Ready


πŸ“„ License

MIT Β© Sylphx


πŸ™ Credits

Built with:

  • PDF.js - Mozilla PDF engine
  • Bun - Fast JavaScript runtime

Special thanks to the open source community ❀️

Powered by Sylphx

This project uses the following @sylphx packages:


Star History

Star History Chart


Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "pdf-reader-mcp": {
      "command": "npx",
      "args": [
        "@sylphlab/pdf-reader-mcp"
      ]
    }
  }
}

Available Tools

  • read_pdf

    Reads content/metadata from one or more PDFs (local/URL). Each source can specify pages to extract.

Use PDF Reader MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once PDF Reader is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add PDF Reader as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the PDF Reader MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "pdf-reader": {
      "command": "npx",
      "args": [
        "-y",
        "@shtse8/pdf-reader-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the PDF Reader MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the PDF Reader MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use PDF Reader to help me with this task?
PDF Reader
Sure. I read it.
Here is what I found using PDF Reader.

Frequently asked questions

What is the PDF Reader MCP server used for?

PDF Reader is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use PDF Reader MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use PDF Reader with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use PDF Reader MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With PDF Reader connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect PDF Reader MCP to TypingMind?

PDF Reader runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does PDF Reader MCP provide in TypingMind?

PDF Reader exposes 1 MCP tools that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use PDF Reader MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If PDF Reader requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter πŸ‘‡