loading…
Search for a command to run...
loading…
Security and governance proxy for MCP infrastructure. Enforces YAML-configurable policies (blocklists, rate limits, token budgets), tracks real token costs via
Security and governance proxy for MCP infrastructure. Enforces YAML-configurable policies (blocklists, rate limits, token budgets), tracks real token costs via tiktoken, monitors server health with live JSON-RPC probes. Features include OAuth 2.1/OIDC with RBAC, web dashboard with Prometheus metrics, payload normalization against encoding bypasses, semantic shell AST analysis, mTLS zero-trust networking, circuit breakers, and a formal STRIDE threat model. 168 tests across 16 suites. Install: npm install -g @mcp-guardian/server
A security layer that sits between your AI agent and its tools — so nothing bad gets through.
npm version npm downloads Website mcp-guardian MCP server TypeScript MCP SDK License CI
Version 3.3.1 · Website · npm · Changelog
| Path | Community | Enterprise (GUARDIAN_ENTERPRISE_MODE=true) |
|---|---|---|
Request (tools/call) |
Regex + schema | + sync semantic request gate (default when LLM configured) |
| Response | Optional sync gate | Sync response gate (production default) |
| Audit / learning | Opt-in async | Opt-in async |
See ENTERPRISE_DEPLOYMENT.md for Redis, multi-replica, and license requirements.
@mcp-guardian/plugin-sdk docs/source/tests aligned to 3.3.1GET /api/audit/attestation)tools/list responses (including JSON-RPC with id), inflight cap before policy/LLM, opt-in policy eval cache (cacheable in YAML), enterprise sync semantic request gate, cross-transport parity (stdio, HTTP, WebSocket, SSE, streamable HTTP)DELETE /api/internal/rug-pull for clearing cluster rug-pull flags; semanticRequestGate on dashboard /api/healthGET /api/analytics/summary)GET /api/security/dashboard)mcp-guardian autopilot init/start/status; scheduled digests and background learningpnpm analyze and Protection workspace plain-English briefingreal-life:* runners honor MCP_GUARDIAN_DB_PATH so attack traffic appears in the dashboardWhen you use an AI assistant (like Claude, Cursor, or Cline), it connects to tool servers — things like GitHub, a database, your filesystem, or Slack. These connections use a standard called MCP (Model Context Protocol).
The problem: there's nothing stopping the AI from making dangerous tool calls, leaking secrets, running commands it shouldn't, or burning through your API budget without you knowing.
MCP Guardian sits in the middle. Every tool call the AI makes passes through Guardian first. Guardian checks it against your rules and either lets it through, blocks it, or flags it for review — before anything happens.
Your AI assistant
│
▼
MCP Guardian ◄── checks every call against your rules
│
▼
Your tool servers (GitHub, filesystem, database...)
history.db)pnpm harness)pnpm real-life:filesystem)pnpm analyze)Pro requires a license in production. Local dev:
pnpm dashboard:proxy. See PRO_SETUP.md and AUTOPILOT.md.
~/.mcp-guardian/history.db by default, WAL mode)AI client or attack runner
│
▼
Guardian proxy (policy + semantic + learning)
│
├──► upstream MCP server(s)
│
└──► history.db ──► Dashboard :4000 (Analytics, Security, Audit)
npm install -g @mcp-guardian/server
mcp-guardian onboard
This finds your MCP configs (Cline, Claude Desktop, Cursor, Windsurf), wraps the servers, and sets up Guardian as the proxy. Takes about 30 seconds.
# Start the proxy with the default policy
mcp-guardian proxy --policy default-policy.yaml
From the repo root after pnpm build:
pnpm dashboard:proxy
# optional: pnpm dashboard:proxy -- guardian-configs/filesystem.json default-policy.yaml
Open http://localhost:4000/ — static SPA + /api/* + /ws are served by the same proxy process. Traffic you send through Guardian is reflected in Operations → Analytics and Security → Dashboard.
Autopilot (wrap + dashboard + background services):
pnpm autopilot:init -- --apply
pnpm autopilot:start
Legacy dev split (Next.js on :3000 proxying to :4040): pnpm soc:full — see SOC-API.md.
Prove end-to-end analytics with a second terminal while dashboard:proxy stays running:
export MCP_GUARDIAN_DB_PATH="$HOME/.mcp-guardian/history.db"
export MCP_GUARDIAN_HOME="$HOME/.mcp-guardian"
export REAL_LIFE_METRICS_ENABLED=false # avoid :9090 clash with dashboard proxy
pnpm real-life:filesystem # ~30s smoke (path traversal, injection, shell-in-args)
# or:
pnpm real-life:continuous # corpus + adversarial fixtures (default 60 min)
Uses the official @modelcontextprotocol/server-filesystem upstream. Success targets: ≥95% attack block rate, ≤2% benign false positives. Details: scenarios/real-life/README.md.
# optional verification
curl -s 'http://localhost:4000/api/analytics/summary?window=1h' | jq '{totalRequests, errorRatePct}'
curl -s 'http://localhost:4000/api/security/dashboard?window=24h' | jq '{securityScore, activeThreatCount}'
pnpm scripts (from repo root)| Script | Purpose |
|---|---|
dashboard:proxy |
Proxy + dashboard at :4000 (recommended) |
autopilot:init / autopilot:start |
Wrap MCP configs and start Autopilot |
analyze |
Full security/health report to stdout |
real-life:filesystem |
Short live MCP attack smoke test |
real-life:continuous |
Extended corpus/adversarial attack stream |
real-life:swarm |
Live filesystem + security swarm analysis report |
security-swarm:analyze |
Unified swarm + live track → reports/security-swarm/analysis.txt |
harness |
Offline adversarial policy matrix (808+ fixtures) |
Your rules live in default-policy.yaml. Here's a simple example:
version: '1.0'
policy:
mode: block # block anything not explicitly allowed
default_action: block
rules:
- name: allow-safe-tools
description: Only allow read-only tools
action: block
tools:
allow:
- read_file
- list_directory
- search
- name: block-shell-commands
description: Never let the AI run shell commands
action: block
tools:
deny:
- bash
- execute_command
- eval
- name: rate-limit
description: Max 60 tool calls per minute
action: block
maxCallsPerMinute: 60
The default policy already blocks ~300 known attack patterns. You can extend it or write your own from scratch.
Common overrides:
| Variable | What it does |
|---|---|
MCP_GUARDIAN_POLICY |
Path to your policy YAML file |
MCP_GUARDIAN_DB_PATH |
SQLite call history (default ~/.mcp-guardian/history.db; share this between dashboard:proxy and real-life:* runners) |
MCP_GUARDIAN_HOME |
Guardian home dir (semantic store, autopilot config) |
DASHBOARD_PORT |
Dashboard + API port (default 4000) |
DASHBOARD_ENABLED |
Serve dashboard SPA + REST from proxy (default on with dashboard:proxy) |
GUARDIAN_WS_ENABLED |
Live WebSocket updates (default true) |
GUARDIAN_CI_BYPASS_LICENSE |
Local dev: enable dashboard REST without Pro license |
GUARDIAN_DAILY_BUDGET_USD |
Daily cost budget (alerts in Operations → Cost) |
GUARDIAN_LLM_PROVIDER / OLLAMA_BASE_URL |
Local Ollama for semantic audit, Threat Lab, full analysis |
REAL_LIFE_METRICS_ENABLED |
Set false when running a second proxy alongside dashboard:proxy |
LIVE_ATTACK_DURATION_MINUTES |
Wall-clock duration for real-life:continuous (default 60) |
SOC_API_PORT |
Legacy standalone SOC API (default 4040; see SOC-API.md) |
| Component | What it is |
|---|---|
mcp-guardian proxy |
Main proxy — policy, audit, optional dashboard on :4000 |
mcp-guardian onboard |
Finds and wraps MCP configs (Cline, Cursor, Claude Desktop, …) |
mcp-guardian autopilot |
Init/start/status for plug-and-play protection + dashboard |
mcp-guardian analyze |
Plain-English full security/health report (pnpm analyze) |
mcp-guardian tui |
Terminal UI for live traffic |
mcp-guardian doctor |
Health check for your setup |
pnpm dashboard:proxy |
Build + start proxy with dashboard SPA (recommended) |
deploy/dashboard-spa/ |
Enterprise dashboard v3 (workspaces, analytics, security, setup) |
src/utils/dashboard-server.ts |
REST + static SPA + WebSocket (embedded in proxy) |
src/soc-api-server.ts |
Legacy standalone SOC API (pnpm soc:api) |
scenarios/real-life/ |
Live filesystem MCP scenarios + continuous attack stream |
default-policy.yaml |
Default rules (~300 attack patterns) |
policy-templates/ |
Ready-made policy templates |
When DASHBOARD_ENABLED=true, the proxy serves the SPA and routes including:
| Endpoint | Purpose |
|---|---|
GET /api/analytics/summary?window=1h|12h|24h|7d |
Traffic KPIs, error rate, token/cost series |
GET /api/security/dashboard?window=24h |
Security score, active threats, threat table |
GET /api/aggregate/audit |
Block/pass audit with filters |
GET /api/autopilot/status |
Autopilot protection / learning / digest summary |
GET /api/setup/status |
Guided setup checklist |
WS /ws |
Live metric and audit ticks |
Legacy standalone backend: SOC-API.md (pnpm soc:api:dev on :4040 + pnpm dashboard:dev on :3000).

Think of the Security Swarm as a team of AI agents working around the clock to find weaknesses in your setup before attackers do.
There are two tracks running in parallel:
The two tracks feed each other: real-world blocks strengthen the test library, and new test discoveries improve live detection. It's a self-improving loop that never stops.
Pro feature — requires a license key. Run with
pnpm security-swarm.

The Threat Lab uses a local AI model (Ollama/Qwen) to invent new attack patterns that haven't been seen before.
Here's how it works step by step:
This means the system gets smarter over time, but you stay in control of every change.
Pro feature — requires a license key + local Ollama with
qwen3:8b. Run withpnpm security-swarm:threat-lab.

While the Threat Lab requires you to trigger it, Auto Threat Research runs in the background automatically whenever something interesting happens.
The flow:
Importantly: nothing is auto-applied to your policy. This is an audit-only research loop. It just builds your library of known attacks for future reference and rule suggestions.
Pro feature — runs automatically when
GUARDIAN_THREAT_RESEARCH_AUTO=trueis set.
Get a Pro license at mcp-guardian-cloud.vercel.app ($4.99 lifetime).
Community features (proxy, policy, scan, harness, real-life scenarios) are free and MIT licensed.
MCP Guardian auto-discovers config files from:
Or point it at any MCP config file with --config path/to/config.json.
MIT for all community features. See LICENSE and COMMUNITY_SCOPE.md for details. Pro features are covered by LICENSE-PRO.
Run in your terminal:
claude mcp add rudraneel93-mcp-guardian -- npx pro tip
Just installed rudraneel93/mcp-guardian? Say to Claude: "remember why I installed rudraneel93/mcp-guardianand what I want to try" — it'll save into your Vault.
how this works →Security
Low riskAutomated heuristic from public metadata — not a security guarantee.