scopeguard-mcp
Enables policy-first defensive security operations for MCP, providing repository and web-security analysis with controlled authorization, scoped execution, and auditability.
README
ScopeGuard MCP
ScopeGuard is a policy-first defensive security operations server for MCP. It gives AI clients useful repository and web-security analysis while keeping authorization, execution, target scope, and auditability under operator control.
It is designed as a safer, maintainable alternative to broad shell-driven pentest orchestrators. “Better” here means stronger trust boundaries and engineering quality—not more autonomous exploitation.
The comparison below uses the public HexStrike AI v6 repository as the reference baseline. ScopeGuard is built on the official MCP Python SDK 2.x.
Why ScopeGuard
| Boundary | ScopeGuard | HexStrike AI v6 reference inspected |
|---|---|---|
| Protocol | Official MCP Python SDK 2.x | FastMCP dependency below 1.0 |
| Architecture | Small modules with explicit domain boundaries | Two main Python scripts totaling about 22k lines |
| Client transport | Local stdio only | MCP client plus local Flask execution API |
| Authorization | Expiring engagements, target scopes, capabilities | Caller-supplied targets sent to execution endpoints |
| Execution | Operator-created execute engagement and server-side environment gate | Tool call can directly launch commands |
| Process control | No arbitrary shell or command tool | Broad subprocess wrappers |
| Audit | SQLite WAL plus a verifiable SHA-256 hash chain | Conventional logs |
| Secret handling | Findings are fingerprinted; matched values are never returned | Tool output may contain raw secrets |
| Quality | CI matrix, linting, packaging, 90% coverage floor | No test or CI suite visible in the inspected tree |
ScopeGuard does not include exploit generation, password attacks, payload generation, credential capture, or autonomous attack-chain execution.
Included tools
health— safety posture, supported capabilities, and audit-chain statuscreate_dry_run_engagement— create an expiring, non-executing scope from MCPrevoke_engagement— stop an engagement immediatelycheck_scope— normalize and evaluate a URL, domain, IP/CIDR, or file targetplan_assessment— produce a bounded web or repository baseline plananalyze_headers— inspect caller-supplied HTTP headers without making a requestscan_repository— read-only built-in Python risk and secret checkslist_audit_eventsandverify_audit_chain— inspect and verify evidence
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-mcp
Configure an MCP client to launch the local stdio server:
{
"mcpServers": {
"scopeguard": {
"command": "/absolute/path/to/scopeguard-mcp/.venv/bin/scopeguard-mcp",
"env": {
"SCOPEGUARD_STATE_DIR": "/absolute/path/to/scopeguard-state"
}
}
}
}
Authorization workflow
MCP clients can create only dry-run engagements. They can check scope, build plans,
and perform offline header analysis, but repository execution remains planned.
For a real read-only repository scan, the operator must create an execute engagement outside the model and launch the server with execution enabled:
export SCOPEGUARD_STATE_DIR=/absolute/path/to/scopeguard-state
export SCOPEGUARD_ALLOWED_ROOTS=/absolute/path/to/authorized-repositories
export SCOPEGUARD_EXECUTION_ENABLED=true
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-mcp
The returned engagement ID is required by scan_repository. Both the engagement file
scope and SCOPEGUARD_ALLOWED_ROOTS must contain the requested path. Symlinks are
resolved before either policy is evaluated.
Capabilities
| Capability | Allows |
|---|---|
plan:assessment |
Bounded web/repository planning for an in-scope target |
analyze:headers |
Offline analysis of supplied HTTP headers |
scan:repository |
Built-in read-only scan, subject to both execution gates |
audit:read |
Reading engagement-specific audit events |
Configuration
| Variable | Default | Purpose |
|---|---|---|
SCOPEGUARD_STATE_DIR |
<cwd>/.scopeguard |
SQLite state and audit database |
SCOPEGUARD_ALLOWED_ROOTS |
current directory | Path-separated operator allowlist |
SCOPEGUARD_EXECUTION_ENABLED |
false |
Enables execute engagements when true |
SCOPEGUARD_MAX_FILES |
5000 |
Repository scan file ceiling |
SCOPEGUARD_MAX_FILE_BYTES |
1000000 |
Per-file read ceiling |
The MCP server intentionally exposes only stdio. A future network transport must ship with standards-based authentication, request-size limits, and explicit deployment guidance; binding an unauthenticated security service to a port is not accepted here.
Repository analyzer
The dependency-free analyzer currently detects:
- Python
eval/exec os.system/os.popensubprocesscalls withshell=True- unsafe Pickle deserialization
yaml.loadwithout a safe loader- private-key blocks, AWS access keys, GitHub tokens, and likely hard-coded secrets
Secret values are never returned. Findings contain only rule metadata, location, and a short one-way fingerprint for correlation.
Development
pip install -e ".[dev]"
ruff check .
pytest
python -m build
The test suite includes a real in-memory MCP v2 discovery and tool-call round trip.
See ARCHITECTURE.md, SECURITY.md, and CONTRIBUTING.md for design and project policy.
Responsible use
Use ScopeGuard only on repositories and systems you own or are explicitly authorized to assess. The project is defensive tooling, not authorization to test a target.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。