mcp-testing
MCP testing guidance and patterns. Loaded by /ops/test/mcp command or subagents for comprehensive Navigator MCP server testing.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Navigator MCP Testing
Automated tests for Navigator MCP server via JSON-RPC protocol.
Quick Start
# Start server
bun run dev
# Run tests
./.claude/scripts/run-mcp-tests.sh schema-validation
./.claude/scripts/run-mcp-tests.sh --all
Structure
.claude/
├── commands/ops/test/mcp.md # Command definition
├── scripts/run-mcp-tests.sh # Test runner (all logic here)
├── scripts/lib/test-runner-lib.sh # Shared test library
└── skills/mcp-testing/SKILL.md # This file
Test Categories
| Category | Tests | What It Validates |
|---|---|---|
schema-validation |
7 | Zod schema validation, missing/invalid params |
action-routing |
7 | Action dispatch for all action types |
error-responses |
4 | Error codes and structured error handling |
response-formatting |
4 | MCP content structure (text/image types) |
Output
.scratch/testing/
├── 20260116-abc12-mcp-schema-validation.md # Results table
├── 20260116-abc12-mcp-schema-validation-debug.log # Debug output
└── ...
Adding Tests
Edit .claude/scripts/run-mcp-tests.sh:
# Add a test to existing category
run_mcp_test 8 "New test name" '{"action":"snap"}' "expected_pattern" "false" # false = expect success
# Add new category
run_new_category() {
setup_category "new-category"
log "Running new-category tests..."
# Setup: navigate to test page
mcp_call '{"action":"navigate","url":"https://example.com"}' >/dev/null 2>&1
run_mcp_test 1 "Test name" '{"action":"..."}' "pattern" "false"
# ... more tests
finalize_category
}
Then add to main():
new-category) test_new_category || exit_code=1 ;;
Key Differences from CLI Tests
| Aspect | CLI | MCP |
|---|---|---|
| Protocol | HTTP to server | JSON-RPC over stdio |
| Input | Shell arguments | JSON objects |
| Output | JSON stdout | MCP content array |
| Error detection | Exit code + stderr | isError flag |
Exit Codes
-
0- All passed -
1- Failures -
2- Setup error (server not running, jq missing)
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!