π‘ Summary
Crush MCP Server orchestrates multiple AI models via a context protocol, optimizing for speed, cost, and quality.
π― Target Audience
π€ AI Roast: βPowerful, but the setup might scare off the impatient.β
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.
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 routingcrush_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
- QUICKSTART.md - Get started in 5 minutes β‘
- TESTING.md - Full testing guide with troubleshooting
- PROGRESS.md - Development history and roadmap
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
- Write tests first (TDD approach)
- Implement strategy
- Run tests (
npm test) - Build (
npm run build) - 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
- Create branch:
git checkout -b feature/your-feature - Write tests: Add to
tests/strategies.test.ts - Implement: Add code to
src/ - Test:
npm test(must pass) - Build:
npm run build - Update docs: Update PROGRESS.md
- 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
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βA hat trick for AI orchestration, but donβt expect it to wear all the hats well.β
pytorch
Sβ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β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.
