Skip to main content
Glama
mlorentedev

pdf-modifier-mcp

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": true
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
extensions
{
  "io.modelcontextprotocol/ui": {}
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
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.

Args: input_path: Absolute path to the PDF file to analyze. Must be a valid, accessible PDF file. password: Optional password if the PDF is encrypted.

Returns: JSON string containing the complete page structure. On error, returns JSON with success=false and error details.

Example: read_pdf_structure("/home/user/documents/invoice.pdf")

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

Args: input_path: Absolute path to the PDF file to inspect. terms: List of text strings to search for (1-50 terms). Each term is searched as a substring. password: Optional password if the PDF is encrypted.

Returns: JSON string with all matches and their font properties. Returns empty matches array if no terms are found.

Example: inspect_pdf_fonts("/path/to/doc.pdf", ["Invoice", "$99.99", "Total"])

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"}

Args: input_path: Absolute path to the source PDF file. output_path: Absolute path where the modified PDF will be saved. Parent directory must exist. replacements: Dictionary mapping old text to new text. Keys are search strings (or regex if use_regex=true). Values are replacement strings (optionally with |URL). use_regex: If true, treat replacement keys as regex patterns. Default is false for literal string matching. password: Optional password if the source PDF is encrypted.

Returns: JSON string with modification results including: - success: boolean indicating if operation completed - replacements_made: count of text spans modified - pages_modified: count of pages with changes - warnings: any non-fatal issues encountered

Examples: # Simple text replacement modify_pdf_content( "/path/input.pdf", "/path/output.pdf", {"$99.99": "$149.99", "Draft": "Final"} )

# Regex replacement for dates
modify_pdf_content(
    "/path/input.pdf",
    "/path/output.pdf",
    {"\d{2}/\d{2}/\d{4}": "01/01/2025"},
    use_regex=True
)

# Create hyperlink
modify_pdf_content(
    "/path/input.pdf",
    "/path/output.pdf",
    {"Learn More": "Visit Website|https://example.com"}
)
list_pdf_hyperlinksA

Extract all existing hyperlinks and clickable URIs from a PDF.

Use this tool to inventory the links in a document before or after making modifications. It reports the target URI, its location (bbox), and the text covered by the link if detectable.

Args: input_path: Absolute path to the PDF file to scan. password: Optional password if the PDF is encrypted.

Returns: JSON string with the inventory of found hyperlinks.

Example: list_pdf_hyperlinks("/path/to/report.pdf")

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.

Args: input_paths: List of absolute paths to input PDF files. output_dir: Directory where modified PDFs will be saved. replacements: Dictionary mapping old text to new text. use_regex: If true, treat keys as regex patterns. password: Optional password if PDFs are encrypted.

Returns: JSON string with batch results including per-file status.

Example: batch_modify_pdf_content( ["/path/a.pdf", "/path/b.pdf"], "/path/output", {"Draft": "Final", "2024": "2025"} )

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

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