Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

code-reasoning

MCP.Pizza Chef: mettamatt

Code Reasoning is an MCP server designed to enhance LLMs like Claude by enabling structured, sequential thinking to solve complex programming problems. It provides a framework for step-by-step code analysis and reasoning, improving the model's ability to handle intricate coding tasks with clarity and precision. This server is a fork of the sequential-thinking MCP server and integrates seamlessly into developer workflows requiring advanced code understanding and generation.

Use This MCP server To

Enable step-by-step code problem solving with LLMs Improve accuracy of complex programming task completions Integrate structured code reasoning into developer tools Support multi-step debugging and code analysis workflows Enhance AI-driven code review with detailed reasoning Facilitate incremental code generation and validation Provide explainable code suggestions in IDEs Automate complex algorithm design with stepwise logic

README

Code Reasoning MCP Server

A Model Context Protocol (MCP) server that enhances Claude's ability to solve complex programming tasks through structured, step-by-step thinking.

Code Reasoning Server MCP server

npm version License: MIT CI

Quick Installation

  1. Configure Claude Desktop by editing:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
    {
      "mcpServers": {
        "code-reasoning": {
          "command": "npx",
          "args": ["-y", "@mettamatt/code-reasoning"]
        }
      }
    }
  2. Configure VS Code:

{
  "mcp": {
    "servers": {
      "code-reasoning": {
        "command": "npx",
        "args": ["-y", "@mettamatt/code-reasoning"]
      }
    }
  }
}

Usage

  1. To trigger this MCP, append this to your chat messages:

    Use sequential thinking to reason about this.
    
  2. Use ready-to-go prompts that trigger Code-Reasoning:

Code Reasoning Prompts

  • Click the "+" icon in the Claude Desktop chat window, or in Claude Code type /help to see the specific commands.
  • Select "Add from Code Reasoning" from the available tools
  • Choose a prompt template and fill in the required information
  • Submit the form to add the prompt to your chat message and hit return

See the Prompts Guide for details on using the prompt templates.

Command Line Options

  • --debug: Enable detailed logging
  • --help or -h: Show help information

Key Features

  • Programming Focus: Optimized for coding tasks and problem-solving
  • Structured Thinking: Break down complex problems into manageable steps
  • Thought Branching: Explore multiple solution paths in parallel
  • Thought Revision: Refine earlier reasoning as understanding improves
  • Safety Limits: Automatically stops after 20 thought steps to prevent loops
  • Ready-to-Use Prompts: Pre-defined templates for common development tasks

Documentation

Detailed documentation available in the docs directory:

Project Structure

├── index.ts                  # Entry point
├── src/                      # Implementation source files
└── test/                     # Testing framework

Prompt Evaluation

The Code Reasoning MCP Server includes a prompt evaluation system that assesses Claude's ability to follow the code reasoning prompts. This system allows:

  • Testing different prompt variations against scenario problems
  • Verifying parameter format adherence
  • Scoring solution quality

To use the prompt evaluation system, run:

npm run eval

Prompt Comparison and Development

Significant effort went into developing the optimal prompt for the Code Reasoning server. The current implementation uses the HYBRID_DESIGN prompt, which emerged as the winner from our evaluation process.

We compared four different prompt designs:

Prompt Design Description
SEQUENTIAL The original sequential thinking prompt design
DEFAULT The baseline prompt previously used in the server
CODE_REASONING_0_30 An experimental variant focusing on code-specific reasoning
HYBRID_DESIGN A refined design incorporating the best elements of other approaches

Our evaluation across seven diverse programming scenarios showed that HYBRID_DESIGN outperformed other prompts:

Scenario HYBRID_DESIGN CODE_REASONING_0_30 DEFAULT SEQUENTIAL
Algorithm Selection 89% 82% 92% 88%
Bug Identification 92% 91% 88% 94%
Multi-Stage Implementation 87% 67% 82% 87%
System Design Analysis 87% 87% 83% 82%
Code Debugging Task 96% 87% 91% 93%
Compiler Optimization 83% 78% 72% 78%
Cache Strategy 87% 88% 89% 87%
Average 89% 83% 85% 87%

The HYBRID_DESIGN prompt demonstrates the highest average solution quality (89%) and the most consistent performance across all scenarios, with no scores below 80%. It also produces the most thoughts. The src/server.ts file has been updated to use this optimal prompt design.

Personally, I think the biggest improvement was adding this to the end of the prompt: "✍️ End each thought by asking: "What am I missing or need to reconsider?"

See Testing Framework for more details on the prompt evaluation system.

License

This project is licensed under the MIT License. See the LICENSE file for details.

code-reasoning FAQ

How do I install the code-reasoning MCP server?
Follow the quick installation guide in the GitHub README, configuring Claude Desktop settings accordingly.
Which LLMs does code-reasoning support?
It primarily enhances Claude but can be adapted for use with OpenAI and Gemini models.
Can code-reasoning handle multi-step programming tasks?
Yes, it is specifically designed for structured, step-by-step reasoning in complex code problems.
Is code-reasoning open source?
Yes, it is MIT licensed and available on GitHub for community contributions and customization.
How does code-reasoning improve code generation?
By breaking down problems into sequential steps, it helps LLMs generate more accurate and logical code.
Can I integrate code-reasoning into my existing development environment?
Yes, it supports integration with tools like Claude Desktop and can be adapted for other MCP-compatible environments.
Does code-reasoning support debugging workflows?
Yes, it facilitates multi-step debugging by enabling detailed reasoning about code behavior.
What programming languages does code-reasoning support?
It is language-agnostic but most effective with popular languages supported by the underlying LLM.