MCP server by liamchampton
F1 Race Engineer MCP Server
A Model Context Protocol (MCP) server that provides Formula 1 race data and analysis tools. Built with FastMCP and FastF1, it gives AI assistants access to real-world F1 telemetry, tyre strategies, and driver comparisons.
Features
- Session Loading — Load any F1 session (practice, qualifying, race) with automatic caching
- Tyre Strategy Analysis — Break down each driver's tyre stints: compound, stint number, and stint length
- Driver Comparison — Compare two drivers' fastest laps with sector-by-sector timing
- Health Check — Simple status endpoint to verify the server is running
Prerequisites
- Python 3.12+
- VS Code with the GitHub Copilot extension (for MCP integration)
Getting Started
1. Clone the repository
git clone https://github.com/liamchampton/f1-race-engineer-mcp.git
cd f1-race-engineer-mcp
2. Create a virtual environment and install dependencies
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
3. Run the MCP server
python -m app.mcp_server
4. Connect from VS Code
The repository includes a .vscode/mcp.json configuration. Open the project in VS Code with GitHub Copilot installed, and the MCP server will be available as a tool provider in Copilot Chat (Agent mode).
Available Tools
| Tool | Description |
|------|-------------|
| health_check() | Returns {"status": "ok"} to confirm the server is running |
| load_session(year, event, session_type) | Loads an F1 session (e.g., 2024, "Monaco", "Q") |
| get_tyre_strategy(year, event, session_type) | Returns tyre stint data for all drivers in a session |
| compare_drivers(year, event, session_type, driver1, driver2) | Compares fastest laps between two drivers |
Parameters
- year — Season year (e.g.,
2024) - event — Grand Prix name (e.g.,
"Monaco","Silverstone") - session_type —
"FP1","FP2","FP3","Q", or"R" - driver1 / driver2 — Three-letter driver codes (e.g.,
"VER","HAM")
Project Structure
app/
├── __init__.py # Package marker
├── mcp_server.py # MCP server definition and tool registration
├── data_loader.py # FastF1 session loading with caching
├── comparisons.py # Driver comparison logic
└── strategy.py # Tyre strategy analysis
tests/
├── conftest.py # Shared pytest fixtures
├── test_comparisons.py # Tests for driver comparisons
├── test_data_loader.py # Tests for session loading
└── test_strategy.py # Tests for tyre strategy
cache/ # FastF1 session data cache (auto-generated)
Running Tests
pip install -r requirements-dev.txt
pytest -v
Contributing
Contributions are welcome! Please read CONTRIBUTING.md before submitting a pull request.
Code of Conduct
This project follows the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.
Security
To report a security vulnerability, please see SECURITY.md.