Back to BlogTechnical

Use Claude Without Leaking PII

A developer's guide to using AI assistants securely. Set up the anonym.legal MCP server in Claude, Claude Code, Cursor, and VS Code, and see what it protects and what it does not.

February 22, 20267 minute read
MCP ServerClaude DesktopCursor IDEsecure AIdeveloper tools

The Developer's Dilemma

You are debugging a production issue. The stack trace has customer email addresses in it. The fastest fix? Paste it into Claude and ask for help.

But what you type into Claude reaches Anthropic.

According to LayerX, 77% of developers use AI tools with sensitive data.

What the MCP Server Does, and What It Does Not

The Model Context Protocol (MCP) lets an AI assistant call tools. The anonym.legal MCP server gives the assistant nine tools to detect, anonymize, and restore personal data in text that it hands to them.

Be clear about the order. What you type into Claude goes to Anthropic first; only then does the assistant decide to call a tool. The MCP server therefore does not protect your own prompt. It anonymizes text that the assistant passes to it, for example the content of a file, a tool output, or data that is about to be stored, shared, or passed on to another tool.

To keep personal data out of the prompt itself, anonymize it before you send it:

  • in the web app: paste, anonymize, then copy the result into Claude
  • with the Chrome extension, which checks text on supported AI sites before it is sent
  • in Claude Code, with the Claude Code mod, which replaces detected personal data before Claude sees the prompt

Setting Up the Integration

What You Need

  • Claude (claude.ai, Claude Desktop, Cowork), Claude Code, Cursor, or VS Code
  • An anonym.legal account on the Pro or Business plan (MCP access starts with Pro)

Claude: Add a Custom Connector

Claude connects through a custom connector. No API key is needed.

  1. Free, Pro and Max: in Claude, open Customize → Connectors → + Add → Add custom connector
  2. Name: anonym.legal, URL: https://anonym.legal/mcp
  3. Sign in with your anonym.legal account and approve access (OAuth)

Team and Enterprise: an Owner adds the connector under Organization settings → Connectors → Add → Custom → Web; members then connect under Customize → Connectors → Connect. A connector added in Claude is also available in Claude Desktop with the same account.

Other Clients: Get Your API Key

Claude Code, Cursor, and VS Code use an API key. In the anonym.legal app, open Settings → Developer → API Access Token and copy the token.

Claude Code

claude mcp add --transport http anonym-legal https://anonym.legal/mcp --header "Authorization: Bearer YOUR_API_KEY"

Cursor

Add this 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 this 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): server URL https://anonym.legal/mcp, transport HTTP (Streamable HTTP), header Authorization: Bearer YOUR_API_KEY. The field names are in your client's documentation.

What Gets Anonymized

The server catches 273 entity types across 48 languages:

CategoryExamples
PersonalNames, emails, phone numbers, DOB
FinancialCredit cards, bank accounts, IBANs
GovernmentSSNs, passport numbers, driver's licenses
TechnicalIP addresses
HealthcarePatient IDs, insurance numbers
CorporateEmployee IDs, account numbers

Example: Anonymize Before Passing Data On

Text the assistant hands to the tool:

Debug this error from user john.smith@acme.com:
Payment failed for card 4532-1234-5678-9012
IP: 192.168.1.100

What anonym_legal_anonymize_text returns (tokenize mode):

Debug this error from user PII_EMAIL_ADDRESS_1:
Payment failed for card PII_CREDIT_CARD_1
IP: PII_IP_ADDRESS_1

The assistant can now write the tokenized version to a ticket, a log, or another tool. With anonym_legal_detokenize_text and the session ID, the original values can be restored later.

Where Processing Happens

ComponentLocation
MCP serveranonym.legal server at https://anonym.legal/mcp
PII detectionanonym.legal servers
AI modelYour AI provider (for example Anthropic)

The tool runs on the server at https://anonym.legal/mcp; your client calls it. Text that the assistant passes to the tools is sent to anonym.legal for detection. See the privacy policy for details.

Pricing

MCP access is included in the Pro and Business plans. Free and Basic do not include it.

PlanTokens/cyclePrice
Pro4,000€15/month
Business10,000€29/month

Conclusion

AI tools are now part of daily dev work. The MCP server adds one control: anonymizing text that the assistant passes on.

The integration:

  • Gives Claude, Claude Code, Cursor, and VS Code tools to anonymize and restore personal data

  • Does not replace anonymizing your own prompt before you send it; use the web app, the Chrome extension, or the Claude Code mod for that

  • Requires a Pro or Business plan

  • Sign up

  • MCP server docs

  • View all entity types

When This Approach Has Limits

The MCP server is one control among several, and a few cases fall outside its protection.

Your prompt reaches the AI provider before any tool runs. What you type into Claude reaches Anthropic. The tools only anonymize text that the assistant hands to them. To protect the prompt itself, anonymize it before sending.

Detection happens server-side and is not perfect. Detection can miss an unusual identifier or an identifier embedded in code or logs, and anything it misses stays in the text that is passed on. For highly sensitive material, check the anonymized output rather than trusting it blindly.

The tools only protect what they are asked to process. A teammate who skips the tool, or an AI surface without the server, bypasses the safeguard entirely. Protection depends on consistent use across every tool and every developer.

Tokens are reversible, so key handling matters. Reversible tokenization is what lets you restore the original values, but that means the mapping exists and is sensitive.

You still trust the detection service. Text passed to the tools goes to anonym.legal. Keep your API key secret.


Sources

Limitations / When this doesn't apply

Your prompt reaches the AI provider before any tool runs: the MCP tools only anonymize text that the assistant hands to them, so to protect the prompt itself, anonymize it before sending (web app, Chrome extension, or Claude Code mod).

  • Detection happens server-side and is not perfect: it can miss an unusual identifier or one embedded in code or log output, and anything it misses stays in the text that is passed on.
  • The tools only protect what they are asked to process. A teammate who skips the tool, or an AI surface without the server, bypasses it entirely.
  • Tokens are reversible, so the mapping is sensitive.
  • You still trust the detection service: text passed to the tools goes to anonym.legal. Keep your API key secret.

Ready to protect your data?

Start anonymizing PII with 273 entity types across 48 languages.