""" FleetMind MCP Server - Hugging Face Space Entry Point (Track 1) This file serves as the entry point for HuggingFace Space deployment. Exposes 18 MCP tools via Server-Sent Events (SSE) endpoint for AI clients. Architecture: User → MCP Client (Claude Desktop, Continue, etc.) → SSE Endpoint (this file) → FleetMind MCP Server (server.py) → Tools (chat/tools.py) → Database (PostgreSQL) For Track 1: Building MCP Servers - Enterprise Category https://huggingface.co/MCP-1st-Birthday Compatible with: - Claude Desktop (via SSE transport) - Continue.dev (VS Code extension) - Cline (VS Code extension) - Any MCP client supporting SSE protocol """ import os import sys import logging from pathlib import Path # Add project root to path sys.path.insert(0, str(Path(__file__).parent)) # Configure logging for HuggingFace Space logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', handlers=[logging.StreamHandler()] ) logger = logging.getLogger(__name__) # Import the MCP server instance from server import mcp from fastapi import FastAPI from fastapi.responses import HTMLResponse import uvicorn # ============================================================================ # HUGGING FACE SPACE CONFIGURATION # ============================================================================ # HuggingFace Space default port HF_SPACE_PORT = int(os.getenv("PORT", 7860)) HF_SPACE_HOST = os.getenv("HOST", "0.0.0.0") # Create FastAPI app with root endpoint app = FastAPI(title="FleetMind MCP Server") @app.get("/", response_class=HTMLResponse) async def root(): """Root endpoint with usage instructions""" return """
✅ Server Status: RUNNING
https://huggingface.co/spaces/MCP-1st-Birthday/fleetmind-dispatch-ai/sse
Add this to your claude_desktop_config.json:
{
"mcpServers": {
"fleetmind": {
"command": "npx",
"args": [
"mcp-remote",
"https://huggingface.co/spaces/MCP-1st-Birthday/fleetmind-dispatch-ai/sse"
]
}
}
}
geocode_address - Convert addresses to GPS coordinatescalculate_route - Find shortest route between locationscreate_order - Create new delivery orderscount_orders - Count orders with filtersfetch_orders - Retrieve orders with paginationget_order_details - Get complete order informationsearch_orders - Search by customer/IDget_incomplete_orders - List active deliveriesupdate_order - Update order detailsdelete_order - Remove orderscreate_driver - Onboard new driverscount_drivers - Count drivers with filtersfetch_drivers - Retrieve drivers with paginationget_driver_details - Get driver info + locationsearch_drivers - Search by name/plate/IDget_available_drivers - List available driversupdate_driver - Update driver informationdelete_driver - Remove driversorders://all - Live orders dataset (last 30 days)drivers://all - Live drivers dataset with locationsAfter connecting via Claude Desktop, try: