Skip to main content
Glama

MCP Sport — F1 Telemetry MCP 🏎️

Animated race replay

An MCP (Model Context Protocol) server that exposes Formula 1 data from the OpenF1 API as tools for AI assistants (Claude Desktop, Cursor, MCP Inspector, etc.).

Full coverage: 18 data tools matching the 18 documented OpenF1 endpoints — sessions, meetings, drivers, results, laps, pit stops, stints, telemetry, weather, championships and more. Two MCP App views sit on top of that data: a drivers standings board and an animated race replay. Hosts that render MCP Apps show the HTML. Cursor and Claude Desktop do not: they return the same payload as JSON.

Stack

Layer

Technology

Language

Python 3.13+

MCP framework

FastMCP 4.x

Validation

Pydantic v2

Data

OpenF1 API (REST, free for historical data 2023+)

Project management

uv + pyproject.toml

Transport

stdio

Related MCP server: OpenF1 MCP Server

Installation

# Clone and install dependencies
git clone https://github.com/andrequeiroz2/mcp-sport.git mcp-sport
cd mcp-sport
uv sync

Usage

Run the server (stdio)

.venv/bin/python src/mcp_sport/server.py

MCP Inspector (web UI to test the tools)

npx @modelcontextprotocol/inspector@latest .venv/bin/python src/mcp_sport/server.py

In the Inspector UI: transport STDIO, command .venv/bin/python, args src/mcp_sport/server.py → Connect.

Claude Desktop / Cursor

Add to the client's MCP configuration:

{
  "mcpServers": {
    "f1-telemetry": {
      "command": "/absolute/path/mcp-sport/.venv/bin/python",
      "args": ["/absolute/path/mcp-sport/src/mcp_sport/server.py"]
    }
  }
}

The 18 data tools work in both clients. The views do not render there.

Views (MCP Apps)

get_drivers_championship_view and get_race_replay_view return interactive HTML. Cursor and Claude Desktop are incompatible with MCP Apps: they ignore the UI and show the JSON payload. The MCP Inspector also treats the result as text.

The views were validated in the official basic-host from modelcontextprotocol/ext-apps. The server must be HTTP, with CORS exposing the MCP session headers. Otherwise the browser cannot complete the Streamable HTTP handshake.

Terminal 1 — MCP server on port 8765:

uv run python -c "
import uvicorn
from starlette.middleware import Middleware
from starlette.middleware.cors import CORSMiddleware
from mcp_sport.server import mcp

app = mcp.http_app(middleware=[Middleware(
    CORSMiddleware,
    allow_origins=['*'],
    allow_methods=['*'],
    allow_headers=['*'],
    expose_headers=['mcp-session-id', 'mcp-protocol-version'],
)])
uvicorn.run(app, host='127.0.0.1', port=8765)
"

Terminal 2 — basic-host (needs Node.js; npm start requires bun, so use tsx):

git clone --depth 1 https://github.com/modelcontextprotocol/ext-apps.git
cd ext-apps/examples/basic-host
npm install
npm run build
SERVERS='["http://127.0.0.1:8765/mcp"]' npx tsx serve.ts

Open http://localhost:8080 (sandbox on :8081) and call get_drivers_championship_view or get_race_replay_view. After a change to the view HTML, hard-refresh the page (Ctrl+Shift+R) before running the tool again. The host caches the ui:// resource.

Available tools (18)

Domain

Tool

Description

Navigation

get_sessions

Sessions (practice, qualifying, sprint, race)

get_meetings

Grand Prix and testing weekends

Registry

get_drivers

Drivers by session/meeting

Results

get_session_results

Final classification of a session

get_starting_grid

Starting grid

get_positions

Position history throughout a session

Race

get_laps

Lap times, sectors and speeds

get_pit_stops

Pit stops

get_stints

Stints and tyre compounds

get_intervals

Real-time gaps (leader and car ahead)

get_race_control

Flags, safety car, incidents

Context

get_weather

Track weather (per-minute samples)

get_overtakes

Overtakes

get_team_radio

Team radio excerpts (MP3)

Telemetry

get_car_data

Speed, RPM, gear, throttle, brake, DRS (~3.7 Hz)

get_location

Approximate car position on the circuit (~3.7 Hz)

Championships

get_drivers_championship

Drivers standings (beta)

get_teams_championship

Teams standings (beta)

Example conversation with the AI

"How many points did Norris score in the last two races?"

The AI orchestrates: get_sessions(session_type="Race") to discover recent sessions → get_session_results(session_key=..., driver_number=4) on each one.

Project structure

src/mcp_sport/
├── server.py           # Entrypoint: FastMCP instance + tool registration
├── exceptions.py       # Domain exceptions
├── logging_config.py   # Logging to stderr (stdout is the protocol channel)
├── clients/openf1.py   # Single OpenF1 HTTP client
├── schemas/            # Pydantic: input (BaseInput) and output per endpoint
├── validators/         # Business validations per endpoint
├── services/           # Orchestration per endpoint
├── tools/              # MCP tools (thin layer) per endpoint
└── apps/               # MCP App views (Custom HTML, ui:// resource)
    ├── championship_view.py  # Drivers standings board
    └── race_replay_view.py   # Animated race replay

Canonical documentation

Document

Contents

docs/Technical_Reference.md

Stack, versions and official links (source of truth)

docs/Architectural_Design.md

Implementation patterns and procedure for new endpoints

docs/Logging_Strategy.md

Logging strategy (stderr + per-request telemetry)

tasks/

History of planned and executed tasks

Configuration

Variable

Default

Description

MCP_SPORT_LOG_LEVEL

INFO

Log level on stderr (DEBUG, INFO, WARNING, ERROR)

Known limitations

  • Historical data from 2023 onwards; real-time data requires a paid OpenF1 subscription

  • session_result and starting_grid return HTTP 404 until official results are published

  • Telemetry (car_data, location) returns 18–24k samples per session/driver. Narrow the call with range filters such as speed_min and date_from/date_to

  • Championship endpoints are in beta on OpenF1

License

MIT. OpenF1 is an unofficial project, not associated in any way with the Formula 1 companies.

Available Tools

20 tools
get_car_dataGet Car DataA

Fetch car telemetry (speed, rpm, gear, throttle, brake, DRS) from OpenF1.

Sampled at ~3.7 Hz — always narrow down with the range filters below (e.g., a single lap via date_from/date_to, or high-speed samples via speed_min) to keep responses usable.

Inputs: date_to, drs_max, drs_min, rpm_max, +10 more. Returns: result

get_driversGet DriversB

Fetch F1 drivers from OpenF1, filtered by session, meeting or identity fields.

Inputs: full_name, last_name, team_name, first_name, +5 more. Returns: result

get_drivers_championshipGet Drivers ChampionshipA

Fetch drivers championship standings from OpenF1 (beta endpoint).

Only available for race sessions. This endpoint is in beta: its behavior or fields may change without notice.

Inputs: session_key, driver_number. Returns: result

get_drivers_championship_viewGet Drivers Championship ViewA

Fetch drivers championship standings and render them as a visual board.

MCP App spike (task 05): in hosts supporting the MCP Apps extension, the result renders as an interactive HTML board with driver photos, team colors and points. In other hosts, the same data is returned as JSON text.

Inputs: session_key. Returns: result

get_intervalsGet IntervalsA

Fetch real-time gaps between drivers and to the race leader from OpenF1.

Available during races only, with updates approximately every 4 seconds. Use date_from/date_to to bound the response (e.g., the closing laps).

Inputs: date_to, date_from, session_key, driver_number. Returns: result

get_lapsGet LapsC

Fetch detailed lap-by-lap data for an F1 session from OpenF1.

Inputs: date_to, date_from, lap_number, session_key, +17 more. Returns: result

get_locationGet LocationA

Fetch approximate car positions on the circuit from OpenF1.

Sampled at ~3.7 Hz — always narrow down with date_from/date_to (e.g., a single lap) to keep responses usable. Useful for gauging progress along the track, but lacks lateral placement (left/right side). The origin point (0, 0, 0) is arbitrary.

Inputs: x_max, x_min, y_max, y_min, +6 more. Returns: result

get_meetingsGet MeetingsC

Fetch F1 meetings (Grand Prix or testing weekends) from OpenF1.

Inputs: year, location, circuit_key, meeting_key, +2 more. Returns: result

get_overtakesGet OvertakesA

Fetch overtakes during F1 races from OpenF1.

Covers on-track passes and position changes from pit stops or post-race penalties. Only available during races and may be incomplete.

Inputs: position, session_key, overtaken_driver_number, overtaking_driver_number. Returns: result

get_pit_stopsGet Pit StopsC

Fetch pit lane passes for an F1 session from OpenF1.

Inputs: date_to, date_from, lap_number, session_key, +5 more. Returns: result

get_positionsGet PositionsC

Fetch driver position changes throughout an F1 session from OpenF1.

Inputs: date_to, position, date_from, meeting_key, +4 more. Returns: result

get_race_controlGet Race ControlC

Fetch race control events (flags, safety car, incidents) from OpenF1.

Inputs: flag, scope, date_to, category, +5 more. Returns: result

get_race_replay_viewGet Race Replay ViewA

Replay a race as an animated position chart (bar-chart-race style).

MCP App (task 06): in hosts supporting the MCP Apps extension, renders cars stacked by official position with a checkered treadmill paced by the leader (a new lap opens when the leader crosses), tyre compound badges (red S / yellow M / white H), per-sector times with broadcast colors recomputed at the displayed instant (one purple per sector, green = personal best, yellow = slower), the lap time as MM:SS:mmm, PIT badges, a centered Safety Car / VSC / race-suspended banner, and a header with circuit, local start time and track conditions. Retired cars show a permanent OUT or DNS tag and drop gap, sectors and lap time. In other hosts the same payload is returned as JSON text.

Inputs: session_key. Returns: result

get_session_resultsGet Session ResultsA

Fetch the final classification of an F1 session from OpenF1.

Results become available a few minutes after the official results are published on the Formula 1 website. If the API returns HTTP 404, the results are not yet published for that session — retry with an earlier session_key (use get_sessions to find completed sessions).

Inputs: position, session_key, driver_number. Returns: result

get_sessionsGet SessionsB

Fetch F1 sessions (practice, qualifying, sprint, race) from OpenF1.

Inputs: year, location, circuit_key, meeting_key, +4 more. Returns: result

get_starting_gridGet Starting GridA

Fetch the starting grid for an F1 race from OpenF1.

Grid data becomes available a few minutes after the official results are published on the Formula 1 website. If the API returns HTTP 404, the grid is not yet published for that session — retry with an earlier session_key (use get_sessions to find completed sessions).

Inputs: position, session_key, driver_number. Returns: result

get_stintsGet StintsC

Fetch tyre stints (periods of continuous driving) from OpenF1.

Inputs: compound, lap_end_max, lap_end_min, session_key, +6 more. Returns: result

get_team_radioGet Team RadioA

Fetch team radio exchanges between drivers and teams from OpenF1.

Only a limited selection of communications is included, not the complete record. Coverage has decreased significantly starting in 2026, with most events providing no radio data at all (a limitation on F1's side).

Inputs: session_key, driver_number. Returns: result

get_teams_championshipGet Teams ChampionshipA

Fetch teams championship standings from OpenF1 (beta endpoint).

Only available for race sessions. This endpoint is in beta: its behavior or fields may change without notice.

Inputs: team_name, session_key. Returns: result

get_weatherGet WeatherC

Fetch weather conditions over the track from OpenF1 (sampled every minute).

Inputs: date_to, date_from, meeting_key, session_key, +10 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 20 tools

    Disambiguation4/5

    Most tools target clearly distinct F1 data endpoints (weather, laps, pit stops, car data, etc.), but get_drivers_championship and get_drivers_championship_view fetch the same standings with different rendering, which could cause selection confusion. get_race_replay_view also partially overlaps with position/location tools, though its replay purpose is described distinctly.

    Naming Consistency5/5

    All tools follow a consistent get_<resource> snake_case pattern (e.g., get_weather, get_drivers, get_laps). The two view tools add a predictable _view suffix, so the naming remains coherent and readable.

    Tool Count4/5

    20 tools is on the heavy side, but the F1 data domain is broad and each tool maps to a distinct OpenF1 endpoint or presentation layer. The count is reasonable rather than bloated, though it could be tightened by merging the championship view with its data tool.

    Completeness5/5

    The set covers the full OpenF1 read-only surface: sessions, meetings, drivers, results, grids, positions, laps, pit stops, stints, intervals, race control, overtakes, radio, telemetry, location, and both championships. The added view tools provide optional rendering without leaving obvious gaps.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Provides comprehensive Formula 1 data access including race schedules, session results, lap times, telemetry data, driver/constructor standings, and circuit information. Enables users to retrieve and analyze F1 racing data through natural language queries using the FastF1 Python package.
      5
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables access to Formula 1 data from the openF1.org API, including driver information, race results, lap times, telemetry, pit stops, weather conditions, and live position data across multiple seasons.
      -
    • A
      license
      C
      quality
      D
      maintenance
      Provides easy access to Formula 1 data including championship standings, event info, season calendars, track visualizations, session results, and driver/constructor info via FastF1 and OpenF1 API.
      17
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to query real-time and historical Formula 1 data through the OpenF1 API, providing tools for driver info, lap times, telemetry, race events, and more.
      MIT