Build MCP on HuggingFace: Traffic Pattern Analyzer

Introducing the Model Context Protocol (MCP) through building a simple traffic pattern analyzer running on HuggingFace Spaces. This is a Gradio app which also serves as an MCP. The traffic data comes from Google Maps API.


What is MCP?

The Model Context Protocol (MCP) is an open-source standardized protocol that enables LLMs to integrate and share data with external sources (Wikipedia). Introduced by Anthropic in November 2024, MCP allows users to build custom servers that connect and communicate directly with LLMs. For Claude, Anthropic’s language model, Claude Code and Claude Desktop provide the MCP support.


App: Simple Traffic Pattern Analyzer

In the Bay Area, CA, traffic during rush hour is notoriously bad, in particular, crossing the bridges getting in to SF, such as Bay Bridge. While Google Maps provides estimated driving times, I felt manually adjusting departure times to find the best time windows were tedious, and not easy to see the entire trend. Thus, this application streamlines that process by querying Google Maps API based on user input instead.

The application is running on live on HuggingFace Spaces using the Gradio framework, and can be also accessed directly below. Please note that initial loading may take a moment. Building upon on Gradio’s MCP support, the app can serve as an MCP as well, demonstrated in the video section below using Claude Desktop.

Try several different origin, destination, date, etc, and visualize the result!


MCP: Same App on Claude Desktop

The following video demonstrates the above app integrated with Claude Desktop via MCP. Integrated with LLMs, now we can get much more fine-grained and customized analysis about the traffic data we obtained from API querying.