Co-Pilot
Updated 24 days ago

crush-mcp-server

Mmanutej
0.0k
manutej/crush-mcp-server
82
Agent Score

πŸ’‘ Summary

Crush MCP Server orchestrates multiple AI models via a context protocol, optimizing for speed, cost, and quality.

🎯 Target Audience

AI developers looking for orchestration toolsData scientists needing cost-effective model executionProduct managers evaluating AI strategiesSoftware engineers integrating AI into applicationsResearchers experimenting with multi-model approaches

πŸ€– AI Roast: β€œPowerful, but the setup might scare off the impatient.”

Security AnalysisMedium Risk

Risk: Medium. Review: shell/CLI command execution; outbound network access (SSRF, data egress); filesystem read/write scope and path traversal; dependency pinning and supply-chain risk. Run with least privilege and audit before enabling in production.

Crush MCP Server

Multi-model AI orchestration through Model Context Protocol

Transform Crush CLI into an intelligent MCP tool for Claude Code, enabling meta-orchestration across multiple AI models with automatic strategy selection.

Tests TypeScript MCP


What is This?

An MCP server that exposes Crush CLI's multi-model orchestration capabilities to Claude Code and other MCP clients. Choose from 4 execution strategies based on your speed, cost, and quality needs.

Claude Code β†’ Crush MCP Server β†’ Crush CLI β†’ Multiple AI Models
                   ↑
           (This Project)

Features

✨ 4 Execution Strategies

  • Fast: Single model, <10s, <$0.005 (grok-3-mini)
  • Balanced: Two models, <30s, ~$0.015 (grok β†’ haiku)
  • Quality: Multi-model with iteration, <60s, ~$0.06 (grok β†’ sonnet β†’ refinement)
  • Cost-Optimized: Budget-constrained, customizable max cost

🎯 MCP Tools

  • crush_execute - Execute prompts with intelligent model routing
  • crush_evaluate - Estimate cost/time/quality before execution

πŸ§ͺ Fully Tested

  • 12/12 unit tests passing
  • Comprehensive strategy coverage
  • TDD approach with Vitest

Quick Start

Install (2 minutes)

cd /Users/manu/Documents/LUXOR/crush-mcp-server npm install npm run build npm link

Add to Claude Code

Already configured! βœ… Added to ~/.claude/settings.json

Next step: Restart Claude Code to load the server.

Test It

Use crush_execute with fast strategy to explain REST APIs in 2 sentences.

πŸ“– Full guide: See QUICKSTART.md


Architecture

Strategy Pattern

interface Strategy { execute(prompt: string, maxCost?: number): Promise<ExecuteResult>; } class Orchestrator { private strategies: Map<string, Strategy>; async execute(request: ExecuteRequest): Promise<ExecuteResult> { const strategy = this.strategies.get(request.strategy || 'balanced'); return await strategy.execute(request.prompt, request.max_cost); } }

Execution Flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1. User Prompt β†’ Claude Code                                β”‚
β”‚    "Design a REST API using quality strategy"               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ MCP Protocol
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 2. Crush MCP Server (This Project)                          β”‚
β”‚    - Parse strategy from request                            β”‚
β”‚    - Route to appropriate Strategy implementation           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 3. Quality Strategy                                          β”‚
β”‚    Step 1: grok-3-mini (outline)        β†’ Cost: $0.002      β”‚
β”‚    Step 2: claude-sonnet-4-5 (detail)   β†’ Cost: $0.045      β”‚
β”‚    Step 3: iterative refinement         β†’ Cost: $0.016      β”‚
β”‚                                                              β”‚
β”‚    Quality Score: 0.87 (target: 0.75)                       β”‚
β”‚    Total Cost: $0.063                                        β”‚
β”‚    Execution Time: 42s                                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ Formatted Response
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 4. Return to User via Claude Code                           β”‚
β”‚    {                                                         β”‚
β”‚      result: "...",                                          β”‚
β”‚      metadata: {                                             β”‚
β”‚        models_used: ["grok-3-mini", "claude-sonnet-4-5"],   β”‚
β”‚        total_cost: 0.063,                                    β”‚
β”‚        quality_score: 0.87,                                  β”‚
β”‚        strategy: "quality"                                   β”‚
β”‚      }                                                       β”‚
β”‚    }                                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Project Structure

crush-mcp-server/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts              # MCP server (stdio transport)
β”‚   β”œβ”€β”€ orchestrator.ts       # Strategy orchestration
β”‚   β”œβ”€β”€ crush-client.ts       # Crush CLI wrapper
β”‚   β”œβ”€β”€ evaluator.ts          # Quality evaluation (0-1 scale)
β”‚   β”œβ”€β”€ types.ts              # TypeScript definitions
β”‚   └── strategies/
β”‚       β”œβ”€β”€ base.ts           # Strategy interface
β”‚       β”œβ”€β”€ fast.ts           # Single model (grok-3-mini)
β”‚       β”œβ”€β”€ balanced.ts       # Two models (grok β†’ haiku)
β”‚       β”œβ”€β”€ quality.ts        # Multi-model + iteration
β”‚       └── cost-optimized.ts # Budget-constrained
β”œβ”€β”€ tests/
β”‚   └── strategies.test.ts    # 12 comprehensive tests
β”œβ”€β”€ dist/                     # Compiled JavaScript
β”œβ”€β”€ QUICKSTART.md             # Get started in 5 minutes
β”œβ”€β”€ TESTING.md                # Comprehensive testing guide
β”œβ”€β”€ PROGRESS.md               # Development tracker
└── package.json

Documentation


Development

Run Tests

npm test # Run all tests npm run test:watch # Watch mode npm run test:ui # Visual UI npm run test:coverage # Coverage report

Current: βœ… 12/12 tests passing

Build

npm run build # Compile TypeScript npm run dev # Watch mode (auto-rebuild) npm start # Run compiled server

Workflow

  1. Write tests first (TDD approach)
  2. Implement strategy
  3. Run tests (npm test)
  4. Build (npm run build)
  5. Test in Claude Code

Strategy Details

Fast Strategy

// Single model, minimal tokens const result = await client.run({ model: 'grok-3-mini', prompt: userPrompt, maxTokens: 2000 }); // Target: <10s, <$0.005, quality: 0.6

Balanced Strategy

// Step 1: Fast outline const outline = await client.run({model: 'grok-3-mini', prompt}); // Step 2: Quality refinement with context const refined = await client.run({ model: 'claude-haiku-4-5', prompt: `Refine: ${outline.output}` }); // Target: <30s, ~$0.015, quality: >0.5

Quality Strategy

// Step 1: Outline (grok) // Step 2: Detailed analysis (sonnet) // Step 3: Iterative refinement until quality >= 0.75 while (qualityScore < 0.75 && iterations < maxIterations) { const improvement = await refine(currentOutput); qualityScore = evaluator.evaluate(improvement); } // Target: <60s, ~$0.06, quality: >0.7

Cost-Optimized Strategy

// Calculate max tokens from budget const maxTokens = Math.min( Math.floor((budget / costPerMToken) * 1_000_000 / 2), 1000 ); const result = await client.run({ model: 'grok-3-mini', prompt, maxTokens }); // Target: Custom budget, quality: 0.5

Configuration

Crush Binary Path

Default: /opt/homebrew/bin/crush

To customize, edit src/orchestrator.ts:

constructor(crushBinaryPath: string = '/your/custom/path/to/crush') {

API Keys (for real execution)

Configure in ~/.local/share/crush/crush.json:

{ "providers": { "grok": { "api_key": "your-grok-api-key" }, "anthropic": { "api_key": "your-anthropic-api-key" } } }

Roadmap

βœ… Complete (v0.1.0)

  • 4 execution strategies
  • MCP server implementation
  • Comprehensive test suite
  • Quality evaluation system
  • TypeScript build system

πŸ”„ In Progress

  • Claude Code integration testing
  • Real-world usage validation

πŸ“‹ Planned

  • Session Management (CET-266) - Stateful multi-turn conversations
  • Explicit Multi-Model (CET-265) - User-defined model workflows
  • Performance Optimization (CET-271) - Caching and response time
  • Enhanced Documentation (CET-269) - API reference and examples

See Linear Project for details.


Contributing

Development Workflow

  1. Create branch: git checkout -b feature/your-feature
  2. Write tests: Add to tests/strategies.test.ts
  3. Implement: Add code to src/
  4. Test: npm test (must pass)
  5. Build: npm run build
  6. Update docs: Update PROGRESS.md
  7. Commit: git commit -m "feat: description"

Code Style

  • TypeScript strict mode
  • ES2022 target
  • Node16 modules
  • Comprehensive JSDoc comments
  • TDD approach (tests first)

License

MIT


Links

  • Linear Project: https://linear.app/ceti-luxor/project/crush-mcp-server-fabcd9722fbc
  • Crush CLI: https://github.com/charmbracelet/crush
  • MCP Specification: https://modelcontextprotocol.io

Status: βœ… Production ready for testing | πŸ§ͺ Integration testing in progress

Next: Restart Claude Code and try it! See QUICKSTART.md

5-Dim Analysis
Clarity8/10
Novelty7/10
Utility9/10
Completeness8/10
Maintainability9/10
Pros & Cons

Pros

  • Supports multiple execution strategies
  • Well-tested with a TDD approach
  • Flexible configuration for various needs
  • Integrates easily with Claude Code

Cons

  • Requires configuration of API keys
  • Dependency on Claude Code for operation
  • May require additional documentation for new users
  • Limited to the strategies defined in the code

Related Skills

ralph-orchestrator

A
toolCo-Pilot
80/ 100

β€œA hat trick for AI orchestration, but don’t expect it to wear all the hats well.”

pytorch

S
toolCode Lib
92/ 100

β€œIt's the Swiss Army knife of deep learning, but good luck figuring out which of the 47 installation methods is the one that won't break your system.”

agno

S
toolCode Lib
90/ 100

β€œIt promises to be the Kubernetes for agents, but let's see if developers have the patience to learn yet another orchestration layer.”

Disclaimer: This content is sourced from GitHub open source projects for display and rating purposes only.

Copyright belongs to the original author manutej.