MCP server for CloakLLM — PII cloaking tools for Claude Desktop
Project description
CloakLLM MCP Server
MCP server that wraps CloakLLM's Python SDK as tools for Claude Desktop and other MCP-compatible clients.
Tools
| Tool | Description |
|---|---|
sanitize |
Detect & cloak PII, return sanitized text + token map ID + entity_details. Pass mode: "redact" for irreversible PII removal (no token_map_id returned). |
desanitize |
Restore original values using a token map ID |
analyze |
Detect 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",
"token_map_id": "optional-id-for-multi-turn"
}
Multi-turn: Pass the
token_map_idfrom a previoussanitizeresponse to reuse the same token map across conversation turns. The same PII will always map to the same token.
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},
"entity_details": [
{"category": "EMAIL", "start": 6, "end": 19, "length": 13, "confidence": 0.95, "source": "regex", "token": "[EMAIL_0]"},
{"category": "PERSON", "start": 42, "end": 56, "length": 14, "confidence": 0.85, "source": "spacy", "token": "[PERSON_0]"}
]
}
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
| Variable | Default | Description |
|---|---|---|
CLOAKLLM_LOG_DIR |
./cloakllm_audit |
Audit log directory |
CLOAKLLM_AUDIT_ENABLED |
true |
Enable/disable audit logging |
CLOAKLLM_SPACY_MODEL |
en_core_web_sm |
spaCy model for NER |
CLOAKLLM_LLM_DETECTION |
false |
Enable LLM-based detection |
CLOAKLLM_LLM_MODEL |
llama3.2 |
Ollama model for LLM detection |
CLOAKLLM_OLLAMA_URL |
http://localhost:11434 |
Ollama endpoint |
Testing
# Test with MCP inspector
python -m mcp dev server.py
# Or run directly
python server.py
See Also
- CloakLLM Hub — project overview, architecture, and links
- CloakLLM Python SDK — Python library with spaCy NER + OpenAI / LiteLLM middleware
- CloakLLM JS SDK — JavaScript library with OpenAI + Vercel AI middleware
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cloakllm_mcp-0.2.1.tar.gz.
File metadata
- Download URL: cloakllm_mcp-0.2.1.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fd1dd28c1d56c487a1b7d444eb10f59f12c897e2c42cd922306cee8c04625fe
|
|
| MD5 |
ebfdbd43f6dd5b08b4c7edff82879bf8
|
|
| BLAKE2b-256 |
f9fe6654b0b219ab1a26ce3da3cb5b4edea192b2bd89b4011f37238d331ced96
|
File details
Details for the file cloakllm_mcp-0.2.1-py3-none-any.whl.
File metadata
- Download URL: cloakllm_mcp-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97818aee03fff344283a9697c7db854936b969350b4846203099fee80b491366
|
|
| MD5 |
b1b37775249a971431cfdda5f48dceae
|
|
| BLAKE2b-256 |
6982aa2d3e16c91e9d0014f0a7046b66d872acbf0a0d977ac80df4409b30664a
|