scopeguard-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@scopeguard-mcp check whether https://staging.example.test/login is in scope"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
scopeguard-mcp
An MCP stdio server that gives bug-hunting AI agents an enforceable authorized-scope guardrail: every target is checked against a declarative allow/deny list before a finding can be recorded, and evidence is stripped of secrets on the way in.
Problem
Agent-driven bug hunting fails in a predictable way: the agent happily turns toward a host the operator never authorized, or it pastes a live credential from a captured response straight into a finding (and from there into an LLM prompt). Human review catches that after the fact — if at all.
scopeguard-mcp puts the check in the middle of the loop, as MCP tools the
agent must call:
check_targetanswers "am I allowed to touch this?" before any request.add_findingre-checks the same scope itself and refuses out-of-scope records, so a rule skipped by the agent still holds.redactremoves tokens, keys, JWTs, card numbers and e-mail addresses from evidence before it leaves the workstation.
Related MCP server: sentrik
Key features
Declarative scope — JSON allow/deny list with
host(wildcard*.a.b),url(scheme + path prefix) andcidrrules. Deny always wins; loopback is always allowed so the local lab works out of the box.No network activity, ever — the scope decision is pure string/IP matching. No DNS lookups, no connections, so a check can never become a side channel to an unauthorized host.
CVSS v3.1 Base scoring — verified against FIRST's published example vectors (9.8, 8.8, 7.8, 8.1, 7.5, 6.1, 0.0).
Evidence redaction — GitHub/Slack/AWS tokens, PEM private keys, JWTs, bearer headers,
api_key=...assignments, URL credentials, Luhn-valid card numbers and e-mail addresses.Append-only JSONL ledger — each finding stores the scope verdict that allowed it, with sequential IDs and corrupt-line tolerance.
Zero dependencies — Python 3.10+ standard library only, including the JSON-RPC layer.
Example session
-> {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26",...}}
<- {"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-03-26","capabilities":{"tools":{}},"serverInfo":{"name":"scopeguard-mcp",...}}}
-> {"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"check_target","arguments":{"target":"https://prod.staging.example.test"}}}
<- {"jsonrpc":"2.0","id":4,"result":{"content":[{"type":"text","text":"{\"allowed\": false, \"reason\": \"explicitly denied by deny rule host:prod.staging.example.test\"}"}],"isError":false}}
-> {"jsonrpc":"2.0","id":9,"method":"tools/call","params":{"name":"add_finding","arguments":{"target":"https://victim.example.org",...}}}
<- {"jsonrpc":"2.0","id":9,"result":{"content":[{"type":"text","text":"refused (out of scope): no matching allow rule..."}],"isError":true}}The full captured run is in results/demo_transcript.txt.
Architecture
MCP client (Claude Code / opencode / Cursor)
│ newline-delimited JSON-RPC 2.0 over stdin/stdout
▼
server.py ── initialize / tools/list / tools/call / ping
├─ scope.py allow|deny verdicts (pure, no I/O)
├─ redact.py secret + PII scrubbing
├─ cvss.py CVSS:3.1 Base score
└─ findings.py append-only JSONL ledgerProtocol revision is pinned to 2025-03-26 (the initialize handshake
era); 2024-11-05 clients are negotiated with. See
docs/ARCHITECTURE.md.
Requirements
Python 3.10 or newer
No third-party runtime dependencies
An MCP-capable client for interactive use (tests and demo only need Python)
Installation
git clone https://github.com/Wsh7Ash/scopeguard-mcp
cd scopeguard-mcp
pip install -e . # installs the scopeguard-mcp console scriptFor a throwaway run without installing:
PYTHONPATH=src python -m scopeguard_mcpQuick start
# 1. Show the active scope (loopback-only by default)
PYTHONPATH=src python -m scopeguard_mcp --print-scope
# 2. Run the scripted end-to-end session
PYTHONPATH=src python examples/demo_session.py
# 3. Run the test suite
PYTHONPATH=src python -m pytest -qUsage examples
Register with an MCP client
{
"mcpServers": {
"scopeguard": {
"command": "scopeguard-mcp",
"args": ["--scope", "examples/scope.json", "--ledger", ".findings.jsonl"]
}
}
}Authorize a staging host
Edit the scope document — see examples/scope.json:
{
"name": "local-lab",
"allow": [{ "type": "host", "value": "*.staging.example.test" }],
"deny": [{ "type": "host", "value": "prod.staging.example.test" }]
}Record a finding
tools/call add_finding
title: Debug endpoint reflects Authorization header
target: http://127.0.0.1:8080/debug
evidence: Authorization: Bearer ghp_... echoed in HTML
severity: high
cvss: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N
→ stored with id 1, evidence redacted, cvss_score 8.2Configuration
Flag | Default | Meaning |
| loopback-only built-in scope | JSON scope document |
|
| findings ledger file |
| – | print the active scope as JSON and exit |
Scope document fields: name, description, allow[], deny[], each rule
being {"type": "host|url|cidr", "value": "..."}.
Testing
PYTHONPATH=src python -m pytest -q # 43 testsCoverage: CVSS fixtures from FIRST, scope matching (wildcards, path prefixes, CIDR, deny precedence), redaction patterns, ledger behaviour, and a subprocess-level MCP protocol test that exercises the real handshake, tool calls, tool errors and JSON-RPC error codes.
Project structure
scopeguard-mcp/
├─ src/scopeguard_mcp/
│ ├─ server.py JSON-RPC dispatch + tool registry
│ ├─ scope.py allow/deny evaluation (no I/O)
│ ├─ redact.py secret/PII scrubbing
│ ├─ cvss.py CVSS v3.1 Base score
│ ├─ findings.py JSONL ledger
│ └─ __main__.py CLI
├─ tests/ unit + protocol tests
├─ docs/ ARCHITECTURE.md, USAGE.md, PROJECT_SPEC.md
├─ examples/ scope.json, demo_session.py
├─ results/ demo_transcript.txt
└─ SECURITY.mdLimitations
Base metric group only: Temporal and Environmental scores are not computed.
No DNS resolution by design, so
cidrrules only match IP-literal targets.The ledger is a local file with no locking; two concurrent writers could interleave lines (corrupt lines are skipped on read).
Redaction is pattern-based. It catches common token shapes, not every bespoke secret; treat it as a safety net, not a guarantee.
It guards scope, not behaviour: nothing here stops an authorized agent from making a destructive request to an authorized host.
Roadmap
Optional
tools/listpagination (nextCursor).Ledger export to SARIF for CI consumption.
Scope rule unit tests as a CLI subcommand (
--check-rule).
Security notes
Defensive tooling for targets you own or are explicitly authorized to test. See SECURITY.md for authorized-use wording, threat model and reporting.
License
MIT — see LICENSE.
Available Tools
5 toolsadd_findingA
Append a finding to the local ledger. The target is re-checked against the authorized scope and evidence is redacted automatically. Fails if the target is out of scope.
Inputs: title (required), target (required), evidence (required), cvss, +1 more.
check_targetA
Check whether a URL or host is inside the authorized testing scope. Returns an allow/deny verdict with the matching rule. Performs no network activity: no DNS lookups, no connections.
Inputs: target (required).
cvss_baseA
Compute the CVSS v3.1 Base score and qualitative severity for a vector string such as CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
Inputs: vector (required).
list_findingsC
Read findings back from the local ledger, newest last.
Inputs: limit.
redactA
Strip secrets, tokens and PII from text before it is pasted into a finding, a prompt or a report. Returns the cleaned text and counts.
Inputs: text (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a distinct primary action: scope checking, CVSS scoring, redaction, reading findings, and appending findings. There is mild conceptual overlap because add_finding internally re-checks scope and redacts evidence, but the descriptions make clear that check_target and redact are standalone utilities while add_finding is the enforced write path.
Three tools follow a clear verb_noun snake_case pattern (check_target, list_findings, add_finding), but cvss_base is a noun phrase and redact is a bare verb. The set remains readable and all lowercase snake_case, but the convention is not uniform.
Five tools is well-scoped for a narrow scope-guard and findings-ledger server. Each tool maps to a necessary step in the workflow: validate scope, score severity, sanitize text, and read/write findings.
The surface covers scope checking, scoring, redaction, and append/read of findings, but the ledger lacks get-by-id, update, delete, or filtering operations, and there is no tool for managing or listing the authorized scope rules themselves. Some gaps may be intentional for an append-only ledger, but agents will hit dead ends when correcting or querying findings.
Maintenance
Related MCP Connectors
Pre-execution governance for AI agents. Deterministic PASS/FAIL/REVIEW verdicts, replayable proof.
Security scanner for AI agents: prompt injection, leaked secrets, PII, and SSRF-risk URL detection.
Security gateway for AI agents: policy, approval, and audited execution, no secrets shared.
Signed security scores for what an AI agent runs and reads: skills, MCP servers, prompts, tokens.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to perform safe, authorized penetration testing by managing engagements, enforcing scope and risk policies, and orchestrating tools like Nmap, Nuclei, and Subfinder.-
- FlicenseNot gradedqualityCmaintenanceEnables authorized autonomous application and API security testing, allowing LLM-driven agents to plan and execute pentest checks while a deterministic policy layer enforces scope and authorization outside the model.-
- AlicenseBqualityBmaintenanceEnables AI agents to conduct authorized pentests and bug-bounty workflows with scope enforcement, audit logging, reconnaissance, safe vulnerability checks, payload/wordlist generation, and professional report generation.14MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to perform authorized web-pentest reconnaissance and interaction, including crawling, headless-browser control, login/BOLA comparisons, safe probes, HAR replay, and evidence-first reporting, while enforcing declared scope, audit trails, rate limits, and data minimization.1MIT