RedactAI MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@RedactAI MCP Server Redact this message before sending to the AI: "My name is John Doe, email john@example.com, phone 555-123-4567""
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
RedactAI MCP Server
A standalone, production-ready Model Context Protocol (MCP) server built in TypeScript for sensitive data detection, sanitization, and PII redaction before downstream AI agent processing.
Supports both Local STDIO MCP and Remote Streamable HTTP MCP (compatible with Render, cloud hosts, and remote agent workflows).
1. What the Project Does
RedactAI MCP Server exposes a high-performance MCP tool named sanitize_text. It inspects text for sensitive personal identifiable information (PII) including Names, Email Addresses, Phone Numbers, ID Numbers (Employee IDs, Tax IDs, National IDs), and Locations, redacting them using configurable strategies:
MASK(default): Replaces sensitive entities with semantic tokens (e.g.[NAME],[EMAIL],[PHONE],[ID_NUMBER],[LOCATION]).HASH: Computes deterministic SHA-256 hash placeholders (e.g.[HASH:a1b2c3d4]) to preserve referential consistency across documents without exposing raw plaintext.REMOVE: Strips the sensitive entity completely ("").
Related MCP server: PII Redaction MCP Server
2. Why MCP (Model Context Protocol)?
AI agents and LLMs frequently ingest raw user prompts, support transcripts, logs, and sensitive internal records. Sending unredacted PII to external model APIs introduces critical privacy, security, and regulatory compliance risks (GDPR, HIPAA, DPDP).
By exposing the RedactAI engine as a native MCP tool, any MCP-compatible agent workflow, IDE, or client (Claude Desktop, Antigravity, Cursor, LangChain, LlamaIndex, or custom agent runtimes) can automatically call sanitize_text directly within the agent loop to scrub sensitive context before executing external prompts.
3. Architecture & Transports
Both local and remote transports share the exact same redaction and detection pipeline:
MCP CLIENT / AI AGENT
/ \
/ \
STDIO HTTPS
(Local CLI) (Remote Server)
| |
v v
src/index.ts src/http.ts
\ /
\ /
v v
Tool: sanitize_text (/mcp)
|
v
Redaction Service
|
v
DetectionProvider
|
v
Teammate's Core Engine
(future adapter)Local STDIO Transport (
src/index.ts): Communicates overstdin/stdout.Remote Streamable HTTP Transport (
src/http.ts): Exposes standard MCP over HTTP at/mcpwith full SSE/streaming and CORS support.TemporaryDetectionProvider: High-accuracy deterministic regex and context-based provider for standalone demonstration.Teammate Core Adapter: Drop-in replacement via the
DetectionProviderinterface.
4. Installation & Build
Ensure Node.js (v20+ or v22+) is installed:
# Clone or navigate into project directory
cd redactai-mcp
# Install dependencies
npm install
# Typecheck TypeScript
npm run typecheck
# Build both STDIO and HTTP entry points to dist/
npm run build
# Run all 21 unit, STDIO, and HTTP tests
npm run test5. Running the MCP Server
A. Local STDIO MCP Server
Used for local CLI tools, Claude Desktop, Cursor, or local Antigravity setups.
# Production start
npm run start
# Or directly: node dist/index.js
# Development mode
npm run devB. Remote Streamable HTTP MCP Server
Used for remote web clients, cloud-hosted agents, or teammate web applications connecting over HTTPS.
# Production start (listens on PORT or 10000, binds to 0.0.0.0)
npm run start:http
# Or directly: node dist/http.js
# Development mode
npm run dev:httpDefault endpoints when running locally:
MCP Endpoint:
http://localhost:10000/mcpHealth Check:
http://localhost:10000/healthInfo:
http://localhost:10000/
6. Testing with MCP Inspector
The official MCP Inspector provides an interactive web UI to test tools and schema definitions.
Testing Local STDIO Server:
npx @modelcontextprotocol/inspector node dist/index.jsTesting Remote Streamable HTTP Server:
Start the HTTP server in one terminal:
npm run start:httpLaunch MCP Inspector in another terminal connecting via HTTP transport:
npx @modelcontextprotocol/inspector http://localhost:10000/mcp
7. Render Deployment Guide
A pre-configured render.yaml blueprint is included in the project.
Automatic Blueprint Deployment
Push this repository to GitHub/GitLab.
In the Render Dashboard, click New > Blueprint.
Connect your repository. Render will automatically read
render.yaml:Environment: Node
Build Command:
npm install && npm run buildStart Command:
npm run start:httpHealth Check Path:
/healthPort: Auto-assigned by Render (
process.env.PORT)
Once deployed, your public MCP URL will be:
https://YOUR-SERVICE-NAME.onrender.com/mcp
Health Check Verification
curl https://YOUR-SERVICE-NAME.onrender.com/health
# Returns: {"status":"ok"}8. Example sanitize_text Invocation
Tool Name
sanitize_text
Description
Detect and redact sensitive personal information from text before downstream processing.
Input Schema
{
"text": "Contact John Mehta at john.mehta@example.com or 9876543210.",
"rules": {
"NAME": "MASK",
"EMAIL": "MASK",
"PHONE": "MASK",
"ID_NUMBER": "MASK",
"LOCATION": "MASK"
}
}(Note: The rules object is optional. If omitted, all entity types default to MASK.)
Custom Rules Example (e.g. Hashing email & Removing phone)
{
"text": "Contact John Mehta at john.mehta@example.com or 9876543210.",
"rules": {
"NAME": "MASK",
"EMAIL": "HASH",
"PHONE": "REMOVE"
}
}Example Structured Response
{
"redactedText": "Contact [NAME] at [EMAIL] or [PHONE].",
"detections": [
{
"type": "NAME",
"value": "John Mehta",
"start": 8,
"end": 18,
"confidence": 98,
"redaction": "[NAME]"
},
{
"type": "EMAIL",
"value": "john.mehta@example.com",
"start": 22,
"end": 44,
"confidence": 99,
"redaction": "[EMAIL]"
},
{
"type": "PHONE",
"value": "9876543210",
"start": 48,
"end": 58,
"confidence": 95,
"redaction": "[PHONE]"
}
],
"summary": {
"totalDetections": 3,
"byType": {
"NAME": 1,
"EMAIL": 1,
"PHONE": 1,
"ID_NUMBER": 0,
"LOCATION": 0
}
}
}9. Connecting Teammate's Core Engine
When your teammate completes the core redaction engine or an ML/NER model, integrate it in 3 simple steps:
Step 1: Implement DetectionProvider
Create an adapter class implementing the DetectionProvider interface:
// src/teammate-adapter.ts
import { Detection, DetectionProvider } from "./types.js";
import { realTeammateEngine } from "teammate-core-engine";
export class CoreEngineAdapter implements DetectionProvider {
async detect(text: string): Promise<Detection[]> {
const coreResults = await realTeammateEngine.scan(text);
return coreResults.map((item) => ({
type: item.category as any, // "NAME" | "EMAIL" | "PHONE" | "ID_NUMBER" | "LOCATION"
value: item.rawText,
start: item.startIndex,
end: item.endIndex,
confidence: item.score,
}));
}
}Step 2: Inject the Adapter
In src/index.ts and src/http.ts:
import { CoreEngineAdapter } from "./teammate-adapter.js";
import { RedactionService } from "./redaction.js";
import { runStdioServer } from "./index.js";
import { createHttpServer } from "./http.js";
// Initialize with teammate's adapter
const customProvider = new CoreEngineAdapter();
const redactionService = new RedactionService(customProvider);
// For STDIO:
// runStdioServer(redactionService);
// For HTTP:
// createHttpServer(undefined, undefined, redactionService);Step 3: Run Tests
npm run test10. Security & Privacy Guarantees
Zero Persistence: No input text or processed output is logged or written to storage.
Protocol Separation: All operational logs are directed strictly to
stderr.Deterministic Privacy:
HASHmode computes one-way SHA-256 tokens preserving referential linkability without exposing raw cleartext.Hackathon Note: The public HTTP endpoint is designed for hackathon demonstration and agent workflow integration.
Available Tools
1 toolsanitize_textB
Detect and redact sensitive personal information from text before downstream processing.
Inputs: text (required), rules.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
With only one tool, there is no possibility of an agent confusing it with another operation. sanitize_text has a clear, singular purpose that is easy to identify.
The single tool name follows a clean verb_noun convention and is descriptive of its function. Since there are no other tool names, there are no inconsistencies to introduce confusion.
One tool is on the low end of typical MCP server scopes, but for a focused RedactAI service it is reasonable and not trivial. The tool directly addresses the server's intended operation without unnecessary bloat.
The tool fully covers the stated purpose of detecting and redacting sensitive personal information before downstream processing. No additional lifecycle or auxiliary operations are needed for this narrow, stateless transformation task.
Maintenance
Related MCP Connectors
Find and redact leaked secrets, wallet keys and PII before an AI agent sends text.
Detect and redact PII and secrets before text reaches an LLM, with reversible placeholders.
Detects and redacts PII (emails, phones, SSNs, names, addresses) from text. $0.02/call via x402.
Detect and redact PII and secrets (API keys, tokens) in text, HTML or PDF before it reaches an LLM.
Related MCP Servers
- FlicenseAqualityBmaintenancePII sanitization layer for autonomous AI agent pipelines. Detects and redacts emails, phone numbers, national IDs, private keys, and financial data before text reaches LLMs. Supports EN, ES (LATAM), PT (BR/PT), DE, JA.12-
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to redact PII from text, summarize redacted content, and manage custom redaction patterns across multiple languages.-
- FlicenseNot gradedqualityDmaintenanceRedacts PII from LLM traces and tool payloads before they leave review, enabling PII scanning, payload redaction, sensitive field classification, privacy receipts, and trace audit exports.-
- AlicenseNot gradedqualityCmaintenanceStrips personal data and credentials from text before it reaches a model, log, or ticket, using checksum-verified detection for cards, IBANs, routing numbers, SSNs, contact details, and API keys. Placeholders such as <EMAIL_1> can later be swapped back in so the model's response is restored with the original values.MIT