MCP哨兵
MCP(模型上下文协议)服务器的行为测试工具。
一个问题: 这个MCP服务器只做它声称的事情吗?
模式
| 模式 | 功能 | 限制 |
|---|---|---|
schema | Stdio模糊测试:发现工具,从模式生成测试输入,验证错误处理。没有Docker。 | 无法检测到副作用。 |
sandbox | Docker+sidecar观察器+exfil接收器。完全行为监视。 | 无法检测仅在内存中的行为。 |
快速开始
# Install
pip install -e ".[dev]"
# Schema mode — test a local MCP server
mcp-sentinel test --mode schema --command "python server.py"
# Sandbox mode — test a Docker image
mcp-sentinel test --mode sandbox --image my-mcp-server:latest
# Export telemetry
mcp-sentinel test --mode schema --command "python server.py" --export-telemetry results.jsonl项目结构
src/mcp_sentinel/
├── __init__.py
├── models.py # Pydantic data models
├── schema_analyzer.py # Tool discovery + test case generation
├── cli.py # Click CLI entry point
├── test_runner.py # Test execution orchestrator
├── exfil_sink.py # Exfil sink server + host-side log parser
└── sandbox.py # Docker sandbox orchestrator
tests/
├── unit/ # Unit tests
├── integration/ # Integration tests (require fixtures/Docker)
└── fixtures/
├── good_server/ # Clean, well-behaved MCP server
└── evil_server/ # Malicious MCP server for testing detection技术栈
- Python 3.11+
- MCP-SDK --工具发现和调用客户端
- 点击+丰富 --CLI和终端格式化
- 码头工人 --沙盒行为监控
- Pydantic v2 --数据模型和验证
发展
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run only unit tests
pytest tests/unit/
# Run integration tests (requires MCP fixtures)
pytest tests/integration/ -m integration
# Lint
ruff check src/ tests/
# Type check
mypy src/文档
- ROADMAP.md --带有里程碑和验收标准的项目路线图
- mcp哨兵规范-md --完整实施规范(v0.3)
