- Home
- MCP servers
- MCP Presidio
MCP Presidio
- python
0
GitHub Stars
python
Language
5 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"cmalpass-mcp-presidio": {
"command": "mcp-presidio",
"args": []
}
}
}MCP Presidio is an MCP server that detects and anonymizes PII in text and structured data using Microsoft Presidio. It enables safe handling of sensitive information by providing robust PII recognition and flexible anonymization options for both plain text and JSON-like data structures.
How to use
You run the MCP Presidio server locally or in a container and connect your MCP client to it through stdio. Use the server to detect PII in text or JSON-like data and then apply anonymization accordingly. You can analyze single texts, anonymize them, or process batches. You can also extend the recognizers with custom patterns and test detection with validation tools.
How to install
Prerequisites you need before installation:
-
Python 3.10 or higher
-
Docker 20.10 or higher
Choose your installation method and follow the steps below.
Docker installation (recommended for production)
Quick start with Docker to run the MCP Presidio server in a self-contained container.
# Clone the repository
git clone https://github.com/cmalpass/mcp-presidio.git
cd mcp-presidio
# Build the Docker image
docker build -t mcp-presidio .
# Run the container with stdio (default)
docker run -i mcp-presidio
Using Docker Compose
You can build and start the container with Docker Compose, then view logs or stop the service as needed.
# Clone the repository
git clone https://github.com/cmalpass/mcp-presidio.git
cd mcp-presidio
# Build and start the container
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the container
docker-compose down
Configuring Claude Desktop with Docker
If you want Claude Desktop to run the Presidio MCP server in a Docker container, configure the MCP server entry to launch the container.
{
"mcpServers": {
"presidio": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"mcp-presidio:latest"
],
"env": {}
}
}
}
Docker image details
The Docker image includes Python 3.11 slim, the Presidio components, spaCy, and an English language model. It runs with a non-root user and uses a multi-stage build to keep the image small.
Advanced Docker usage
Interact with the container for debugging, add more language models, or mount a local configuration.
docker run -it mcp-presidio bash
Python installation (quick install)
If you prefer a Python-based setup, run the interactive installation script or install manually.
# Clone the repository
git clone https://github.com/cmalpass/mcp-presidio.git
cd mcp-presidio
# Run the installation script
./install.sh
# or
python install.py
Python installation (manual)
For a manual setup, install the package and download the English spaCy model.
# Clone the repository
git clone https://github.com/cmalpass/mcp-presidio.git
cd mcp-presidio
# Install the package
pip install -e .
# Download required spaCy language model (for English)
python -m spacy download en_core_web_lg
Running the server
Start the server using stdio transport, suitable for MCP clients.
mcp-presidio
or
python -m mcp_presidio.server
Configuring with Claude Desktop
Add the MCP server configuration to Claude Desktop so it can launch the server as part of your workflow.
{
"mcpServers": {
"presidio": {
"command": "python",
"args": ["-m", "mcp_presidio.server"],
"env": {}
}
}
}
Example usage in conversations
The server powers tools that detect and anonymize PII in text. You can run a detection or an anonymization flow through an MCP client and inspect the results.
Supported PII entity types
The server supports 25+ PII types, including personal, contact, financial, government IDs, international IDs, location, medical, and other identifiers. Use the get_supported_entities tool to list all available types for your language.
Anonymization operators
Choose how you replace or remove PII with operators like replace, redact, hash, mask, encrypt, or keep.
Additional features
Custom recognizers enable domain-specific patterns, batch processing handles multiple documents efficiently, and the server architecture integrates MCP FastMCP with Presidio and spaCy for fast, accurate detection.
Security considerations
All processing happens locally, and the server communicates via stdio with MCP clients. Docker deployment provides isolation, and the container can run as a non-root user for enhanced security.
Development and tests
To run development tests locally, install dev dependencies, then run the test suite with pytest.
pip install -e ".[dev]"
pytest tests/
Project structure and license
The project includes the MCP server implementation under src/mcp_presidio/server.py, along with tests, a Docker setup, and build configurations. The license is MIT.
Notes and caveats
Be mindful of privacy considerations when analyzing text with external agents. If sensitive data will be sent to third-party services, consider local LLMs or private deployments to keep data in your environment.
Available tools
analyze_text
Detect PII entities in text with confidence scores.
anonymize_text
Anonymize detected PII using various operators such as replace, redact, hash, mask, encrypt, or keep.
get_supported_entities
List all supported PII entity types for your language.
add_custom_recognizer
Add custom PII recognition patterns to extend detection capabilities.
batch_analyze
Analyze multiple texts for PII in a single call.
batch_anonymize
Anonymize PII across multiple texts in one operation.
get_anonymization_operators
List available methods for anonymizing detected PII.
analyze_structured_data
Detect PII in JSON or structured data.
anonymize_structured_data
Anonymize PII found in structured data.
validate_detection
Validate detection accuracy with test metrics.