mcp-guard is a local-first MCP proxy that enforces policy before forwarding JSON-RPC tool calls to an upstream MCP server.
- Enforces allow/deny tool lists
- Enforces argument-level rules (
arg_rules) - Enforces payload-size limits
- Applies per-tool/per-client rate limits
- Redacts sensitive text in audit excerpts
- Persists signed audit events to JSONL or SQLite
- Supports replay by
event_id
mcp-guard run --config mcp-guard.yaml
mcp-guard validate --config mcp-guard.yaml
mcp-guard replay --log logs/session.jsonl --id <event_id>
mcp-guard policy test --config mcp-guard.yaml --fixture fixtures/*.json- Validate config:
mcp-guard validate --config mcp-guard.yaml- Run policy fixtures:
mcp-guard policy test --config mcp-guard.yaml --fixture fixtures/*.json- Start proxy:
mcp-guard run --config mcp-guard.yaml- Block
filesystem.delete:fixtures/block-filesystem-delete.json - URL whitelist for
http.fetch:fixtures/allow-http-fetch-example.json - Deny non-whitelisted
http.fetch:fixtures/deny-http-fetch-non-whitelist.json
Top-level keys:
versionserverspoliciesredactionrate_limitsauditdefaults
See mcp-guard.yaml for a full example.
Each JSONL line stores:
event_idtimestampclient_idservertooldecisionreasonlatency_msarg_hashredactions_appliedrequest_excerptresponse_excerptevent_hash
event_hash is a SHA-256 signature over the event body (excluding event_hash) for replay integrity checks.
go test ./...
go build ./cmd/mcp-guard- Static binaries: see
Makefile - Docker image: see
Dockerfile - CI matrix (Linux/macOS/Windows):
.github/workflows/ci.yml
- Architecture:
docs/architecture.md - Threat model:
docs/threat-model.md - Benchmarks:
docs/benchmark.md - Skillbench follow-up plan:
docs/skillbench-roadmap.md
Apache-2.0