Skip to main content
Glama

pdf-mcp

An MCP server for reading, rendering, and searching PDF files. Built with PyMuPDF and PyMuPDF4LLM.

Designed for use with LLMs that need to read datasheets and other PDFs containing diagrams, tables, and technical content.

Tools

Tool

Description

get_pdf_info

Get metadata about a PDF (page count, author, title, etc.)

get_table_of_contents

Get the outline/bookmarks with page numbers for each section

get_page_text

Extract text from a page range in json (default), text, markdown, or html format. Optionally exclude headers/footers

get_page_image

Render a single page as a PNG image, returned as base64 or written to a temp file. Configurable DPI (default 150)

search_text

Case-insensitive text search across the entire PDF, returning page numbers and surrounding context

All requests are stateless and take the PDF filename as a parameter.

Related MCP server: MCP PDF Reader

Setup

Add the following to your .mcp.json:

{
  "mcpServers": {
    "pdf-mcp": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/I-CAN-hack/pdf-mcp.git", "pdf-mcp"]
    }
  }
}

Or for codex run codex mcp add pdf-mcp -- uvx --from git+https://github.com/I-CAN-hack/pdf-mcp.git pdf-mcp.

This will automatically install and run the server using uvx.

Development

# Install dependencies
uv sync

# Generate test PDFs
uv run python assets/generate.py

# Run tests
uv run pytest tests/ -v

# Run the server locally
uv run pdf-mcp

Available Tools

5 tools
get_page_imageA

Render a single PDF page as a PNG image.

Args:
    filename: Path to a PDF file.
    page: Page number (1-indexed).
    dpi: Image resolution. Default 150 (good balance of readability and size).
    output: "base64" returns the image inline as MCP image content.
            "file" writes to a temp file and returns the path.
ParametersJSON Schema
NameRequiredDescriptionDefault
filenameYes
pageNo
dpiNo
outputNobase64

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden. It successfully discloses the 1-indexed page numbering and the behavioral difference between 'base64' (inline MCP content) and 'file' (temp path) output modes. However, it omits safety declarations (read-only vs. destructive), error handling for invalid pages, and temp file cleanup behavior.

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 Args-section structure efficiently organizes parameter documentation. While slightly programmatic in tone, every sentence earns its place—particularly the DPI guidance explaining the trade-off between readability and file size. No redundant information.

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 zero schema coverage and no output schema, the description adequately covers inputs and explains return value behaviors (base64 vs file path). Minor gaps remain regarding error conditions and file system safety (read-only nature).

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

Parameters5/5

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

With 0% schema description coverage (titles only), the description comprehensively compensates by documenting all four parameters: filename as 'Path to a PDF file', page as '1-indexed', dpi with resolution guidance and rationale for the default, and output with detailed enum semantics.

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 states 'Render a single PDF page as a PNG image', providing a specific verb (render), resource (PDF page), and output format (PNG). The 'single' qualifier and image format implicitly distinguish it from sibling get_page_text and get_pdf_info, though it does not explicitly contrast with alternatives.

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 explicit guidance on when to select this tool versus siblings like get_page_text (visual analysis vs. text extraction) or search_text. It explains the 'how' of the output parameter but not the 'when' of tool selection.

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

get_page_textA

Extract text content from one or more PDF pages.

Args:
    filename: Path to a PDF file.
    start_page: First page number (1-indexed, inclusive).
    end_page: Last page number (1-indexed, inclusive). Defaults to start_page.
    format: Output format. "json" returns structured page data with block/line/span
            detail. "text" returns plain text. "markdown" returns markdown via
            PyMuPDF4LLM. "html" returns HTML.
    include_headers_footers: If False, crops top/bottom margins to exclude
                             headers and footers. Default True.
ParametersJSON Schema
NameRequiredDescriptionDefault
filenameYes
start_pageNo
end_pageNo
formatNojson
include_headers_footersNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior4/5

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

No annotations provided, so description carries full burden. Discloses critical behavioral details: 1-indexed page numbering, inclusive ranges, end_page defaults to start_page, cropping logic for headers/footers, and distinguishes four output formats (including implementation detail PyMuPDF4LLM). Minor gap: no mention of error handling for missing files or invalid page ranges.

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?

Front-loaded purpose statement followed by structured Args documentation. Every sentence provides necessary detail given zero schema coverage. Format explanations are particularly dense and useful. Slightly verbose structure (Args header style) but appropriate for the information density required.

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 existence of output schema (has_output_schema: true), description appropriately avoids duplicating return value specification while still explaining format variations. Complete parameter documentation compensates for empty schema descriptions. Minor gap: no mention of performance characteristics for large page ranges.

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

Parameters5/5

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

Schema description coverage is 0%, requiring heavy description compensation. Args section thoroughly documents all 5 parameters: filename (path), start_page/end_page (indexing semantics), format (detailed enum explanations for all four options including structured vs plain output), and include_headers_footers (cropping behavior). Excellent semantic coverage given schema limitations.

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?

Opening sentence 'Extract text content from one or more PDF pages' provides specific verb (Extract), resource (text content), and scope (PDF pages). Implicitly distinguishes from sibling get_page_image (images vs text) and search_text (extraction vs search).

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?

No explicit guidance on when to use this tool versus siblings like search_text (which finds specific text) or get_table_of_contents. No prerequisites mentioned (file existence, PDF validity) or when to prefer text vs markdown formats.

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

get_pdf_infoB

Get metadata and basic info about a PDF file.

Args:
    filename: Path to a PDF file.
ParametersJSON Schema
NameRequiredDescriptionDefault
filenameYes

TDQS

B3.3/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 fails to mention that this is a read-only operation, what format the metadata is returned in (JSON, string, object?), or what happens if the file is not found or invalid.

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 efficiently structured with a clear single-sentence purpose followed by Args documentation. No wasted words, though the 'Args:' section is slightly informal compared to natural language descriptions.

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?

For a single-parameter tool with no output schema, the description covers the basics but could improve by hinting at what metadata fields are returned (e.g., page count, author, creation date) to help agents confirm this is the correct tool for their needs.

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

Parameters4/5

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

With 0% schema description coverage (only 'title': 'Filename' in schema), the description compensates by documenting the parameter: 'Path to a PDF file.' This clarifies it expects a file path string and implies the file type constraint, adding essential meaning missing from the structured schema.

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 states a specific verb ('Get') and resource ('PDF file') with clear scope ('metadata and basic info'). It implicitly distinguishes from content-extraction siblings (get_page_text, get_page_image) by focusing on file-level properties rather than page content, though it doesn't explicitly name the siblings.

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 provides implied usage through the scope ('metadata' vs content), but lacks explicit guidance on when to use this versus get_page_text for text extraction or search_text for searching. No 'when-not-to-use' or prerequisites are mentioned.

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

get_table_of_contentsA

Get the table of contents (bookmarks/outline) from a PDF.

When max_level is not specified and the TOC is very large, the depth is automatically
reduced to keep the response manageable. The response will include an
``auto_trimmed_to_level`` field and a hint when this happens.

Args:
    filename: Path to a PDF file.
    parent: Return only children of the entry whose title contains this string
            (case-insensitive). For example, pass a chapter title to get its sections.
    max_level: Only include entries up to this depth (1=chapters only, 2=sections, etc.).
               When used with parent, levels are relative: 1 means direct children only,
               2 means children and grandchildren, etc.
ParametersJSON Schema
NameRequiredDescriptionDefault
filenameYes
parentNo
max_levelNo

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, description carries full burden and discloses important behavioral traits: automatic depth reduction for large TOCs and the presence of an auto_trimmed_to_level response field. However, omits discussion of error conditions (missing file, malformed PDF) or idempotency guarantees.

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?

Well-structured with purpose front-loaded, followed by behavioral note, then structured Args documentation. No wasted words. Minor improvement possible: the auto-trimming sentence could be split for clarity, but overall efficient for the information density provided.

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 zero schema coverage, no annotations, and no output schema, the description achieves strong completeness by documenting the output field auto_trimmed_to_level and explaining parameter interactions. Would benefit from brief note on return structure format (array/tree).

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

Parameters5/5

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

Excellent compensation for 0% schema coverage. Args section provides rich semantics for all 3 parameters: filename is clarified as 'Path to a PDF file'; parent includes filtering logic, case-sensitivity note, and concrete example ('pass a chapter title'); max_level includes numeric mapping (1=chapters) and relative behavior with parent.

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?

Description opens with specific verb+resource: 'Get the table of contents (bookmarks/outline) from a PDF.' This clearly distinguishes from siblings like get_page_text (content extraction) and get_pdf_info (general metadata) by specifying navigation structure extraction.

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?

Provides implicit guidance through explaining auto-trimming behavior when max_level is omitted and complex interactions between parent/max_level parameters. However, lacks explicit 'when to use vs alternatives' (e.g., when to prefer this over get_pdf_info for document structure).

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

search_textA

Search for text in a PDF file (case-insensitive).

Returns a list of hits with page number and surrounding context.

Args:
    filename: Path to a PDF file.
    query: Text to search for.
    context_chars: Characters of context to include around each hit. Default 100.
ParametersJSON Schema
NameRequiredDescriptionDefault
filenameYes
queryYes
context_charsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden. It successfully discloses that the search is case-insensitive and describes the return structure ('list of hits with page number and surrounding context'). It misses edge case handling (empty results, malformed PDFs) but covers the essential behavioral contract.

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 well-structured with the purpose first, followed by return value summary, then the Args section. While the Args section adds length, it is necessary given the 0% schema coverage and follows standard documentation conventions. No sentences appear wasted or redundant.

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 that an output schema exists, the brief summary of return values is sufficient. All three parameters are documented despite poor schema coverage. For a straightforward search utility with obvious read-only semantics, the description provides adequate context for an agent to invoke the tool correctly.

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

Parameters5/5

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

Schema description coverage is 0% (only titles provided). The description fully compensates by documenting all three parameters in the Args section: filename as 'Path to a PDF file', query as 'Text to search for', and context_chars with both semantics and default value. This is exemplary compensation for schema deficiencies.

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 action ('Search for text'), the resource ('in a PDF file'), and a key behavioral trait ('case-insensitive'). The 'search' verb effectively distinguishes this from sibling 'get_' tools that extract content by location rather than content matching.

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?

While the purpose is clear, the description provides only implied usage guidance based on the verb 'search' versus siblings' 'get' operations. It does not explicitly state when to use this versus get_page_text (e.g., 'use this when looking for specific text across the document, use get_page_text to extract all text from a specific page').

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

TDQS

A4/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose with no overlap: get_page_image renders visual content, get_page_text extracts textual content, get_pdf_info provides metadata, get_table_of_contents retrieves structural outline, and search_text performs text search. The descriptions reinforce these distinct functions, making tool selection unambiguous.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern with 'get_' or 'search_' prefixes (get_page_image, get_page_text, get_pdf_info, get_table_of_contents, search_text). The naming convention is perfectly uniform across all five tools, using snake_case throughout without any deviations.

Tool Count5/5

Five tools is well-scoped for a PDF processing server, covering core operations without bloat. Each tool serves a specific, essential function (rendering, text extraction, metadata, navigation, and search), making the count appropriate and efficient for the domain.

Completeness4/5

The toolset covers most fundamental PDF operations well, including reading, extracting, navigating, and searching. A minor gap exists in write/modify operations (e.g., merging, splitting, or annotating PDFs), but the provided tools are sufficient for common agent workflows involving PDF analysis and content retrieval.

Maintenance

ActivitySlowing
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

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/I-CAN-hack/pdf-mcp'

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