MCPGuard-Lab
Click on "Install 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., "@MCPGuard-LabTest SSRF prevention by fetching localhost."
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.
MCPGuard-Lab
A security experiment project for MCP tool invocation based on the real mcp==2.0.0 SDK. It does not rely on external large models or API keys, and implements tool whitelisting, parameter validation, file boundary enforcement, SSRF protection, sensitive operation confirmation, output sanitization, tool description poisoning detection, and JSONL auditing through deterministic policies. Regression test cases verify that protections are not broken by subsequent changes.
Usage boundary: This project is intended only for local experimentation, authorized testing, and defense research. It does not include attack functionality against unauthorized targets.
Implemented Capabilities
MCP 2.0 stdio server and real client round-trip testing.
Six demonstration tools: safe calculation, file reading within root directory, note query, public URL request, tool metadata inspection, and write note after confirmation.
Tool whitelist and strict JSON Schema validation, rejecting extra parameters.
File path normalization, rejecting absolute paths, directory traversal, and root directory escape.
URL protocol, user info, port, and DNS resolution result checks, rejecting loopback, private network, link-local, and other non-public addresses.
Write operation
confirmed=truegate.Explicit labeling of untrusted tool outputs; recursive sanitization of passwords, tokens, API keys, and Bearer credentials.
High-risk prompt injection signal detection in tool names/descriptions.
Each decision written to JSONL: request ID, time, tool, parameters, allow/deny, reason, and result.
pytest unit/integration tests and reproducible attack regression reports.
Related MCP server: meok-mcp-injection-scan-mcp
Architecture
MCP Client
│ stdio / MCP 2.0
▼
MCP Server ──► GuardedGateway ──► PolicyEngine
│ ├─ allowlist + schema
│ ├─ path boundary
│ ├─ URL / SSRF
│ └─ confirmation
├─ Tool handler
├─ untrusted labeling + redaction
└─ JSONL auditThe core principle is "decide first, execute second, sanitize output, and leave traces throughout." Prompt text does not directly gain additional permissions; permissions are determined by the whitelist and policies in the code.
Quick Start (Windows)
py -3.10 -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e ".[dev]"
.\.venv\Scripts\python.exe -m pytest
.\.venv\Scripts\python.exe -m mcpguard.regressionOr run directly:
powershell -ExecutionPolicy Bypass -File .\scripts\verify.ps1Reports will be generated in:
reports/regression-report.mdreports/regression-report.jsonreports/regression-audit.jsonl
MCP Client Configuration Example
First run pip install -e ., then replace the following structure with the absolute path of the current repository:
{
"mcpServers": {
"mcpguard-lab": {
"command": "D:/path/to/mcpguard-lab/.venv/Scripts/python.exe",
"args": ["-m", "mcpguard.server"],
"env": {
"MCPGUARD_WORKSPACE": "D:/path/to/mcpguard-lab/fixtures/workspace",
"MCPGUARD_NOTES": "D:/path/to/mcpguard-lab/fixtures/workspace/notes",
"MCPGUARD_AUDIT": "D:/path/to/mcpguard-lab/reports/audit.jsonl"
}
}
}
}Real-World Boundaries
Tool description poisoning detection is a high-signal rule layer and cannot replace manual review and a fixed whitelist.
confirmed=trueis an explicit confirmation gate in local experiments; production environments should use confirmation credentials issued by the host UI/identity system that cannot be forged by the model itself.The URL tool currently disables redirects to avoid passing the check on the first hop and then redirecting to an internal network; a production version should also limit response size, content type, and egress network.
Labeling untrusted content reduces the risk of "data being treated as instructions," but the final host agent must still follow trust boundaries.
Regression data only represents fixed test cases within the repository and does not guarantee blocking all prompt injections or all MCP risks.
Table of Contents
src/mcpguard/ 核心实现
tests/ 单元测试与真实 MCP stdio 集成测试
fixtures/ 可公开的本地测试数据
reports/ 自动生成的测试和审计证据
scripts/verify.ps1 一键验证入口References
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityFmaintenanceAn educational project that deliberately implements vulnerable MCP servers to demonstrate various security risks like prompt injection, tool poisoning, and code execution for training security researchers and AI safety professionals.1,334
- AlicenseAqualityCmaintenanceScans MCP servers for prompt-injection, tool-poisoning, and SSRF vulnerabilities using 30+ canonical rules across 5 severity tiers, with optional signed safety reports for procurement.5MIT
- Alicense-qualityBmaintenanceAn MCP server that provides safeguard capabilities to protect against prompt injection and unsafe tool calls.6MIT
- Flicense-qualityBmaintenanceProvides real-time RCE, SSRF, and env leak interception for AI tool calls, with MCP server mode offering diagnostic and repair suggestions.
Related MCP Connectors
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Scans MCP servers for tool poisoning, prompt injection and supply chain risks.
An MCP server for Arcjet - the runtime security platform that ships with your AI code.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Lc517/mcpguard-lab'
If you have feedback or need assistance with the MCP directory API, please join our Discord server