Documentación
Guías de integración del MCP Server, la API REST y el SDK para anonym.legal y cloak.business
Configuración del MCP Server
Transporte HTTP: https://anonym.legal/mcp · 7 herramientas · sin instalación necesaria
Claude Desktop
Añadir a claude_desktop_config.json:
{
"mcpServers": {
"anonym-legal": {
"type": "http",
"url": "https://anonym.legal/mcp",
"headers": { "Authorization": "Bearer YOUR_API_KEY" }
}
}
}
macOS: ~/Library/Application Support/Claude/claude_desktop_config.jsonWindows: %APPDATA%\Claude\claude_desktop_config.json
Cursor IDE
Añada a la configuración MCP de Cursor (Settings › Features › MCP):
{
"mcpServers": {
"anonym-legal": {
"type": "http",
"url": "https://anonym.legal/mcp",
"headers": { "Authorization": "Bearer YOUR_API_KEY" }
}
}
}
7 herramientas MCP
| Herramienta | Descripción |
|---|---|
anonymize_text | Anonimiza el texto: replace, redact, hash, encrypt, mask o keep por entidad |
analyze_text | Detecta entidades de PII: devuelve posiciones, tipos y puntuaciones de confianza |
detokenize_text | Restaura los valores originales a partir de tokens de sesión |
get_balance | Consulta el saldo de tokens restante |
estimate_cost | Estima el coste en tokens antes de llamar a anonymize_text |
list_sessions | Enumera las sesiones de anonimización activas |
delete_session | Elimina una sesión (supresión conforme al art. 17 del RGPD) |
Requisitos previos
| Requisito | Obligatorio | Descripción |
|---|---|---|
anonym.legal account | Sí | Plan Pro o Business (el MCP Server no está disponible en Free/Basic) |
API key | Sí | Se envía como Authorization: Bearer YOUR_API_KEY cabecera; no se necesita instalar Node.js ni npm |
MCP client | Sí | Cualquier cliente compatible con transporte HTTP (Claude Desktop, Cursor, VS Code, Windsurf, Continue, Cline) |
API REST
API REST de anonym.legal: sin necesidad de SDK, integración HTTP directa
URL base
https://api.anonym.legal/v1
Autenticación
Incluya su clave API en la cabecera Authorization:
Authorization: Bearer your-api-key
POST/anonymize
Anonimiza el texto y detecta entidades de PII.
Cuerpo de la solicitud
{
"text": "John Smith's email is john@example.com",
"method": "replace",
"language": "en",
"entities": ["PERSON", "EMAIL_ADDRESS"]
}
Respuesta
{
"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
Restaura los valores originales a partir de tokens de sesión.
{ "text": "enc_xK9mP2... email is enc_jL7nQ4...", "session_id": "abc123" }
Ejemplos de código
API REST de anonym.legal: 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("Contact John at john@example.com")
print(result["anonymized"])
# → "Contact 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: 'Contact John at john@example.com', method: 'replace' })
}).then(r => r.json());
console.log(result.anonymized);
// → "Contact 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":"Contact John at john@example.com","method":"replace"}'
Métodos de anonimización
Elija el método adecuado para su caso de uso
replace
Predeterminado
Sustituye la PII por datos ficticios realistas. Mantiene la legibilidad del documento.
"John Smith" → "Max Mueller"
redact
Elimina por completo la PII. Irreversible pero con la máxima privacidad.
"john@example.com" → "[REDACTED]"
hash
SHA-256
Hash criptográfico unidireccional. Seudonimización coherente.
"555-0123" → "a7f3c9d2..."
encrypt
AES-256-GCM
Cifrado de grado militar. Totalmente reversible con la clave correcta.
"DE89370400..." → "enc_xK9mP2..."
mask
Visibilidad parcial con caracteres enmascarados. Muestra la estructura.
"4532-1234-5678-9012" → "4532-****-****-9012"
¿Necesita ayuda?
Nuestro equipo está listo para ayudarle a integrar Anonymize.dev en su flujo de trabajo.