Skip to main content
Glama
xraywu

PDF Extraction MCP Server

by xraywu

PDF Extraction MCP Server (Claude Code Fork)

MCP server to extract contents from PDF files, with fixes for Claude Code CLI installation.

This fork includes critical fixes for installing and running the server with Claude Code (the CLI version).

What's Different in This Fork

  1. Added __main__.py - Enables the package to be run as a module with python -m pdf_extraction

  2. Claude Code specific instructions - Clear installation steps that work with Claude Code CLI

  3. Tested installation process - Verified working with claude mcp add command

Related MCP server: mcp-pdf-tools

Components

Tools

The server implements one tool:

  • extract-pdf-contents: Extract contents from a local PDF file

    • Takes pdf_path as a required string argument (local file path)

    • Takes pages as an optional string argument (comma-separated page numbers, supports negative indexing like -1 for last page)

    • Supports both PDF text extraction and OCR for scanned documents

Installation for Claude Code CLI

Prerequisites

  • Python 3.11 or higher

  • pip or conda

  • Claude Code CLI installed (claude command)

Step 1: Clone and Install

# Clone this fork
git clone https://github.com/lh/mcp-pdf-extraction-server.git
cd mcp-pdf-extraction-server

# Install in development mode
pip install -e .

Step 2: Find the Installed Command

# Check where pdf-extraction was installed
which pdf-extraction
# Example output: /opt/homebrew/Caskroom/miniconda/base/bin/pdf-extraction

Step 3: Add to Claude Code

# Add the server using the full path from above
claude mcp add pdf-extraction /opt/homebrew/Caskroom/miniconda/base/bin/pdf-extraction

# Verify it was added
claude mcp list

Step 4: Use in Claude

# Start a new Claude session
claude

# In Claude, type:
/mcp

# You should see:
# MCP Server Status
# • pdf-extraction: connected

Usage Example

Once connected, you can ask Claude to extract PDF contents:

"Can you extract the content from the PDF at /path/to/document.pdf?"

"Extract pages 1-3 and the last page from /path/to/document.pdf"

Troubleshooting

Server Not Connecting

  1. Make sure you started a NEW Claude session after adding the server

  2. Verify the command path is correct: ls -la $(which pdf-extraction)

  3. Test the command directly (it should hang waiting for input): pdf-extraction

Module Not Found Errors

If you get Python import errors:

  1. Make sure you're using the same Python environment where you installed the package

  2. Try using the full Python path: claude mcp add pdf-extraction /path/to/python -m pdf_extraction

Installation Issues

If pip install -e . fails:

  1. Make sure you have Python 3.11+: python --version

  2. Try creating a fresh virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    pip install -e .

For Claude Desktop Users

This fork is specifically for Claude Code CLI. If you're using Claude Desktop (the GUI app), please refer to the original repository for installation instructions.

Dependencies

  • mcp>=1.2.0

  • pypdf2>=3.0.1

  • pytesseract>=0.3.10 (for OCR support)

  • Pillow>=10.0.0

  • pydantic>=2.10.1,<3.0.0

  • pymupdf>=1.24.0

Contributing

Contributions are welcome! The main change in this fork is the addition of __main__.py to make the package runnable as a module.

License

Same as the original repository.

Credits

Original server by @xraywu Claude Code fixes by @lh

Available Tools

1 tool
extract-pdf-contentsC

Extract contents from a local PDF file, given page numbers separated in comma. Negative page index number supported.

ParametersJSON Schema
NameRequiredDescriptionDefault
pdf_pathYes
pagesNo

TDQS

C2.7/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. It states the tool extracts contents but doesn't disclose behavioral traits such as what format the extracted contents are in (e.g., text, images), error handling, permissions needed for local file access, or performance considerations. The mention of negative page indices adds some context but is insufficient for a mutation-like operation.

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

Conciseness4/5

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

The description is brief and to the point with two sentences, front-loading the main action. It avoids unnecessary words, though it could be slightly more structured (e.g., separating parameter explanations).

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, 0% schema coverage, and no output schema, the description is incomplete. It lacks details on return values, error cases, file format support, and operational constraints, making it inadequate for a tool that interacts with local files and performs extraction.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It explains that 'pages' accepts 'page numbers separated in comma' and supports 'negative page index number', which adds meaning for one parameter. However, it doesn't clarify 'pdf_path' (e.g., file path format, supported locations) or other details, leaving gaps for the 2 parameters overall.

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 verb 'extract' and the resource 'contents from a local PDF file', making the purpose understandable. It specifies the scope of extraction (by page numbers) but doesn't distinguish from siblings since none exist, so it cannot achieve a perfect score of 5.

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, prerequisites, or exclusions. It mentions 'negative page index number supported' which hints at a feature but doesn't clarify usage context or limitations.

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

TDQS

C2.9/5.0
Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap with other tools. The tool's purpose is clearly defined as extracting contents from PDF files, making it impossible for an agent to confuse it with another tool.

Naming Consistency5/5

Since there is only one tool, naming consistency is inherently perfect. The tool name 'extract-pdf-contents' follows a clear verb-noun pattern, and there are no other tools to deviate from or conflict with this pattern.

Tool Count2/5

A single tool for a PDF extraction server is too minimal for the apparent scope. While the tool handles content extraction, typical PDF operations like metadata retrieval, text analysis, or format conversion are missing, making the server feel incomplete and underpowered for its domain.

Completeness2/5

The server is severely incomplete for PDF extraction. It only provides content extraction with page selection, lacking essential operations such as getting metadata, extracting images, converting to other formats, or searching within PDFs. This will likely cause agent failures when broader PDF tasks are required.

Maintenance

ActivityInactive
ResponsivenessSyncing

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
    An MCP server that provides comprehensive PDF processing capabilities including text extraction, image extraction, table detection, annotation extraction, metadata retrieval, page rendering, and document structure analysis.
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that provides tools for reading, writing, and manipulating PDF files, including text extraction, metadata retrieval, and merging or splitting documents. It also enables users to create PDFs from plain text and convert specific pages or entire documents into images.
    53
    ISC
  • F
    license
    Not graded
    quality
    D
    maintenance
    MCP server for extracting text from PDF files, supporting local files and URLs.

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/xraywu/mcp-pdf-extraction-server'

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