PII_MCP_Server

ajaykallepalli/PII_MCP_Server

3.2

If you are the rightful owner of PII_MCP_Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Model Context Protocol (MCP) server is a standalone Node/Express service designed to handle AI-powered text sanitization tasks, ensuring the protection of sensitive information through a client-server architecture.

Tools
4
Resources
0
Prompts
0

SanitizeAI

SanitizeAI is a web application that demonstrates how AI can protect sensitive information in text using the Model Context Protocol (MCP). It showcases a clear separation between an MCP client (Genkit flow inside Next.js) and an MCP server (standalone Node/Express service that owns the sanitization tools).

Features

  • šŸ”’ AI-Powered Text Sanitization: Uses Google Gemini 2.0 Flash to intelligently select and execute sanitization tools
  • šŸ› ļø Model Context Protocol: Demonstrates MCP architecture with client-server separation
  • šŸ“Š Real-time Progress Streaming: Watch the sanitization process in real-time
  • šŸŽÆ Multiple Sanitization Types:
    • Personal Information (PII) anonymization
    • Financial data redaction
    • Health information redaction
    • Workplace data anonymization
  • šŸŽØ Modern UI: Built with Next.js 14, ShadCN UI, and Tailwind CSS
  • šŸ“± Responsive Design: Works on desktop and mobile devices

Technology Stack

LayerTechnology
FrameworkNext.js 14 (App Router)
AI SDKGenkit
AI ModelGoogle Gemini 2.0 Flash
AI ProtocolAnthropic Model Context Protocol (MCP)
UIShadCN UI
StylingTailwind CSS
LanguageTypeScript
Formsreact-hook-form + zod
Streamingai/rsc (React Server Component streaming)

Architecture

Browser (ShadCN UI)
        │
        ā–¼
Next.js Server Action  ←  streams progress + result
        │
        ā–¼
Genkit Flow (MCP CLIENT)  –  no tools here!
        │
        ā–¼
MCP Server (standalone HTTP service)  –  owns tools

Quick Start

  1. Clone and install dependencies:

    git clone <repo>
    cd sanitize-ai
    npm install
    
  2. Set up environment variables:

    cp .env.example .env
    # Edit .env and add your GEMINI_API_KEY
    
  3. Start the MCP server (in terminal 1):

    npm run dev:mcp
    
  4. Start Next.js (in terminal 2):

    npm run dev
    
  5. Open your browser: Visit http://localhost:3000

Environment Variables

Create a .env file with:

GEMINI_API_KEY=your_gemini_api_key_here
MCP_PORT=9003

Usage

  1. Select a sample dataset or enter your own text containing sensitive information
  2. Specify sanitization intent (e.g., "Anonymize PII", "Redact financial data")
  3. Click "Sanitize Text" and watch the real-time progress
  4. View the sanitized result in the output panel
  5. Check the "Tool Info" tab to see which MCP tool was selected
  6. Use "View Raw Output" to see the complete response data

Sample Datasets

The application includes sample datasets for testing:

  • Personal Information: Name, email, phone, address, date of birth
  • Financial Data: Credit cards, IBAN, cryptocurrency wallets
  • Health Information: Medical records, prescriptions, insurance info
  • Workplace Data: Employee IDs, company names, salaries

MCP Tools

The MCP server provides these sanitization tools:

  1. anonymize_pii: Anonymizes personal identifiable information
  2. redact_financial: Redacts financial data like credit cards and bank accounts
  3. redact_health_info: Redacts protected health information
  4. anonymize_workplace: Anonymizes workplace-related sensitive information

Development

Project Structure

src/
ā”œā”€ā”€ ai/
│   ā”œā”€ā”€ flows/
│   │   └── sanitize-text-with-mcp.ts  # MCP client & Genkit flow
│   └── dev.ts                         # Development runner
ā”œā”€ā”€ app/
│   ā”œā”€ā”€ actions.ts                     # Next.js Server Actions
│   └── page.tsx                       # Main UI
ā”œā”€ā”€ components/ui/                     # ShadCN UI components
ā”œā”€ā”€ lib/
│   ā”œā”€ā”€ ai.ts                         # Genkit configuration
│   └── utils.ts                      # Utilities
└── mcp/
    └── server.ts                     # MCP server with tools

Scripts

  • npm run dev - Start Next.js development server
  • npm run dev:mcp - Start MCP server in watch mode
  • npm run build - Build for production
  • npm run start - Start production server
  • npm run lint - Run ESLint

Security Features

  • Defensive Security Focus: Only creates tools for protecting sensitive data
  • No Credential Harvesting: Designed specifically for data sanitization
  • Safe AI Processing: Uses AI to anonymize rather than extract sensitive information
  • Secure Architecture: Clear separation between client and server components

Educational Goals

This project demonstrates:

  1. Model Context Protocol (MCP) implementation in TypeScript
  2. AI-powered tool selection using Gemini 2.0 Flash
  3. Real-time streaming with React Server Components
  4. Modern full-stack architecture with Next.js and Genkit
  5. Secure AI application design focused on data protection

License

MIT License - feel free to use this project for learning and development!# PII_MCP_Server