Automating Development Workflows with Claude Code + MCP: Code Review, Documentation Generation, and Testing in One Go
By integrating GitHub MCP and filesystem MCP with Claude Code, you can achieve: automated code review for PRs (identifying potential issues and security vulnerabilities), automatic generation of function-level documentation, and auto-completion of unit test cases. With a one-time setup, every commit runs automatically, boosting development workflow efficiency by over 40%. ## Direct Answer **What can this workflow do?** - Automatically generate code review comments after a PR is submitted (formatted output with specific suggestions) - Automatically generate JSDoc / Python docstring comments for new functions - Automatically generate unit test cases based on function signatures and implementations - Detect potential security issues (SQL injection, XSS, hardcoded secrets) ## Configuration Steps ### Step 1: Create .mcp.json in the project root ```json { "mcpServers": { "github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "env": { "GITHUB_TOKEN": "ghp_your_token" } }, "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "./src"] } } } ``` ### Step 2: Define Code Review rules in CLAUDE.md Create CLAUDE.md in the project root and write: ``` ## Code Review Rules When I say "review PR #[number]", please: 1. Use the github MCP to get the PR diff 2. Check: security/performance/readability/test coverage 3. Mark critical issues with 🔴, suggestions for improvement with 🟡, and optimization points with 🟢 ``` ### Step 3: Automatically generate test cases In Claude Code, enter: "Generate unit tests for all exported functions in src/utils/payment.ts using Vitest, covering normal paths, edge cases, and error scenarios" Claude Code will: 1. Read the source file (filesystem MCP) 2. Analyze function signatures and implementation logic 3. Generate a complete test file and write it to __tests__/payment.test.ts ## Measured Data - Code Review: average 40 seconds per PR (including 3-8 actionable comments) - Documentation generation: about 2 minutes for 100 functions - Test generation: coverage increased from 35% to 72% (AI-generated tests require human review)
Steps
- 1
Create .mcp.json in the project root, configuring GitHub MCP and filesystem MCP
- 2
Create CLAUDE.md to define code review rules and output format (🔴🟡🟢 levels)
- 3
Test the workflow in Claude Code with "review PR #1"
- 4
Generate test cases for core modules and verify coverage improvement
- 5
(Optional) Configure GitHub Actions to automatically trigger Claude Code review
Recommended tools
Also available in 中文.