The Chain of Draft (CoD) MCP Server is a versatile tool for efficient problem-solving that offers:
Domain-Flexible Reasoning: Solve problems across various domains (math, code, logic) using the CoD approach
Reasoning Method Selection: Automatically or manually choose between Chain of Draft (CoD) and Chain of Thought (CoT) reasoning
Customizable Parameters: Control word limits per reasoning step with options for adaptive limits based on problem complexity
Performance Analytics: Access statistics comparing CoD vs CoT, including accuracy, execution time, and token reduction
Integration Options: Functions as a drop-in replacement for OpenAI clients and integrates with existing systems via Python or JavaScript
Complexity Analysis: Analyzes problem complexity to optimize reasoning approaches
Format Enforcement: Applies consistent formatting rules to generated reasoning steps
Provides compatibility with OpenAI API clients, serving as a drop-in replacement for standard OpenAI interfaces while implementing the Chain of Draft approach.
Chain of Draft (CoD) MCP Server
Overview
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.
Key Benefits
Efficiency: Significantly reduced token usage (as little as 7.6% of standard CoT)
Speed: Faster responses due to shorter generation time
Cost Savings: Lower API costs for LLM calls
Maintained Accuracy: Similar or even improved accuracy compared to CoT
Flexibility: Applicable across various reasoning tasks and domains
Features
Core Chain of Draft Implementation
Concise reasoning steps (typically 5 words or less)
Format enforcement
Answer extraction
Performance Analytics
Token usage tracking
Solution accuracy monitoring
Execution time measurement
Domain-specific performance metrics
Adaptive Word Limits
Automatic complexity estimation
Dynamic adjustment of word limits
Domain-specific calibration
Comprehensive Example Database
CoT to CoD transformation
Domain-specific examples (math, code, biology, physics, chemistry, puzzle)
Example retrieval based on problem similarity
Format Enforcement
Post-processing to ensure adherence to word limits
Step structure preservation
Adherence analytics
Hybrid Reasoning Approaches
Automatic selection between CoD and CoT
Domain-specific optimization
Historical performance-based selection
OpenAI API Compatibility
Drop-in replacement for standard OpenAI clients
Support for both completions and chat interfaces
Easy integration into existing workflows
Setup and Installation
Prerequisites
Python 3.10+ (for Python implementation)
Node.js 18+ (for JavaScript implementation)
Anthropic API key
Python Installation
Clone the repository
Install dependencies:
pip install -r requirements.txtConfigure API keys in
.env
file:ANTHROPIC_API_KEY=your_api_key_hereRun the server:
python server.py
JavaScript Installation
Clone the repository
Install dependencies:
npm installConfigure API keys in
.env
file:ANTHROPIC_API_KEY=your_api_key_hereRun the server:
node index.js
Claude Desktop Integration
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.jsonAdd 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:
Available Tools
The Chain of Draft server provides the following tools:
Tool | Description |
| Solve a problem using Chain of Draft reasoning |
| Solve a math problem with CoD |
| Solve a coding problem with CoD |
| Solve a logic problem with CoD |
| Get performance stats for CoD vs CoT |
| Get token reduction statistics |
| Analyze problem complexity |
Developer Usage
Python Client
If you want to use the Chain of Draft client directly in your Python code:
JavaScript Client
For JavaScript/Node.js applications:
Implementation Details
The server is available in both Python and JavaScript implementations, both consisting of several integrated components:
Python Implementation
AnalyticsService: Tracks performance metrics across different problem domains and reasoning approaches
ComplexityEstimator: Analyzes problems to determine appropriate word limits
ExampleDatabase: Manages and retrieves examples, transforming CoT examples to CoD format
FormatEnforcer: Ensures reasoning steps adhere to word limits
ReasoningSelector: Intelligently chooses between CoD and CoT based on problem characteristics
JavaScript Implementation
analyticsDb: In-memory database for tracking performance metrics
complexityEstimator: Analyzes problems to determine complexity and appropriate word limits
formatEnforcer: Ensures reasoning steps adhere to word limits
reasoningSelector: Automatically chooses between CoD and CoT based on problem characteristics and historical performance
Both implementations follow the same core principles and provide identical MCP tools, making them interchangeable for most use cases.
License
This project is open-source and available under the MIT license.
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
Implements the Chain of Draft reasoning approach to generate minimalistic intermediate reasoning outputs while solving tasks, significantly reducing token usage while maintaining accuracy.
- Overview
- Key Benefits
- Features
- Setup and Installation
- Claude Desktop Integration
- Available Tools
- Developer Usage
- Implementation Details
- License
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityEnhances AI model capabilities with structured, retrieval-augmented thinking processes that enable dynamic thought chains, parallel exploration paths, and recursive refinement cycles for improved reasoning.Last updated -16MIT License
- AsecurityAlicenseAqualityChain of Draft Server is a powerful AI-driven tool that helps developers make better decisions through systematic, iterative refinement of thoughts and designs. It integrates seamlessly with popular AI agents and provides a structured approach to reasoning, API design, architecture decisions, code rLast updated -12524MIT License
- AsecurityAlicenseAqualityAn 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.Last updated -1150219MIT License
- AsecurityAlicenseAqualityProvides structured sequential thinking capabilities for AI assistants to break down complex problems into manageable steps, revise thoughts, and explore alternative reasoning paths.Last updated -16MIT License