MCP Hub
Back to servers

CloakLLM MCP Server

Wraps CloakLLM's Python SDK to provide tools for PII detection, cloaking, and restoration within MCP-compatible clients. It enables users to sanitize sensitive data before sending it to an LLM and restore original values using unique token map IDs.

Updated
Mar 1, 2026

CloakLLM MCP Server

MCP server that wraps CloakLLM's Python SDK as tools for Claude Desktop and other MCP-compatible clients.

Tools

ToolDescription
sanitizeDetect & cloak PII, return sanitized text + token map ID
desanitizeRestore original values using a token map ID
analyzeDetect PII without cloaking (pure analysis)

Install

cd cloakllm-mcp
pip install -e .

Claude Desktop Configuration

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "cloakllm": {
      "command": "python",
      "args": ["/path/to/cloakllm-mcp/server.py"],
      "env": {
        "CLOAKLLM_LOG_DIR": "./cloakllm_audit",
        "CLOAKLLM_LLM_DETECTION": "false"
      }
    }
  }
}

Or using uvx:

{
  "mcpServers": {
    "cloakllm": {
      "command": "uvx",
      "args": ["mcp", "run", "/path/to/cloakllm-mcp/server.py"]
    }
  }
}

Usage Examples

Sanitize text before sending to an LLM

Tool call: sanitize

{
  "text": "Email john@acme.com about the meeting with Sarah Johnson at 742 Evergreen Terrace",
  "model": "claude-sonnet-4-20250514"
}

Response:

{
  "sanitized": "Email [EMAIL_0] about the meeting with [PERSON_0] at 742 Evergreen Terrace",
  "token_map_id": "a1b2c3d4-...",
  "entity_count": 2,
  "categories": {"EMAIL": 1, "PERSON": 1}
}

Restore original values

Tool call: desanitize

{
  "text": "I've drafted an email to [EMAIL_0] regarding [PERSON_0]'s request.",
  "token_map_id": "a1b2c3d4-..."
}

Response:

{
  "restored": "I've drafted an email to john@acme.com regarding Sarah Johnson's request."
}

Analyze text for PII (no cloaking)

Tool call: analyze

{
  "text": "Contact john@acme.com, SSN 123-45-6789"
}

Response:

{
  "entity_count": 2,
  "entities": [
    {"text": "john@acme.com", "category": "EMAIL", "start": 8, "end": 21, "confidence": 0.95, "source": "regex"},
    {"text": "123-45-6789", "category": "SSN", "start": 27, "end": 38, "confidence": 0.95, "source": "regex"}
  ]
}

Environment Variables

VariableDefaultDescription
CLOAKLLM_LOG_DIR./cloakllm_auditAudit log directory
CLOAKLLM_AUDIT_ENABLEDtrueEnable/disable audit logging
CLOAKLLM_SPACY_MODELen_core_web_smspaCy model for NER
CLOAKLLM_LLM_DETECTIONfalseEnable LLM-based detection
CLOAKLLM_LLM_MODELllama3.2Ollama model for LLM detection
CLOAKLLM_OLLAMA_URLhttp://localhost:11434Ollama endpoint

Testing

# Test with MCP inspector
python -m mcp dev server.py

# Or run directly
python server.py

See Also

License

MIT

Reviews

No reviews yet

Sign in to write a review