mcp-redact
mcp-redact
AI 도구와 로그, 설정, 오류를 공유하기 전에 민감한 텍스트를 삭제(redact)하기 위한 로컬 우선 CLI 및 MCP 서버입니다.
mcp-redact는 Claude Code, Cursor 또는 기타 AI 도구에 텍스트를 붙여넣기 전에 비밀 정보와 민감한 데이터를 먼저 삭제하도록 도와줍니다.
이 도구가 필요한 이유
개발자들은 종종 로그, .env 파일, 요청 헤더, 스택 트레이스 및 설정 스니펫을 AI 도구에 붙여넣습니다. 이러한 스니펫에는 API 키, 베어러 토큰, 쿠키, 이메일 및 기타 민감한 값이 포함될 수 있습니다.
mcp-redact는 해당 흐름을 더 안전하게 만들기 위해 구축되었습니다:
로컬 우선
결정론적 정규식 기반 삭제
CLI와 MCP 모두를 위한 공유 엔진
[REDACTED_EMAIL]과 같이 읽기 쉬운 플레이스홀더
Related MCP server: phi-redact-mcp
적용 전 / 후
적용 전
Authorization: Bearer abcdefghijklmnop123456
user_email=user@example.com
callback=https://example.com/callback?token=secret123&lang=en
Cookie: session=abcdef123456; theme=dark적용 후
Authorization: Bearer [REDACTED_AUTHORIZATION_HEADER]
user_email=[REDACTED_EMAIL]
callback=https://example.com/callback?token=[REDACTED_SENSITIVE_URL]&lang=en
Cookie: session=[REDACTED_COOKIE_HEADER]; theme=dark빠른 시작
요구 사항:
Node.js 20+
pnpm
의존성 설치:
pnpm install샘플 파일 실행:
pnpm dev -- --file ./examples/sample.logstdin을 통한 텍스트 파이프:
pnpm dev -- < ./examples/sample.log예제 파일
이 저장소에는 로컬 테스트 및 데모에 사용할 수 있는 샘플 입력이 포함되어 있습니다:
examples/sample.logexamples/sample.envexamples/sample.jsonexamples/sample.yamlexamples/mcp-redact.config.json
모든 샘플 값은 가짜입니다.
CLI 사용법
stdin에서 읽기
pnpm dev -- < ./examples/sample.log파일에서 읽기
pnpm dev -- --file ./examples/sample.logpnpm dev -- --file ./examples/sample.env파일로 출력 쓰기
pnpm dev -- --file ./examples/sample.env --output ./sanitized.envJSON 출력
pnpm dev -- --file ./examples/sample.log --format json출력 예시:
{
"redactedText": "Authorization: Bearer [REDACTED_AUTHORIZATION_HEADER]\nuser_email=[REDACTED_EMAIL]\ncallback=https://example.com/callback?token=[REDACTED_SENSITIVE_URL]&lang=en\nCookie: session=[REDACTED_COOKIE_HEADER]; theme=dark\n",
"summary": {
"totalMatches": 4,
"byType": {
"authorization_header": 1,
"email": 1,
"sensitive_url": 1,
"cookie_header": 1
}
}
}요약 전용 출력
pnpm dev -- --file ./examples/sample.log --summary-only출력 예시:
Total matches: 4
By type:
- authorization_header: 1
- cookie_header: 1
- email: 1
- sensitive_url: 1활성화된 그룹 제한
개인(personal) 탐지기만 실행:
pnpm dev -- --file ./examples/sample.log --only personal런타임에 특정 그룹 비활성화:
pnpm dev -- --file ./examples/sample.log --disable http설정 파일 사용
pnpm dev -- --file ./examples/sample.log --config ./examples/mcp-redact.config.json예제 설정은 personal 및 custom 그룹만 활성화하고, 내장된 email 탐지기를 비활성화하며, 사용자 지정 internal-ticket 규칙을 추가합니다. 해당 설정을 사용하면 sample.log는 사용자 지정 티켓 값이 포함되어 있지 않고 이메일 삭제 기능이 비활성화되어 있으므로 변경되지 않은 상태로 유지됩니다.
MCP 사용법
MCP 서버 시작
개발 모드:
pnpm mcp:dev빌드 및 실행:
pnpm build
pnpm mcp:startMCP 도구
redact_text
입력:
{
"text": "Authorization: Bearer abcdefghijklmnop123456",
"groups": ["http"],
"configPath": "./examples/mcp-redact.config.json"
}redact_file
입력:
{
"filePath": "./examples/sample.log",
"groups": ["http"],
"configPath": "./examples/mcp-redact.config.json"
}두 도구 모두 동일한 구조의 결과를 반환합니다:
{
"redactedText": "...",
"summary": {
"totalMatches": 4,
"byType": {
"authorization_header": 1,
"email": 1
}
}
}MCP 클라이언트에서 연결
환경에 맞는 서버 명령어를 사용하세요:
개발:
pnpm mcp:dev빌드 출력:
pnpm mcp:start
MCP 클라이언트가 명령어와 인수를 요구하는 경우, 로컬 프로젝트를 가리키고 stdio를 통해 서버를 실행하세요. 서버는 redact_text와 redact_file이라는 두 가지 도구를 제공합니다.
설정
기본 설정 파일 이름:
mcp-redact.config.json명시적인 설정 경로가 제공되지 않으면 mcp-redact는 현재 작업 디렉토리에서 해당 파일을 읽으려고 시도합니다. 기본 파일이 없으면 실행은 정상적으로 계속됩니다. 존재하지 않는 설정 경로를 명시적으로 전달하면 명령은 실패합니다.
설정 예시:
{
"enabledGroups": ["personal", "custom"],
"disabledDetectors": ["email"],
"customRules": [
{
"name": "internal-ticket",
"pattern": "TICKET-[0-9]{6}",
"placeholder": "[REDACTED_TICKET]"
}
]
}설정 필드
enabledGroups: 내장 및 사용자 지정 탐지기를 나열된 그룹으로 제한합니다.disabledDetectors:email또는github-token과 같이 이름으로 탐지기를 비활성화합니다.customRules: 내장 규칙과 동일한 파이프라인을 사용하는 로컬 정규식 기반 탐지기를 추가합니다.
지원되는 탐지기
secrets
베어러 토큰
JWT
GitHub 토큰
OpenAI 스타일 API 키
Anthropic 스타일 API 키
AWS 액세스 키 ID
password=,token=,secret=,api_key=와 같은 키-값 비밀 정보개인 키 블록
personal
이메일
전화번호
IPv4
http
Authorization 헤더 베어러 값
쿠키 헤더 민감한 값
token=과 같은 민감한 URL 쿼리 값
로컬 개발
공통 명령어:
pnpm install
pnpm test
pnpm lint
pnpm typecheck
pnpm build
pnpm mcp:dev로드맵
더 많은 토큰 및 API 키 패턴
더 나은 오탐지 억제
더 많은 실제 로그 및 설정 예제
더 많은 엔드투엔드 MCP 클라이언트 예제
This server cannot be deployed
Maintenance
Related MCP Connectors
Detect and redact PII and secrets before text reaches an LLM, with reversible placeholders.
Redact personal data from text before your agent sends it to a model or stores it: names, contact details, ID numbers, financial and health identifiers, card numbers, plus any exact terms you add. Nothing stored, no third-party AI. Tools - redact_text: returns the redacted text and a count of what was removed, by type. Never the removed values. Options: restrict to particular data types, add exact terms to remove, choose the replacement style (a type label such as <PERSON> by default) and set a confidence threshold. - list_entity_types: lists the detectable data types. Free. Data handling - Nothing you send is stored. Text is processed in memory and discarded when the call returns. - No third-party AI. Text is never sent to OpenAI, Anthropic, Google or any other outside model. - Tool arguments are never logged. Only counts are kept: credits used, a timestamp and how many of each type were found. PDFs, including scanned pages, are handled by the REST API with the same key and credits. They aren't offered as an MCP tool because a file doesn't fit in a tool call. Pricing: 1 credit per call plus 1 per 1,000 characters. 10 free credits on sign-up, no card. Credit packs from $5; purchased credits never expire. Failed calls and repeated identical calls are free. Setup and API key: https://eleyed.com/mcp?utm_source=glama&utm_medium=directory&utm_campaign=listing
Stateless PII redaction over MCP/REST. Free ≤1000 words or $0.01/call; file upload supported.
Security & DLP proxy for MCP: tool-poisoning scans, PII redaction on tool args/results. Beta.
Related MCP Servers
- AlicenseAqualityDmaintenanceA redaction engine and MCP server that scrubs sensitive identifiers (AWS keys, IPs, emails, etc.) from AI agent traces, enabling safe storage and sharing of war stories via submit, search, and retrieve tools.3Apache 2.0
- AlicenseAqualityBmaintenanceAn MCP server that redacts PII/PHI from text before it ever reaches an LLM — self-hosted, fail-closed, and HIPAA-aware.336 PyPIMIT
- AlicenseAqualityAmaintenanceSanitizes text and files by removing PII, secrets, and custom patterns locally before sending to LLMs, with optional reverse-scrubbing.31,224 npm2MIT
- AlicenseNot gradedqualityCmaintenanceScans text and files for common secrets (AWS, GitHub, etc.) and redacts them to prevent credential leakage in AI-assisted development. Runs entirely locally with no telemetry.MIT