Overview
The Secure MCP Gateway provides automatic detection and redaction of Personally Identifiable Information (PII) to protect sensitive user data. The PII handling system operates transparently:- Input: PII is detected and redacted before sending to MCP servers
- Processing: MCP servers see only redacted/anonymized data
- Output: PII is automatically restored in responses (de-anonymization)
Zero Trust for PII: Even trusted MCP servers never see original PII values, reducing data exposure risk.
How PII Redaction Works
Complete Flow
Step-by-Step Process
PII Detection
Input Analysis: Scan request for PII entitiesThe PII handler analyzes the input text using pattern matching and NLP models:Example:
PII Redaction
Token Replacement: Replace PII with anonymized tokensEach PII entity is replaced with a unique token:Example:
Protected Processing
Server Communication: Send redacted text to MCP serverThe MCP server receives only anonymized data:
Supported PII Types
Personal Information
Personal Information
Names:
- Person names (first, last, full)
- Organization names
- Nicknames and aliases
- Social Security Numbers (SSN)
- Tax IDs (EIN, ITIN)
- National ID numbers
- Passport numbers
- Driver’s license numbers
Contact Information
Contact Information
Email Addresses:
- Standard emails ([email protected])
- Subdomains ([email protected])
- Plus addressing ([email protected])
- US format: (555) 123-4567
- International: +1-555-123-4567
- Extensions: 555-1234 x567
- Street addresses
- Cities, states, ZIP codes
- Country information
- PO boxes
Financial Information
Financial Information
Payment Cards:
- Credit card numbers (Visa, MasterCard, Amex, Discover)
- Debit card numbers
- CVV codes
- Expiration dates
- Account numbers
- Routing numbers
- IBAN codes
- SWIFT codes
Network & System Information
Network & System Information
IP Addresses:
- IPv4 (192.168.1.1)
- IPv6 (2001:0db8:85a3::8a2e:0370:7334)
- Private IPs (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16)
- Standard format (00:1B:44:11:3A:B7)
- Cisco format (001B.4411.3AB7)
- Windows format (00-1B-44-11-3A-B7)
Temporal Information
Temporal Information
Dates:
- Birth dates
- Event dates
- Timestamps
- Exact ages
- Age ranges (if specific)
Configuration
Enable PII Redaction
Per-Server Configuration:Block on PII Detection (Optional)
You can also block requests that contain PII instead of redacting:Custom PII Entities
Configure which PII types to detect:PII Mapping Security
Secure Storage
The PII mapping is:- Generated server-side by Enkrypt API
- Associated with a unique session key
- Never logged or persisted
- Automatically expires after use
- Encrypted in transit (HTTPS)
Mapping Key Structure
- Keys are cryptographically random (160+ bits of entropy)
- Mappings are never exposed in logs
- Keys cannot be reused across sessions
- Server-side storage is encrypted at rest
Advanced Use Cases
Scenario 1: Customer Support
Goal: Protect customer PII when using AI toolsScenario 2: Data Analysis
Goal: Analyze customer data without exposing PIIScenario 3: Compliance (GDPR/CCPA)
Goal: Minimize PII exposure for complianceLimitations & Best Practices
Detection Accuracy
Detection Accuracy
Not 100% Accurate: PII detection uses ML models with ~95-98% accuracyFalse Positives:
- Generic names (“John Smith” in documentation)
- Example emails ([email protected])
- Sample phone numbers (555-0100)
- Obfuscated PII ([email protected] as “j dot doe at example”)
- Non-standard formats
- Context-dependent PII
- Test with sample data before production
- Review redaction results periodically
- Use additional guardrails (keyword detection) for critical PII
Performance Impact
Performance Impact
Latency: PII redaction adds 50-150ms per requestOptimization:
- Enable only for servers handling user data
- Use selective entity types (don’t detect all PII if unnecessary)
- Cache redaction results for repeated inputs
Context Preservation
Context Preservation
Challenge: Redaction may break context for AI understandingExample:Mitigation:
- Use partial redaction for non-sensitive patterns
- Provide domain whitelist (e.g., allow @company.com)
- Include metadata hints (e.g., “[EMAIL_1 from company.com]”)
Token Persistence
Token Persistence
Problem: Tokens don’t persist across sessionsExample:Why: Each session gets a unique PII key for securityBest Practice: If consistency needed, use custom identifiers instead of PII
Testing PII Redaction
Manual Testing
Integration Testing
Automated Testing
Use the included test suite:Monitoring & Metrics
PII Metrics
Available Metrics:pii_redactions_total- Total PII redaction operationspii_detections_by_type- PII detections by entity type (EMAIL, PHONE, etc.)pii_redaction_latency- Time to redact PIIpii_restoration_latency- Time to restore PIIpii_failures_total- Failed PII operations
- Redaction rate over time
- PII types detected
- Latency percentiles (p50, p95, p99)
- Error rates
Logging
PII events are logged (with PII values masked):Next Steps
Security Testing
Test PII redaction with attack scenarios
Guardrail Types
Learn about other guardrail types
Configuration
Configure PII redaction for your servers
Compliance
GDPR/CCPA compliance guide