mcp-f1
MCP Sport ā F1 Telemetry MCP šļø

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 syncUsage
Run the server (stdio)
.venv/bin/python src/mcp_sport/server.pyMCP Inspector (web UI to test the tools)
npx @modelcontextprotocol/inspector@latest .venv/bin/python src/mcp_sport/server.pyIn 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.tsOpen 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 |
| Sessions (practice, qualifying, sprint, race) |
| Grand Prix and testing weekends | |
Registry |
| Drivers by session/meeting |
Results |
| Final classification of a session |
| Starting grid | |
| Position history throughout a session | |
Race |
| Lap times, sectors and speeds |
| Pit stops | |
| Stints and tyre compounds | |
| Real-time gaps (leader and car ahead) | |
| Flags, safety car, incidents | |
Context |
| Track weather (per-minute samples) |
| Overtakes | |
| Team radio excerpts (MP3) | |
Telemetry |
| Speed, RPM, gear, throttle, brake, DRS (~3.7 Hz) |
| Approximate car position on the circuit (~3.7 Hz) | |
Championships |
| Drivers standings (beta) |
| 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 replayCanonical documentation
Document | Contents |
| Stack, versions and official links (source of truth) |
| Implementation patterns and procedure for new endpoints |
| Logging strategy (stderr + per-request telemetry) |
| History of planned and executed tasks |
Configuration
Variable | Default | Description |
|
| Log level on stderr ( |
Known limitations
Historical data from 2023 onwards; real-time data requires a paid OpenF1 subscription
session_resultandstarting_gridreturn HTTP 404 until official results are publishedTelemetry (
car_data,location) returns 18ā24k samples per session/driver. Narrow the call with range filters such asspeed_minanddate_from/date_toChampionship endpoints are in beta on OpenF1
License
MIT. OpenF1 is an unofficial project, not associated in any way with the Formula 1 companies.
Related MCP Connectors
- F1LapsOAuthcom.f1laps
Read-only F1 game laps, telemetry, setups, leaderboard benchmarks, and progress.
Anonymous read-only Formula 1 tools, resources, prompts, completion, and interactive dashboard.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides 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.5MIT
- FlicenseNot gradedqualityDmaintenanceEnables 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.-
- AlicenseNot gradedqualityDmaintenanceProvides 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.1MIT
- FlicenseNot gradedqualityDmaintenanceA real-time Formula 1 analytics server that lets you ask natural language questions about races, lap times, tyre strategies, pit stops, and more using live data from the OpenF1 API.-