ajaykallepalli/PII_MCP_Server
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.
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
| Layer | Technology |
|---|---|
| Framework | Next.js 14 (App Router) |
| AI SDK | Genkit |
| AI Model | Google Gemini 2.0 Flash |
| AI Protocol | Anthropic Model Context Protocol (MCP) |
| UI | ShadCN UI |
| Styling | Tailwind CSS |
| Language | TypeScript |
| Forms | react-hook-form + zod |
| Streaming | ai/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
-
Clone and install dependencies:
git clone <repo> cd sanitize-ai npm install -
Set up environment variables:
cp .env.example .env # Edit .env and add your GEMINI_API_KEY -
Start the MCP server (in terminal 1):
npm run dev:mcp -
Start Next.js (in terminal 2):
npm run dev -
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
- Select a sample dataset or enter your own text containing sensitive information
- Specify sanitization intent (e.g., "Anonymize PII", "Redact financial data")
- Click "Sanitize Text" and watch the real-time progress
- View the sanitized result in the output panel
- Check the "Tool Info" tab to see which MCP tool was selected
- 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:
- anonymize_pii: Anonymizes personal identifiable information
- redact_financial: Redacts financial data like credit cards and bank accounts
- redact_health_info: Redacts protected health information
- 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 servernpm run dev:mcp- Start MCP server in watch modenpm run build- Build for productionnpm run start- Start production servernpm 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:
- Model Context Protocol (MCP) implementation in TypeScript
- AI-powered tool selection using Gemini 2.0 Flash
- Real-time streaming with React Server Components
- Modern full-stack architecture with Next.js and Genkit
- Secure AI application design focused on data protection
License
MIT License - feel free to use this project for learning and development!# PII_MCP_Server