Skip to main content
Glama
Chain of Draft (CoD) MCP Server

Chain of Draft (CoD) MCP Server

by stat-guy

초안 체인(CoD) MCP 서버

개요

이 MCP 서버는 연구 논문 "Chain of Draft: Thinking Faster by Writing Less"에 설명된 초안 체인(CoD) 추론 방식을 구현합니다. CoD는 LLM이 과제를 해결하는 동안 간결하면서도 유익한 중간 추론 결과를 생성할 수 있도록 하는 새로운 패러다임으로, 토큰 사용량을 크게 줄이는 동시에 정확성을 유지합니다.

Related MCP server: Visum Thinker MCP Server

주요 이점

  • 효율성 : 토큰 사용량이 크게 감소(표준 CoT의 7.6%에 불과)

  • 속도 : 생성 시간이 짧아 응답 속도가 빠릅니다.

  • 비용 절감 : LLM 호출에 대한 API 비용 절감

  • 유지된 정확도 : CoT와 비교했을 때 유사하거나 더 향상된 정확도

  • 유연성 : 다양한 추론 작업 및 도메인에 적용 가능

특징

  1. 초안 구현의 핵심 체인

    • 간결한 추론 단계(일반적으로 5단어 이하)

    • 형식 적용

    • 답변 추출

  2. 성과 분석

    • 토큰 사용 추적

    • 솔루션 정확도 모니터링

    • 실행 시간 측정

    • 도메인별 성능 측정 항목

  3. 적응형 단어 제한

    • 자동 복잡도 추정

    • 단어 제한의 동적 조정

    • 도메인별 교정

  4. 포괄적인 예제 데이터베이스

    • CoT에서 CoD로의 변환

    • 도메인별 예시(수학, 코드, 생물학, 물리학, 화학, 퍼즐)

    • 문제 유사성에 기반한 검색 예시

  5. 형식 시행

    • 단어 제한 준수를 보장하기 위한 사후 처리

    • 계단 구조 보존

    • 준수 분석

  6. 하이브리드 추론 접근 방식

    • CoD와 CoT 간 자동 선택

    • 도메인별 최적화

    • 과거 성과 기반 선택

  7. OpenAI API 호환성

    • 표준 OpenAI 클라이언트를 위한 드롭인 교체

    • 완성 및 채팅 인터페이스 모두 지원

    • 기존 워크플로에 쉽게 통합

설정 및 설치

필수 조건

  • Python 3.10+(Python 구현용)

  • Node.js 18+(JavaScript 구현용)

  • Anthropic API 키

파이썬 설치

  1. 저장소를 복제합니다

  2. 종속성 설치:

    지엑스피1

  3. .env 파일에서 API 키를 구성합니다.

    ANTHROPIC_API_KEY=your_api_key_here
  4. 서버를 실행합니다:

    python server.py

자바스크립트 설치

  1. 저장소를 복제합니다

  2. 종속성 설치:

    npm install
  3. .env 파일에서 API 키를 구성합니다.

    ANTHROPIC_API_KEY=your_api_key_here
  4. 서버를 실행합니다:

    node index.js

Claude 데스크톱 통합

Claude Desktop과 통합하려면:

  1. claude.ai/download 에서 Claude Desktop을 설치하세요

  2. Claude Desktop 구성 파일을 만들거나 편집합니다.

    ~/Library/Application Support/Claude/claude_desktop_config.json
  3. 서버 구성을 추가합니다(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"
                }
            }
        }
    }
  4. Claude Desktop을 다시 시작하세요

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 서버는 다음과 같은 도구를 제공합니다.

도구

설명

chain_of_draft_solve

초안 추론을 사용하여 문제 해결

math_solve

CoD로 수학 문제를 풀어보세요

code_solve

CoD를 사용하여 코딩 문제 해결

logic_solve

CoD를 사용하여 논리 문제를 해결하세요

get_performance_stats

CoD와 CoT의 성능 통계를 확인하세요

get_token_reduction

토큰 감소 통계 가져오기

analyze_problem_complexity

문제 복잡성 분석

개발자 사용

파이썬 클라이언트

Python 코드에서 Chain of Draft 클라이언트를 직접 사용하려면 다음을 수행하세요.

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 구현 모두에서 사용 가능하며, 두 구현 모두 여러 가지 통합 구성 요소로 구성됩니다.

파이썬 구현

  1. AnalyticsService : 다양한 문제 도메인과 추론 접근 방식에 걸쳐 성과 측정 항목을 추적합니다.

  2. ComplexityEstimator : 문제를 분석하여 적절한 단어 제한을 결정합니다.

  3. ExampleDatabase : CoT 예제를 CoD 형식으로 변환하여 예제를 관리하고 검색합니다.

  4. FormatEnforcer : 추론 단계가 단어 제한을 준수하도록 보장합니다.

  5. ReasoningSelector : 문제 특성에 따라 CoD와 CoT 중에서 지능적으로 선택합니다.

JavaScript 구현

  1. analyticsDb : 성능 지표 추적을 위한 메모리 내 데이터베이스

  2. 복잡성 추정기 : 문제를 분석하여 복잡성과 적절한 단어 제한을 결정합니다.

  3. formatEnforcer : 추론 단계가 단어 제한을 준수하도록 보장합니다.

  4. reasoningSelector : 문제 특성과 과거 성과를 기반으로 CoD와 CoT 중에서 자동으로 선택합니다.

두 구현 모두 동일한 핵심 원칙을 따르고 동일한 MCP 도구를 제공하므로 대부분의 사용 사례에서 상호 교환이 가능합니다.

특허

이 프로젝트는 오픈 소스이며 MIT 라이선스에 따라 제공됩니다.

Available Tools

7 tools
analyze_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

    B3.1/5.0

    Scored across 7 tools

    Disambiguation3/5

    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.

    Naming Consistency4/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers