ContextGuard – PII Anonymization Proxy for AI Pipelines

⚡ 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.

🛡 GDPR Article 25 Ready🔒 Self-Hostable🌐 MIT License⚡ MCP Native
50+PII entity types
<20msAdded latency
4Languages (v1)
0Cloud dependencies

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.

Customer wrote: “Hi, my name is Maria Kowalski and I need help with invoice DE89370400440532013000. Please call me at +49 151 23456789 or email m.kowalski@example.de.”
→ LLM receives: “Hi, my name is [PERSON_1] and I need help with invoice [IBAN_1]. Please call me at [PHONE_1] or email [EMAIL_1].”

Three Steps. Transparent to Your App.

No changes to your existing MCP client or server. Connect, protect, deploy.

01

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.

02

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.

03

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

# Install ContextGuard
pip install contextguard

2. Configure (contextguard.yaml)

mode: pseudonymize
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.

M1Month 1–2

Core Detection Engine

Presidio + spaCy integration, baseline entity coverage for English, unit tests with synthetic PII datasets.

M2Month 3–4

MCP Proxy Transport Layer

Transparent proxy for MCP stdio and HTTP/SSE. Encrypted session store with configurable TTL.

M3Month 5–6

Pseudonymization & Audit

Reversible and irreversible modes, NDJSON audit log for compliance reporting.

M4Month 7–8

Multilingual & Plugin API

German, Spanish, Ukrainian language models. Plugin API for custom entity recognizers.

M5Month 9–10

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