Redact Sensitive Data from PDFs for LLMs
MCP server that reads PDFs, sends text to Tinfoil (Llama 3.3 70B) to identify sensitive data, redacts it, and returns a summary with masked data and redaction
Maintainer of this project? Claim this page to edit the listing.
1.0.0Add to Favorites
Why it matters
Securely process PDF documents by automatically detecting and redacting sensitive information before sending them to LLM models, ensuring data privacy.
Outcomes
What it gets done
Detect and redact names, emails, and dates from PDF documents.
Generate redacted PDF files with sensitive areas highlighted.
Provide a summary of masked data and redaction counts per page.
Integrate with isolated AI platforms for sensitive data detection.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-masquerade | bash Capabilities
Tools your agent gets
Detects and redacts sensitive data (names, emails, dates, entities) from PDF documents
Previews redacted data and sensitive areas before sending PDF to LLM
Generates a redacted PDF file with sensitive areas highlighted
Provides summary with masked sensitive data and redaction count per page
Overview
Masquerade MCP Server
PDF redaction MCP server using Tinfoil AI when you need to redact sensitive data from PDFs before LLM analysis
What it does
Big Job: Process PDFs containing sensitive information by redacting detected data before you decide whether to share with LLMs.
Small Job: Provide a file path to a PDF, and Masquerade reads the PDF, converts it to text, and sends it to Tinfoil (an isolated AI platform using Llama 3.3 70B) to identify sensitive data like names, emails, dates, and entities. The MCP server then removes the sensitive data, creates a redacted PDF, and sends Claude a summary with masked versions of the sensitive data, redaction counts per page, and the path to the redacted file. You can then manually upload the redacted PDF to Claude if satisfied with the redactions.
Install with the automated setup:
curl -O https://raw.githubusercontent.com/postralai/masquerade/main/setup.sh && bash setup.sh
Or configure manually in claude_desktop_config.json:
{
"mcpServers": {
"pdf-redaction": {
"command": "/path/to/python",
"args": ["/path/to/mcp_pdf_redaction.py"],
"env": {
"TINFOIL_API_KEY": "your_api_key"
}
}
}
}
Prompt Claude with "Redact sensitive information from this PDF: /path/to/filename.pdf" to process. The MCP opens the redacted and highlighted PDF files, then you manually upload the redacted PDF to Claude for querying.
Requires Python 3.10-3.12, Claude desktop app, and a Tinfoil API key.
Source README
Masquerade MCP: Redact. Replace. Retain Control.
🤐 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
- User Input: The user asks Claude to redact a PDF by providing its file path.
- PDF Processing: MCP reads the PDF and converts it to text.
- Sensitive Data Detection: The text is sent to Tinfoil (an isolated AI platform using Llama 3.3 70B) to identify sensitive data.
- Redaction: MCP removes the sensitive data and creates a redacted PDF.
- Summary Return: MCP sends Claude a summary with:
- Masked versions of the sensitive data
- Redaction counts per page
- The path to the redacted file
- Quering PDF with Claude: The user can upload the redacted PDF to Claude if satisfied with the redactions.
Installation
- Install Claude desktop
- Get Tinfoil API key (create account and API key)
- Configure environment
Option 1: Automated
curl -O https://raw.githubusercontent.com/postralai/masquerade/main/setup.sh && bash setup.sh
- Restart Claude desktop app (if successfully configured)
Option 2: Manual (click to expand)
- Create a virtual environment with Python ">=3.10, <=3.12"
python3.12 -m venv pdfmcp
source pdfmcp/bin/activate
python --version
- Install this repo with the command below
pip install git+https://github.com/postralai/masquerade@main
- Automate the Claude config setup (and skip the next steps)
python -m masquerade.configure_claude
- Get Python path:
which python - Get MCP file path:
python -c "import masquerade as m; print(f'{m.__path__[0]}/mcp_pdf_redaction.py')" - 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. - 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
}
}
}
}
How to use?
- Prompt Claude: "Redact sensitive information from this PDF: /path/to/filename.pdf"
- MCP opens the redacted and highlighted PDF files
- Manually upload the redacted PDF to Claude for quering
Note: Don't upload the original PDF to Claude, only the file path.
Need Help?
For questions and common issues, please see the FAQ section or open an issue on GitHub.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.