PDF Reader MCP Server

PDF Reader MCP Server

A Model Context Protocol server that extracts and processes content from PDF documents, providing text extraction, metadata retrieval, page-level processing, and PDF validation capabilities.

Category
访问服务器

Tools

extract_pdf_text

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

extract_pdf_metadata

Extract metadata and document information from PDF files

extract_pdf_pages

Extract content from specific pages or page ranges of PDF documents

validate_pdf

Validate PDF file integrity and readability

README

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

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选