๐ก 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:
- Live GPS Geocoding: Translates natural-language place names into precise latitude and longitude via the OpenStreetMap Nominatim API.
- Real Road Routing: Queries the OSRM (Open Source Routing Machine) API to determine real-world driving distance in kilometers and live travel duration.
- 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.
- 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 nativeThreadingHTTPServerto 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), andtools/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
- 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
ThreadingHTTPServerand setting explicit connection-close headers. - 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.
- 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
- alexa
- html5
- javascript
- json-rpc
- model-context-protocol
- openstreetmap-api
- osrm-api
- python
- web-speech-api
Log in or sign up for Devpost to join the conversation.