Chain of Draft (CoD) MCP Server
チェーン・オブ・ドラフト(CoD)MCPサーバー
概要
このMCPサーバーは、研究論文「Chain of Draft:より少ない文章でより速く考える」で説明されているChain of Draft(CoD)推論アプローチを実装しています。CoDは、LLMがタスクを解決しながら最小限ながらも有益な中間推論出力を生成することを可能にする新しいパラダイムであり、トークンの使用量を大幅に削減しながら精度を維持します。
Related MCP server: Visum Thinker MCP Server
主なメリット
効率性: トークン使用量が大幅に削減されます (標準 CoT のわずか 7.6%)
速度: 生成時間が短いため応答が速い
コスト削減: LLM呼び出しのAPIコストの削減
維持された精度: CoTと比較して同等またはそれ以上の精度
柔軟性:さまざまな推論タスクやドメインに適用可能
特徴
ドラフト実装のコアチェーン
簡潔な推論手順(通常 5 語以下)
フォーマットの強制
回答抽出
パフォーマンス分析
トークン使用状況の追跡
ソリューション精度の監視
実行時間の測定
ドメイン固有のパフォーマンスメトリック
適応型単語制限
自動複雑度推定
単語数制限の動的調整
ドメイン固有のキャリブレーション
包括的なサンプルデータベース
CoTからCoDへの変換
分野固有の例(数学、コード、生物学、物理学、化学、パズル)
問題の類似性に基づく例の検索
フォーマットの強制
文字数制限を遵守するための後処理
ステップ構造の保存
遵守分析
ハイブリッド推論アプローチ
CoDとCoTの自動選択
ドメイン固有の最適化
過去の実績に基づく選抜
OpenAI APIの互換性
標準の OpenAI クライアントの代替品
補完とチャットインターフェースの両方をサポート
既存のワークフローへの簡単な統合
セットアップとインストール
前提条件
Python 3.10+ (Python実装用)
Node.js 18+(JavaScript実装用)
アントロピックAPIキー
Pythonのインストール
リポジトリをクローンする
依存関係をインストールします:
pip install -r requirements.txt.envファイルで API キーを設定します。ANTHROPIC_API_KEY=your_api_key_hereサーバーを実行します。
python server.py
JavaScriptのインストール
リポジトリをクローンする
依存関係をインストールします:
npm install.envファイルで API キーを設定します。ANTHROPIC_API_KEY=your_api_key_hereサーバーを実行します。
node index.js
クロードデスクトップ統合
Claude Desktop と統合するには:
claude.ai/downloadからClaude Desktopをインストールします。
Claude Desktop 構成ファイルを作成または編集します。
~/Library/Application Support/Claude/claude_desktop_config.jsonサーバー構成を追加します (Python バージョン):
{ "mcpServers": { "chain-of-draft": { "command": "python3", "args": ["/absolute/path/to/cod/server.py"], "env": { "ANTHROPIC_API_KEY": "your_api_key_here" } } } }または JavaScript バージョンの場合:
{ "mcpServers": { "chain-of-draft": { "command": "node", "args": ["/absolute/path/to/cod/index.js"], "env": { "ANTHROPIC_API_KEY": "your_api_key_here" } } } }Claudeデスクトップを再起動します
Claude CLI を使用してサーバーを追加することもできます。
# For Python implementation
claude mcp add chain-of-draft -e ANTHROPIC_API_KEY="your_api_key_here" "python3 /absolute/path/to/cod/server.py"
# For JavaScript implementation
claude mcp add chain-of-draft -e ANTHROPIC_API_KEY="your_api_key_here" "node /absolute/path/to/cod/index.js"利用可能なツール
Chain of Draft サーバーは次のツールを提供します。
道具 | 説明 |
| ドラフトの連鎖推論を使って問題を解決する |
| CoDで数学の問題を解く |
| CoDでコーディングの問題を解決する |
| CoDで論理問題を解く |
| CoDとCoTのパフォーマンス統計を取得する |
| トークン削減統計を取得する |
| 問題の複雑さを分析する |
開発者の使用
Pythonクライアント
Chain of Draft クライアントを Python コード内で直接使用する場合:
from client import ChainOfDraftClient
# Create client
cod_client = ChainOfDraftClient()
# Use directly
result = await cod_client.solve_with_reasoning(
problem="Solve: 247 + 394 = ?",
domain="math"
)
print(f"Answer: {result['final_answer']}")
print(f"Reasoning: {result['reasoning_steps']}")
print(f"Tokens used: {result['token_count']}")JavaScriptクライアント
JavaScript/Node.js アプリケーションの場合:
import { Anthropic } from "@anthropic-ai/sdk";
import dotenv from "dotenv";
// Load environment variables
dotenv.config();
// Create the Anthropic client
const anthropic = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
});
// Import the Chain of Draft client
import chainOfDraftClient from './lib/chain-of-draft-client.js';
// Use the client
async function solveMathProblem() {
const result = await chainOfDraftClient.solveWithReasoning({
problem: "Solve: 247 + 394 = ?",
domain: "math",
max_words_per_step: 5
});
console.log(`Answer: ${result.final_answer}`);
console.log(`Reasoning: ${result.reasoning_steps}`);
console.log(`Tokens used: ${result.token_count}`);
}
solveMathProblem();実装の詳細
サーバーは Python と JavaScript の両方の実装で利用可能で、どちらもいくつかの統合コンポーネントで構成されています。
Python実装
AnalyticsService : さまざまな問題領域と推論アプローチにわたるパフォーマンス指標を追跡します
ComplexityEstimator : 問題を分析して適切な単語数制限を決定する
ExampleDatabase : CoT の例を CoD 形式に変換して、例を管理および取得します。
FormatEnforcer : 推論ステップが単語数制限を遵守していることを確認する
ReasoningSelector : 問題の特性に基づいて CoD と CoT をインテリジェントに選択します
JavaScript実装
analyticsDb : パフォーマンスメトリックを追跡するためのインメモリデータベース
複雑さ推定器: 問題を分析して複雑さと適切な単語制限を決定します
formatEnforcer : 推論ステップが単語数制限を遵守していることを確認する
推論セレクター: 問題の特性と過去のパフォーマンスに基づいて、CoD と CoT を自動的に選択します。
どちらの実装も同じコア原則に従い、同一の MCP ツールを提供するため、ほとんどのユースケースで互換性があります。
ライセンス
このプロジェクトはオープンソースであり、MIT ライセンスの下で利用できます。
Available Tools
7 toolsanalyze_problem_complexityC
Analyze the complexity of a problem
Inputs: problem (required), domain.
chain_of_draft_solveC
Solve a reasoning problem using Chain of Draft approach
Inputs: problem (required), domain, max_words_per_step, approach, +2 more.
code_solveC
Solve a coding problem using Chain of Draft reasoning
Inputs: problem (required), approach, max_words_per_step.
get_performance_statsC
Get performance statistics for CoD vs CoT approaches
Inputs: domain.
get_token_reductionB
Get token reduction statistics for CoD vs CoT
Inputs: no named parameters.
logic_solveC
Solve a logic problem using Chain of Draft reasoning
Inputs: problem (required), approach, max_words_per_step.
math_solveC
Solve a math problem using Chain of Draft reasoning
Inputs: problem (required), approach, max_words_per_step.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
The tools have clear distinctions in problem domains (math, logic, code, general reasoning) but there is significant overlap between 'chain_of_draft_solve' and the domain-specific solvers (math_solve, logic_solve, code_solve), which could cause confusion about when to use the general versus specific versions. The analysis and statistics tools are clearly distinct from the solving tools.
Most tools follow a consistent snake_case pattern with descriptive names (e.g., 'analyze_problem_complexity', 'get_performance_stats'), but there's a minor inconsistency with 'chain_of_draft_solve' using a longer prefix while others use simpler domain names. The verb usage is reasonably consistent with 'solve', 'analyze', and 'get' patterns.
With 7 tools, this is well-scoped for a server focused on Chain of Draft problem-solving and analysis. The count covers solving across multiple domains plus performance analytics, without being overwhelming or too sparse for the apparent purpose.
The toolset provides good coverage for solving problems (math, logic, code, general) and analyzing performance/token usage, which aligns well with the CoD domain. A minor gap exists in not having tools for configuring or customizing the CoD approach (e.g., setting parameters), but core workflows are well supported.
Maintenance
Related MCP Connectors
Reduces AI Agent token usage by 40% via three-stage SOP workflow.
Deterministic verifier: LLM proposes, graph verifies. Sub-ms, offline, 0 tokens.
Cuts coding agent token burn up to 72% continuously via contradiction-free memory & verification.
Agent-to-agent reasoning-as-a-service: chain-of-thought, analysis, and decision support.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnhances AI model capabilities with structured, retrieval-augmented thinking processes that enable dynamic thought chains, parallel exploration paths, and recursive refinement cycles for improved reasoning.124MIT
- AlicenseBqualityNot gradedmaintenanceProvides structured sequential thinking capabilities for AI assistants to break down complex problems into manageable steps, revise thoughts, and explore alternative reasoning paths.29-
- AlicenseNot gradedqualityDmaintenanceTransforms prompts into Chain of Draft (CoD) or Chain of Thought (CoT) format to enhance LLM reasoning quality while reducing token usage by up to 92.4%, supporting multiple LLM providers including Claude, GPT, Ollama, and local models.35 npm19MIT
- AlicenseBqualityNot gradedmaintenanceEnables AI assistants to perform structured, step-by-step reasoning by breaking down complex problems into numbered thoughts, with support for revising previous steps and exploring alternative reasoning paths.5-