一键导入
mcp-code-review
Perform comprehensive code review of MCP tools focusing on security, reliability, and best practices
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Perform comprehensive code review of MCP tools focusing on security, reliability, and best practices
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | mcp-code-review |
| description | Perform comprehensive code review of MCP tools focusing on security, reliability, and best practices |
The MCP Code Review Skill performs expert-level code analysis on Model Context Protocol tools. It evaluates tool implementations against MCP best practices, security standards, performance benchmarks, and reliability patterns.
Request: "Review this MCP tool for code quality"
[Provide tool code or file path]
Skill: Analyzes code across all dimensions
Output: Detailed review with scores and recommendations
Request: "Security audit of weather tools"
[Provide multiple tools]
Skill: Performs cross-tool security analysis
Output: Security findings with fix recommendations
| Score | Rating | Status |
|---|---|---|
| 45-50 | Exemplary | Production-Ready ✓ |
| 40-44 | Excellent | Production-Ready with Suggestions |
| 35-39 | Good | Ready with Improvements |
| 30-34 | Fair | Needs Attention |
| <30 | Poor | Requires Rework |
CODE REVIEW REPORT: get_current_weather
═══════════════════════════════════════════════════════════════
📊 SCORES BY CATEGORY
Code Quality ........... 9/10 ✅
Error Handling ......... 8/10 ✅
Security .............. 9/10 ✅
Performance ............ 8/10 ✅
Documentation .......... 9/10 ✅
─────────────────────────────────
TOTAL SCORE ........... 43/50 ⭐⭐⭐⭐
✅ STRENGTHS
• Excellent error handling with specific exception types
• Comprehensive input validation (lat/lon ranges, units)
• Proper async/await implementation for I/O
• Clear, well-structured docstring with examples
• Appropriate timeout configuration (30s)
💡 IMPROVEMENTS (Non-blocking)
• Could add caching for frequently requested coordinates
• Error messages could include suggested fixes
• Consider adding retry logic for transient failures
⚠️ FINDINGS
[None - Code is production-ready]
🎯 RECOMMENDATION: APPROVED FOR PRODUCTION ✓
Quality gate passed. Ready to deploy.
Finding: Parameter validation is comprehensive
Current: Validates lat (-90 to 90) and lon (-180 to 180)
Why Good: Prevents invalid API calls upfront
Score Impact: +3 points (Security and Reliability)
Finding: Could use specific exception types
Current: Generic `except Exception` clause
Suggested: `except (httpx.TimeoutException, httpx.HTTPStatusError) as e`
Why Matters: Better error handling and debugging
Score Impact: -1 point (Error Handling)
Difficulty: Low (quick fix)
Finding: API key in source code
Current: api_key = "sk_live_1234567890" # Hardcoded
Critical: 🔴 SECURITY RISK
Suggested: api_key = os.getenv("OPENWEATHERMAP_API_KEY")
Impact: Code cannot be released until fixed
Score Impact: Tool fails security gate
| Issue | Finding | Fix |
|---|---|---|
| Generic exceptions | except Exception | Catch specific types: httpx.TimeoutException |
| Missing validation | No range checks | Add: if not (-90 <= lat <= 90): return error |
| Sync I/O | requests.get() | Change to: async with httpx.AsyncClient() |
| Hardcoded secrets | api_key = "..." | Use: os.getenv("API_KEY") |
| No docstring | Missing docs | Add complete docstring with Args, Returns |
Request Code Review
Skill Analyzes (5 dimensions)
Skill Produces Report
Developer Takes Action
Approve & Deploy
Q: What's the difference between this and linting? A: Linting checks syntax/style. This skill reviews architectural quality, error handling, security patterns, and reliability - the human aspects.
Q: Can this catch bugs? A: Yes, patterns like missing error handling, unvalidated inputs, and sync I/O issues are caught.
Q: How long does a review take? A: Typical tool review: 2-3 minutes. Comprehensive multi-tool audit: 5-10 minutes.
Q: What if I disagree with feedback? A: Findings are suggestions based on MCP best practices. You can override with justification, but critical security findings must be addressed.
.github/copilot/exemplars.md - Example implementations.github/copilot/architecture.md - Architecture patterns.github/instructions/mcp-server.instructions.md - Best practicesPlan and execute MCP server deployment to production environments
Generate professional documentation for MCP tools including docstrings, examples, and API reference
Generate and manage comprehensive test suites for MCP tools with coverage reporting