Building an MCP server for the BCCI website
There are enough websites and apps in the world to get live cricket scores. Some of them I’ve experienced to be even faster than the live telecast.
But that’s the case for international matches.
Domestic matches (I talk about Indian domestic cricket specifically in the course of this post) usually get only irregular “updates” on the aforementioned websites. But there is one source that provides live updates, ball-by-ball.
One source to track all matches. One source to find them.
One source to fetch them all. And in the darkness bind… Wait, wrong reference.
It’s BCCI, folks. The BCCI website updates live scores for domestic cricket.
However, I find it very difficult to apply the necessary filters, and even after that, struggle to find the specific match that I want.
Which brings us to…
airhorn sounds
Well, that, and I wanted to build an MCP server to comprehend the workings of one.
I built it in Python via FastMCP. But before building anything, I needed to figure out how I’d do it. Because the BCCI website doesn’t document APIs.
Thankfully, the website uses straightforward APIs that return a JSONP or JSON response, which I then mapped out to the following broad requirements for my core usecase of getting details for a match:
- Get list of tournaments
- Get list of matches for a tournament
- Get details of a particular match
This sequence is important, because data from one call feeds into the next.
The list of tournaments remains consistent for days, rarely being updated. So, I stored the tournament list as an MCP resource, treating it as a knowledge base, with a local cache for 24 hours to avoid unnecessary API calls and further reduce latency. This was done after parsing off most of the API response, as the response has way too many details than needed for our flow, and so would just eat up precious tokens.
Other APIs are similarly stripped of unnecessary details for my use case, keeping only the core. These were defined as MCP tools.
The server is now capable of getting a multitude of information from the website, such as
- Tournaments (past/ongoing/upcoming) for particular filters, such as men’s/women’s, domestic/international, etc.
- Tournament schedule
- Points table
- Summary or details of a particular match
Two things impressed me the most about this combination of LLMs + MCP server:
- Filtering - LLMs are naturally very good at searching through structured JSON, so I could skip making functions to filter for specific teams or categories (at the cost of more token usage).
- Formatting - For printing out points tables or scorecards, I initially prepared methods to convert JSON to a pretty output. I needn’t have. Again, LLMs like structured data, so they output very nice tables!
The results:
(Note: The video is sped up 5x)
Let me know if you use the server and have any suggestions!