Skip to main content
Glama
hancengiz

PDF Reader MCP Server

by hancengiz

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

Related MCP server: PDF MCP Server

Installation

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

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.

Available Tools

3 tools
pdf-metadataB

Extract metadata from a PDF file including title, author, page count, creation date, etc.

ParametersJSON Schema
NameRequiredDescriptionDefault
fileYesPath to the PDF file to get metadata from

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 extracts metadata but doesn't mention error handling (e.g., for invalid files), performance characteristics, or what happens if metadata fields are missing. For a tool with zero annotation coverage, this is a significant gap.

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 and provides examples of metadata fields. There is no wasted verbiage, and every word earns its place.

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 low complexity (1 parameter, no output schema, no annotations), the description is minimally adequate. However, it lacks details on return values (since no output schema exists) and behavioral context, which are important for a tool performing extraction. It's complete enough for basic understanding but has clear gaps.

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' clearly documented as 'Path to the PDF file to get metadata from'. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline of 3.

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 from a PDF file'), and lists example metadata fields. It distinguishes from the 'read-pdf' sibling (likely for content extraction) and 'search-pdf' (likely for text search), though not explicitly. A 5 would require explicit sibling differentiation.

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 the sibling tools 'read-pdf' or 'search-pdf'. It also lacks information about prerequisites (e.g., file accessibility) or alternative approaches. This leaves the agent without context for tool selection.

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

read-pdfA

Extract text from a PDF file. Returns the full text content of the PDF with optional page filtering and text cleaning.

ParametersJSON Schema
NameRequiredDescriptionDefault
fileYesPath to the PDF file to extract text from
pagesNoPage range (e.g., '1-5', '1,3,5', 'all'). Default: 'all'
clean_textNoClean and normalize extracted text. Default: false
include_metadataNoInclude PDF metadata in output. Default: true

TDQS

A3.8/5.0
Behavior3/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. It discloses the tool's behavior by stating it 'returns the full text content' and mentions optional features like page filtering and text cleaning. However, it lacks details on error handling, performance characteristics, or limitations (e.g., file size constraints, supported PDF formats), which would be valuable for an agent.

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 two sentences, front-loaded with the core purpose ('Extract text from a PDF file') followed by additional context about return values and optional features. Every sentence adds value without redundancy, making it efficiently structured and appropriately sized.

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

Completeness4/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 (4 parameters, no output schema, no annotations), the description is reasonably complete. It covers the main purpose and key behavioral aspects (returning text, optional features). However, without an output schema, it could benefit from more detail on the return format (e.g., structure of the text output, handling of metadata), slightly reducing completeness.

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, providing clear documentation for all 4 parameters. The description adds minimal value beyond the schema by mentioning 'optional page filtering and text cleaning', which loosely corresponds to the 'pages' and 'clean_text' parameters but does not provide additional semantic context. Baseline 3 is appropriate as the schema does the heavy lifting.

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

Purpose5/5

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

The description clearly states the specific action ('Extract text from a PDF file') and resource ('PDF file'), distinguishing it from sibling tools like 'pdf-metadata' (which likely extracts metadata) and 'search-pdf' (which likely searches within PDFs). The verb 'extract text' precisely defines the tool's function.

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

Usage Guidelines3/5

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

The description implies usage for text extraction from PDFs but does not explicitly state when to use this tool versus alternatives like 'pdf-metadata' or 'search-pdf'. It mentions optional features (page filtering, text cleaning) which provide some context, but lacks explicit guidance on tool selection scenarios.

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

search-pdfA

Search for specific text within a PDF file. Returns matching text with context and page numbers.

ParametersJSON Schema
NameRequiredDescriptionDefault
fileYesPath to the PDF file to search in
queryYesText to search for
case_sensitiveNoCase sensitive search. Default: false
whole_wordNoMatch whole words only. Default: false

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses the return format ('Returns matching text with context and page numbers'), which is valuable behavioral information. However, it doesn't mention potential limitations like maximum file size, search performance, error conditions, or authentication requirements that would help an agent understand operational constraints.

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 perfectly concise with two sentences that each earn their place: the first states the purpose, the second specifies the return format. No wasted words, front-loaded with core functionality, and appropriately sized for the tool's complexity.

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

Completeness4/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 (4 parameters, search operation), no annotations, and no output schema, the description provides good coverage of what the tool does and what it returns. However, it lacks details about error handling, performance characteristics, or limitations that would make it fully complete for agent decision-making.

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 already documents all four parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema. This meets the baseline expectation when schema coverage is complete, but provides no additional semantic context.

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

Purpose5/5

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

The description clearly states the specific action ('Search for specific text'), target resource ('within a PDF file'), and distinguishes from siblings by focusing on text search rather than metadata extraction (pdf-metadata) or full content reading (read-pdf). It provides a complete purpose statement with verb+resource+differentiation.

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

Usage Guidelines3/5

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

The description implies usage context (searching within PDFs) but doesn't explicitly state when to use this tool versus alternatives like read-pdf for full content or pdf-metadata for file information. No explicit when-not-to-use guidance or named alternatives are provided, leaving usage decisions to inference.

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. 3 tool updatesv1.0.7
    • First observedpdf-metadata
    • First observedread-pdf
    • First observedsearch-pdf

TDQS

A3.7/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: pdf-metadata extracts document properties, read-pdf extracts all text content, and search-pdf finds specific text within the document. There is no overlap in functionality, making tool selection straightforward for an agent.

Naming Consistency5/5

All tools follow a consistent verb-noun pattern using hyphens (pdf-metadata, read-pdf, search-pdf). The naming is predictable and readable, with 'pdf' consistently placed as a suffix or prefix across all tools.

Tool Count4/5

Three tools is a minimal but reasonable count for a PDF reader server, covering core operations: metadata extraction, full text reading, and text search. It could benefit from additional tools like PDF conversion or annotation handling, but it's well-scoped for basic use.

Completeness4/5

The toolset covers essential PDF reading operations: metadata, full text extraction, and search. Minor gaps exist, such as no tools for PDF manipulation (e.g., merging, splitting) or advanced features like OCR, but agents can perform basic workflows without dead ends.

Maintenance

ActivityInactive
ResponsivenessNo issues

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

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to search and query PDF documents through a local RAG system with vector embeddings. Provides semantic document search capabilities while keeping all data stored locally without external dependencies.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables processing and analysis of large PDF files through text extraction, search functionality, and intelligent chunking strategies. Provides comprehensive PDF operations including metadata retrieval, page-range text extraction, and content search with contextual results.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables intelligent search and question-answering over PDF documents using semantic similarity and keyword search. Supports OCR for scanned PDFs, persistent vector storage with ChromaDB, and maintains source tracking with page numbers.
    6
    MIT

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/hancengiz/read_pdf_as_text_mcp'

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