Chain of Draft (CoD) MCP Server: An MCP server implementation of the Chain of Draft reasoning approach for more efficient LLM reasoning.
This MCP server implements the Chain of Draft (CoD) reasoning approach as described in the research paper “Chain of Draft: Thinking Faster by Writing Less”. CoD is a novel paradigm that allows LLMs to generate minimalistic yet informative intermediate reasoning outputs while solving tasks, significantly reducing token usage while maintaining accuracy.
Core Chain of Draft Implementation
Performance Analytics
Adaptive Word Limits
Comprehensive Example Database
Format Enforcement
Hybrid Reasoning Approaches
OpenAI API Compatibility
pip install -r requirements.txt
.env
file:ANTHROPIC_API_KEY=your_api_key_here
python server.py
npm install
.env
file:ANTHROPIC_API_KEY=your_api_key_here
node index.js
To integrate with Claude Desktop:
Install Claude Desktop from claude.ai/download
Create or edit the Claude Desktop config file:
~/Library/Application Support/Claude/claude_desktop_config.json
Add the server configuration (Python version):
{
"mcpServers": {
"chain-of-draft": {
"command": "python3",
"args": ["/absolute/path/to/cod/server.py"],
"env": {
"ANTHROPIC_API_KEY": "your_api_key_here"
}
}
}
}
Or for the JavaScript version:
{
"mcpServers": {
"chain-of-draft": {
"command": "node",
"args": ["/absolute/path/to/cod/index.js"],
"env": {
"ANTHROPIC_API_KEY": "your_api_key_here"
}
}
}
}
Restart Claude Desktop
You can also use the Claude CLI to add the server:
## 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"
The Chain of Draft server provides the following tools:
Tool | Description |
---|---|
chain_of_draft_solve |
Solve a problem using Chain of Draft reasoning |
math_solve |
Solve a math problem with CoD |
code_solve |
Solve a coding problem with CoD |
logic_solve |
Solve a logic problem with CoD |
get_performance_stats |
Get performance stats for CoD vs CoT |
get_token_reduction |
Get token reduction statistics |
analyze_problem_complexity |
Analyze problem complexity |
If you want to use the Chain of Draft client directly in your Python code:
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']}")
For JavaScript/Node.js applications:
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();
The server is available in both Python and JavaScript implementations, both consisting of several integrated components:
Both implementations follow the same core principles and provide identical MCP tools, making them interchangeable for most use cases.
This project is open-source and available under the MIT license.
Mcp2tavily
一个MCP服务器,让你的Claude Cline以及Langchain实现网络搜索功能。An MCP server that allows your Claude Cline and Langchain to implement network search functions.
Git Forensics Mcp
An MCP server for deep git repository investigation and analysis. Provides detailed insights into repository history, branch relationships, and development patterns, focusing solely on git repository analysis rather than general GitHub or git operation.
Deepseek Thinking Claude 3.5 Sonnet Cline Mcp
🧠 MCP server implementing RAT (Retrieval Augmented Thinking) - combines DeepSeek's reasoning with GPT-4/Claude/Mistral responses, maintaining conversation context between interactions.