scopeguard-mcp
ScopeGuard MCP is a policy-first defensive security server that enables AI clients to perform secure, bounded assessments, analyze web security headers, and scan authorized local repositories through a controlled interface, ensuring strong security guarantees and auditability.
Health Check: Report server safety settings, capabilities, and audit-chain health (
health).Create Dry-Run Engagement: Create a bounded, non-executing engagement scope with expiry (
create_dry_run_engagement).Revoke Engagement: Immediately revoke an engagement to prevent further operations (
revoke_engagement).Scope Validation: Normalize and verify targets are within allowed scope (
check_scope).Assessment Planning: Generate bounded web or repository assessment plans without executing network actions (
plan_assessment).Header Analysis: Analyze caller-supplied HTTP response headers offline (
analyze_headers).Repository Scanning: Run read-only Python and secret pattern scans on authorized local repos (
scan_repository).Audit Trail: List engagement-specific audit events (
list_audit_events) and verify the tamper-evident audit chain (verify_audit_chain).
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 if https://example.com is in scope for an assessment."
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
ScopeGuard is a policy-first defensive security server for MCP. It lets AI clients plan assessments, evaluate web security headers, and scan explicitly authorized local source trees without exposing a general shell, network scanner, exploit generator, or credential tool.
The project demonstrates senior security-engineering concerns beyond rule detection: authorization boundaries, canonical scope evaluation, dual execution gates, bounded resource use, evidence integrity, secure file access, durable audit history, threat modeling, supply-chain controls, and negative testing.
Security guarantees
MCP clients can create only short-lived
dry-runengagements.Execute engagements are created and revoked only through the local operator CLI.
Every target operation requires an active engagement, an explicit capability, and a canonical target that matches scope.
Repository scans require both an execute engagement and the operator-controlled
SCOPEGUARD_EXECUTION_ENABLEDgate.Production execution can require an HMAC-sealed audit checkpoint. A missing or invalid seal fails closed.
File traversal is bounded by file count, file size, total bytes, and finding count.
Repository files are opened as regular files without following symlink components on supported POSIX platforms, reducing path-race exposure.
Secret matches are never returned. Correlation fingerprints use keyed HMAC rather than a guessable unsalted digest.
Completed scans persist a manifest digest, ruleset digest, timestamps, outcome, and summary so evidence can be correlated with the audit chain.
The server uses local stdio only. It does not expose an unauthenticated network port.
These controls do not prove that a ticket represents legal authorization. The operator is still responsible for validating permission and exporting signed audit heads to a separate trust domain.
Related MCP server: hachiman
Architecture
flowchart LR
A["Untrusted MCP client"] --> B["Typed stdio tools"]
O["Operator CLI + environment"] --> C["Policy engine"]
B --> C
C --> D["Canonical scope matcher"]
C --> E["Capability + expiry gate"]
C --> F["Dual execution gate"]
F --> G["Bounded repository analyzer"]
C --> H["Offline header analyzer"]
C --> I[("SQLite engagements")]
G --> J[("Durable scan evidence")]
C --> K[("Hash-chained audit events")]
K --> L["HMAC-sealed checkpoint"]See ARCHITECTURE.md, the threat model, and the operations runbook for the detailed design.
MCP tools
Tool | Purpose | Boundary |
| Report safety posture and audit integrity | No target access |
| Create a bounded non-executing scope | Execute mode is unavailable |
| Revoke an MCP-created dry-run engagement | Cannot revoke operator execute grants |
| Normalize and evaluate a target | Active engagement required |
| Produce a bounded web or repository plan | No network or process execution |
| Inspect caller-supplied response headers | Offline and input-bounded |
| Run read-only Python and secret checks | Requires both execution gates |
| Read engagement-specific evidence | Requires |
| Read durable scan manifests and outcomes | Requires |
| Verify event order and the signed head | Does not reveal signing material |
Quick start
Python 3.11 or newer is required.
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -e .
scopeguard doctor
scopeguard-mcpExample MCP client configuration:
{
"mcpServers": {
"scopeguard": {
"command": "/absolute/path/to/scopeguard-mcp/.venv/bin/scopeguard-mcp",
"env": {
"SCOPEGUARD_STATE_DIR": "/absolute/path/to/scopeguard-state"
}
}
}
}Authorized execution workflow
Generate and store a random audit key in your secret manager. Do not commit it or place it in shell history. Then configure a dedicated state directory and the smallest possible repository root:
export SCOPEGUARD_STATE_DIR=/absolute/path/to/scopeguard-state
export SCOPEGUARD_ALLOWED_ROOTS=/absolute/path/to/authorized-repositories
export SCOPEGUARD_EXECUTION_ENABLED=true
export SCOPEGUARD_REQUIRE_SEALED_AUDIT=true
export SCOPEGUARD_AUDIT_HMAC_KEY='value-loaded-from-your-secret-manager'
export SCOPEGUARD_AUDIT_KEY_ID='primary-2026'
scopeguard create-engagement \
--title "Repository security baseline" \
--ticket SEC-1234 \
--target file:/absolute/path/to/authorized-repositories/example \
--capability scan:repository \
--capability audit:read \
--mode execute \
--expires-in-minutes 60
scopeguard-mcpExport the signed audit head after an assessment and anchor it in an append-only external system:
scopeguard verify-audit
scopeguard export-audit-checkpoint > scopeguard-audit-head.jsonThe checkpoint contains only the event count, chain head, key identifier, and HMAC signature. It never includes the signing key.
Capabilities
Capability | Allows |
| Bounded web or repository planning for an in-scope target |
| Offline analysis of supplied HTTP headers |
| Built-in read-only scanning under both execution gates |
| Engagement audit events and durable scan-run evidence |
Configuration
Variable | Default | Purpose |
|
| Private SQLite state directory |
| current directory | Path-separated operator allowlist |
|
| Enables operator-created execute engagements |
|
| Fails execution closed without a verified audit seal |
| unset | At least 32 bytes; signs the durable audit checkpoint |
| key fingerprint | Non-secret identifier used for rotation tracking |
|
| Engagement target ceiling |
|
| Offline header count ceiling |
|
| Total header input ceiling |
|
| Repository file ceiling |
|
| Per-file read ceiling |
|
| Total repository read ceiling |
|
| Returned finding ceiling |
Repository analysis
The dependency-free analyzer detects focused high-signal patterns:
Python
evalandexecos.systemandos.popensubprocesscalls withshell=Trueunsafe Pickle deserialization
yaml.loadwithout a safe loaderprivate-key blocks, AWS access keys, GitHub tokens, and likely hard-coded secrets
Results include a deterministic file-manifest SHA-256 and ruleset SHA-256. Secret values are excluded from results, audit events, and scan records. This scanner is a bounded baseline, not a replacement for CodeQL, Semgrep, Gitleaks, dependency auditing, or expert review.
Engineering quality
The repository includes:
Python 3.11–3.13 tests with a 90% coverage floor
Ruff lint and format verification
static type analysis with complete function signatures
Bandit and dependency vulnerability scanning
CodeQL analysis on pushes, pull requests, and a weekly schedule
package build and metadata verification
tagged release artifacts with an SBOM and GitHub build-provenance attestation
Dependabot for Python and GitHub Actions dependencies
architecture, threat-model, ADR, operations, contribution, and security documents
Local verification:
pip install -e ".[dev]"
ruff check .
ruff format --check .
mypy src/scopeguard_mcp
bandit -q -r src
pytest
python -m build
twine check dist/*Responsible use
Use ScopeGuard only on repositories and systems you own or are explicitly authorized to assess. The project intentionally excludes exploit generation, password attacks, credential collection, payload generation, persistence, evasion, denial of service, internet-scale scanning, and autonomous attack chains.
Available Tools
9 toolsanalyze_headersAnalyze HTTP security headersARead-onlyIdempotent
Analyze caller-supplied response headers offline; no HTTP request is performed.
Inputs: target (required), headers (required), engagement_id (required). Returns: object
check_scopeCheck target scopeARead-onlyIdempotent
Normalize a target and report whether it is inside the engagement scope.
Inputs: target (required), engagement_id (required). Returns: object
create_dry_run_engagementCreate dry-run engagementA
Create a non-executing assessment scope; execute mode is operator-CLI only.
Inputs: title (required), ticket (required), targets (required), capabilities (required), +1 more. Returns: object
healthScopeGuard healthARead-onlyIdempotent
Return server safety settings, capabilities, and audit-chain health.
Inputs: no named parameters. Returns: object
list_audit_eventsRead engagement audit eventsARead-onlyIdempotent
Return recent audit events when the engagement includes audit:read.
Inputs: engagement_id (required), limit. Returns: object
plan_assessmentPlan defensive assessmentARead-onlyIdempotent
Create a bounded web or repository assessment plan without running network tools.
Inputs: target (required), engagement_id (required), profile. Returns: object
revoke_engagementRevoke engagementBDestructive
Immediately revoke an engagement and prevent further target operations.
Inputs: engagement_id (required). Returns: object
scan_repositoryScan authorized local repositoryARead-onlyIdempotent
Run built-in read-only Python and secret checks under operator-allowed roots.
Inputs: path (required), engagement_id (required). Returns: object
verify_audit_chainVerify audit chainARead-onlyIdempotent
Verify every persisted event against the tamper-evident hash chain.
Inputs: no named parameters. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool has a clearly distinct purpose: health for status, engagement lifecycle (create/revoke), scope checking, planning, header analysis, repository scanning, and audit operations (list/verify). Even the two audit tools are distinct in intent—listing versus verifying integrity. There is no meaningful overlap that would cause an agent to select the wrong tool.
Most tools follow a consistent verb_noun snake_case pattern (create_dry_run_engagement, revoke_engagement, check_scope, plan_assessment, analyze_headers, scan_repository, list_audit_events, verify_audit_chain). The only deviation is 'health', which is a noun instead of a verb_noun form, but this is a common exception for status endpoints and does not detract from overall readability.
With 9 tools, this server is well-scoped for its domain of security assessment scope management. Each tool addresses a distinct operation without redundancy, and the count feels neither thin nor bloated.
The tool surface covers engagement creation and revocation, scope checking, planning, analysis, scanning, and audit verification. However, there is no way to list existing engagements or retrieve engagement details, which creates a gap in the engagement lifecycle. An agent cannot easily determine what engagements are active or inspect a specific engagement's configuration, limiting practical management.
Maintenance
Related MCP Connectors
Authenticated MCP server for ClearPolicy policy and compliance workflows.
Governed MCP gateway: one endpoint for your tools, with credential custody and audit log.
Security & DLP proxy for MCP: tool-poisoning scans, PII redaction on tool args/results. Beta.
MCP server for mandates, delegation, policy-gated execution, credential grants, and audit.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables agents to audit and safeguard repositories by detecting dependency pinning issues, license compliance problems, hardcoded secrets, and dead code through MCP tools.4MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents and MCP servers to operate under autonomous security enforcement, including pre-deployment scanning, per-call authorization, runtime monitoring, incident containment, and comprehensive auditing.1MIT
- AlicenseAqualityCmaintenanceEnables policy-governed MCP interactions with deterministic authorization, tenant isolation, minimized PII exposure, and human approval gates for sensitive mutations, while producing structured audit events.3MIT
- AlicenseAqualityBmaintenanceEnables MCP clients to run deterministic AST safety audits, secret scanning, and sandboxed test execution on codebases, with human approval required before any remediation action.5MIT