Code Reasoning MCP Server

Code Reasoning MCP Server

An enhanced sequential thinking tool optimized for programming tasks that helps break down complex coding problems into structured, self-auditing thought steps with branching and revision capabilities.

Category
Visit Server

README

Code Reasoning MCP Server

An enhanced fork of the Sequential Thinking MCP server, optimized for programming tasks and complex problem-solving through a structured thinking process.

Quick Start

# Install globally
npm install -g code-reasoning

# Configure Claude Desktop
# Edit ~/Library/Application Support/Claude-Desktop/claude_desktop_config.json:
{
  "mcpServers": {
    "sequential-thinking": {
      "command": "code-reasoning",
      "args": []
    }
  }
}

# Start Claude Desktop and enjoy enhanced sequential thinking!

Why This Fork?

This fork was created to enhance the original Sequential Thinking server with several key improvements:

  1. Programming Focus: Optimized for coding tasks and programming problem-solving
  2. Improved Parameter Naming: Consistent snake_case naming convention (e.g., thought_number instead of thoughtNumber)
  3. Enhanced Prompting: Clearer, more structured guidance in the tool description
  4. Enforcement of Best Practices: Automatically aborts chains after 20 steps to prevent excessive recursion
  5. Local Development: Designed to work seamlessly with Claude Desktop for programming tasks

Key Differences from Original

Feature Original Code Reasoning
Parameter Style camelCase snake_case
Max Steps Not enforced Enforced (max 20)
Tool Description Basic Enhanced markdown with examples
Primary Focus General problem-solving Programming/code tasks
Error Handling Basic Improved with status codes

Enhanced Prompt

This fork features a significantly improved prompt that provides clearer guidance and examples:

🧠 **Sequential Thinking Tool**

Purpose → break complex problems into **self-auditing, exploratory** thought steps that can *branch*, *revise*, or *back-track* until a **single, well-supported answer** emerges.

---

## WHEN TO CALL
• Multi-step planning, design, debugging, or open-ended analysis  
• Whenever *further private reasoning* or *hypothesis testing* is required **before** replying to the user

---

## ENCOURAGED PRACTICES
🔍 **Question aggressively** – ask "What am I missing?" after each step  
🔄 **Revise freely** – mark `is_revision=true` even late in the chain  
🌿 **Branch often** – explore plausible alternatives in parallel; you can merge or discard branches later  
↩️ **Back-track** – if a path looks wrong, start a new branch from an earlier thought  
❓ **Admit uncertainty** – explicitly note unknowns and schedule extra thoughts to resolve them

---

## MUST DO
✅ Put **every** private reasoning step in `thought`  
✅ Keep `thought_number` correct; update `total_thoughts` when scope changes  
✅ Use `is_revision` & `branch_from_thought`/`branch_id` precisely  
✅ Set `next_thought_needed=false` *only* when **all** open questions are resolved  
✅ Abort and summarise if `thought_number > 20`  

---

## DO NOT
⛔️ Reveal the content of `thought` to the end-user  
⛔️ Continue thinking once `next_thought_needed=false`  
⛔️ Assume thoughts must proceed strictly linearly – *branching is first-class*

---

### PARAMETER CHEAT-SHEET
• `thought` (string) – current reasoning step  
• `next_thought_needed` (boolean) – request further thinking?  
• `thought_number` (int ≥ 1) – 1-based counter  
• `total_thoughts` (int ≥ 1) – mutable estimate  
• `is_revision`, `revises_thought` (int) – mark corrections  
• `branch_from_thought`, `branch_id` – manage alternative paths  
• `needs_more_thoughts` (boolean) – optional hint that more thoughts may follow  

_All JSON keys **must** use `lower_snake_case`._

---

### EXAMPLE ✔️
```json
{
  "thought": "List solution candidates and pick the most promising",
  "thought_number": 1,
  "total_thoughts": 4,
  "next_thought_needed": true
}

EXAMPLE ✔️ (branching late)

{
  "thought": "Alternative approach: treat it as a graph-search problem",
  "thought_number": 6,
  "total_thoughts": 8,
  "branch_from_thought": 3,
  "branch_id": "B1",
  "next_thought_needed": true
}

Features

  • Break down complex programming problems into manageable steps
  • Revise and refine thoughts as understanding deepens
  • Branch into alternative paths of reasoning
  • Adjust the total number of thoughts dynamically
  • Generate and verify solution hypotheses
  • Enforce a maximum of 20 thought steps to prevent excessive reasoning

Tool

sequentialthinking

Facilitates a detailed, step-by-step thinking process for programming and technical problem-solving.

Inputs:

  • thought (string): The current thinking step
  • next_thought_needed (boolean): Whether another thought step is needed
  • thought_number (integer): Current thought number
  • total_thoughts (integer): Estimated total thoughts needed
  • is_revision (boolean, optional): Whether this revises previous thinking
  • revises_thought (integer, optional): Which thought is being reconsidered
  • branch_from_thought (integer, optional): Branching point thought number
  • branch_id (string, optional): Branch identifier
  • needs_more_thoughts (boolean, optional): If more thoughts are needed

Important: All parameters must use snake_case format (e.g., thought_number, not thoughtNumber). The server will reject requests using camelCase parameters.

Usage

The Code Reasoning tool is designed for:

  • Breaking down complex programming problems into steps
  • Algorithm design and optimization
  • Debugging and error analysis
  • Code architecture planning
  • Technical decision-making when multiple approaches exist
  • Understanding complex codebases

Configuration

Usage with Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "sequential-thinking": {
      "command": "code-reasoning",
      "args": []
    }
  }
}

Location of Claude Desktop config file on macOS:

~/Library/Application Support/Claude-Desktop/claude_desktop_config.json

Usage with VS Code

For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing Ctrl + Shift + P and typing Preferences: Open Settings (JSON).

Optionally, you can add it to a file called .vscode/mcp.json in your workspace. This will allow you to share the configuration with others.

{
  "mcp": {
    "servers": {
      "sequential-thinking": {
        "command": "code-reasoning",
        "args": []
      }
    }
  }
}

Installation

# Create the directory
mkdir -p ~/Sites/code-reasoning

# Copy files from original repository (if you have it)
cp -r /path/to/mcp-servers/src/sequentialthinking/* ~/Sites/code-reasoning/

# Navigate to the directory
cd ~/Sites/code-reasoning

# Update package.json and index.ts with the custom changes

# Install dependencies
npm install

# Build the package
npm run build

# Install globally
npm link

Troubleshooting

TypeScript Configuration Error

If you encounter an error like:

error TS5083: Cannot read file '/tsconfig.json'.

This is because the original tsconfig.json extends a parent configuration. Update your tsconfig.json to be self-contained:

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true,
    "outDir": "./dist",
    "rootDir": ".",
    "declaration": true
  },
  "include": ["./**/*.ts"]
}

Parameter Naming Errors

If Claude receives errors from the server, ensure all parameters use snake_case:

  • Use thought_number instead of thoughtNumber
  • Use next_thought_needed instead of nextThoughtNeeded
  • Use total_thoughts instead of totalThoughts

Keeping Up-to-Date with Upstream

This is a fork of the original Sequential Thinking server. To incorporate updates from the original while maintaining our customizations:

  1. Check for updates to the original repository:

    cd /path/to/original/mcp-servers
    git pull
    
  2. Compare the changes to our fork:

    diff -r /path/to/original/mcp-servers/src/sequentialthinking/ ~/Sites/code-reasoning/
    
  3. Selectively incorporate updates:

    • Update dependencies to match the original (especially important for SDK updates)
    • Add new features or bug fixes while maintaining our snake_case naming conventions
    • Update the tool description if improvements are made to the original
  4. Rebuild and reinstall after updating:

    npm install
    npm run build
    npm link
    

License

This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured