Skip to main content
Glama
mlorentedev

pdf-modifier-mcp

by mlorentedev

PDF Modifier MCP

CLI + MCP server + Web UI for PDF text replacement with font style preservation.

CI PyPI Python 3.12+ Docs License: MIT

Quick start

pip install pdf-modifier-mcp

# CLI
pdf-mod modify input.pdf output.pdf -r "Draft=Final"

# MCP server (for Claude/Cursor/Codex)
claude mcp add -s user pdf-modifier -- uvx pdf-modifier-mcp

Related MCP server: pdf-navigator-mcp

Interfaces

Interface

Description

Run

CLI

pdf-mod — batch jobs, scripting, CI pipelines

make run cli ARGS="..."

MCP Server

pdf-modifier-mcp — AI agents edit PDFs

make run mcp

Web UI

FastAPI + SvelteKit — drag & drop, preview, replace

make up (Docker) or make run api + make run frontend

Features

  • Text replacement — find and replace with font style preservation (family, weight, size, color)

  • Regex support — pattern-based bulk replacements (--regex)

  • Hyperlinks — create clickable links or neutralize existing ones

  • Batch processing — apply same replacements to multiple files

  • Web UI — drag & drop PDF upload, structure browser, page preview with zoom, text highlighting

  • MCP toolsread_pdf_structure, inspect_pdf_fonts, list_pdf_hyperlinks, modify_pdf_content

Development

# Setup
make setup

# Run tests
make test

# Full check (lint + type + test)
make check

# Start dev stack (Docker)
make up
# API: http://localhost:8000 | Web: http://localhost:8080

# Start servers locally
make run api          # FastAPI dev server
make run frontend     # SvelteKit dev server

Documentation

License

MIT

Available Tools

6 tools
batch_modify_pdf_contentA

Apply the same text replacements to multiple PDF files at once.

Each file is processed independently -- a failure in one file does not stop the rest of the batch. Output files are written to output_dir using the same filename as the input.

ParametersJSON Schema
NameRequiredDescriptionDefault
input_pathsYesList of absolute paths to input PDF files.
output_dirYesDirectory where modified PDFs will be saved.
replacementsYesDictionary mapping old text to new text.
use_regexNoIf true, treat keys as regex patterns.
passwordNoOptional password if PDFs are encrypted.
max_file_sizeNoMaximum allowed input file size in bytes (default: 100 MB).

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?

Without annotations, the description discloses key behaviors: independent file processing, failure tolerance, and output naming. It does not cover all edge cases but adds useful context beyond the input schema.

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 extremely concise with three sentences, front-loading the purpose and adding necessary behavioral details without any fluff.

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 presence of an output schema, the description covers core functionality and output behavior. It lacks details on error handling and prerequisites but is adequate for a batch tool.

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?

Schema coverage is 100%, providing baseline. The description adds value by specifying that output files keep the same filename as input, which is not in the schema, thus improving parameter understanding.

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 tool's purpose: 'Apply the same text replacements to multiple PDF files at once.' It uses a specific verb and resource, and the name 'batch' distinguishes it from the sibling 'modify_pdf_content'.

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 mentions that each file is processed independently, implying batch use, but does not explicitly specify when to use this tool versus alternatives like 'modify_pdf_content' or when not to use it.

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

extract_embedded_fontsA

Extract metadata and buffers of all embedded fonts in a PDF.

Use this tool to inspect which fonts are actually embedded in a document. Custom fonts (TrueType, OpenType) appear as Type0 with their binary buffer. Base 14 system fonts (Helvetica, Times, Courier) are NOT embedded and will not appear in the results.

ParametersJSON Schema
NameRequiredDescriptionDefault
input_pathYesAbsolute path to the PDF file to inspect.
passwordNoOptional password if the PDF is encrypted.
max_file_sizeNoMaximum allowed input file size in bytes (default: 100 MB).

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/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. It explains output includes metadata and binary buffers for embedded custom fonts, and that Base 14 fonts are absent. Implies read-only behavior and file input, but does not elaborate on file size or password handling beyond schema.

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?

Three sentences: main action, use case, and key exclusion. Every sentence adds value, no redundant words. Front-loaded with core purpose.

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

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given output schema exists and low complexity, description covers essential: what it does, which fonts are included/excluded, and why. Sufficient 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 coverage is 100%, so schema already documents all parameters. Description adds no new parameter-specific details, but does clarify overall input-output relationship.

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 clearly states 'Extract metadata and buffers of all embedded fonts in a PDF' and distinguishes between custom fonts (Type0 with buffer) and Base 14 system fonts that are not embedded. This differentiates it from sibling tools like inspect_pdf_fonts.

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

Usage Guidelines4/5

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

Explicitly tells when to use ('inspect which fonts are actually embedded') and what fonts are excluded (Base 14). However, it does not mention when not to use or provide alternatives among siblings.

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

inspect_pdf_fontsA

Search for specific text terms and report their font properties.

Use this tool to understand the exact font styling of text you want to replace. This ensures replacements will match the surrounding document style as closely as possible.

The tool searches through all pages and returns matches with:

  • Page number where the term was found

  • The search term that matched

  • Surrounding context (first 100 characters)

  • Font name (e.g., "Helvetica-Bold", "Times-Roman")

  • Font size in points

  • Origin coordinates for precise positioning

ParametersJSON Schema
NameRequiredDescriptionDefault
input_pathYesAbsolute path to the PDF file to inspect.
termsYesList of text strings to search for (1-50 terms). Each term is searched as a substring.
passwordNoOptional password if the PDF is encrypted.
max_file_sizeNoMaximum allowed input file size in bytes (default: 100 MB).

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, the description carries full burden. It states the tool 'searches through all pages' and lists returned fields (page number, context, font name, etc.). It discloses no destructive behavior and is transparent about its read-only nature.

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 paragraphs, concise, and front-loaded with purpose. Every sentence adds value. No wasted words.

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 presence of an output schema, the description need not detail return values, but it does list them. It covers the core functionality, use case, and output fields. It is complete for an inspection tool, though error handling or performance notes could be added.

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 coverage is 100%, so baseline is 3. The description adds context about usage for replacements but does not add new information about individual parameters beyond the schema descriptions.

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 tool's purpose: 'Search for specific text terms and report their font properties.' It distinguishes from siblings like 'modify_pdf_content' (modify) and 'extract_embedded_fonts' (extract fonts). The verb 'search' and resource 'PDF fonts' are specific.

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

Usage Guidelines4/5

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

The description provides explicit guidance: 'Use this tool to understand the exact font styling of text you want to replace.' This gives a clear use case. It does not explicitly mention when not to use or name alternative tools, but the context is clear.

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

modify_pdf_contentA

Find and replace text in a PDF while preserving font styles.

This tool performs text replacement by:

  1. Locating all occurrences of the search text

  2. Redacting the original text (white fill)

  3. Inserting the replacement text with matched styling

IMPORTANT BEHAVIORS:

  • Text is matched within individual text spans

  • Font style is approximated using Base 14 fonts (Helvetica, Times, Courier)

  • Replacement text should be similar length to avoid overlap

  • Multiple replacements can be specified in a single call

HYPERLINK SUPPORT:

  • Append "|URL" to create a clickable link: "Click Here|https://example.com"

  • Use "|void(0)" to neutralize existing links: "Product|void(0)"

REGEX SUPPORT:

  • Set use_regex=true to treat keys as regex patterns

  • Useful for matching dates, IDs, or variable content

  • Example: {"Order #\d+": "Order #REDACTED"}

PAGE RANGE:

  • Use pages="1-3" to process only pages 1 through 3 (1-indexed, inclusive)

  • Use pages="5" to process only page 5

  • Omit to process all pages

ParametersJSON Schema
NameRequiredDescriptionDefault
input_pathYesAbsolute path to the source PDF file.
output_pathYesAbsolute path where the modified PDF will be saved. Parent directory must exist.
replacementsYesDictionary mapping old text to new text. Keys are search strings (or regex if use_regex=true). Values are replacement strings (optionally with |URL).
use_regexNoIf true, treat replacement keys as regex patterns. Default is false for literal string matching.
passwordNoOptional password if the source PDF is encrypted.
pagesNoOptional page range, e.g. "1-3" or "5". Defaults to all pages.
max_file_sizeNoMaximum allowed input file size in bytes (default: 100 MB).

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/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. It discloses text matching within spans, font approximation using Base 14 fonts, replacement length concerns, and hyperlink/date features. Lacks mention of potential side effects like irreversibility or permission requirements.

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 clear headings and bullet points. Each section serves a purpose without redundancy. Slightly lengthy but justified by the complexity of features (hyperlink, regex, page range).

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?

Covers main behaviors, edge cases (hyperlink, regex, password), and max file size. Output schema exists, so return value details are unnecessary. Could mention layout changes due to font approximation, but overall sufficiently comprehensive.

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?

Schema has 100% description coverage, but description adds significant value beyond schema: explains hyperlink syntax for replacements, regex format, page range formatting, and max_file_size default. Provides clear examples that schema alone does not.

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 clearly states the tool finds and replaces text in a PDF while preserving font styles. It details the process (locate, redact, insert) and distinguishes from siblings like batch_modify_pdf_content or list_pdf_hyperlinks by focusing on single-file content modification.

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

Usage Guidelines4/5

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

Provides clear usage sections for important behaviors, hyperlinks, regex, and page ranges. Implicitly distinguishes from batch_modify_pdf_content for multi-file tasks, but lacks explicit when-not-to-use guidance or direct sibling comparisons.

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

read_pdf_structureA

Extract the complete structural content of a PDF document.

Returns detailed information about each page including:

  • Page dimensions (width, height)

  • All text elements with their:

    • Exact text content

    • Bounding box coordinates (x0, y0, x1, y1)

    • Origin point for text insertion

    • Font name and size

    • Color value

Use this tool FIRST to understand the document layout before making any modifications. The output helps identify exact text to target for replacements.

ParametersJSON Schema
NameRequiredDescriptionDefault
input_pathYesAbsolute path to the PDF file to analyze. Must be a valid, accessible PDF file.
passwordNoOptional password if the PDF is encrypted.
max_file_sizeNoMaximum allowed input file size in bytes (default: 100 MB).

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.4/5.0
Behavior4/5

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

No annotations, but description fully explains tool behavior: read-only extraction of structural content. Discloses what is returned but doesn't mention file locking or performance; still sufficient for a read tool.

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?

Description is well-structured: single sentence stating purpose, bulleted output details, and a usage directive. No redundant sentences; every part earns its place.

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 output schema exists, description complements it by explaining output structure. Covers purpose, parameters, and usage. Could add edge-case behavior but overall adequately complete.

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 baseline is 3. Description adds no additional parameter meaning beyond what schema provides; it lists output fields instead of detailing input parameters.

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 clearly states verb+resource: 'Extract the complete structural content of a PDF document.' Details output (page dimensions, text elements with coordinates, fonts, color) and distinguishes from sibling modification tools.

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

Usage Guidelines5/5

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

Explicit guidance: 'Use this tool FIRST to understand the document layout before making any modifications.' Implies alternatives are the sibling tools involving modifications.

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. 6 tool updatesv1.6.0
    • Changedbatch_modify_pdf_content1 field changed
      • addedInput schema / properties / max_file_size
        Added value: +{
        +  "default": 104857600,
        +  "description": "Maximum allowed input file size in bytes (default: 100 MB).",
        +  "type": "integer"
        +}
    • Changedextract_embedded_fonts1 field changed
      • addedInput schema / properties / max_file_size
        Added value: +{
        +  "default": 104857600,
        +  "description": "Maximum allowed input file size in bytes (default: 100 MB).",
        +  "type": "integer"
        +}
    • Changedinspect_pdf_fonts1 field changed
      • addedInput schema / properties / max_file_size
        Added value: +{
        +  "default": 104857600,
        +  "description": "Maximum allowed input file size in bytes (default: 100 MB).",
        +  "type": "integer"
        +}
    • Changedlist_pdf_hyperlinks1 field changed
      • addedInput schema / properties / max_file_size
        Added value: +{
        +  "default": 104857600,
        +  "description": "Maximum allowed input file size in bytes (default: 100 MB).",
        +  "type": "integer"
        +}
    • Changedmodify_pdf_content1 field changed
      • addedInput schema / properties / max_file_size
        Added value: +{
        +  "default": 104857600,
        +  "description": "Maximum allowed input file size in bytes (default: 100 MB).",
        +  "type": "integer"
        +}
    • Changedread_pdf_structure1 field changed
      • addedInput schema / properties / max_file_size
        Added value: +{
        +  "default": 104857600,
        +  "description": "Maximum allowed input file size in bytes (default: 100 MB).",
        +  "type": "integer"
        +}
  2. 6 tool updatesv1.5.0
    • Changedbatch_modify_pdf_content5 fields changed
      • addedInput schema / properties / input_paths / description
        Added value: +"List of absolute paths to input PDF files."
      • addedInput schema / properties / output_dir / description
        Added value: +"Directory where modified PDFs will be saved."
      • addedInput schema / properties / password / description
        Added value: +"Optional password if PDFs are encrypted."
      • addedInput schema / properties / replacements / description
        Added value: +"Dictionary mapping old text to new text."
      • addedInput schema / properties / use_regex / description
        Added value: +"If true, treat keys as regex patterns."
    • Addedextract_embedded_fonts
    • Changedinspect_pdf_fonts3 fields changed
      • addedInput schema / properties / input_path / description
        Added value: +"Absolute path to the PDF file to inspect."
      • addedInput schema / properties / password / description
        Added value: +"Optional password if the PDF is encrypted."
      • addedInput schema / properties / terms / description
        Added value: +"List of text strings to search for (1-50 terms).\n   Each term is searched as a substring."
    • Changedlist_pdf_hyperlinks2 fields changed
      • addedInput schema / properties / input_path / description
        Added value: +"Absolute path to the PDF file to scan."
      • addedInput schema / properties / password / description
        Added value: +"Optional password if the PDF is encrypted."
    • Changedmodify_pdf_content6 fields changed
      • addedInput schema / properties / input_path / description
        Added value: +"Absolute path to the source PDF file."
      • addedInput schema / properties / output_path / description
        Added value: +"Absolute path where the modified PDF will be saved.\n        Parent directory must exist."
      • addedInput schema / properties / pages
        Added value: +{
        +  "anyOf": [
        +    {
        +      "type": "string"
        +    },
        +    {
        +      "type": "null"
        +    }
        +  ],
        +  "default": null,
        +  "description": "Optional page range, e.g. \"1-3\" or \"5\". Defaults to all pages."
        +}
      • addedInput schema / properties / password / description
        Added value: +"Optional password if the source PDF is encrypted."
      • addedInput schema / properties / replacements / description
        Added value: +"Dictionary mapping old text to new text.\n         Keys are search strings (or regex if use_regex=true).\n         Values are replacement strings (optionally with |URL)."
      • addedInput schema / properties / use_regex / description
        Added value: +"If true, treat replacement keys as regex patterns.\n      Default is false for literal string matching."
    • Changedread_pdf_structure2 fields changed
      • addedInput schema / properties / input_path / description
        Added value: +"Absolute path to the PDF file to analyze.\n       Must be a valid, accessible PDF file."
      • addedInput schema / properties / password / description
        Added value: +"Optional password if the PDF is encrypted."
  3. 5 tool updatesv1.4.2
    • First observedbatch_modify_pdf_content
    • First observedinspect_pdf_fonts
    • First observedlist_pdf_hyperlinks
    • First observedmodify_pdf_content
    • First observedread_pdf_structure

TDQS

A4.3/5.0
Disambiguation4/5

Most tools are distinct: batch vs single modify, hyperlinks vs fonts. However, `inspect_pdf_fonts` (search text for font properties) and `read_pdf_structure` (full layout including fonts) could confuse an agent about which to use for font analysis.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with underscores (e.g., `modify_pdf_content`, `list_pdf_hyperlinks`). The only variation is the 'batch_' prefix, which clearly distinguishes batch operations from single operations.

Tool Count5/5

With 6 tools, the surface is well-scoped for PDF text modification: reading structure, inspecting fonts, extracting fonts, listing hyperlinks, and both single and batch modify. No tool feels redundant or missing for the intended domain.

Completeness4/5

The tool set covers the full workflow for text replacement and font inspection. Minor gaps exist, such as no tool for adding/removing pages or extracting images, but these are outside the stated focus on text modification.

Maintenance

ActivityMaintained
ResponsivenessWithin a week

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/mlorentedev/pdf-modifier-mcp'

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