๐Ÿ’ก Inspiration

Every day, urban commuters face the same friction: switching between multiple applicationsโ€”Google Maps for traffic, Uber and Ola for cab prices, Rapido for bike taxis, and local transit apps for metro timings. When running against a tight deadline, there is no single intelligent interface that answers: "What is the fastest and cheapest way to get there without missing my deadline?"

With the arrival of Alexa+ and the Model Context Protocol (MCP), voice assistants can move beyond simple web lookups to real-time agentic reasoning. We built SmartCommute to turn Alexa+ into an autonomous, deadline-aware multimodal transit optimizer.


๐Ÿš€ What It Does

SmartCommute exposes a live MCP tool called find_best_commute over Streamable HTTP. When a user asks:

"Alexa, I need to reach Z Square Mall from IIT Kanpur in 35 minutes. What is my fastest and cheapest option?"

The system executes a real-time 4-step pipeline:

  1. Live GPS Geocoding: Translates natural-language place names into precise latitude and longitude via the OpenStreetMap Nominatim API.
  2. Real Road Routing: Queries the OSRM (Open Source Routing Machine) API to determine real-world driving distance in kilometers and live travel duration.
  3. Multimodal Calculation Engine: Dynamically computes travel times and fares across four distinct transit modes:
    • ๐Ÿ›ต Bike Taxi (Rapido): Weaves through urban congestion for rapid transit.
    • ๐Ÿš‡ Metro Rail: High-speed corridor travel with station walking buffers.
    • ๐Ÿš• AC Cab (Uber / Ola): Full road-network travel with dynamic traffic multipliers.
    • ๐ŸšŒ City AC Bus: Economical public transit factoring in scheduled stop delays.
  4. Deadline-Aware Filtering: Evaluates each mode against the user's explicit deadline, rejecting routes that would arrive late, and returns both structured JSON for smart display cards and natural voice responses for Alexa+.

๐Ÿ› ๏ธ How We Built It

  • MCP Server Architecture (server.py): Built from scratch using Python's native ThreadingHTTPServer to implement the official Model Context Protocol (MCP Spec 2025-11-25+) over Streamable HTTP on port 8000.
  • Handshake & Spec Compliance: Full JSON-RPC 2.0 handling supporting initialize (capabilities negotiation), tools/list (schema discovery), and tools/call (tool execution).
  • Zero Heavy Dependencies: Engineered entirely with Python standard libraries (http.server, urllib.request, json) to eliminate cross-platform C++ compilation issues.
  • Interactive Smart Display Simulator (index.html): An Alexa+ web simulator utilizing the browser's native Web Speech API (speechSynthesis) to speak responses aloud while dynamically rendering UI cards.
  • IDE AI Client Integration (mcp.json): Configured for direct discovery and execution within developer environments like VS Code Copilot.

๐Ÿง— Challenges We Faced

  1. Concurrency & Blocking Connections: Standard single-threaded HTTP servers would block or hang when persistent AI agent clients held connections open. We resolved this by refactoring the backend with ThreadingHTTPServer and setting explicit connection-close headers.
  2. Strict MCP Schema Compliance: Ensuring the JSON-RPC response strictly satisfied MCP client schema validation while simultaneously delivering rich payload data to visual web clients required refining the response structures into compliant content blocks.
  3. Live Geocoding & Route Accuracy: Avoiding hardcoded mock datasets meant integrating live OpenStreetMap Nominatim and OSRM APIs with robust timeouts and fallback coordinate handling.

๐Ÿ† Accomplishments That We're Proud Of

  • Building a spec-compliant Model Context Protocol server from the ground up over Streamable HTTP without external runtime wrappers.
  • Integrating real-time GIS and routing APIs for genuine live road distance calculations.
  • Verifying end-to-end tool execution through both an IDE AI Agent (VS Code Copilot) and a responsive, voice-enabled visual smart display simulator.

๐Ÿ“š What We Learned

  • Deepened our understanding of JSON-RPC 2.0 and agentic tool discovery protocols under the Model Context Protocol (MCP) standard.
  • Gained hands-on experience handling multi-threaded network sockets and HTTP header lifecycles in Python.
  • Learned how to bridge backend agent capabilities with multimodal user interfaces combining speech synthesis and visual feedback.

๐Ÿ”ฎ What's Next for SmartCommute

  • Integrating direct deep-links into Uber, Ola, and Rapido apps to allow one-click ride bookings directly from the Alexa+ interface.
  • Incorporating live weather alerts (e.g., sudden rain delays adjusting bike taxi viability).
  • Adding electric vehicle (EV) charging availability along selected road transit corridors.

Built With

Share this project:

Updates