PDF Reader MCP Server

PDF Reader MCP Server

Enables reading, searching, and metadata extraction from PDF files without loading the entire content into the context window. It provides efficient tools for text cleaning, page-specific extraction, and context-aware search results.

Category
Visit Server

README

PDF Reader MCP Server

npm version npm downloads

A Model Context Protocol (MCP) server that provides efficient PDF text extraction capabilities for Claude Code. This server allows you to read, search, and extract metadata from PDF files without loading the entire content into Claude's context window.

npm package: @fabriqa.ai/pdf-reader-mcp Author: Cengiz Han Blog Post: How I Built This Tool to Save My Context

Features

  • Read PDF Files: Extract full text content from PDF files with optional text cleaning
  • Search PDFs: Search for specific text within PDFs with context-aware results
  • Extract Metadata: Get detailed metadata including title, author, page count, dates, etc.
  • Efficient Context Usage: Process large PDFs without consuming excessive Claude Code context
  • Flexible Options: Support for page ranges, case-sensitive search, and more

Installation

Option A: Install from npm (Recommended)

npm install -g @fabriqa.ai/pdf-reader-mcp

After installation, the server will be available globally. You can configure it by running:

# The package will be installed in your global node_modules
# Typically: /usr/local/lib/node_modules/@fabriqa.ai/pdf-reader-mcp

Option B: Install from source

  1. Clone this repository:
git clone https://github.com/hancengiz/read_pdf_as_text_mcp.git
cd read_pdf_as_text_mcp
  1. Install dependencies:
npm install

Configuration

If installed via npm (Recommended):

Option 1: Using Claude Code CLI (Easiest)

# Add the MCP server
claude mcp add pdf-reader npx @fabriqa.ai/pdf-reader-mcp@latest

# Or use the convenience script
npx @fabriqa.ai/pdf-reader-mcp/update-config.js

Option 2: Manual Configuration

Add to your ~/.claude.json:

{
  "mcpServers": {
    "pdf-reader": {
      "command": "npx",
      "args": [
        "@fabriqa.ai/pdf-reader-mcp@latest"
      ]
    }
  }
}

This uses npx to automatically run the globally installed package without needing to specify paths.

Quick Setup Script (Optional):

After installing via npm, you can use the included configuration script to automatically update your ~/.claude.json:

npx @fabriqa.ai/pdf-reader-mcp/update-config.js

Or if installed from source:

node update-config.js

This will automatically add the MCP server using npx, making it available machine-wide across all your projects.

Manual Configuration:

For Claude Desktop, edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "pdf-reader": {
      "command": "npx",
      "args": [
        "@fabriqa.ai/pdf-reader-mcp@latest"
      ]
    }
  }
}

Usage

Once configured, restart Claude Code. The following tools will be available:

1. read-pdf

Extract text content from a PDF file.

Parameters:

  • file (required): Path to the PDF file
  • pages (optional): Page range (e.g., '1-5', '1,3,5', 'all'). Default: 'all'
  • clean_text (optional): Clean and normalize extracted text. Default: false
  • include_metadata (optional): Include PDF metadata in output. Default: true

Example:

Can you read the PDF at /path/to/document.pdf?

2. search-pdf

Search for specific text within a PDF file.

Parameters:

  • file (required): Path to the PDF file
  • query (required): Text to search for
  • case_sensitive (optional): Case sensitive search. Default: false
  • whole_word (optional): Match whole words only. Default: false

Example:

Search for "machine learning" in /path/to/document.pdf

3. pdf-metadata

Extract metadata from a PDF file.

Parameters:

  • file (required): Path to the PDF file

Example:

Get metadata from /path/to/document.pdf

Example Workflow

Here's how you might use this MCP server with Claude Code:

  1. Extract metadata first to understand the document:

    What's the metadata for ~/Documents/research-paper.pdf?
    
  2. Search for specific topics without reading the entire file:

    Search for "neural networks" in ~/Documents/research-paper.pdf
    
  3. Read specific sections when you know what you're looking for:

    Read pages 10-15 from ~/Documents/research-paper.pdf with cleaned text
    

Benefits

  • Context Efficiency: Process large PDF files without loading everything into Claude's context
  • Faster Analysis: Search and extract only what you need
  • Better Performance: Reduce token usage when working with multiple or large PDFs
  • Flexible Extraction: Choose what information to extract and how to format it

Technical Details

  • Built with the @modelcontextprotocol/sdk
  • Uses pdf-parse for PDF text extraction
  • Runs as a local Node.js process communicating via stdio
  • Supports all PDF versions that pdf-parse can handle

Troubleshooting

Server not appearing in Claude Code

  1. Verify the path in your configuration file is correct
  2. Ensure Node.js is installed and in your PATH
  3. Check that dependencies are installed: npm install
  4. Restart Claude Code completely
  5. Check Claude Code logs for any error messages

PDF not found errors

  • Use absolute paths to PDF files
  • Verify file permissions
  • Ensure the PDF file exists at the specified location

Text extraction issues

  • Some PDFs (scanned images) may not contain extractable text
  • Try enabling clean_text option for better formatting
  • Complex layouts may affect text extraction quality

Development

To modify or extend the server:

  1. Edit index.js to add new tools or modify existing ones
  2. Update the ListToolsRequestSchema handler to register new tools
  3. Add corresponding handlers in the CallToolRequestSchema handler
  4. Restart the server (restart Claude Code) to test changes

License

MIT

Author

Created by Cengiz Han

Contributing

Feel free to submit issues or pull requests to improve this MCP server.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured