Documentation
MCP Server, REST API, and SDK integration guides for anonym.legal and cloak.business
MCP Server Setup
NPM: @anthropic-ai/mcp-server-anonym-legal · 7 tools · REST API under the hood
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"anonymize": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-server-anonym-legal"],
"env": { "ANONYM_LEGAL_API_KEY": "your-api-key" }
}
}
}
macOS: ~/Library/Application Support/Claude/claude_desktop_config.jsonWindows: %APPDATA%\Claude\claude_desktop_config.json
Cursor IDE
Add to Cursor MCP settings (Settings › Features › MCP):
{
"mcpServers": {
"anonymize": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-server-anonym-legal"],
"env": { "ANONYM_LEGAL_API_KEY": "your-api-key" }
}
}
}
7 MCP Tools
| Tool | Description |
|---|---|
anonymize_text | Anonymize text — replace, redact, hash, encrypt, mask, or keep per entity |
analyze_text | Detect PII entities — returns positions, types, and confidence scores |
detokenize_text | Restore original values from session tokens |
get_balance | Check remaining token balance |
estimate_cost | Estimate token cost before calling anonymize_text |
list_sessions | List active anonymization sessions |
delete_session | Delete a session — GDPR Art. 17 erasure |
Environment Variables
| Variable | Required | Description |
|---|---|---|
ANONYM_LEGAL_API_KEY | Yes | API key from anonym.legal |
ANONYM_METHOD | No | Standard: replace. Options: replace, redact, hash, encrypt, mask, keep |
ANONYM_LANGUAGE | No | Standard: auto. ISO 639-1 language code |
REST API
anonym.legal REST API — no SDK required, direct HTTP integration
Base URL
https://api.anonym.legal/v1
Authentication
Include your API key in the Authorization header:
Authorization: Bearer your-api-key
POST/anonymize
Anonymize text and detect PII entities.
Request Body
{
"text": "John Smith's email is john@example.com",
"method": "replace",
"language": "en",
"entities": ["PERSON", "EMAIL_ADDRESS"]
}
Response
{
"anonymized": "Max Mueller's email is max.mueller@example.de",
"entities": [{ "type": "PERSON", "original": "John Smith", "start": 0, "end": 10 }],
"tokens_used": 2
}
POST/detokenize
Restore original values from session tokens.
{ "text": "enc_xK9mP2... email is enc_jL7nQ4...", "session_id": "abc123" }
Code Examples
anonym.legal REST API — Python, JavaScript, cURL
Python (requests)
import requests
API_KEY = "your-api-key"
BASE_URL = "https://api.anonym.legal/v1"
def anonymize(text, method="replace"):
response = requests.post(
f"{BASE_URL}/anonymize",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"text": text, "method": method}
)
return response.json()
result = anonymize("Kontakt John at john@example.com")
print(result["anonymized"])
# → "Kontakt Max Mueller at max.mueller@example.de"
JavaScript / Node.js
const BASE_URL = 'https://api.anonym.legal/v1';
const API_KEY = 'your-api-key';
const result = await fetch(`${BASE_URL}/anonymize`, {
method: 'POST',
headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ text: 'Kontakt John at john@example.com', method: 'replace' })
}).then(r => r.json());
console.log(result.anonymized);
// → "Kontakt Max Mueller at max.mueller@example.de"
cURL
curl -X POST https://api.anonym.legal/v1/anonymize \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{"text":"Kontakt John at john@example.com","method":"replace"}'
Anonymisierungsmethoden
Wählen Sie die richtige Methode für Ihren Use Case
replace
Standard
Ersetzt PII durch realistische gefälschte Daten. Erhält die Lesbarkeit des Dokuments.
"John Smith" → "Max Mueller"
redact
Entfernt PII vollständig. Irreversibel, aber maximale Datenschutz.
"john@example.com" → "[REDACTED]"
hash
SHA-256
Einweg-Kryptographie-Hash. Konsistente Pseudonymisierung.
"555-0123" → "a7f3c9d2..."
encrypt
AES-256-GCM
Militär-Grad-Verschlüsselung. Vollständig reversibel mit dem richtigen Schlüssel.
"DE89370400..." → "enc_xK9mP2..."
mask
Teilweise Sichtbarkeit mit maskierten Zeichen. Zeigt Struktur.
"4532-1234-5678-9012" → "4532-****-****-9012"
Benötigen Sie Hilfe?
Unser Team ist bereit, Ihnen dabei zu helfen, Anonymize.dev in Ihren Arbeitsablauf zu integrieren.