Sandbox
@postralai/masquerade

MCP server for PDF redaction and pseudonymization

Masquerade connects an MCP client to a PDF redaction workflow. You give it a file path, it extracts text, sends it to Tinfoil to detect sensitive data, and produces a redacted PDF plus a summary of what was removed. It is meant to keep raw documents out of the LLM prompt while still letting you work with the content.

78 stars21 forksPythonUpdated 1y ago
Who it's for

Builders who want to send PDFs to an MCP-capable agent without exposing names, emails, dates, or other sensitive text.

What it delivers

You can review a redacted PDF and masked summary instead of handing raw confidential documents to your agent.

What it does

PDF text extraction

Reads a PDF from a file path and converts it to text through MCP.

Sensitive data detection

Sends the extracted text to Tinfoil to find names, emails, dates, and entities.

PDF redaction

Creates a redacted PDF with the sensitive text removed or masked.

Redaction preview

Returns masked examples, per-page redaction counts, and the path to the redacted file.

Claude desktop setup

Includes automated and manual setup steps for wiring the MCP server into Claude desktop.

How to get it

  1. 1Configure environment
    curl -O https://raw.githubusercontent.com/postralai/masquerade/main/setup.sh && bash setup.sh
  2. 2Create a virtual environment with Python ">=3.10, <=3.12"
    python3.12 -m venv pdfmcp
    source pdfmcp/bin/activate
    python --version
  3. 3Install this repo with the command below
    pip install git+https://github.com/postralai/masquerade@main
  4. 4Automate the Claude config setup (and skip the next steps)
    python -m masquerade.configure_claude

README

Masquerade MCP: Redact. Replace. Retain Control.

Demo video

🤐 Problem: Tools like Claude or GPT are incredibly powerful, but they require raw input. If you're dealing with contracts, medical records, or internal documents, that's risky.

🛡️ Solution: Masquerade acts as a privacy firewall for your files. Just paste in the file path to a PDF, and Masquerade will:

  • Automatically detect sensitive data (names, emails, dates, entities)
  • Redact the sensitive data
  • Let you preview before sending to an LLM

Architecture

Image

  1. User Input: The user asks Claude to redact a PDF by providing its file path.
  2. PDF Processing: MCP reads the PDF and converts it to text.
  3. Sensitive Data Detection: The text is sent to Tinfoil (an isolated AI platform using Llama 3.3 70B) to identify sensitive data.
  4. Redaction: MCP removes the sensitive data and creates a redacted PDF.
  5. Summary Return: MCP sends Claude a summary with:
    • Masked versions of the sensitive data
    • Redaction counts per page
    • The path to the redacted file
  6. Quering PDF with Claude: The user can upload the redacted PDF to Claude if satisfied with the redactions.

Installation

Setup video

  1. Install Claude desktop
  2. Get Tinfoil API key (create account and API key)
  3. Configure environment
Option 1: Automated
curl -O https://raw.githubusercontent.com/postralai/masquerade/main/setup.sh && bash setup.sh
  1. Restart Claude desktop app (if successfully configured)
Option 2: Manual (click to expand)
  1. Create a virtual environment with Python ">=3.10, <=3.12"
python3.12 -m venv pdfmcp
source pdfmcp/bin/activate
python --version
  1. Install this repo with the command below
pip install git+https://github.com/postralai/masquerade@main
  1. Automate the Claude config setup (and skip the next steps)
python -m masquerade.configure_claude
  1. Get Python path: which python
  2. Get MCP file path: python -c "import masquerade as m; print(f'{m.__path__[0]}/mcp_pdf_redaction.py')"
  3. Add (1) Python path, (2) MCP file path, and (3) Tinfoil API key to the JSON below and add that to claude_desktop_config.json. Instructions to find the config file are in the image below.
  4. Restart Claude
{
  "mcpServers": {
    "pdf-redaction": {
      "command": "/path/to/python", // Run `which python`
      "args": ["/path/to/mcp_pdf_redaction.py"], // Run `python -c "import masquerade as m; print(f'{m.__path__[0]}/mcp_pdf_redaction.py')"`
      "env": {
        "TINFOIL_API_KEY": "your_api_key" // Create Tinfoil account and paste API key
      }
    }
  }
}

Image

How to use?

  1. Prompt Claude: "Redact sensitive information from this PDF: /path/to/filename.pdf"
  2. MCP opens the redacted and highlighted PDF files
  3. Manually upload the redacted PDF to Claude for quering

Note: Don't upload the original PDF to Claude, only the file path.

Contributing

If you have a fix or improvement, feel free to submit a pull request. For significant changes, please open an issue first to discuss your proposed updates.

See the Developer section for the installation of this repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Need Help?

For questions and common issues, please see the FAQ section or open an issue on GitHub.

Files in the repo

Repository payload8 top-level entries
  • docs
  • src
  • .gitignore
  • LICENSE
  • LICENSED-MATERIALS.txt
  • pyproject.toml
  • README.md
  • setup.sh

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k

x64dbg-MCP Server is a native MCP (Model Context Protocol) plugin for x64dbg that exposes the debugger's full functionality over HTTP. Connect any MCP-compatible AI assistant and control x64dbg programmatically: set breakpoints, step through code, read memory, dump registers, and more. Built with Zig — zero dependencies, single-binary output, cros

1.9k

Context7 Platform -- Up-to-date code documentation for LLMs and AI code editors

62k
1 add

Minimal Coding Agent Harness on MCP for ChatGPT, Claude, Hermes, Grok Bot, OpenClaw

4.6k

Fast and Accurate Code Search for Agents. Uses 99% fewer tokens than grep+read

6k