mask_api_keys_and_secrets
Redact OpenAI-style API keys, bearer tokens, and common named secrets.
text必填
io.github.saurabhdrh由 GitHub 账号 saurabhdrh 发布v1.0.0更新于 Oct 27, 2026
Redacts common secrets, email addresses, and phone numbers.
基于正则的脱敏工具,让助手遮蔽文本中的 API 密钥、令牌、邮箱和电话号码,并统计识别到的风险数量。
Web executable,通过 SSE。 远程服务在工作区中配置后即可从网页运行时运行。
把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。
阅读 https://sourceweft.com/mcp/io.github.saurabhdrh%2Fmcp-security-sanitizer/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。把它添加到你客户端的 mcpServers 配置中。
{
"mcpServers": {
"security-sanitizer": {
"type": "sse",
"url": "https://mcp-security-sanitizer-server.onrender.com/sse"
}
}
}A small MCP server and interactive LangChain/Groq chatbot. The server exposes local regex-based tools for redacting common secrets and personally identifiable information (PII), and the client sanitizes each message before sending it to the language model.
Important limitation: Regex matching only recognizes the patterns implemented here. It cannot guarantee detection of every secret or PII value. The client guarantees that both configured sanitizer tools are called before each non-empty user message is passed to Groq; the system prompt is defense-in-depth, not the enforcement mechanism. Do not send regulated or highly sensitive data without adding appropriate controls and validating detection coverage for your environment.
Sanitization uses local Python regular expressions in the MCP server and
consumes 0 LLM tokens. The client makes the sanitizer calls synchronously
before invoking the agent, so raw input is not sent to Groq by this chat flow.
An MCP transport is still a network boundary; this configuration binds the
server to loopback (127.0.0.1) and is intended for local development.
The logging interceptor prints tool names and argument field names but withholds all argument and result contents, so it does not log unsanitized input or potentially sensitive sanitizer output.
uvFrom the project directory, resolve dependencies, create the project-local
.venv, and write or update uv.lock:
You do not need to activate .venv when using uv run; it selects the
project environment automatically.
Create a .env file in the project directory (beside pyproject.toml):
Keep .env out of version control. The client loads this file at startup and
checks that GROQ_API_KEY is set before connecting to Groq. A .env placed
inside .venv is also recognized as a fallback, but the project directory is
the recommended location because .venv is generated and can be deleted and
recreated. GROQ_MODEL is optional; if omitted, the client uses
openai/gpt-oss-120b. If Groq reports that a model is unavailable, set
GROQ_MODEL to a model ID enabled for your account. The API key is used by
ChatGroq; it is not sent to the MCP server.
Start the MCP server in one terminal:
It listens on http://127.0.0.1:8000 using the SSE transport, with the MCP
endpoint at /sse.
The image below illustrates the expected server terminal after startup. It is a generated example rather than a direct screenshot from your machine; process IDs and log formatting can differ by FastMCP/Uvicorn version.
[Illustrative MCP server startup terminal]
In a second terminal, start the interactive chatbot:
Alternatively, activate the project environment in each terminal and run Python directly. For example, in Windows PowerShell:
In a second activated terminal:
Type exit or quit to end the chat.
With both the server and client running, paste one of these prompts into the client. Every value below is synthetic test data; do not use real credentials or personal information for testing.
Email and phone
The text passed to the agent should replace those values with:
API key and named password
Both credential values should be replaced with [REDACTED_SECRET] before the
message is sent to Groq.
Bearer token and mixed data
The email, phone number, and Bearer token should be masked by the applicable tool. The interactive client intentionally does not print sanitized text to the terminal; it logs which tools ran while withholding their arguments and results. The expected replacements above describe what is passed onward, not what is displayed in the console.
Run the server and client in separate terminals. The server stays running while the client connects to it.
Terminal 1 — MCP server (timestamps and process IDs vary):
Terminal 2 — client (example sanitizer call; the fake values below are for testing only):
The interceptor intentionally withholds tool arguments and results from the terminal, so the unsanitized input is not printed by the MCP logs. The message passed to the agent has these substitutions:
The assistant reply depends on the Groq model and is not a fixed output. The illustration below shows the server startup and the local sanitizer calls. It is an example terminal view, not a raw desktop screenshot; the sanitizer check does not make a Groq request. Startup timestamps and process IDs vary by run.
[Illustrative MCP server and sanitizer client terminal output]
uv run manages and uses the project environment without requiring manual
activation. To run python server.py or python client.py directly, first
activate .venv in that terminal.来源:README.md,提交 1710258
Redact OpenAI-style API keys, bearer tokens, and common named secrets.
text必填Redact email addresses and common North American phone numbers.
text必填Count recognizable secrets, email addresses, and phone numbers.
text必填已满足适用检查项的 90%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
请在仓库或注册中心条目中声明许可证。
User input | vPython client --MCP/SSE--> local regex scrubbers | 1. mask_api_keys_and_secrets | 2. mask_pii_data vSanitized text --> LangChain agent --> Groquv syncGROQ_API_KEY=your_groq_api_keyGROQ_MODEL=openai/gpt-oss-120buv run server.pyuv run client.py.\.venv\Scripts\Activate.ps1python server.py.\.venv\Scripts\Activate.ps1python client.pyWrite a friendly appointment reminder for [email protected] and ask them tocall (415) 555-0134 if they need to reschedule.[email protected] -> [REDACTED_EMAIL](415) 555-0134 -> [REDACTED_PHONE]Explain why this demo credential should not be shared: sk-1234567890abcdef.The test password is password=hunter2.Help me write a support note for [email protected]. The test phone is212-555-0199 and the example authorization header is Bearerabc123.def456.ghi789.INFO Starting MCP server 'MCP Security Sanitizer' with transport 'sse' on http://127.0.0.1:8000/sseINFO: Started server process [process-id]INFO: Waiting for application startup.INFO: Application startup complete.Secure assistant ready. Type 'exit' or 'quit' to stop.
You: Contact [email protected] at (415) 555-0134; test key sk-1234567890abcdef.
[MCP] Calling mask_api_keys_and_secrets (arguments: text)[MCP] mask_api_keys_and_secrets completed; result content withheld.
[MCP] Calling mask_pii_data (arguments: text)[MCP] mask_pii_data completed; result content withheld.
Assistant: [The assistant's reply appears here after the sanitized message is sent to the configured Groq model.]Contact [REDACTED_EMAIL] at [REDACTED_PHONE]; test key [REDACTED_SECRET].