Skip to main content
Glama
apasupul

MCP Presidio Server

by apasupul

MCP Presidio Server (Anonymize/Deanonymize)

This project exposes the same functionality via MCP tools and FastAPI endpoints.

Quickstart

python -m venv .venv && source .venv/bin/activate  # on Windows: .venv\Scripts\activate
pip install -r requirements.txt
uvicorn app.main:app --reload

Endpoints

  • POST /session -> { "session_id": "<uuid>" }

  • POST /anonymize body:

{
  "session_id": "uuid",
  "messages": [{"content": "Secret is 123, password=foo"}]
}

returns anonymized messages and stores mapping for the session.

  • POST /deanonymize body:

{
  "session_id": "uuid",
  "text": "<<CUSTOM_TOKEN_0>> is 123, <<pass_pattern_...>>"
}

MCP server

Run the stdio MCP server:

python mcp_server/server.py

Register it in your MCP-compatible client pointing to this command.

Notes

  • Storage uses SQLite at app/data.db with tables sessions and mappings.

  • Custom patterns mirror the code you provided; add more Presidio recognizers as needed.

  • Placeholders look like <<ENTITY_#>> and are reversible per session_id.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Sanitizes text and files by removing PII, secrets, and custom patterns locally before sending to LLMs, with optional reverse-scrubbing.
    3
    705 npm
    2
    Cryptographic Autonomy 1.0 (Combined Work Exception)
  • A
    license
    A
    quality
    A
    maintenance
    Local pseudonymisation MCP server that detects PII in text, replaces it with opaque tokens before sending to cloud LLMs, and restores tokens afterward.
    2
    196 npm
    2
    MIT

Appeared in Searches