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