Skip to main content
Glama
Code Reasoning MCP Server

Code Reasoning MCP Server

コード推論MCPサーバー

構造化された段階的な思考を通じて複雑なプログラミング タスクを解決する Claude の能力を強化する Model Context Protocol (MCP) サーバー。

npmバージョン ライセンス: MIT CI

クイックインストール

  1. 以下を編集して Claude Desktop を構成します。

    • 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. VS Code を構成します。

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

Related MCP server: Sequential Thinking MCP Server

使用法

  1. この MCP をトリガーするには、チャット メッセージに以下を追加します。

    Use sequential thinking to reason about this.
  2. コード推論をトリガーするすぐに使えるプロンプトを使用します。

コード推論プロンプト

  • 特定のコマンドを表示するには、Claude Desktop のチャット ウィンドウの「+」アイコンをクリックするか、Claude Code で/help 。

  • 利用可能なツールから「コード推論から追加」を選択します

  • プロンプトテンプレートを選択し、必要な情報を入力します

  • フォームを送信してチャットメッセージにプロンプトを追加し、リターンキーを押します

プロンプト テンプレートの使用の詳細については、「プロンプト ガイド」を参照してください。

コマンドラインオプション

  • --debug : 詳細なログを有効にする

  • --helpまたは-h : ヘルプ情報を表示する

主な特徴

  • プログラミングの焦点:コーディングタスクと問題解決に最適化

  • 構造化思考:複雑な問題を扱いやすいステップに分解する

  • 思考の分岐:複数の解決策を並行して検討する

  • 思考の修正:理解が深まるにつれて、以前の推論を洗練させる

  • 安全制限: ループを防ぐために 20 回の思考ステップ後に自動的に停止します

  • すぐに使えるプロンプト: 一般的な開発タスク用の事前定義されたテンプレート

ドキュメント

詳細なドキュメントは docs ディレクトリにあります:

プロジェクト構造

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

迅速な評価

コード推論MCPサーバーには、クロードのコード推論プロンプトへの対応能力を評価するプロンプト評価システムが搭載されています。このシステムでは、以下のことが可能です。

  • シナリオ問題に対してさまざまなプロンプトのバリエーションをテストする

  • パラメータ形式の遵守の検証

  • ソリューションの品質を評価する

プロンプト評価システムを使用するには、次のコマンドを実行します。

npm run eval

迅速な比較と開発

Code Reasoningサーバーに最適なプロンプトの開発には多大な労力が費やされました。現在の実装では、評価プロセスを経て最終的に選ばれたHYBRID_DESIGNプロンプトを使用しています。

4 つの異なるプロンプト デザインを比較しました。

プロンプトデザイン

説明

一連

オリジナルのシーケンシャルシンキングプロンプトデザイン

デフォルト

以前サーバーで使用されていたベースラインプロンプト

コード_推論_0_30

コード固有の推論に焦点を当てた実験的な変種

ハイブリッドデザイン

他のアプローチの最良の要素を取り入れた洗練されたデザイン

7 つの異なるプログラミング シナリオにわたる評価では、HYBRID_DESIGN が他のプロンプトよりも優れていることが示されました。

シナリオ

ハイブリッドデザイン

コード_推論_0_30

デフォルト

一連

アルゴリズムの選択

87%

82%

88%

82%

バグの特定

87%

91%

88%

92%

多段階の実装

83%

67%

79%

82%

システム設計分析

82%

87%

78%

82%

コードデバッグタスク

92%

87%

92%

92%

コンパイラの最適化

83%

78%

67%

73%

キャッシュ戦略

86%

88%

82%

87%

平均

86%

83%

82%

84%

HYBRID_DESIGNプロンプトは、平均ソリューション品質(86%)がわずかに最高であり、すべてのシナリオで最も安定したパフォーマンスを示しました(80%を下回るスコアはありませんでした)。また、最も多くの思考を生成しましたsrc/server.tsファイルは、この最適なプロンプトデザインを使用するように更新されました。

個人的には、最大の改善点はプロンプトの最後に次の文を追加したことだと考えています。「✍️ それぞれの考えを「何が欠けているか、または再考する必要があるか」と自問して終わらせます。」

プロンプト評価システムの詳細については、 「テスト フレームワーク」を参照してください。

ライセンス

このプロジェクトはMITライセンスの下で提供されています。詳細はLICENSEファイルをご覧ください。

Available Tools

1 tool
code-reasoningA

🧠 Code Reasoning Tool (using sequential thinking)

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 ✔️

{
  "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
}

Inputs: next_thought_needed (required), thought (required), thought_number (required), total_thoughts (required), +5 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 1 tool

    Disambiguation5/5

    With only one tool, there is no possibility of confusion or overlap between tools. The single tool has a clearly defined purpose for code reasoning and problem-solving, so agents cannot misselect between multiple options.

    Naming Consistency5/5

    Since there is only one tool named 'code-reasoning', naming consistency is inherently perfect. There are no other tools to compare against, so no inconsistencies can exist in the tool set.

    Tool Count2/5

    A single tool for a 'Code Reasoning MCP Server' feels too minimal for the apparent scope. While the tool is feature-rich internally, the server's purpose suggests it should offer multiple specialized reasoning tools (e.g., for debugging, design, analysis) rather than one monolithic tool, making the count inappropriate.

    Completeness2/5

    The server claims to handle 'code reasoning' but provides only one general-purpose tool. This creates significant gaps: there are no specialized tools for different reasoning tasks (e.g., debugging vs. design), no tools for input/output handling, and no way to manage reasoning sessions independently, leading to potential agent failures in complex workflows.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers