⚡ OPEN SOURCE BY HELPERFY
PII-Free AI Context
Out of the Box
ContextGuard sits between your AI agent and the LLM provider, detects personal data in real time, pseudonymizes it, and lets the model work — without ever seeing the original.
Every time an AI agent processes a support ticket, a contract, or a CRM record — names, emails, IBANs, and national IDs travel straight to OpenAI or Anthropic. There’s no layer that stops this. ContextGuard is that layer.
What ContextGuard Does
Real input. What the LLM actually receives.
Three Steps. Transparent to Your App.
No changes to your existing MCP client or server. Connect, protect, deploy.
Detect
Scans every MCP message field using Microsoft Presidio + spaCy NER models. Covers names, emails, phones, addresses, IBANs, national IDs, and custom entity types you define.
Pseudonymize
Replaces detected PII with consistent session-scoped tokens. “Maria Kowalski” becomes [PERSON_1] — and stays [PERSON_1] every time she appears in the same session.
Restore (optional)
After the LLM responds, ContextGuard re-inserts original values before returning to your client. Your users see real names. The LLM never did.
One Library. Full Coverage.
Everything you need to protect personal data across your AI pipeline.
MCP stdio + HTTP/SSE
Drop-in for any MCP setup
Works with both local process-pipe MCP servers and remote HTTP/SSE transports. No changes to your existing config.
Multilingual
EN / DE / ES / UK out of the box
Language-specific NER models via spaCy. Each language gets proper named-entity detection, not a generic regex fallback.
Reversible by default
Pseudonymize, not destroy
Consistent tokens across the session. One-way anonymization mode also available for highest-risk contexts.
Plugin API
Add your own entity types
Write a 10-line Python class to detect employee IDs, patient numbers, or any proprietary identifier. Fully documented.
Audit log
GDPR compliance reporting
Every detection event logged (entity type, timestamp, field) — without storing the original value. NDJSON format, ready for compliance tools.
YAML config
One file, no code changes
Enable/disable entity types, set confidence thresholds, choose language models, define custom recognizer paths.
Install in Under 5 Minutes
pip install, one config file, add to Claude Desktop. That’s it.
1. Install
pip install contextguard
2. Configure (contextguard.yaml)
languages: [en, de, uk]
entities:
enabled: [PERSON, EMAIL_ADDRESS, PHONE_NUMBER, IBAN_CODE]
transport:
type: stdio
3. Add to Claude Desktop
“mcpServers”: {
“my-server-private”: {
“command”: “contextguard”,
“args”: [“run”, “–config”, “contextguard.yaml”,
“–“, “npx”, “-y”, “@modelcontextprotocol/server-filesystem”,
“/path/to/your/data”]
}
}
}
Development Roadmap
Here’s what’s planned and in what order.
Core Detection Engine
Presidio + spaCy integration, baseline entity coverage for English, unit tests with synthetic PII datasets.
MCP Proxy Transport Layer
Transparent proxy for MCP stdio and HTTP/SSE. Encrypted session store with configurable TTL.
Pseudonymization & Audit
Reversible and irreversible modes, NDJSON audit log for compliance reporting.
Multilingual & Plugin API
German, Spanish, Ukrainian language models. Plugin API for custom entity recognizers.
Packaging, Docs & Community
PyPI package, Docker image, MkDocs documentation site, integration guides for Claude Desktop and Cursor.
Ready to Protect Your AI Pipeline?
ContextGuard is open source and self-hostable. Get notified when it launches — no credit card, no commitment.
MIT License · Self-hostable · No cloud dependency · GDPR Article 25 ready
