npm guardrails-mcp-serverstdioMITupdated 11d ago
MCP server for AI agent security guardrails. Provides input validation, prompt injection detection, PII redaction, output filtering, policy enforcement, rate limiting, and comprehensive audit logging.
guardrails 能做什么?
guardrails-mcp-server
[!License: MIT](https://opensource.org/licenses/MIT) [!MCP](https://modelcontextprotocol.io) [!Node.js](https://nodejs.org)
MCP server for AI agent security guardrails. Provides input validation, prompt injection detection, PII redaction, output filtering, policy enforcement, rate limiting, and comprehensive audit logging.
Tools
| Tool | Description |
|---|---|
validate_input |
Validate and sanitize incoming requests through all guardrail checks |
filter_output |
Filter and redact sensitive data (PII, secrets, credentials) from responses |
check_policy |
Evaluate a request against security policies (RBAC, resource access, quotas) |
get_audit_logs |
Query the audit log with filtering by type, user, time range |
get_stats |
Get engine statistics including active users, block rate, request counts |
update_config |
Update guardrail configuration at runtime |
Security Features
- Prompt Injection Detection -- 12 regex patterns for jailbreak, DAN mode, system prompt override
- PII Detection and Redaction -- SSN, credit card, email, phone, IP, API keys, AWS keys, JWT, passwords, private keys, connection strings
- Malicious Code Blocking -- eval, exec, subprocess, child_process, shell injection
- Policy Engine -- Block sensitive paths, dangerous tools, unauthenticated destructive ops, URL allowlist, maintenance windows
- Rate Limiting -- Per-user sliding window (configurable requests/minute)
- Audit Logging -- Timestamped events with metrics, log rotation, external handler support
Install
npm install
Configuration
{
"mcpServers": {
"guardrails": {
"type": "stdio",
"command": "node",
"args": ["/path/to/guardrails-mcp-server/index.js"]
}
}
}
Project Structure
src/engine/GuardrailsEngine.js # Core orchestration
src/validators/InputValidator.js # Prompt injection and PII detection
src/filters/OutputFilter.js # Redaction and harmful content blocking
src/policies/PolicyEngine.js # RBAC, quotas, maintenance windows
src/audit/AuditLogger.js # Event logging and metrics
License
安装
把 guardrails 添加到你的客户端。选择你正在使用的那个。
claude mcp add guardrails-mcp-server -- npx -y guardrails-mcp-servercodex mcp add guardrails-mcp-server -- npx -y guardrails-mcp-serveramp mcp add guardrails-mcp-server -- npx -y guardrails-mcp-server{
"mcpServers": {
"guardrails-mcp-server": {
"command": "npx",
"args": [
"-y",
"guardrails-mcp-server"
]
}
}
}Add to `claude_desktop_config.json`, then restart Claude Desktop.
{
"mcpServers": {
"guardrails-mcp-server": {
"command": "npx",
"args": [
"-y",
"guardrails-mcp-server"
]
}
}
}Add to `~/.cursor/mcp.json`, or `.cursor/mcp.json` for a single project.
code --add-mcp '{"name":"guardrails-mcp-server","command":"npx","args":["-y","guardrails-mcp-server"]}'Or add the block manually to `.vscode/mcp.json` under `servers`.
{
"mcpServers": {
"guardrails-mcp-server": {
"command": "npx",
"args": [
"-y",
"guardrails-mcp-server"
]
}
}
}Add to `~/.codeium/windsurf/mcp_config.json`.
{
"mcpServers": {
"guardrails-mcp-server": {
"command": "npx",
"args": [
"-y",
"guardrails-mcp-server"
]
}
}
}Add to `cline_mcp_settings.json` via the MCP Servers panel.
{
"mcpServers": {
"guardrails-mcp-server": {
"command": "npx",
"args": [
"-y",
"guardrails-mcp-server"
]
}
}
}Add to `~/.gemini/settings.json`.
{
"mcpServers": {
"guardrails-mcp-server": {
"type": "local",
"command": "npx",
"args": [
"-y",
"guardrails-mcp-server"
],
"tools": [
"*"
]
}
}
}Add to `~/.copilot/mcp-config.json`, or run `/mcp add` inside the CLI.
{
"context_servers": {
"guardrails-mcp-server": {
"command": {
"path": "npx",
"args": [
"-y",
"guardrails-mcp-server"
]
}
}
}
}Add to your Zed `settings.json`.
npx -y guardrails-mcp-serverRun `goose configure`, choose **Add Extension → Command-line Extension**, and paste this command.
6 个工具
guardrails 向已连接的智能体提供 6 个工具。
- validate_input
- Validate and sanitize incoming requests through all guardrail checks
- filter_output
- Filter and redact sensitive data (PII, secrets, credentials) from responses
- check_policy
- Evaluate a request against security policies (RBAC, resource access, quotas)
- get_audit_logs
- Query the audit log with filtering by type, user, time range
- get_stats
- Get engine statistics including active users, block rate, request counts
- update_config
- Update guardrail configuration at runtime
评分
72 / 100
良好
- 文档22/25
- 维护19/25
- 可信度13/20
- 能力6/15
- 安装体验12/15
- Documents what it does and how to connect
- Has a resolvable package or endpoint
- Exposes at least one tool, prompt or resource
- README has substantive content
- Includes a code example
- Documents its configuration
- Mentions credentials or security posture
- Last commit 3 days ago
- Has a release history
- Repository is not archived
- Licensed MIT
- Namespace verified in the official MCP registry
- Claimed by its owner
- Published under an organisation
- 6 tool(s) documented
- Provides prompt templates
- Provides resources
- 12 documented install method(s)
- Published to a package registry
- Offers a hosted endpoint — no local install
版本历史
| 版本 | 发布于 |
|---|---|
| 1.0.1最新 | 2026年2月14日 |