Doc Sanitizer MCP Server
Doc Sanitizer MCP Server
A local, containerized MCP (Model Context Protocol) server that uses a local LLM (via Ollama) to sanitize documents by removing or transforming PII before content is sent to public LLM services.
Features
Document Support: Word (.docx), PDF, Excel (.xlsx/.xls), CSV, Plain text, Email (.eml)
PII Detection: Names, emails, phone numbers, companies, addresses, financial data, IDs
Flexible Actions: Delete, invent synthetic data, or keep partial information
Profile Management: Create and manage multiple sanitization profiles via CLI
MCP Integration: Works with Claude Desktop, Claude.ai, and Claude Code
Privacy First: All processing happens locally - nothing sent to external services
Quick Start
Prerequisites
Docker and Docker Compose
Ollama (installed automatically via Docker)
Installation
git clone https://github.com/yourusername/doc-sanitizer-mcp.git
cd doc-sanitizer-mcp
./setup.shConfiguration
Edit .env to customize settings:
# Change LLM model (no rebuild required)
OLLAMA_MODEL=phi4:14b
# Alternative models:
# OLLAMA_MODEL=qwen2.5:7b # Faster, less RAM
# OLLAMA_MODEL=llama3.2:3b # Fastest, minimal RAMTo switch models:
# Pull new model
docker exec doc-sanitizer-ollama ollama pull qwen2.5:7b
# Update .env
sed -i '' 's/OLLAMA_MODEL=.*/OLLAMA_MODEL=qwen2.5:7b/' .env
# Restart
docker compose restart doc-sanitizerClaude Desktop Integration
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"doc-sanitizer": {
"url": "http://localhost:8000/sse"
}
}
}Usage
Via Claude (MCP Tools)
Once configured, you can ask Claude:
"List available sanitization profiles"
"Show me the default profile settings"
"Sanitize this document using the high_privacy profile"
Via CLI
# List profiles
doc-sanitizer profiles list
# Create a new profile
doc-sanitizer profiles create high_privacy
# Edit profile settings
doc-sanitizer profiles edit high_privacy --set person_name=delete --set company=delete
# Sanitize a document
doc-sanitizer sanitize document.docx --profile high_privacyProfile Management
Profiles define how each PII type is handled:
PII Type | Available Actions |
| delete, invent, keep_part |
| delete, keep_part |
| delete, invent, keep_part |
| keep_part, invent |
| delete, invent |
| delete, invent |
| delete, invent |
| delete, invent |
Profiles persist across container restarts (stored in ~/.doc-sanitizer/).
Documentation
License
MIT License - see LICENSE for details.