Skip to main content
Glama
pablontiv

PDF Reader MCP Server

by pablontiv

PDF Reader MCP Server

CI/CD Pipeline Node.js Version TypeScript License: MIT npm package

A Model Context Protocol (MCP) server for extracting and processing content from PDF documents. This server provides secure, efficient, and flexible PDF content extraction capabilities following the MCP specification.

Features

  • Text Extraction: Extract plain text from PDF documents with formatting preservation

  • Metadata Extraction: Extract document metadata (title, author, dates, page count, etc.)

  • Page-Level Processing: Extract content from specific pages or page ranges

  • PDF Validation: Validate PDF file integrity and readability

  • Security-First: Input validation and sandboxed processing

  • Type-Safe: Full TypeScript implementation with comprehensive type definitions

Related MCP server: MCP Docling Server

Why Choose This MCP Server?

🎯 Specialized PDF Tools

  • 4 dedicated tools for different PDF processing needs (text, metadata, pages, validation)

  • Granular control - extract specific pages, preserve formatting, or get structured output

  • Flexible page ranges - support for "1-5", "1,3,5", or "all" syntax

🛡️ Enterprise-Grade Security

  • Directory traversal protection prevents unauthorized file access

  • File size limits (configurable up to 100MB by default)

  • Processing timeouts prevent resource exhaustion

  • Memory usage controls (500MB limit by default)

  • No temporary file persistence - secure processing without data leakage

Production-Ready Architecture

  • Robust error handling with standardized MCP error codes (-32602 to -32605)

  • Structured logging with Winston for monitoring and debugging

  • Comprehensive input validation using Zod schemas

  • Type-safe TypeScript implementation with full type definitions

  • Concurrent processing support for multiple PDF operations

🔧 Developer Experience

  • Easy configuration via environment variables

  • Flexible deployment - works with 70+ MCP-compatible clients

  • Clear documentation with real-world examples

  • Modern tech stack - TypeScript, pdf-parse, pdf-lib

  • Test coverage with Vitest for reliability

📊 Performance Optimized

  • Efficient PDF processing optimized for text-based documents

  • Configurable resource limits to match your infrastructure

  • Minimal dependencies for faster startup and lower memory footprint

  • Streaming support for large document processing

Installation

npm install
npm run build

Usage

As MCP Server

Start the server:

npm start

Client Configuration

This MCP server can be used with various AI applications and development tools. Below are configuration instructions for the most popular clients:

Claude Desktop

Add this configuration to your Claude Desktop config file:

Windows: %APPDATA%\Claude\claude_desktop_config.json macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "pdf-reader": {
      "command": "node",
      "args": ["/path/to/pdf-reader-mcp/dist/index.js"],
      "env": {
        "PDF_MAX_FILE_SIZE": "104857600",
        "LOG_LEVEL": "info"
      }
    }
  }
}

VS Code and VS Code-based Editors

For VS Code, Cursor, Windsurf, and other VS Code-based editors, install an MCP extension:

  1. Install the MCP extension from the marketplace

  2. Add this configuration to your settings.json:

{
  "mcp.servers": {
    "pdf-reader": {
      "command": "node",
      "args": ["/path/to/pdf-reader-mcp/dist/index.js"]
    }
  }
}

ChatGPT Desktop

For ChatGPT Desktop (available since OpenAI's MCP adoption in March 2025):

  1. Go to Settings → Integrations → MCP Servers

  2. Add new server with:

    • Name: PDF Reader

    • Command: node /path/to/pdf-reader-mcp/dist/index.js

Claude Code

Option 1: Command Line (Recommended)

Unix/macOS:

# Add the MCP server directly via command line
claude mcp add pdf-reader node /path/to/pdf-reader-mcp/dist/index.js

# With environment variables
claude mcp add pdf-reader -e PDF_MAX_FILE_SIZE=104857600 -e LOG_LEVEL=info -- node /path/to/pdf-reader-mcp/dist/index.js

# Set scope (optional: --scope local|project|user)
claude mcp add --scope project pdf-reader node /path/to/pdf-reader-mcp/dist/index.js

Windows:

rem Add the MCP server directly via command line
claude mcp add pdf-reader node C:\path\to\pdf-reader-mcp\dist\index.js

rem With environment variables
claude mcp add pdf-reader -e PDF_MAX_FILE_SIZE=104857600 -e LOG_LEVEL=info -- node C:\path\to\pdf-reader-mcp\dist\index.js

rem Set scope (optional: --scope local|project|user)
claude mcp add --scope project pdf-reader node C:\path\to\pdf-reader-mcp\dist\index.js

Option 2: Configuration File Configure in your project's .claude/settings.json:

{
  "mcp": {
    "servers": {
      "pdf-reader": {
        "command": "node",
        "args": ["/path/to/pdf-reader-mcp/dist/index.js"]
      }
    }
  }
}

Other Clients

For other MCP-compatible applications (Microsoft Copilot Studio, Replit, Zed, etc.), refer to the official MCP documentation for client-specific configuration instructions.

Available Tools

1. extract_pdf_text

Extract text content from PDF documents.

Parameters:

  • file_path (required): Path to the PDF file

  • pages (optional): Page range ("1-5", "1,3,5", or "all")

  • preserve_formatting (optional): Whether to preserve text formatting

  • include_metadata (optional): Whether to include document metadata

2. extract_pdf_metadata

Extract metadata and document information from PDF files.

Parameters:

  • file_path (required): Path to the PDF file

3. extract_pdf_pages

Extract content from specific pages or page ranges.

Parameters:

  • file_path (required): Path to the PDF file

  • page_range (required): Page range to extract

  • output_format (optional): "text" or "structured"

4. validate_pdf

Validate PDF file integrity and readability.

Parameters:

  • file_path (required): Path to the PDF file

Configuration

Environment variables:

  • PDF_MAX_FILE_SIZE: Maximum file size in bytes (default: 104857600 = 100MB)

  • PDF_PROCESSING_TIMEOUT: Processing timeout in milliseconds (default: 60000)

  • PDF_MAX_MEMORY_USAGE: Maximum memory usage in bytes (default: 524288000 = 500MB)

  • LOG_LEVEL: Logging level (default: 'info')

Security

  • Input validation for all file paths

  • Directory traversal protection

  • File size and memory limits

  • Processing timeouts

  • No temporary file persistence

Error Handling

The server provides comprehensive error handling with specific error codes:

  • -32602: Validation errors

  • -32603: File access errors

  • -32604: Size/resource errors

  • -32605: Format errors

Performance

  • Supports files up to 100MB

  • Memory usage limited to 500MB

  • Concurrent processing support

  • Optimized for text-based PDFs

License

MIT

Available Tools

4 tools
extract_pdf_metadataC

Extract metadata and document information from PDF files

ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to the PDF file to extract metadata from

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions extraction but doesn't describe what metadata is returned (e.g., author, creation date, page count), whether the operation is read-only or has side effects, error handling, or performance characteristics. This leaves significant gaps for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy to understand at a glance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what metadata is extracted, the return format, or potential limitations (e.g., encrypted PDFs). For a tool with no structured behavioral or output information, more detail is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the single parameter 'file_path' clearly documented. The description adds no additional parameter details beyond what the schema provides, such as file format requirements or path validation rules. With high schema coverage, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('extract') and resource ('metadata and document information from PDF files'). It distinguishes from siblings like 'extract_pdf_text' (which extracts text content) and 'extract_pdf_pages' (which extracts pages), but doesn't explicitly mention these distinctions in the description itself.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'extract_pdf_text' or 'validate_pdf'. It states what the tool does but offers no context about use cases, prerequisites, or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

extract_pdf_pagesC

Extract content from specific pages or page ranges of PDF documents

ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to the PDF file to extract pages from
page_rangeYesPage range to extract (e.g., "1-3", "2,4,6", or "all")
output_formatNoOutput format: "text" for plain text, "structured" for formatted texttext

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions extraction but doesn't cover critical aspects like whether this modifies the original file, requires specific permissions, handles errors, or has rate limits. For a tool with three parameters and no annotations, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without any wasted words. It's appropriately sized for the tool's complexity and gets straight to the point.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no annotations, no output schema, and three parameters, the description is incomplete. It doesn't explain what 'extract content' means in practice (e.g., returns text, images, or something else), lacks error handling or behavioral context, and doesn't guide usage relative to siblings. For a tool with this complexity, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds no additional meaning beyond what's in the schema (e.g., it doesn't explain 'structured' format details or provide examples beyond the schema's 'page_range' examples). Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('extract content') and resource ('PDF documents'), and specifies the scope ('specific pages or page ranges'). However, it doesn't explicitly differentiate from sibling tools like 'extract_pdf_text' or 'extract_pdf_metadata', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'extract_pdf_text' (which might extract all pages) or 'validate_pdf'. It lacks context about use cases, prerequisites, or exclusions, leaving the agent to infer usage from the purpose alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

extract_pdf_textC

Extract text content from PDF documents with optional metadata and formatting preservation

ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to the PDF file to extract text from
pagesNoPage range to extract (e.g., "1-5", "1,3,5", or "all")all
preserve_formattingNoWhether to preserve text formatting and structure
include_metadataNoWhether to include document metadata in the response

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions optional metadata and formatting preservation, but lacks details on permissions needed, file size limits, rate limits, error handling, or output format. For a tool that processes files and has no annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Extract text content from PDF documents') and adds key optional features. Every word earns its place with no redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a tool that performs file processing with multiple parameters, the description is incomplete. It doesn't address behavioral aspects like error conditions, performance expectations, or output structure, leaving the agent with insufficient context for reliable use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all four parameters. The description adds minimal value beyond the schema by hinting at optional metadata and formatting preservation, but doesn't provide additional context like examples of preserved formatting or metadata types. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Extract text content from PDF documents' with additional features like optional metadata and formatting preservation. It specifies the verb ('extract') and resource ('text content from PDF documents'), but doesn't explicitly differentiate from sibling tools like 'extract_pdf_metadata' or 'extract_pdf_pages' beyond the core focus on text extraction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus its siblings (extract_pdf_metadata, extract_pdf_pages, validate_pdf). It mentions optional features like metadata and formatting preservation, but doesn't clarify scenarios where this tool is preferred over alternatives or any prerequisites for use.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

validate_pdfB

Validate PDF file integrity and readability

ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to the PDF file to validate

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool validates 'integrity and readability,' which implies a read-only, non-destructive operation, but doesn't specify what validation entails (e.g., checks for corruption, encryption, or formatting issues), potential error conditions, or output format. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action ('validate') and resource ('PDF file'), making it easy to parse quickly. Every part of the sentence earns its place by conveying essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (validation operation with one parameter) and lack of annotations or output schema, the description is minimally adequate but incomplete. It covers the basic purpose but misses details on behavioral traits, usage context, and expected results, which are important for an agent to invoke it correctly without structured guidance.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the single parameter 'file_path' clearly documented. The description doesn't add any parameter-specific details beyond what the schema provides, such as file format requirements or path examples. Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('validate') and resource ('PDF file integrity and readability'), making it immediately understandable. However, it doesn't explicitly distinguish this validation tool from its sibling tools (extract_pdf_metadata, extract_pdf_pages, extract_pdf_text), which all perform extraction rather than validation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., file existence), context for validation (e.g., before extraction operations), or comparisons with sibling tools, leaving the agent to infer usage scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updates
    • First observedextract_pdf_metadata
    • First observedextract_pdf_pages
    • First observedextract_pdf_text
    • First observedvalidate_pdf

TDQS

A3.5/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: metadata extraction, page extraction, text extraction, and validation. The descriptions reinforce these differences, with no overlap that would cause agent confusion or misselection.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern with 'extract' or 'validate' as the verb and 'pdf' plus a specific noun (metadata, pages, text, or implied file for validate). The naming is uniform and predictable throughout the set.

Tool Count5/5

With 4 tools, the server is well-scoped for a PDF reader domain, covering key operations without bloat. Each tool earns its place by addressing a distinct aspect of PDF processing, making the count appropriate and focused.

Completeness4/5

The tool set covers essential PDF operations like metadata, content extraction, and validation, but lacks tools for actions like merging, splitting, or converting PDFs. These gaps are minor and agents can likely work around them for basic reading tasks.

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pablontiv/pdf-reader-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server