Skip to content

feat: Add policy-based automatic PII detection and dynamic masking #3373

Description

@Deeven-Seru

Feature Request

Is your feature request related to a problem? Please describe.
Enterprises using MCP Toolbox to connect AI agents to databases face significant privacy compliance challenges (GDPR, CCPA, HIPAA, etc.) when query results contain personally identifiable information (PII). While MCP Toolbox provides secure access controls, it lacks intelligent output filtering to automatically detect and mask PII in query results before they reach LLMs or applications.

Describe the solution you'd like

Add a policy-based automatic PII detection and dynamic masking layer that:

  1. Scans query results for PII using configurable patterns, dictionaries, and optional NLP
  2. Applies dynamic masking (partial/full/tokenization) based on data classification policies
  3. Respects user/role-based permissions for different masking levels
  4. Preserves data utility where possible (e.g., statistical masking for analytics)
  5. Logs masking actions for audit trails without exposing raw sensitive data

Example Policy Configuration (in tools.yaml):

kind: pii-policy
name: gdpr-compliant
rules:
  - pattern: "\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b"
    type: EMAIL
    action: MASK_PARTIAL  # Shows first/last char: j*****n@example.com
  - pattern: "\\b\\d{3}-\\d{2}-\\d{4}\\b"
    type: SSN
    action: MASK_FULL     # Shows ***-**-**** 
  - column: credit_card_number
    type: CREDIT_CARD
    action: TOKENIZE      # Reversible tokenization for authorized users

Integration:

  • As a configurable middleware layer in the tool execution pipeline
  • Works with all prebuilt tools (execute_sql, query_table, etc.)
  • Compatible with custom tools framework
  • Role-based policy application

Describe alternatives you've considered

Additional context

This feature would transform MCP Toolbox from a secure conduit into an intelligent privacy-aware data fabric, addressing a critical gap for regulated industries adopting AI agents. It aligns with the project's goals of enhanced security and enterprise readiness.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions