File size: 5,531 Bytes
d69447e 6b34b01 d69447e 0e59aa0 d69447e 6b34b01 d69447e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
---
title: FleetMind AI Dispatch Coordinator
emoji: π
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.9.0
app_file: app.py
pinned: false
tags:
- mcp
- mcp-in-action-track-01
- model-context-protocol
- multi-agent
- autonomous-ai
- gemini-2.0-flash
- delivery-management
- postgresql
---
# FleetMind MCP - Autonomous Dispatch Coordinator
**π MCP 1st Birthday Hackathon Submission - Track: MCP in Action**
An autonomous AI coordinator that handles delivery exceptions using multi-agent orchestration powered by Google Gemini 2.0 Flash and the Model Context Protocol (MCP).
**π Links:**
- **GitHub Repository:** https://github.com/mashrur-rahman-fahim/fleetmind-mcp
- **Hugging Face Space:** https://huggingface.co/spaces/MCP-1st-Birthday/fleetmind-dispatch-ai
- **Auto-Sync:** Every push to GitHub automatically updates HF Space via GitHub Actions β¨
---
## π₯ Team
**Team Name:** [Your Team Name]
**Team Members:**
- **[Your Name]** - [@your-hf-username](https://huggingface.co/your-hf-username) - Lead Developer & Repository Manager
- **[Partner 2 Name]** - [@partner2-username](https://huggingface.co/partner2-username) - [Role - e.g., Backend Developer, Testing]
**Collaboration:** Team collaborates via GitHub repository (https://github.com/mashrur-rahman-fahim/fleetmind-mcp) with automatic sync to HF Space via GitHub Actions.
*(Note: Replace placeholders with actual team member information. All members must have Hugging Face accounts and be listed here for valid hackathon submission.)*
---
## π Quick Start
### 1. Install PostgreSQL
**Windows:**
- Download from https://www.postgresql.org/download/windows/
- Install with default settings
- Remember your postgres password
**macOS:**
```bash
brew install postgresql
brew services start postgresql
```
**Linux:**
```bash
sudo apt-get install postgresql postgresql-contrib
sudo systemctl start postgresql
```
### 2. Create Database
```bash
# Login to PostgreSQL
psql -U postgres
# Create the database
CREATE DATABASE fleetmind;
# Exit
\q
```
### 3. Set Up Environment
```bash
# Install Python dependencies
pip install -r requirements.txt
# Copy environment template
cp .env.example .env
# Edit .env with your database credentials
# DB_HOST=localhost
# DB_PORT=5432
# DB_NAME=fleetmind
# DB_USER=postgres
# DB_PASSWORD=your_password_here
```
### 4. Initialize Database Schema
```bash
# Run database initialization script
python scripts/init_db.py
```
This will create all necessary tables in the PostgreSQL database.
### 3. Run Application
```bash
# Start the Gradio UI (coming soon)
python ui/app.py
```
## π Project Structure
```
fleetmind-mcp/
βββ database/ # Database connection and schema
β βββ __init__.py
β βββ connection.py # Database connection utilities
β βββ schema.py # Database schema definitions
βββ data/ # Database and data files
β βββ fleetmind.db # SQLite database (auto-generated)
βββ mcp_server/ # MCP server implementation
βββ agents/ # Multi-agent system
βββ workflows/ # Orchestration workflows
βββ ui/ # Gradio interface
βββ tests/ # Test suite
βββ scripts/ # Utility scripts
β βββ init_db.py # Database initialization
βββ requirements.txt # Python dependencies
βββ .env.example # Environment variables template
βββ README.md # This file
```
## π Database Schema (PostgreSQL)
The system uses PostgreSQL with the following tables:
### Orders Table
The `orders` table stores all delivery order information:
| Column | Type | Description |
|--------|------|-------------|
| order_id | VARCHAR(50) | Primary key |
| customer_name | VARCHAR(255) | Customer name |
| customer_phone | VARCHAR(20) | Contact phone |
| customer_email | VARCHAR(255) | Contact email |
| delivery_address | TEXT | Delivery address |
| delivery_lat/lng | DECIMAL(10,8) | GPS coordinates |
| time_window_start/end | TIMESTAMP | Delivery time window |
| priority | VARCHAR(20) | standard/express/urgent |
| weight_kg | DECIMAL(10,2) | Package weight |
| status | VARCHAR(20) | pending/assigned/in_transit/delivered/failed/cancelled |
| assigned_driver_id | VARCHAR(50) | Assigned driver |
| created_at | TIMESTAMP | Creation timestamp |
| updated_at | TIMESTAMP | Auto-updated timestamp |
### Additional Tables
- **drivers** - Driver information and status
- **assignments** - Order-driver assignments with routing
- **exceptions** - Exception tracking and resolution
- **agent_decisions** - AI agent decision logging
- **metrics** - Performance metrics and analytics
## π§ Development
### Database Operations
```python
from database.connection import get_db_connection, execute_query, execute_write
# Get all pending orders (note: PostgreSQL uses %s for parameters)
orders = execute_query("SELECT * FROM orders WHERE status = %s", ("pending",))
# Create new order
order_id = execute_write(
"INSERT INTO orders (order_id, customer_name, delivery_address, status) VALUES (%s, %s, %s, %s)",
("ORD-001", "John Doe", "123 Main St", "pending")
)
# Test connection
from database.connection import test_connection
if test_connection():
print("Database connected successfully!")
```
## π License
MIT License
## π€ Contributing
Contributions welcome! Please read the contributing guidelines first.
|