home / mcp / presidio mcp server
Exposes anonymize and deanonymize capabilities via MCP tools and FastAPI endpoints with local storage.
Configuration
View docs{
"mcpServers": {
"apasupul-mcp_presidio_server": {
"command": "python",
"args": [
"mcp_server/server.py"
]
}
}
}You run and use the Presidio MCP Server to anonymize and deanonymize messages using a local stdio MCP server or the FastAPI endpoints. This setup lets you create anonymized mappings per session and later reverse them, while keeping mappings stored locally for privacy-conscious workflows.
You start a session to obtain a session identifier, then send messages you want anonymized. The server returns anonymized content and stores the mapping for your session, which you can later deanonymize by submitting the anonymized text along with the session identifier.
To operate locally, you run the stdio MCP server and point your MCP client to that local command. If you prefer the HTTP API, you start the FastAPI server and access the defined endpoints to create sessions, anonymize messages, and deanonymize content.
Prerequisites you need before installation: a Python 3 environment and access to the internet to install dependencies.
python -m venv .venv && source .venv/bin/activate # on Windows: .venv\Scripts\activate
pip install -r requirements.txt
uvicorn app.main:app --reload
```
```bash
python mcp_server/server.pyStorage is implemented with SQLite at app/data.db, containing tables for sessions and mappings. Custom recognition patterns mirror the provided codebase; you can extend Presidio recognizers as needed. Placeholders use the format <<ENTITY_#>> and can be reversed per session_id.
Create and manage sessions to group anonymized mappings and link them to a session_id.
Process incoming messages to replace sensitive content with reversible placeholders and store the mapping for the session.
Restore original content from anonymized text using the session_id and stored mappings.