Deep Code Reasoning MCP Server
About
Performs complementary code analysis by combining Claude Code and Google's Gemini AI.
Details
- Author
- haasonsaas
- Categories
- Developer Tools, AI
Jump to
Setup
Install Deep Code Reasoning MCP Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/haasonsaas/deep-code-reasoning-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
Performs complementary code analysis by combining Claude Code and Google's Gemini AI.
An MCP server that pairs Claude Code with Google's Gemini AI for complementary code analysis. This server enables a multi-model workflow where Claude Code handles tight terminal integration and multi-file refactoring, while Gemini leverages its massive context window (1M tokens) and code execution capabilities for distributed system debugging and long-trace analysis.
Both Claude and Gemini can handle deep semantic reasoning and distributed system bugs. This server enables an intelligent routing strategy where:
- Claude Codeexcels at local-context operations, incremental patches, and CLI-native workflows
- Gemini 2.5 Proshines with huge-context sweeps, synthetic test execution, and analyzing failures that span logs + traces + code
The "escalation" model treats LLMs like heterogeneous microservices - route to the one that's most capable for each sub-task.
- Gemini 2.5 Pro Preview: Uses Google's latest Gemini 2.5 Pro Preview (05-06) model with 1M token context window
- Conversational Analysis: NEW! AI-to-AI dialogues between Claude and Gemini for iterative problem-solving
- Execution Flow Tracing: Understands data flow and state transformations, not just function calls
- Cross-System Impact Analysis: Models how changes propagate across service boundaries
- Performance Modeling: Identifies N+1 patterns, memory leaks, and algorithmic bottlenecks
- Hypothesis Testing: Tests theories about code behavior with evidence-based validation
- Long Context Support: Leverages Gemini 2.5 Pro Preview's 1M token context for analyzing large codebases
- Node.js 18 or later
- A Google Cloud account with Gemini API access
- Gemini API key fromGoogle AI Studio
- @google/generative-ai: Google's official SDK for Gemini API integration
- @modelcontextprotocol/sdk: MCP protocol implementation for Claude integration
- zod: Runtime type validation for tool parameters
- dotenv: Environment variable management
Note: After installation, you'll need to update the file path to your actual installation directory and set yourGEMINI_API_KEY.
git clone https://github.com/Haasonsaas/deep-code-reasoning-mcp.git cd deep-code-reasoning-mcp
cp .env.example .env # Edit .env and add your GEMINI_API_KEY
- GEMINI_API_KEY(required): Your Google Gemini API key
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):
{ "mcpServers": { "deep-code-reasoning": { "command": "node", "args": ["/path/to/deep-code-reasoning-mcp/dist/index.js"], "env": { "GEMINI_API_KEY": "your-gemini-api-key" } } } }
- Claude Code performs initial analysisusing its strengths in multi-file refactoring and test-driven loops
- When beneficial, Claude escalates to this MCP server- particularly for:
- Analyzing gigantic log/trace dumps that exceed Claude's context
- Running iterative hypothesis testing with code execution
- Correlating failures across many microservices
Note: The tool parameters use snake_case naming convention and are validated using Zod schemas. The actual implementation provides more detailed type safety than shown in these simplified examples. Full TypeScript type definitions are available insrc/models/types.ts.
The server now includes AI-to-AI conversational tools that enable Claude and Gemini to engage in multi-turn dialogues for complex analysis:
Initiates a conversational analysis session between Claude and Gemini.
{ claude_context: { attempted_approaches: string[]; // What Claude tried partial_findings: any[]; // What Claude found stuck_description: string; // Where Claude got stuck code_scope: { files: string[]; // Files to analyze entry_points?: CodeLocation[]; // Starting points service_names?: string[]; // Services involved } }; analysis_type: 'execution_trace' | 'cross_system' | 'performance' | 'hypothesis_test'; initial_question?: string; // Optional opening question }
Continues an active conversation with Claude's response or follow-up question.
{ session_id: string; // Active session ID message: string; // Claude's message to Gemini include_code_snippets?: boolean; // Enrich with code context }
Completes the conversation and generates structured analysis results.
{ session_id: string; // Active session ID summary_format: 'detailed' | 'concise' | 'actionable'; }
Checks the status and progress of an ongoing conversation.
{ session_id: string; // Session ID to check }
Main tool for handing off complex analysis from Claude Code to Gemini.
{ claude_context: { attempted_approaches: string[]; // What Claude tried partial_findings: any[]; // What Claude found stuck_description: string; // Where Claude got stuck code_scope: { files: string[]; // Files to analyze entry_points?: CodeLocation[]; // Starting points (file, line, function_name) service_names?: string[]; // Services involved } }; analysis_type: 'execution_trace' | 'cross_system' | 'performance' | 'hypothesis_test'; depth_level: 1-5; // Analysis depth time_budget_seconds?: number; // Time limit (default: 60) }
Deep execution analysis with Gemini's semantic understanding.
{ entry_point: { file: string; line: number; function_name?: string; }; max_depth?: number; // Default: 10 include_data_flow?: boolean; // Default: true }
Analyze impacts across service boundaries.
{ change_scope: { files: string[]; service_names?: string[]; }; impact_types?: ('breaking' | 'performance' | 'behavioral')[]; }
Deep performance analysis beyond simple profiling.
{ code_path: { entry_point: { file: string; line: number; function_name?: string; }; suspected_issues?: string[]; }; profile_depth?: 1-5; // Default: 3 }
Test specific theories about code behavior.
{ hypothesis: string; code_scope: { files: string[]; entry_points?: CodeLocation[]; // Optional array of {file, line, function_name?} }; test_approach: string; }
When Claude needs deep iterative analysis with Gemini:
// 1. Start conversation const session = await start_conversation({ claude_context: { attempted_approaches: ["Checked for N+1 queries", "Profiled database calls"], partial_findings: [{ type: "performance", description: "Multiple DB queries in loop" }], stuck_description: "Can't determine if queries are optimizable", code_scope: { files: ["src/services/UserService.ts"] } }, analysis_type: "performance", initial_question: "Are these queries necessary or can they be batched?" }); // 2. Continue with follow-ups const response = await continue_conversation({ session_id: session.sessionId, message: "The queries fetch user preferences. Could we use a join instead?", include_code_snippets: true }); // 3. Finalize when ready const results = await finalize_conversation({ session_id: session.sessionId, summary_format: "actionable" });
When a failure signature spans multiple services with GB of logs:
// Claude Code: Identifies the error pattern and suspicious code sections // Escalate to Gemini when: Need to correlate 1000s of trace spans across 10+ services // Gemini: Processes the full trace timeline, identifies the exact race window
When performance degrades but the cause isn't obvious:
// Claude Code: Quick profiling, identifies hot paths // Escalate to Gemini when: Need to analyze weeks of performance metrics + code changes // Gemini: Correlates deployment timeline with perf metrics, pinpoints the exact commit
When you have theories but need extensive testing:
// Claude Code: Forms initial hypotheses based on symptoms // Escalate to Gemini when: Need to test 20+ scenarios with synthetic data // Gemini: Uses code execution API to validate each hypothesis systematically
# Run in development mode npm run dev # Run tests npm test # Lint code npm run lint # Type check npm run typecheck
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐ │ Claude Code │────▶│ MCP Server │────▶│ Gemini API │ │ (Fast, Local, │ │ (Router & │ │ (1M Context, │ │ CLI-Native) │◀────│ Orchestrator) │◀────│ Code Exec) │ └─────────────────┘ └──────────────────┘ └─────────────────┘ │ ▼ ┌──────────────────┐ │ Code + Logs + │ │ Traces + Tests │ └──────────────────┘
- API Key: Store your Gemini API key securely in environment variables
- Code Access: The server reads local files - ensure proper file permissions
- Data Privacy: Code is sent to Google's Gemini API - review their data policies
- Ensure you've set theGEMINI_API_KEYin your.envfile or environment
- Check that the.envfile is in the project root
- Verify that file paths passed to the tools are absolute paths
- Check file permissions
- Verify your API key is valid and has appropriate permissions
- Check API quotas and rate limits
- Ensure your Google Cloud project has the Gemini API enabled
- The server uses Zod for parameter validation
- Ensure all required parameters are provided
- Check that parameter names use snake_case (e.g.,claude_context, notclaudeContext)
- Review error messages for specific validation requirements
Best Practices for Multi-Model Debugging
When debugging distributed systems with this MCP server:
- Capture the timeline first- Use OpenTelemetry/Jaeger traces with request IDs
- Start with Claude Code- Let it handle the initial investigation and quick fixes
- Escalate strategicallyto Gemini when you need:
- Analysis of traces spanning 100s of MB
- Correlation across 10+ services
- Iterative hypothesis testing with code execution
- go test -race, ThreadSanitizer for race detection
- rr or JFR for deterministic replay
- TLA+ or Alloy for formal verification
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License - see theLICENSEfile for details.
- Built for integration with Anthropic's Claude Code
- Powered by Google's Gemini AI
- Uses the Model Context Protocol (MCP) for communication
If you encounter any issues or have questions:
- Open an issue onGitHub Issues
- Check thetroubleshooting sectionabove
- Review theMCP documentation
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
Your AI Code Review Council - Get diverse perspectives from multiple AI models in parallel.
Provides AI-powered mentorship to LLM agents for tasks like code review, design critique, and brainstorming, using the Deepseek API.
An AI-powered server providing access to multiple models for code analysis, problem-solving, and collaborative development with guided workflows.
Orchestrates multiple AI models like Claude and Gemini for enhanced code analysis, problem-solving, and collaborative development.
AI-to-AI code review platform — Claude, Codex, and Gemini cross-check each other via MCP, REST API, and CLI for consensus-based results.
A stateful LSP runtime for AI agents: warm language server sessions with 50+ tools for go-to-definition, find-references, diagnostics, rename, and more across 30+ languages.
Persistent code index using Tree-sitter for fast, precise code search. Replaces grep with ~50 token responses instead of 2000+.
AI-powered code quality analysis to detect best practice violations, security issues, and architectural problems in real-time.
Orchestrates a dual-AI engineering loop where a Primary AI plans and implements, while a Review AI validates and reviews, with continuous feedback for optimal code quality. Supports custom AI pairing (Claude, Codex, Gemini, etc.)
AmazingMCP — MCP Server for .NET / C# Codebases
An MCP server that gives AI agents deep understanding of C# codebases via Roslyn — type search, dependency graphs, usage analysis, and architecture overviews, all from a live in-memory compilation.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.




