A comprehensive Model Context Protocol (MCP) server implementation for Dispatch's order creation and estimate APIs, developed during the Fall 2025 Buildathon. This project combines conversational AI capabilities with Dispatch's logistics platform to create an intelligent interface for order management and pricing optimization.
This repository contains both the implementation (MCP server) and planning documentation from the Fall 2025 Buildathon project. The goal was to create a conversational AI interface for Dispatch orders and pricing estimates using the Model Context Protocol framework.
- π€ Claude AI Integration: Natural language pricing conversations powered by Anthropic's Claude via AI Hub
- π¬ Conversational Pricing Advisor: Interactive chat interface for pricing recommendations
- π Web Chat Interface: Modern web-based chat interface with real-time order tracking
- π¦ Order Management: Create estimates and orders through conversational interface
- π° Advanced Pricing Models: Compare different pricing strategies (multi-delivery, volume discounts, loyalty programs)
- π Real-time Progress Tracking: Visual order creation progress and pricing recommendations
- β Input Validation: Comprehensive validation for all user inputs with detailed error messages
- π IDP Authentication: Support for Identity Provider token management with auto-refresh
- π‘οΈ Production Ready: Secure authentication with OAuth 2.0 and comprehensive error handling
dispatch-mcp-buildathon/
βββ docs/ # All documentation
β βββ README.md # Main documentation
β βββ API_REFERENCE.md # API documentation
β βββ PRICING_GUIDE.md # Pricing guide
β βββ QUICK_START.md # Quick start guide
β βββ TESTING_GUIDE.md # Testing documentation
β βββ TROUBLESHOOTING.md # Troubleshooting guide
β βββ AI_HUB_INTEGRATION.md # AI Hub integration
β βββ buildathon-planning/ # Buildathon planning documents
βββ scripts/ # Shell scripts
β βββ build.sh # Build script
β βββ demo.sh # Demo script
β βββ demo-cli.sh # CLI demo
β βββ chat_with_ai_hub.sh # AI Hub chat script
β βββ test_*.sh # Test scripts
βββ cmd/ # Application entry points
β βββ cli/main.go # Command-line interface
β βββ server/main.go # MCP server
β βββ web/main.go # Web chat server
βββ internal/ # Core application logic
β βββ auth/ # Authentication handling
β βββ claude/ # Claude AI integration
β βββ config/ # Configuration management
β βββ conversation/ # Conversational AI engine
β βββ dispatch/ # Dispatch API client
β βββ mcp/ # MCP server implementation
β βββ pricing/ # Pricing model engine
β βββ validation/ # Input validation
βββ static/ # Web interface assets
β βββ index.html # Web chat interface
βββ test/ # Test suites
βββ samples/ # Sample data files
βββ bin/ # Built binaries
β βββ dispatch-cli # CLI tool
β βββ dispatch-mcp-server # MCP server
β βββ dispatch-web # Web server
βββ [configuration files] # go.mod, Makefile, etc.
This project was developed over 3 buildathon days:
- Day 1 (Oct 3, 2025): Foundation and Setup
- Day 2 (Oct 10, 2025): Integration and Testing
- Day 3 (Oct 17, 2025): Polish and Demo
See docs/buildathon-planning/ for detailed planning documents and timeline.
- Go 1.23 or later
- Dispatch API credentials
- (Optional) Anthropic API key for Claude AI features
-
Clone the repository:
git clone <repository-url> cd dispatch-mcp-buildathon
-
Install dependencies:
go mod tidy
-
Configure authentication (choose one method):
Option 1: IDP Authentication (Recommended)
export USE_IDP_AUTH=true export IDP_ENDPOINT=https://id.dispatchfog.io export IDP_CLIENT_ID=your_client_id export IDP_CLIENT_SECRET=your_client_secret export IDP_SCOPE=dispatch:api export IDP_TOKEN_ENDPOINT=https://id.dispatchfog.io/oauth/token export DISPATCH_ORGANIZATION_ID=your_org_id_here
Option 2: Static Token (Development)
export USE_IDP_AUTH=false export DISPATCH_AUTH_TOKEN=your_static_token_here export DISPATCH_ORGANIZATION_ID=your_org_id_here
-
Configure Claude AI via AI Hub (Recommended):
export USE_AI_HUB=true export AI_HUB_ENDPOINT=https://aihub.dispatchit.com/v1 export ANTHROPIC_API_KEY=your_ai_hub_api_key_here export AI_HUB_MODEL=claude-sonnet # or claude-haiku for faster responses
Alternative: Direct Claude API:
export USE_AI_HUB=false export ANTHROPIC_API_KEY=your_anthropic_api_key_here export USE_CLAUDE_AI=true
-
Build the server:
chmod +x scripts/build.sh ./scripts/build.sh
-
Run the server:
./bin/dispatch-mcp-server
The project includes a modern web-based chat interface:
# Start the web server
PORT=8081 ./bin/dispatch-web
# Open in browser
open http://localhost:8081Features:
- π¬ Real-time chat with AI assistant
- π Live order creation progress tracking
- π° Real-time pricing recommendations
- π± Mobile-responsive design
- π€ Animated thinking indicators
The project includes a comprehensive CLI for testing and interaction:
# Check connection status
./bin/dispatch-cli status
# Set subenvironment (monkey, staging, prod)
./bin/dispatch-cli subenv
# Authenticate with Dispatch API
./bin/dispatch-cli login
# Create cost estimate
./bin/dispatch-cli estimate
# Create delivery order
./bin/dispatch-cli order
# Compare pricing models
./bin/dispatch-cli pricing
# Interactive mode
./bin/dispatch-cli interactiveThe server provides several MCP tools for AI agent integration:
Note: The vehicle_type parameter is required. Always ask the user what type of vehicle they need before calling this tool.
{
"tool": "create_estimate",
"arguments": {
"pickup_info": "{\"business_name\":\"Test Business\",\"location\":{\"address\":{\"street\":\"123 Main St\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip_code\":\"94105\",\"country\":\"US\"}}}",
"drop_offs": "[{\"business_name\":\"Drop Off Business\",\"location\":{\"address\":{\"street\":\"456 Oak Ave\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip_code\":\"94110\",\"country\":\"US\"}}}]",
"vehicle_type": "cargo_van"
}
}Available Vehicle Types:
pickup_truck- Small to medium items, quick deliveriescargo_van- Medium to large packages, furnituresprinter_van- Large items, multiple packagesbox_truck- Very large items, bulk deliveries
{
"tool": "create_order",
"arguments": {
"delivery_info": "{\"service_type\":\"delivery\"}",
"pickup_info": "{\"business_name\":\"Test Business\",\"contact_name\":\"John Doe\",\"contact_phone_number\":\"555-123-4567\"}",
"drop_offs": "[{\"business_name\":\"Drop Off Business\",\"contact_name\":\"Jane Smith\",\"contact_phone_number\":\"555-987-6543\"}]"
}
}{
"tool": "select_delivery_option",
"arguments": {
"estimate_response": "{\"data\":{\"createEstimate\":{\"estimate\":{\"availableOrderOptions\":[...]}}}}",
"delivery_scenario": "fastest" // or "cheapest"
}
}{
"tool": "compare_pricing_models",
"arguments": {
"original_estimate": "{\"serviceType\":\"delivery\",\"estimatedOrderCost\":45.99,\"vehicleType\":\"cargo_van\"}",
"delivery_count": "3",
"customer_tier": "gold",
"order_frequency": "5",
"total_order_value": "150.00",
"is_bulk_order": "false"
}
}The system supports two key delivery scenarios that align with common customer needs:
- Use: First option in the estimate response
- Characteristics: Fastest delivery time, highest cost
- Best for: Urgent deliveries, time-sensitive items
- Use: Last option in the estimate response
- Characteristics: Slowest delivery time, lowest cost
- Best for: Non-urgent deliveries, cost-conscious customers
The API returns multiple delivery options sorted by speed and cost, allowing customers to choose between speed and cost based on their specific needs.
The system includes comprehensive input validation to ensure data quality:
- Vehicle Type Validation: Ensures only valid vehicle types (pickup_truck, cargo_van, sprinter_van, box_truck)
- Delivery Scenario Validation: Validates delivery scenarios (fastest, cheapest, etc.)
- Address Validation: Validates address format and required fields
- JSON Format Validation: Ensures all JSON parameters are properly formatted
- Numeric Validation: Validates numeric parameters with range checking
- Boolean Validation: Ensures boolean parameters are properly formatted
All validation errors include detailed messages to help users correct their inputs.
The system includes advanced pricing comparison capabilities:
| Model | Description | Discount | Requirements |
|---|---|---|---|
| Standard Pricing | No discounts | 0% | None |
| Multi-Delivery Discount | Discount for multiple deliveries | 15% | 2+ deliveries |
| Volume Discount | Discount for high-volume customers | 20% | 5+ deliveries + 3+ orders/month |
| Loyalty Discount | Discount for loyal customers | 10% | Gold tier customer |
| Bulk Order Discount | Discount for large bulk orders | 25% | 10+ deliveries + bulk order flag |
Run the comprehensive test suite:
# Run all tests
go test ./test
# Run specific test categories
go test ./test -run TestClaudeIntegration
go test ./test -run TestConversation
go test ./test -run TestMCPNote: Tests require valid Dispatch credentials to run.
- Quick Start Guide: Get up and running in 5 minutes
- API Reference: Complete API documentation
- Pricing Guide: Quick reference for pricing functionality
- Testing Guide: Comprehensive testing documentation
- Troubleshooting: Common issues and solutions
- MCP Prompt Guide: Understanding MCP server prompts and AI behavior
- Buildathon Planning: Original project planning documents
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Camron: Go/MCP Development
- Julia: UI/Prompts Development
- Tyler: Domain Expertise
- Chris: Project Oversight
This project was developed during the Fall 2025 Buildathon as a proof of concept for conversational AI integration with Dispatch's logistics platform.