By George Curta ·
Privacy Protection for AI — Works with Claude Desktop, Cursor, and Any MCP Tool
Connect Claude through a custom connector with OAuth, or Claude Code, Cursor, and VS Code with a URL and API key. 48 languages, 5 protection operators (Replace, Redact, Mask, Hash, Encrypt; Keep in addition via API and MCP), entity groups, presets, and personal encryption keys.
The Hidden Risk in AI-Assisted Work
Every time you use ChatGPT, Claude, or Cursor, you might be sharing sensitive information. Most users don't realize their data is being sent to third-party AI providers.
Customer names and emails
Financial account numbers
Medical records and patient IDs
Trade secrets and proprietary data
Why Secure MCP Servers Matter — 2026 Research
8,000+
MCP servers publicly exposed
492
servers with zero authentication
36.7%
vulnerable to SSRF attacks
CVSS 8.8
CVE-2026-25253 severity
MCP servers that handle raw user prompts without PII filtering expose sensitive data to AI models and downstream tool calls. anonym.legal acts as a secure MCP gateway — anonymizing PII before it reaches any other MCP server, AI model, or external API.
How It Works: Automatic Protection
You Write Normally
With sensitive data
AI Tool
Cursor, Claude, etc.
anonym.legal MCP Server
1. Detect
Find sensitive info
2. Replace
Use placeholders
3. Store
Encrypted, temporary
AI Processes
Safe placeholders only
Restore Values
Original data back
The MCP Server acts as a privacy shield between your AI tools and sensitive data. AI never sees your real information.
What Gets Protected?
The system automatically detects and protects 273 types of sensitive information
People
John Doe, Jane Smith, Dr. Williams
Emails
john@example.com, info@company.org
Phones
+1-555-1234, (555) 123-4567
Credit Cards
4532-1234-5678-9010
Addresses
123 Main Street, New York, NY
Dates
January 15, 2026, 01/15/2026
Medical Info
Patient ID, prescription numbers
Financial IDs
IBANs, Tax IDs, VAT numbers
Digital Identifiers
IP addresses, MAC addresses, URLs
And 40+ More Types
License plates, passport numbers, etc.
Key Benefits
Works with Claude Desktop, Cursor & All MCP Tools
Claude connects through a custom connector with OAuth. Claude Code, Cursor, VS Code, and other MCP clients need only the URL and an API key. No Node.js required.
5 Anonymization Operators
Choose the right method: Replace, Redact, Hash (SHA-256/512), Encrypt (AES-256), Mask (API/MCP: + Keep). Apply different operators per entity type.
Entity Groups & Presets
Use predefined groups (UNIVERSAL, FINANCIAL, DACH, FRANCE, NORTH_AMERICA) or create personal presets for consistent anonymization across sessions.
48 Languages Supported
Detects PII in English, German, French, Spanish, Chinese, Japanese, Arabic, and 41 other languages. RTL support included.
Personal Encryption Keys
Load your own AES-128/192/256 keys for encrypt operator. Decrypt anytime with your key. Keys stored securely in your account.
Session Management
Tokenization mode with session IDs for reversible anonymization. List, manage, and delete sessions. 24h or 30-day persistence options.
Works With Your Favorite AI Tools
HTTP transport — Claude Desktop, Cursor, any MCP tool
Cursor IDE
AvailableProtect code secrets and sensitive data while coding with AI assistance via HTTP
Claude Desktop
AvailableAdd anonym.legal as a custom connector in Claude and sign in with your anonym.legal account. A connector added in Claude is also available in Claude Desktop.
Continue (VS Code)
AvailableSecure AI coding assistant integration directly in Visual Studio Code via HTTP
Cline (VS Code)
AvailableAI-powered coding with automatic privacy protection via MCP HTTP
Any MCP Tool
AvailableStreamable HTTP transport works with any MCP-compatible application
Setup in 2 Minutes
Claude connects through a custom connector with OAuth — Claude Code, Cursor, VS Code, and other MCP clients use your API key
Claude (claude.ai, Claude Desktop, Cowork) — no API key needed:
- 1Free, Pro, and Max: in Claude, open Customize → Connectors → + Add → Add custom connector
- 2Enter the name anonym.legal and the URL https://anonym.legal/mcp
- 3Sign in with your anonym.legal account and approve access (OAuth 2.1 with PKCE)
- 49 privacy tools are available in your chats. A connector added in Claude is also available in Claude Desktop with the same account.
Team and Enterprise: an Owner adds the connector under Organization settings → Connectors → Add → Custom → Web. Members then connect under Customize → Connectors → Connect.
Claude Free allows one custom connector.
This sign-in only works through a custom connector in Claude. Claude Code, Cursor, VS Code, and other MCP clients connect with an API key, as described below.
Name: anonym.legal
URL: https://anonym.legal/mcp
Auth: OAuth 2.1Follow the full admin + user walkthrough — add the custom connector, configure the tool-permission ceiling, and verify a live tool call.
Claude Code, Cursor, VS Code, and other MCP clients — with your API key:
Get your API key in the anonym.legal app under Settings → Developer → API Access Token.
MCP access requires a Pro or Business plan.
Claude Code — run this command, or add the server to .mcp.json in your project:
claude mcp add --transport http anonym-legal https://anonym.legal/mcp --header "Authorization: Bearer YOUR_API_KEY"{
"mcpServers": {
"anonym-legal": {
"type": "http",
"url": "https://anonym.legal/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}Cursor — add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project):
{
"mcpServers": {
"anonym-legal": {
"url": "https://anonym.legal/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}VS Code — add to .vscode/mcp.json. VS Code uses the top-level key servers, not mcpServers:
{
"servers": {
"anonym-legal": {
"type": "http",
"url": "https://anonym.legal/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}Other clients (for example Windsurf): use the server URL https://anonym.legal/mcp, transport HTTP (Streamable HTTP), and the header Authorization: Bearer YOUR_API_KEY. The field names are in your client's documentation.
Use Cases
Software Development
Review code containing API keys, database credentials, and customer data without exposing secrets to AI providers.
Legal Firms
Anonymize client names, case numbers, and sensitive details when using AI to draft documents, ensuring attorney-client privilege.
Healthcare
Analyze patient notes and reports with AI assistance while keeping patient identities and medical records completely private.
Customer Support
Process customer inquiries with AI help while automatically protecting email addresses, phone numbers, and account details.
Finance
Use AI for report analysis while protecting account numbers, transaction details, and customer identities.
MCP Server vs Manual Redaction
| Aspect | Manual Redaction | anonym.legal MCP |
|---|---|---|
| Speed | Minutes per document | < 1 second |
| Accuracy | Human error-prone | Context-aware detection across 273 entity types |
| Reversible | No - permanent | Yes - fully reversible |
| Maintenance | Constant vigilance | Automatic |
| Languages | One at a time | 48 simultaneously |
| Integration | Copy/paste workflow | Seamless in your tools |
| Cost | Staff time | From €15/month |
anonym.legal MCP vs. Unprotected MCP
Without a secure MCP server layer, raw PII flows into AI models and all downstream tool calls — including other MCP servers, APIs, and logs. anonym.legal anonymizes data before it leaves your environment.
| Capability | Unprotected MCP Server | anonym.legal MCP |
|---|---|---|
| PII in AI prompts | Raw names, emails, SSNs sent to LLM | Detected PII replaced with tokens before sending — values the detection misses still go through |
| Authentication | Often none (492 servers exposed, no auth) | Bearer token + rate limiting on every request |
| SSRF protection | 36.7% vulnerable to SSRF (CVE-2026-25253) | SSRF allowlist enforced — no private IP access |
| Data to downstream MCPs | Raw PII forwarded to all connected tools | Detected PII replaced before forwarding — undetected values pass through |
| GDPR / HIPAA compliance | Non-compliant — PII in AI training data risk | Reduces personal data sent to AI tools; token mappings stored encrypted for the session — supports your compliance, does not replace it |
| Audit trail | No log of what PII was exposed | Session-based tokens with full detokenization audit |
| Multilingual PII detection | English-only or no detection | 273 entity types across 48 languages |
Claude Code hook: an anonymized copy alongside each prompt
The UserPromptSubmit hook sends each prompt to the MCP server and attaches an anonymized version as additional context. The original prompt is still sent to Claude, so Claude sees the plain text as well. The hook therefore does not stop Claude from seeing personal data.
Then the hook is the wrong tool. The Claude Code mod anonym-legal-guard replaces detected personal data with placeholders before the text reaches the model — in prompts, in files Claude reads and in command output. Detection can miss values; what it misses reaches the model.
Create the anonymize hook
Save as ~/.claude/hooks/anonymize-prompt.py — runs on every UserPromptSubmit event, calls the MCP server and returns the anonymized version as additional context. It does not replace the prompt Claude receives.
# ~/.claude/hooks/anonymize-prompt.py
import sys, json, requests, os
data = json.load(sys.stdin)
prompt = data.get("prompt", "")
key = os.environ.get("ANONYM_API_KEY", "")
resp = requests.post("https://anonym.legal/api/mcp/anonymize",
headers={"Authorization": f"Bearer {key}"},
json={"text": prompt, "language": "en", "mode": "tokenize"})
if resp.ok:
result = resp.json()
data["prompt"] = result["anonymized_text"]
data["session_id"] = result["session_id"]
print(json.dumps(data))Create the restore hook
Save as ~/.claude/hooks/deanonymize-response.py — automatically detokenizes Claude's response using the session ID.
# ~/.claude/hooks/deanonymize-response.py
import sys, json, requests, os
data = json.load(sys.stdin)
response = data.get("response", "")
session_id = data.get("session_id", "")
key = os.environ.get("ANONYM_API_KEY", "")
if session_id:
resp = requests.post("https://anonym.legal/api/mcp/detokenize",
headers={"Authorization": f"Bearer {key}"},
json={"text": response, "session_id": session_id})
if resp.ok:
data["response"] = resp.json().get("detokenized_text", response)
print(json.dumps(data))Register hooks in Claude Code settings
Add both hooks to ~/.claude/settings.json under the hooks key.
// ~/.claude/settings.json
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [{"type": "command",
"command": "python3 ~/.claude/hooks/anonymize-prompt.py"}]
}
],
"Stop": [
{
"hooks": [{"type": "command",
"command": "python3 ~/.claude/hooks/deanonymize-response.py"}]
}
]
}
}Frequently Asked Questions
How do I connect Claude Desktop or Cursor?
In Claude (claude.ai, Claude Desktop, Cowork), add https://anonym.legal/mcp as a custom connector and sign in with your anonym.legal account — no API key needed. Cursor and other MCP clients connect over HTTP with the same URL and your API key in their MCP configuration (Cursor: ~/.cursor/mcp.json). No Node.js or local installation needed. In Claude Code, the optional hook adds an anonymized copy of each prompt as context, but the original prompt still reaches Claude. To replace detected personal data before Claude sees it, use the Claude Code mod (see /features/claude-code).
What logical operators are available for filter rules?
5 operators: Replace (fake data), Redact (remove), Hash (SHA-256/512), Encrypt (AES-256 with your key), Mask (partial hide). The API additionally accepts Keep (exclude from anonymization).
Can I use my own encryption keys?
Yes! Load personal AES keys (16/24/32 chars) from your account or enter them manually. Encrypt with your key, decrypt later with the same key. Keys never leave your control.
What are entity groups and how are they used?
Predefined collections: UNIVERSAL (common PII), FINANCIAL (banking), DACH (German-speaking), FRANCE, NORTH_AMERICA, etc. Saves time configuring which entities to detect.
What's the difference between redact and tokenize modes?
Redact mode permanently removes PII. Tokenize mode replaces with reversible tokens and returns a session_id. Use detokenize_text with the session_id to restore original values.
How do MCP server sessions work for token reuse?
Tokenization creates sessions (24h or 30-day persistence). Use list_sessions to see active sessions, delete_session to remove them. Sessions store the mapping between tokens and original values.
API Reference
9 tools available via MCP protocol (incl. image PII redaction). Free operations marked with *.
| Tool | Description | Cost |
|---|---|---|
| anonym_legal_analyze_text | Detect PII entities without modifying text | 2-10+ tokens |
| anonym_legal_anonymize_text | Anonymize text with configurable operators | 3-20+ tokens |
| anonym_legal_detokenize_text | Restore original PII from tokenized text | 1-5+ tokens |
| anonym_legal_get_balance | Check token balance and billing cycle | Free * |
| anonym_legal_estimate_cost | Estimate token cost before processing | Free * |
| anonym_legal_list_presets | List available presets (builtin, personal, public/featured) to pass to the preset parameter | Free * |
| anonym_legal_list_sessions | List active tokenization sessions | Free * |
| anonym_legal_delete_session | Delete a session and its token mappings | Free * |
| anonym_legal_redact_image | Redact or analyze PII in a PNG/JPEG image using OCR (modes: analyze, redact) | Varies by image |
Operator Reference
Configure per-entity anonymization using the operators parameter.
| Operator | Description | Parameters | Example Output |
|---|---|---|---|
| replace | Replace with custom value | new_value (string, max 100 chars) | <PERSON_1> |
| redact | Permanently remove | None | [REDACTED] |
| hash | One-way hash | hash_type: SHA256 | SHA512 | a3f2b8c1... |
| encrypt | Reversible encryption | key (16, 24 or 32 chars) | ENC:base64... |
| mask | Partial character masking | chars_to_mask, masking_char, from_end | John **** |
| keep | Keep original value | None | John Smith |
Request Examples
Analyze Text
{
"text": "John Smith lives at 123 Main St, New York. SSN: 123-45-6789",
"language": "en",
"score_threshold": 0.5,
"entities": ["PERSON", "LOCATION", "US_SSN"]
}Anonymize with Per-Entity Operators
{
"text": "John Smith, SSN 123-45-6789, email john@example.com",
"language": "en",
"mode": "tokenize",
"operators": {
"PERSON": { "type": "replace" },
"US_SSN": { "type": "mask", "masking_char": "*", "chars_to_mask": 5, "from_end": false },
"EMAIL_ADDRESS": { "type": "hash", "hash_type": "SHA256" }
}
}Response (Anonymize)
{
"anonymized_text": "<PERSON_1>, SSN ***-**-6789, email a3f2b8c1d4e5...",
"entities_found": 3,
"tokens_charged": 5,
"session_id": "sess_abc123",
"entity_types": { "PERSON": 1, "US_SSN": 1, "EMAIL_ADDRESS": 1 }
}Error Codes
| Code | Description | Resolution |
|---|---|---|
| 400 | Invalid request parameters | Check text length (max 100KB), operator config |
| 401 | Invalid or missing API key | Verify API key in Settings → Developer → API Access Token |
| 429 | Token balance exhausted | Check balance, upgrade plan, or wait for cycle reset |
| 500 | Server error | Retry after a few seconds, contact support if persistent |
From the Blog
View all articlesReal-Time PII Prevention Saves $2.2M
IBM found a $2.2M cost difference between prevention and detection. Here's the math that makes real-time PII interception non-optional for security teams.
Enterprise AI: Dev Access Without Risk
Banks banned ChatGPT, but developers used it from home anyway. 27.4% of content fed into enterprise AI chatbots is sensitive data. Fix: secure MCP access.
Using Cursor & Claude Without Leaking Code
Cursor loads .env files into AI context by default. A financial services firm lost $12M after proprietary trading algorithms were sent to an AI assistant.
Try anonym.legal MCP Free
Requires Pro (4,000 tokens) or Business (10,000 tokens) per 31-day cycle. Setup takes 2 minutes.
Limitations / Important note
- Availability and limits depend on your plan and MCP client; behaviour varies across hosts.
- Detection results are probabilistic; validate before automated downstream use. This is not legal advice.