Chain of Draft Prompt Tool
About
Organizes prompts into structured, multi-step workflows through a chain execution system where outputs from one step become inputs for subsequent steps, enabling progressive refinement for complex tasks like research, code review, and documentation generation.
Details
- Author
- brendancopley
- Repository
- brendancopley/mcp-chain-of-draft-prompt-tool
- GitHub stars
- 7
- Categories
- Developer Tools, AI, Productivity, Design, Workplace, File Management, Search, Communication, Infrastructure, Knowledge Base, Project Management
Jump to
1. Core Chain of Draft Implementation
- Concise reasoning steps (typically 5 words or less)
- Format enforcement
- Answer extraction
2. Performance Analytics
- Token usage tracking
- Solution accuracy monitoring
- Execution time measurement
- Domain-specific performance metrics
3. Adaptive Word Limits
- Automatic complexity estimation
- Dynamic adjustment of word limits
- Domain-specific calibration
4. Comprehensive Example Database
- CoT to CoD transformation
- Domain-specific examples (math, code, biology, physics, chemistry, puzzle)
- Example retrieval based on problem similarity
5. Format Enforcement
- Post-processing to ensure adherence to word limits
- Step structure preservation
- Adherence analytics
6. Hybrid Reasoning Approaches
- Automatic selection between CoD and CoT
- Domain-specific optimization
- Historical performance-based selection
7. OpenAI API Compatibility
- Drop-in replacement for standard OpenAI clients
- Support for both completions and chat interfaces
- Easy integration into existing workflows
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Chain of Draft Prompt ToolCommand (node, npx, python, etc.)python3Arguments-
Argument 1
/absolute/path/to/cod/server.py
Environment-
ANTHROPIC_API_KEY
your_api_key_here
Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
-
Argument 1
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
1. Cloud Services
curl https://ollama.ai/install.sh | sh
export MCP_LLM_PROVIDER=ollama
export MCP_OLLAMA_MODEL=llama2 # or your chosen model
3. Custom Local Models
1. Clone the repository
2. Install dependencies:
bashpip install -r requirements.txt
3. Configure API keys in .env file:
ANTHROPIC_API_KEY=your_api_key_here
4. Run the server:
bashpython server.py
1. Clone the repository
2. Install dependencies:
bashnpm install
3. Configure API keys in .env file:
ANTHROPIC_API_KEY=your_api_key_here
4. Build and run the server:
bash
The project uses Nx for managing the build process. The SEA configuration is handled through the nx-node-sea plugin, which provides a streamlined way to create Node.js single executable applications.
Key features of the SEA build process:
- Cross-platform support (macOS, Linux, Windows)
- Automatic dependency bundling
- Optimized binary size
- No runtime dependencies required
You can start the MCP Inspector using the provided npm script:
```bash
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.
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 |
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"chain of draft prompt tool": {
"env": {
"ANTHROPIC_API_KEY": "your_api_key_here"
},
"args": [
"/absolute/path/to/cod/server.py"
],
"command": "python3"
}
}
}
Linux
{
"env": {
"ANTHROPIC_API_KEY": "your_api_key_here"
},
"args": [
"/absolute/path/to/cod/server.py"
],
"command": "python3"
}
Macos
{
"env": {
"ANTHROPIC_API_KEY": "your_api_key_here"
},
"args": [
"/absolute/path/to/cod/server.py"
],
"command": "python3"
}
Windows
{
"env": {
"ANTHROPIC_API_KEY": "your_api_key_here"
},
"args": [
"/absolute/path/to/cod/server.py"
],
"command": "python3"
}
MCP Chain of Draft (CoD) Prompt Tool
Overview
The MCP Chain of Draft (CoD) Prompt Tool is a powerful Model Context Protocol tool that enhances LLM reasoning by transforming standard prompts into either Chain of Draft (CoD) or Chain of Thought (CoT) format. Here's how it works:
1. Input Transformation: Your regular prompt is automatically transformed into a CoD/CoT format
2. LLM Processing: The transformed prompt is passed to your chosen LLM (Claude, GPT, Ollama, or local models)
3. Enhanced Reasoning: The LLM processes the request using structured reasoning steps
4. Result Transformation: The response is transformed back into a clear, concise format
This approach significantly improves reasoning quality while reducing token usage and maintaining high accuracy.
BYOLLM Support
This tool supports a "Bring Your Own LLM" approach, allowing you to use any language model of your choice:
Supported LLM Integrations
- Cloud Services - Anthropic Claude - OpenAI GPT models - Mistral AI - Local Models - Ollama (all models) - Local LLama variants - Any model supporting chat completion APIConfiguring Your LLM
1. Cloud Services
# For Anthropic Claude
export ANTHROPIC_API_KEY=your_key_here
# For OpenAI
export OPENAI_API_KEY=your_key_here
# For Mistral AI
export MISTRAL_API_KEY=your_key_here
2. Local Models with Ollama
# First install Ollama
curl https://ollama.ai/install.sh | sh
# Pull your preferred model
ollama pull llama2
# or
ollama pull mistral
# or any other model
# Configure the tool to use Ollama
export MCP_LLM_PROVIDER=ollama
export MCP_OLLAMA_MODEL=llama2 # or your chosen model
3. Custom Local Models
# Point to your local model API
export MCP_LLM_PROVIDER=custom
export MCP_CUSTOM_LLM_ENDPOINT=http://localhost:your_port
Credits
This project implements the Chain of Draft (CoD) reasoning approach as a Model Context Protocol (MCP) prompt tool for Claude. The core Chain of Draft implementation is based on the work by stat-guy. We extend our gratitude for their pioneering work in developing this efficient reasoning approach.
Original Repository: https://github.com/stat-guy/chain-of-draft
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
1. Core Chain of Draft Implementation
- Concise reasoning steps (typically 5 words or less)
- Format enforcement
- Answer extraction
2. Performance Analytics
- Token usage tracking
- Solution accuracy monitoring
- Execution time measurement
- Domain-specific performance metrics
3. Adaptive Word Limits
- Automatic complexity estimation
- Dynamic adjustment of word limits
- Domain-specific calibration
4. Comprehensive Example Database
- CoT to CoD transformation
- Domain-specific examples (math, code, biology, physics, chemistry, puzzle)
- Example retrieval based on problem similarity
5. Format Enforcement
- Post-processing to ensure adherence to word limits
- Step structure preservation
- Adherence analytics
6. Hybrid Reasoning Approaches
- Automatic selection between CoD and CoT
- Domain-specific optimization
- Historical performance-based selection
7. 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 22+ (for JavaScript implementation) - Nx (for building Single Executable Applications)Python Installation
1. Clone the repository
2. Install dependencies:
pip install -r requirements.txt
3. Configure API keys in
.env file: ANTHROPIC_API_KEY=your_api_key_here
4. Run the server:
python server.py
JavaScript/TypeScript Installation
1. Clone the repository
2. Install dependencies:
npm install
3. Configure API keys in
.env file: ANTHROPIC_API_KEY=your_api_key_here
4. Build and run the server:
# Build TypeScript files using Nx
npm run nx build
# Start the server
npm start
# For development with auto-reload:
npm run dev
Available scripts:
- npm run nx build: Compiles TypeScript to JavaScript using Nx build system
- npm run build:sea: Creates Single Executable Applications for all platforms
- npm start: Runs the compiled server from dist
- npm test: Runs the test query against the server
- npm run dev: Runs the TypeScript server directly using ts-node (useful for development)
The project uses Nx as its build system, providing:
- Efficient caching and incremental builds
- Cross-platform build support
- Integrated SEA generation
- Dependency graph visualization
- Consistent build process across environments
Single Executable Applications (SEA)
This project supports building Single Executable Applications (SEA) using Node.js 22+ and the @getlarge/nx-node-sea plugin. This allows you to create standalone executables that don't require Node.js to be installed on the target system.
Building SEA Executables
The project includes several scripts for building SEA executables:
# Build for all platforms
npm run build:sea
Build for specific platforms
npm run build:macos # macOS
npm run build:linux # Linux
npm run build:windows # Windows
SEA Build Configuration
The project uses Nx for managing the build process. The SEA configuration is handled through the nx-node-sea plugin, which provides a streamlined way to create Node.js single executable applications.
Key features of the SEA build process:
- Cross-platform support (macOS, Linux, Windows)
- Automatic dependency bundling
- Optimized binary size
- No runtime dependencies required
Using SEA Executables
…
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.






