black and yellow f 1 car on road during daytime

Open Formula 1 MCP Server

I am fascinated with Formula 1 racing !! The races are so amazing, there is so much excitement that makes your heart pound out of your chest!!

Over time, I found myself wondering more and more about what was going on during the races, who was the 3rd fastest driver in the race, which team did well in the last season but not so good this year, and then much more specific questions like:

What was Kimi Antonelli's, my favorite driver, fastest lap in the Miami GP?

In which lap did he overtake Lewis Hamilton?

Which team won the most races in Singapore between 2020 and 2024?

As my fascination grew more and more, I started to wonder how one gets to find out about what happened during a race and where can I find the data to answer such questions?

OpenF1 Project - the data source

Searching online, I came across OpenF1.org, an open-source project that has APIs to get very detailed race information. This is great, I can get a lot of detailed info from OpenF1 APIs but then I need to write a specific piece of code to analyze that info to answer my F1 questions above and repeat this process for every new question - not an easy task.

I started thinking of better ways to do this with AI.

What if there was an AI Agent that can answer any of my Formula 1 questions?

What is an "AI Agent"?

Agentic AI, the autonomous AI systems that can act on their own, is the hottest AI topic these days and they are expected to change how we work and live in the next few years. While these agentic AI systems, the "AI agents", can think through the existing capabilities of LLMs such as ChatGPT, Claude, Gemini models, they need a mechanism to connect to external tools and data sources to gather more information or to take real action.

Anthropic came up with a solution, the Model Context Protocol (MCP), a standard and universal adapter approach to enable the AI agents a structured way to access information and perform actions in the real world.

Building My First MCP Server

So, I coded and built my first MCP Server with the hopes that I can hook it up to Claude Code and have my Claude based AI Agent answer all my questions. It took some effort, but the results were well worth it.

The source code and the documentation (MCP Server tools, installation instructions) can be accessed at:

{ "mcpServers": { "Open-F1": { "command": "python", "args": ["/path/to/OpenF1MCPServer.py"] } } }

Adding the MCP Server to Claude Code

After connecting with Claude Code using the following config (claude_desktop_config.json), it was ready to go

The results:

With my newly built MCP Server and Claude's intelligence, I had my Formula 1 Agent ready to answer my questions. Here are some of the results. Impressive !!

Go ahead, try it out and share your thoughts below.