convez.ai
MCP ServerAutomaçãoIntermediário
mlorentedev

PDF Modifier MCP

mlorentedev/pdf-modifier-mcp

Edição nativa de PDFs para assistentes de IA com preservação de layout

Ver no GitHub
BomPluginScore · de 0 a 100

Servidor MCP que fornece ferramentas nativas para leitura, edição e redação de documentos PDF, eliminando a necessidade de scripts manuais. Preserva 100% do layout e estilos de fonte ao realizar substituições de texto, com suporte a regex e processamento em lote.

Instalação

$npx convez-ai mlorentedev/pdf-modifier-mcp

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
3
Forks
2
Acompanhando
0
Saúde
100%
Último commit
há 4 dias
Versão
v1.10.1
Issues abertas
52
Contribuidores
4

Casos de uso

  • Redação automática de informações sensíveis em documentos
  • Substituição em massa de texto em múltiplos PDFs
  • Extração de estrutura PDF para análise e processamento
  • Busca e inventário de hyperlinks em documentos

Veredito

Ferramenta sólida e bem-testada que integra manipulação de PDFs diretamente em workflows com Claude e outros assistentes. Resolve um problema real: reduz drasticamente o tempo de edição de documentos eliminando ciclos de debug de scripts, com garantia de preservação de layout.

README

A tradução para o português deste README ainda está na fila.

PDF Modifier MCP

CI PyPI codecov Python 3.12+ Docs License: MIT

Give your AI coding assistant the ability to natively read, edit, and redact PDF documents.

Most AI assistants can generate Python scripts to edit PDFs, but running them requires manual execution, debugging missing fonts, and fixing broken layouts. PDF Modifier is an MCP server that gives your AI direct, native tools to safely manipulate PDFs in place.

The numbers:

MetricWithout PDF Modifier MCPWith PDF Modifier MCP
WorkflowAI writes script -> You run it -> Debug errorsAI edits PDF directly via MCP
Time to redact 10 invoices~15 minutes (trial & error)Seconds (autonomous)
Layout preservationOften breaks styling or coordinates100% (Base 14 font matching)
InterfaceTerminal onlyNative AI Tools + CLI fallback

Quick Install (30 seconds)

One command. No cloning, no venv. Use user scope (-s user) so the tools are available across all your projects.

Claude Code

claude mcp add -s user pdf-modifier -- uvx --upgrade pdf-modifier-mcp

Gemini CLI

gemini mcp add -s user pdf-modifier uvx -- --upgrade pdf-modifier-mcp

OpenAI Codex CLI

Add to ~/.codex/config.toml:

[mcp_servers.pdf-modifier]
command = "uvx"
args = ["--upgrade", "pdf-modifier-mcp"]

GitHub Copilot (VS Code)

Add to .vscode/mcp.json or your User Settings:

{
  "mcp": {
    "servers": {
      "pdf-modifier": {
        "command": "uvx",
        "args": ["--upgrade", "pdf-modifier-mcp"]
      }
    }
  }
}

Then ask your assistant:

"Read the structure of invoice.pdf and redact all credit card numbers"

That's it. You're running.

What You Get

5 MCP Tools — PDF manipulation, on demand

ToolWhat it does
read_pdf_structureExtract complete PDF structure with text positions, sizes, and fonts
inspect_pdf_fontsSearch for terms and report their exact font properties
list_pdf_hyperlinksInventory all existing hyperlinks and URIs in the document
modify_pdf_contentFind and replace text (or regex) with strict style and layout preservation
batch_modify_pdf_contentApply the same replacements to multiple PDFs at once

CLI Interface (For Humans)

Still want to script it yourself? The package includes a powerful Typer CLI:

# Simple text replacement
pdf-mod modify input.pdf output.pdf -r "old text=new text"

# Inventory hyperlinks
pdf-mod links input.pdf

# Batch process multiple PDFs
pdf-mod batch *.pdf -o output/ -r "Draft=Final"

Regex replacement (dates, IDs, etc.)

pdf-mod modify input.pdf output.pdf -r "Order #\d+=Order #REDACTED" --regex

Create hyperlinks

pdf-mod modify input.pdf output.pdf -r "Click Here=Visit Site|https://example.com"


## Before / After

**Before PDF Modifier MCP** — Manual scripting workflow:
```python
# The AI generates a script like this for you to run:
import fitz
doc = fitz.open("invoice.pdf")
for page in doc:
    # Hope the AI calculated the rects and fonts correctly...
    page.insert_text((100, 100), "REDACTED", fontname="helv")
doc.save("out.pdf")

With PDF Modifier MCP — Autonomous AI action:

# The AI natively calls the tool without asking you to run scripts
modify_pdf_content(
    input_path="invoice.pdf",
    replacements={"pattern": r"\b\d{4}-\d{4}-\d{4}-\d{4}\b", "replacement": "XXXX-XXXX-XXXX-XXXX"},
    use_regex=True
)

Architecture

MCP Host (Claude, Gemini, Copilot)
  ↓ MCP protocol (stdio)
pdf-modifier-mcp (FastMCP Server)
  │
  ├── Core Layer (PDFModifier, PDFAnalyzer)
  │     ├── Regex matching & text extraction
  │     ├── Base 14 font fallback mapping
  │     └── Layout & coordinate preservation
  │
  └── PyMuPDF (fitz) Engine

Development

See CONTRIBUTING.md for setup, code standards, and PR workflow.

git clone https://github.com/mlorentedev/pdf-modifier-mcp.git
cd pdf-modifier-mcp
make setup     # create venv + install deps
make check     # lint + typecheck + test

License

MIT License - see LICENSE for details.

Documentation

Project-bound knowledge lives in docs/ (docs-as-code): ADRs, runbooks, troubleshooting, and lessons.

Ver o original no GitHub

Bom para

Relacionados