home / mcp / pdf redaction mcp server

PDF Redaction MCP Server

Provides a Python MCP server to load PDFs, redact text in batches, track redactions, and save redacted documents.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "marc-hanheide-redact_mcp": {
      "command": "python",
      "args": [
        "-m",
        "redact_mcp.server"
      ]
    }
  }
}

You can load PDFs, identify sensitive text, and apply redactions with a dedicated MCP server that uses PyMuPDF. It supports batch redaction, an audit trail of applied redactions, area-based redaction, and saving redacted documents for secure sharing or review.

How to use

Start the server and connect with an MCP client to load PDFs, review content, and apply redactions. Use the load, redact, and save operations in sequence to manage sensitive information efficiently. You can redact multiple texts at once to minimize passes over the document, review what has been redacted, and finally save the redacted PDF with an automatic or custom name.

Typical workflows include loading a PDF, reviewing its text content, batch redacting several sensitive strings, checking the redaction list, optionally redacting a specific page area, saving the redacted PDF, and closing the document to free resources.

Practical tips: - Redacting multiple texts in one step is faster and reduces processing overhead. - Use area-based redaction for known coordinates when text cannot be reliably matched. - Always save after applying redactions to commit changes to disk.

How to install

# Clone the project repository
git clone <your-repo-url>
cd redact_mcp

# Install in editable mode using the uv package manager
uv pip install -e .

Other important notes

Run the server using either the Python runtime or the FastMCP CLI. The Python option starts a stdio-based MCP server, while the CLI option uses the MCP protocol over its transport layer.

The server supports the following operations to manage PDFs and redactions. You can load PDFs, redact by text or by area, save redacted PDFs, list loaded PDFs and applied redactions, and close PDFs when finished.

Available tools

load_pdf

Load a PDF file and extract its text content, returning the full text organized by pages.

redact_text

Redact one or more specified texts in a loaded PDF. Supports batch redaction and automatically tracks already-redacted texts to avoid duplicates.

redact_area

Redact a specific rectangular area on a PDF page using coordinates.

save_redacted_pdf

Apply all pending redactions and save the PDF, producing a redacted version with an automatic or custom filename.

list_loaded_pdfs

List all PDFs currently loaded in memory with their page counts.

list_applied_redactions

List all redactions that have been applied to loaded PDFs to show what has been redacted.

close_pdf

Close a loaded PDF and free its resources, clearing any associated redaction state.