include dockerfile / docker-compose for startup
This commit is contained in:
296
README.md
296
README.md
@@ -4,7 +4,19 @@ A **Model Context Protocol (MCP) server** that enables multiple AI agents to coo
|
||||
|
||||
## 🎯 What is Agent Coordinator?
|
||||
|
||||
Agent Coordinator is an MCP server that solves the problem of multiple AI agents stepping on each other's toes when working on the same codebase. Instead of agents conflicting over files or duplicating work, they can register with the coordinator, receive tasks, and collaborate intelligently.
|
||||
Agent Coordinator is a **unified MCP proxy server** that enables multiple AI agents to collaborate seamlessly without conflicts. As shown in the architecture diagram above, it acts as a single interface connecting multiple agents (Purple Zebra, Yellow Elephant, etc.) to a comprehensive ecosystem of tools and task management.
|
||||
|
||||
**The coordinator orchestrates three core components:**
|
||||
- **Task Registry**: Intelligent task queuing, agent matching, and automatic progress tracking
|
||||
- **Agent Manager**: Agent registration, heartbeat monitoring, and capability-based assignment
|
||||
- **Codebase Registry**: Cross-repository coordination, dependency management, and workspace organization
|
||||
|
||||
**Plus a Unified Tool Registry** that seamlessly combines:
|
||||
- Native coordination tools (register_agent, get_next_task, etc.)
|
||||
- Proxied MCP tools from external servers (read_file, search_memory, etc.)
|
||||
- VS Code integration tools (get_active_editor, run_command, etc.)
|
||||
|
||||
Instead of agents conflicting over files or duplicating work, they connect through a single MCP interface that automatically routes tool calls, tracks all operations as coordinated tasks, and maintains real-time communication via personal agent inboxes and shared task boards.
|
||||
|
||||
**Key Features:**
|
||||
|
||||
@@ -42,28 +54,29 @@ Agent Coordinator is an MCP server that solves the problem of multiple AI agents
|
||||
│ ┌─────────────────────────────────────────────────────────────┐ │
|
||||
│ │ UNIFIED TOOL REGISTRY │ │
|
||||
│ ├─────────────────────────────────────────────────────────────┤ │
|
||||
│ │ Native Tools: register_agent, get_next_task, │ │
|
||||
│ │ create_task_set, complete_task, ... │ │
|
||||
│ │ Proxied MCP Tools: read_file, write_file, │ │
|
||||
│ │ search_memory, get_docs, ... │ │
|
||||
│ │ VS Code Tools: get_active_editor, set_selection, │ │
|
||||
│ │ get_workspace_folders, run_command, ... │ │
|
||||
│ ├─────────────────────────────────────────────────────────────┤ │
|
||||
│ │ Routes to appropriate server or handles natively │ │
|
||||
│ │ Configure MCP Servers to run via MCP_TOOLS_FILE │ │
|
||||
│ └─────────────────────────────────────────────────────────────┘ │
|
||||
└─────────────────────────────────┬────────────────────────────────┘
|
||||
│
|
||||
│
|
||||
│
|
||||
┌─────────────────────────────────┴─────────────────────────────────────┐
|
||||
│ EXTERNAL MCP SERVERS │
|
||||
└──────────────┬─────────┬─────────┬─────────┬─────────┬─────────┬──────┤
|
||||
│ │ │ │ │ │ │ │
|
||||
┌────┴───┐ │ ┌────┴───┐ │ ┌────┴───┐ │ ┌────┴───┐ │
|
||||
│ MCP 1 │ │ │ MCP 2 │ │ │ MCP 3 │ │ │ MCP 4 │ │
|
||||
├────────┤ │ ├────────┤ │ ├────────┤ │ ├────────┤ │
|
||||
│• tool 1│ │ │• tool 1│ │ │• tool 1│ │ │• tool 1│ │
|
||||
│ │ Native Tools: register_agent, get_next_task, │ ╞═══════════════════════════════════╕
|
||||
│ │ create_task_set, complete_task, ... │ │ │
|
||||
│ │ Proxied MCP Tools: read_file, write_file, │ │ ┍━━━━━━━━━━━┷━━━━━━━━━━━┑
|
||||
│ │ search_memory, get_docs, ... │ │ │ Task Board │
|
||||
│ │ VS Code Tools: get_active_editor, set_selection, │ │ ┏━━━━━━━━━━━━━━━━━━━━┓┝━━━━━━━━━━━┳━━━━━━━━━━━┥ ┏━━━━━━━━━━━━━━━━━━━━┓
|
||||
│ │ get_workspace_folders, run_command, ... │ │ ┃ Agent 1 INBOX ┃│ Agent 1 Q ┃ Agent 2 Q │ ┃ Agent 2 INBOX ┃
|
||||
│ ├─────────────────────────────────────────────────────────────┤ │ ┣━━━━━━━━━━━━━━━━━━━━┫┝━━━━━━━━━━━╋━━━━━━━━━━━┥ ┣━━━━━━━━━━━━━━━━━━━━┫
|
||||
│ │ Routes to appropriate server or handles natively │ │ ┃ current: task 3 ┃│ ✓ Task 1 ┃ ✓ Task 1 │ ┃ current: task 2 ┃
|
||||
│ │ Configure MCP Servers to run via MCP_TOOLS_FILE │ │ ┃ [ complete task ] ┣┥ ✓ Task 2 ┃ ➔ Task 2 ┝━┫ [ complete task ] ┃<─┐
|
||||
│ └─────────────────────────────────────────────────────────────┘ │ ┗━━━━━━━━━━━━━━━━━━━━┛│ ➔ Task 3 ┃ … Task 3 │ ┗━━━━━━━━━━━━━━━━━━━━┛ │
|
||||
└─────────────────────────────────┬────────────────────────────────┘ ┝━━━━━━━━━━━╋━━━━━━━━━━━┥ │
|
||||
│ │ Agent 3 Q ┃ Agent 4 Q │ ┏━━━━━━━━━━━━━━━━━━━━┓ │
|
||||
│ ┝━━━━━━━━━━━╋━━━━━━━━━━━┥ ┃ Agent 4 INBOX ┃<─┤ Personal inboxes
|
||||
│ │ ✓ Task 1 ┃ ➔ Task 1 │ ┣━━━━━━━━━━━━━━━━━━━━┫ │
|
||||
│ │ ✓ Task 2 ┃ … Task 2 │ ┃ current: task 2 ┃ │
|
||||
┌─────────────────────────────────┴─────────────────────────────────────┐ │ ✓ Task 3 ┃ … Task 3 ┝━┫ [ complete task ] ┃ │
|
||||
│ EXTERNAL MCP SERVERS │ ┕━━━━━┳━━━━━┻━━━━━━━━━━━┙ ┗━━━━━━━━━━━━━━━━━━━━┛ │
|
||||
└──────────────┬─────────┬─────────┬─────────┬─────────┬─────────┬──────┤ ┏━━━━━━━━━━┻━━━━━━━━━┓ │
|
||||
│ │ │ │ │ │ │ │ ┃ Agent 3 INBOX ┃<━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┙
|
||||
┌────┴───┐ │ ┌────┴───┐ │ ┌────┴───┐ │ ┌────┴───┐ │ ┣━━━━━━━━━━━━━━━━━━━━┫
|
||||
│ MCP 1 │ │ │ MCP 2 │ │ │ MCP 3 │ │ │ MCP 4 │ │ ┃ current: none ┃
|
||||
├────────┤ │ ├────────┤ │ ├────────┤ │ ├────────┤ │ ┃ [ view history ] ┃
|
||||
│• tool 1│ │ │• tool 1│ │ │• tool 1│ │ │• tool 1│ │ ┗━━━━━━━━━━━━━━━━━━━━┛
|
||||
│• tool 2│ │ │• tool 2│ │ │• tool 2│ │ │• tool 2│ │
|
||||
│• tool 3│┌────┴───┐│• tool 3│┌────┴───┐│• tool 3│┌────┴───┐│• tool 3│┌─┴──────┐
|
||||
└────────┘│ MCP 5 │└────────┘│ MCP 6 │└────────┘│ MCP 7 │└────────┘│ MCP 8 │
|
||||
@@ -84,6 +97,7 @@ Agent Coordinator is an MCP server that solves the problem of multiple AI agents
|
||||
6. Routes tool calls to appropriate servers
|
||||
7. Automatically tracks all operations as tasks
|
||||
8. Maintains heartbeat & coordination across agents
|
||||
|
||||
```
|
||||
|
||||
## 🔧 MCP Server Management & Unified Tool Registry
|
||||
@@ -201,14 +215,54 @@ Updates agent task → Sends heartbeat → Returns file content
|
||||
|
||||
## 🛠️ Prerequisites
|
||||
|
||||
You need these installed to run Agent Coordinator:
|
||||
Choose one of these installation methods:
|
||||
|
||||
### Option 1: Docker (Recommended - No Elixir Installation Required)
|
||||
|
||||
- **Docker**: 20.10+ and Docker Compose
|
||||
- **Node.js**: 18+ (for external MCP servers via bun)
|
||||
|
||||
### Option 2: Manual Installation
|
||||
|
||||
- **Elixir**: 1.16+ with OTP 26+
|
||||
- **Mix**: Comes with Elixir installation
|
||||
- **Node.js**: 18+ (for external MCP servers via bun)
|
||||
|
||||
## ⚡ Quick Start
|
||||
|
||||
### 1. Get the Code
|
||||
### Option A: Docker Setup (Easiest)
|
||||
|
||||
#### 1. Get the Code
|
||||
|
||||
```bash
|
||||
git clone https://github.com/your-username/agent_coordinator.git
|
||||
cd agent_coordinator
|
||||
```
|
||||
|
||||
#### 2. Run with Docker Compose
|
||||
|
||||
```bash
|
||||
# Start the full stack (MCP server + NATS + monitoring)
|
||||
docker-compose up -d
|
||||
|
||||
# Or start just the MCP server
|
||||
docker-compose up agent-coordinator
|
||||
|
||||
# Check logs
|
||||
docker-compose logs -f agent-coordinator
|
||||
```
|
||||
|
||||
#### 3. Configuration
|
||||
|
||||
Edit `mcp_servers.json` to configure external MCP servers, then restart:
|
||||
|
||||
```bash
|
||||
docker-compose restart agent-coordinator
|
||||
```
|
||||
|
||||
### Option B: Manual Setup
|
||||
|
||||
#### 1. Get the Code
|
||||
|
||||
```bash
|
||||
git clone https://github.com/your-username/agent_coordinator.git
|
||||
@@ -216,7 +270,7 @@ cd agent_coordinator
|
||||
mix deps.get
|
||||
```
|
||||
|
||||
### 2. Start the MCP Server
|
||||
#### 2. Start the MCP Server
|
||||
|
||||
```bash
|
||||
# Start the MCP server directly
|
||||
@@ -228,7 +282,31 @@ mix run --no-halt
|
||||
|
||||
### 3. Configure Your AI Tools
|
||||
|
||||
The agent coordinator is designed to work with VS Code and AI tools that support MCP. Add this to your VS Code `settings.json`:
|
||||
#### For Docker Setup
|
||||
|
||||
If using Docker, the MCP server is available at the container's stdio interface. Add this to your VS Code `settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"github.copilot.advanced": {
|
||||
"mcp": {
|
||||
"servers": {
|
||||
"agent-coordinator": {
|
||||
"command": "docker",
|
||||
"args": ["exec", "-i", "agent-coordinator", "/app/scripts/mcp_launcher.sh"],
|
||||
"env": {
|
||||
"MIX_ENV": "prod"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### For Manual Setup
|
||||
|
||||
Add this to your VS Code `settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -245,16 +323,180 @@ The agent coordinator is designed to work with VS Code and AI tools that support
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 4. Test It Works
|
||||
|
||||
#### Docker Testing
|
||||
|
||||
```bash
|
||||
# Test with Docker
|
||||
docker-compose exec agent-coordinator /app/bin/agent_coordinator ping
|
||||
|
||||
# Run example (if available in container)
|
||||
docker-compose exec agent-coordinator mix run examples/full_workflow_demo.exs
|
||||
|
||||
# View logs
|
||||
docker-compose logs -f agent-coordinator
|
||||
```
|
||||
|
||||
#### Manual Testing
|
||||
|
||||
```bash
|
||||
# Run the demo to see it in action
|
||||
mix run examples/full_workflow_demo.exs
|
||||
```
|
||||
|
||||
## 🐳 Docker Usage Guide
|
||||
|
||||
### Available Docker Commands
|
||||
|
||||
#### Basic Operations
|
||||
|
||||
```bash
|
||||
# Build the image
|
||||
docker build -t agent-coordinator .
|
||||
|
||||
# Run standalone container
|
||||
docker run -d --name agent-coordinator -p 4000:4000 agent-coordinator
|
||||
|
||||
# Run with custom config
|
||||
docker run -d \
|
||||
-v ./mcp_servers.json:/app/mcp_servers.json:ro \
|
||||
-p 4000:4000 \
|
||||
agent-coordinator
|
||||
```
|
||||
|
||||
#### Docker Compose Operations
|
||||
|
||||
```bash
|
||||
# Start full stack
|
||||
docker-compose up -d
|
||||
|
||||
# Start only agent coordinator
|
||||
docker-compose up -d agent-coordinator
|
||||
|
||||
# View logs
|
||||
docker-compose logs -f agent-coordinator
|
||||
|
||||
# Restart after config changes
|
||||
docker-compose restart agent-coordinator
|
||||
|
||||
# Stop everything
|
||||
docker-compose down
|
||||
|
||||
# Remove volumes (reset data)
|
||||
docker-compose down -v
|
||||
```
|
||||
|
||||
#### Development with Docker
|
||||
|
||||
```bash
|
||||
# Start in development mode
|
||||
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
|
||||
|
||||
# Interactive shell for debugging
|
||||
docker-compose exec agent-coordinator bash
|
||||
|
||||
# Run tests in container
|
||||
docker-compose exec agent-coordinator mix test
|
||||
|
||||
# Watch logs during development
|
||||
docker-compose logs -f
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
Configure the container using environment variables:
|
||||
|
||||
```bash
|
||||
# docker-compose.override.yml example
|
||||
version: '3.8'
|
||||
services:
|
||||
agent-coordinator:
|
||||
environment:
|
||||
- MIX_ENV=prod
|
||||
- NATS_HOST=nats
|
||||
- NATS_PORT=4222
|
||||
- LOG_LEVEL=info
|
||||
```
|
||||
|
||||
### Custom Configuration
|
||||
|
||||
#### External MCP Servers
|
||||
|
||||
Mount your own `mcp_servers.json`:
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
-v ./my-mcp-config.json:/app/mcp_servers.json:ro \
|
||||
agent-coordinator
|
||||
```
|
||||
|
||||
#### Persistent Data
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
-v agent_data:/app/data \
|
||||
-v nats_data:/data \
|
||||
agent-coordinator
|
||||
```
|
||||
|
||||
### Monitoring & Health Checks
|
||||
|
||||
#### Container Health
|
||||
|
||||
```bash
|
||||
# Check container health
|
||||
docker-compose ps
|
||||
|
||||
# Health check details
|
||||
docker inspect --format='{{json .State.Health}}' agent-coordinator
|
||||
|
||||
# Manual health check
|
||||
docker-compose exec agent-coordinator /app/bin/agent_coordinator ping
|
||||
```
|
||||
|
||||
#### NATS Monitoring
|
||||
|
||||
Access NATS monitoring dashboard:
|
||||
```bash
|
||||
# Start with monitoring profile
|
||||
docker-compose --profile monitoring up -d
|
||||
|
||||
# Access dashboard at http://localhost:8080
|
||||
open http://localhost:8080
|
||||
```
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
#### Common Issues
|
||||
|
||||
```bash
|
||||
# Check container logs
|
||||
docker-compose logs agent-coordinator
|
||||
|
||||
# Check NATS connectivity
|
||||
docker-compose exec agent-coordinator nc -z nats 4222
|
||||
|
||||
# Restart stuck container
|
||||
docker-compose restart agent-coordinator
|
||||
|
||||
# Reset everything
|
||||
docker-compose down -v && docker-compose up -d
|
||||
```
|
||||
|
||||
#### Performance Tuning
|
||||
|
||||
```bash
|
||||
# Allocate more memory
|
||||
docker-compose up -d --scale agent-coordinator=1 \
|
||||
--memory=1g --cpus="2.0"
|
||||
```
|
||||
|
||||
## 🎮 How to Use
|
||||
|
||||
Once your AI agents are connected via MCP, they can:
|
||||
|
||||
Reference in New Issue
Block a user