Spaces:
Sleeping
title: Delegation MCP
emoji: ๐
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
license: mit
short_description: Intelligent Multi-Agent Routing & Guidance
tags:
- mcp-server
- building-mcp-track-enterprise
- multi-agent
- agent-orchestration
๐ Delegation MCP Server
Intelligent Multi-Agent Routing & Guidance
Built for the MCP 1st Birthday Hackathon - Winter 2025
โก Quick Start
# One command to install and configure everything
python install.py
That's it! Restart Claude Code and start delegating:
"scan this codebase for security vulnerabilities"
โ MCP suggests: "Delegate to Gemini"
โ Claude executes: gemini scan .
"design an authentication architecture"
โ MCP suggests: "Handle directly (Claude is best)"
โ Claude executes: (Internal reasoning)
"refactor the delegation engine"
โ MCP suggests: "Delegate to Aider"
โ Claude executes: aider --message "refactor delegation engine"
Features:
- โ One-command installation - 30 seconds to full setup
- โ Intelligent Routing - Rules + Capabilities analysis
- โ Privacy-First - Your code never passes through this server
- โ Lightweight - Minimal footprint, no heavy databases
- โ Cross-platform - Windows, Mac, Linux
๐ฎ Try the Interactive Demo
Experience the routing intelligence in action! Our HF Space demo lets you:
Interactive Features:
- ๐งช Test Any Query - See routing decisions in real-time
- ๐ Routing Transparency - View the complete decision-making process:
- Task classification (security, architecture, refactoring, etc.)
- Complexity assessment (simple/medium/complex)
- Detected keywords and routing reasoning
- CLI command that would be executed
- โ๏ธ Live Configuration - Toggle agents and routing strategies to see how settings affect decisions
- ๐ก Example Queries - Simple and complex multi-step scenarios
Try This:
- Visit the HF Space
- Enter: "Audit the authentication system for SQL injection, XSS, and CSRF vulnerabilities"
- Watch it route to Gemini with full reasoning
- Disable Gemini in settings โ See it route to Claude instead!
Want to test with real agents? Duplicate the Space and add your API keys!
๐ What Is This?
A lightweight MCP server that acts as a routing intelligence layer for AI coding agents. Instead of executing tasks itself (which creates a bottleneck and security risk), it analyzes your request and guides your main agent (like Claude Code) on which tool to use.
Key Insight: This follows the Routing Guidance pattern:
- Analyze: The server analyzes the prompt (e.g., "audit security").
- Route: It determines the best agent based on your presets and rules.
- Guide: It returns the exact command to run.
- Execute: The client (Claude) executes the command directly.
This ensures zero lock-in, maximum privacy, and native performance.
๐ฏ The Core Value Proposition
Problem
Developers manually switch between AI agents, losing context and productivity:
- Claude for architecture
- Gemini for security analysis
- Aider for git operations
- Copilot for GitHub integration
Solution
One MCP server that tells your agent who to call:
You โ Claude Code โ Delegation MCP โ "Use Gemini for this" โ Claude calls Gemini
You work with ONE agent, but get the power of ALL agents.
๐ฆ Installation
Prerequisites
- Python 3.10+
- At least one AI agent CLI installed:
- Gemini CLI:
npm install -g @google/gemini-cli - Aider:
pip install aider-chat - Claude Code:
npm install -g @anthropic-ai/claude-code - GitHub Copilot:
npm install -g github/copilot
- Gemini CLI:
Automated Installation (Recommended)
# Clone repository
git clone https://github.com/carlosduplar/multi-agent-mcp.git
cd multi-agent-mcp
# One-command install
python install.py
# Or on Unix/Mac
bash install.sh
The installer will:
- Check system requirements
- Discover installed agents
- Configure Claude Code automatically
- Verify everything works
Restart Claude Code and you're ready!
๐ฏ How It Works
Intelligent Routing Guidance
We use a hybrid approach to determine the best agent for the job:
- Rule-Based Presets: Your configured rules take priority (e.g., "Always use Gemini for security").
- Capability Analysis: If no rule matches, we analyze agent capabilities to find the best fit.
Query: "scan for vulnerabilities"
- Check Rules: Matches
security_auditpreset? -> Gemini - Guide: Return guidance to use Gemini
Example Interaction
User: "Audit my authentication code for SQL injection"
Claude Code calls get_routing_guidance:
{
"query": "Audit auth.py for SQL injection"
}
MCP Server responds:
{
"decision": "DELEGATE_TO: gemini",
"agent": "gemini",
"task_type": "security_audit",
"cli_command": "gemini \"Audit auth.py for SQL injection\""
}
Claude Code then executes:
gemini "Audit auth.py for SQL injection"
๐ง MCP Tools
get_routing_guidance
Get routing guidance for a task. Returns which agent should handle it and the exact CLI command to run.
{
"query": "Audit auth.py for SQL injection"
}
discover_agents
Automatically discover available CLI agents on the system and register them.
{
"force_refresh": false # Optional: force re-discovery
}
list_agents
List all registered agents and their availability status.
โก Token Overhead
One of the key advantages of this MCP server is its minimal context footprint. Here's the actual token usage:
MCP Tools:
โโ get_routing_guidance: 601 tokens
โโ discover_agents: 584 tokens
โโ list_agents: 554 tokens
โโโโโโโโโ
Total MCP overhead: 1,739 tokens (0.9% of 200k context)
What this means:
- โ Less than 1% of your context budget
- โ Leaves 99%+ for actual code and conversation
- โ No heavy prompts or bloated instructions
- โ Intelligent routing without sacrificing context
Compare this to running multiple agent instances or complex orchestration frameworks that can consume 10-20% of your context just for coordination overhead.
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Claude Code (or other MCP client) โ
โ - User chats here โ
โ - Calls get_routing_guidance โ
โ - EXECUTES the returned command โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Protocol (stdio)
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Delegation MCP Server โ
โ - Analyzes task complexity & type โ
โ - Checks rules & capabilities โ
โ - Returns guidance (NO EXECUTION) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
v0.4.0 - Lightweight Architecture
Privacy & Security:
- No Code Execution: The server never executes code or commands. It only suggests them.
- No Data Persistence: No databases or logs of your code are kept by the server.
- Direct Connection: Your agent talks directly to the delegated tool (e.g., Claude -> Gemini).
Agent Auto-Discovery:
- Automatically detects installed CLI agents (Claude, Gemini, Aider, etc.)
- Verifies agent availability
- Graceful error handling
๐๏ธ Project Structure
multi-agent-mcp/
โโโ src/delegation_mcp/
โ โโโ server.py # MCP server (Routing Guidance) โญ
โ โโโ delegation.py # Routing logic & scoring
โ โโโ orchestrator.py # Agent registry
โ โโโ agent_discovery.py # System scanner for agents
โ โโโ tool_discovery.py # Tool definitions
โ โโโ config.py # Configuration handling
โ โโโ cli.py # CLI tools
โ โโโ adapters/ # Agent definitions
โ โโโ claude.py
โ โโโ gemini.py
โ โโโ copilot.py
โ โโโ aider.py
โโโ tools/ # Tool definitions (JSON)
โโโ tests/ # Comprehensive tests
โโโ config/ # Default delegation rules
๐ Roadmap
โ Phase 1: Foundation (COMPLETE)
- MCP server with routing guidance
- Capability-based routing
- Agent auto-discovery
- Production-grade architecture
๐ Phase 2: Intelligence (Q1 2026)
- ML-powered routing
- Learning from user feedback
- Custom agent definitions
๐ฎ Phase 3: Collaboration (Q2 2026)
- Complex multi-step workflows
- Parallel agent execution guidance
๐ค Contributing
We welcome contributions! Add new agent adapters, improve routing logic, or enhance documentation.
๐ License
MIT License - see LICENSE
๐ฏ The Vision
"You work with ONE agent, but get the power of ALL agents."
Today's AI landscape has amazing specialists, but they work in silos. Delegation MCP changes that. It's the intelligence layer that lets agents collaborate, creating something greater than the sum of its parts.
Built with โค๏ธ for the MCP ecosystem