f1-mcp-server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@f1-mcp-server Who won the 2023 Monaco Grand Prix?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Formula 1 MCP Server
A Model Context Protocol (MCP) server that empowers AI assistants (such as Claude Desktop, Cursor, or custom agents) to inspect, explore, and query Formula 1 data hosted on AWS.
Built using FastMCP, this server integrates natively with AWS Glue Data Catalog (schema metadata) and Amazon Athena (serverless SQL execution over S3 Parquet tables).
Relationship to Upstream Data Pipeline
This repository is designed as a downstream AI consumption layer built directly on top of the Formula 1 Enterprise Data Pipeline (aws-f1-pipeline).
How It Fits into the End-to-End Architecture
UPSTREAM DATA PIPELINE
(GovIndLok/aws-f1-pipeline)
┌─────────────────────────────────────────────────────┐
│ Amazon S3 Data Lake (dbt-athena) │
│ Bronze ➔ Silver ➔ Gold │
└──────────────────────────┬──────────────────────────┘
│ (Table & Schema Metadata)
▼
┌───────────────────────┐
│ AWS Glue Data Catalog │
│ (Gold Database) │
└───────────┬───────────┘
│
═══════════════════════════════════════╪═══════════════════════════════════════
DOWNSTREAM AI INTERFACE
(This Repository)
│
▼
┌───────────────────────────┐
│ f1-mcp-server │
│ - FastMCP (Python) │
│ - Boto3 (Glue & Athena) │
└─────────────┬─────────────┘
│ (stdio / SSE JSON-RPC)
▼
┌───────────────────────────┐
│ AI Clients │
│ (Claude Desktop / Cursor) │
└───────────────────────────┘Upstream Pipeline (
aws-f1-pipeline):Transforms Formula 1 race and telemetry data using
dbt-athenaacross Medallion layers (Bronze $\rightarrow$ Silver $\rightarrow$ Gold), materializing optimized Apache Parquet tables in Amazon S3.Registers dimensional models, facts, and analytical marts into the AWS Glue Data Catalog.
Downstream Application (
f1-mcp-server):Connects directly to the curated Gold schema in AWS Glue.
Translates high-level agent intents into validated Athena queries.
Exposes structured tools that allow LLMs to explore schemas, sample records, and perform multi-table joins without writing SQL by hand or needing direct AWS console access.
Related MCP server: MCP Server F1Data
Gold Data Schema
The server queries the gold database generated by the upstream pipeline, organized into a Star schema:
Layer | Tables | Description |
Dimensions ( |
| Reference data containing driver details, teams, circuits, track coordinates, and race calendars. |
Facts ( |
| Granular race events, grid positions, finishing results, lap timing, and pit stop durations. |
Marts ( |
| Pre-aggregated standings and championship points for fast retrieval. |
MCP Tools
The server registers 4 tools under the FastMCP framework:
1. list_tables
Discovers tables available in the Gold schema, automatically grouped by marts, facts, and dimensions.
Argument:
table_type(optional): Filter by"marts","facts", or"dims".Returns: Dictionary listing tables and their descriptions.
2. tables_schema
Fetches column names and data types for one or more tables from the Glue Data Catalog.
Argument:
table_s: List of table names, e.g.["dim_drivers", "fct_results"].Returns: Dictionary mapping table names to their column definitions.
3. get_sample_data
Previews the top 10 rows of a table with schema-validated column filters.
Arguments:
table_name: Name of the table to sample.filters(optional): List of filter rules:[{"column": "nationality", "operator": "=", "value": "British"}]. Supported operators include=,!=,>,<,>=,<=,IN,BETWEEN,LIKE.join_logic(optional): Combine multiple filters using"AND"(default) or"OR".
Returns: JSON object containing sample rows.
4. run_a_query
Executes custom analytical queries joining fact and dimension tables on Athena.
Arguments:
main_table: Primary table to query (e.g."fct_results").columns: Dictionary mapping tables to requested column names, e.g.{"fct_results": ["position", "points"], "dim_drivers": ["forename", "surname"]}.join(optional): List of joins:[{"table": "dim_drivers", "join_column": "driver_id", "on_column": "driver_id"}].filters(optional): Filter criteria with automatic type and operator formatting.filter_logic(optional):"AND"(default) or"OR".limit(optional): Maximum rows to return (default: 20, max: 500).
Validation:
Ensures every table referenced in
columnsis either themain_tableor explicitly joined.Formats strings with single quotes, tuples for
IN, and numeric bounds forBETWEEN.
Environment Configuration
Copy .env.example to .env and provide your AWS and Athena details:
cp .env.example .envConfiguration reference:
# AWS Configuration
AWS_PROFILE=your-aws-profile
AWS_REGION=your-aws-region
# Athena & Glue Settings
GLUE_DATABASE=gold
S3_RESULTS_BUCKET=s3://<your-athena-query-results-bucket>/staging/query-results/
QUERY_TIMEOUT_SECONDS=15
# MCP Server Settings
MCP_SERVER_HOST=127.0.0.1
MCP_SERVER_PORT=8000Getting Started
1. Prerequisites
Python 3.12+
uv (recommended) or standard
pipValid AWS credentials with permissions for Athena (
StartQueryExecution,GetQueryExecution,GetQueryResults), Glue (GetTables,GetTable), and S3 (read/write access to query results bucket).
2. Installation
# Clone the repository
git clone https://github.com/GovIndLok/f1_mcp_server.git
cd f1_mcp_server
# Install dependencies using uv
uv sync
# Activate the virtual environment
source .venv/bin/activate3. Running the Server
Standard Input/Output (stdio) — Default for local AI clients:
source .venv/bin/activate
python -m src.server.mcp_server --transport stdioServer-Sent Events (sse) — For network or containerized setups:
source .venv/bin/activate
python -m src.server.mcp_server --transport sse --port 8080Client Integration
Claude Desktop
Add the server definition to your claude_desktop_config.json:
{
"mcpServers": {
"f1-mcp-server": {
"command": "/path/to/f1_mcp_server/.venv/bin/python",
"args": ["-m", "src.server.mcp_server", "--transport", "stdio"],
"cwd": "/path/to/f1_mcp_server",
"env": {
"AWS_PROFILE": "your-aws-profile",
"AWS_REGION": "your-aws-region",
"GLUE_DATABASE": "gold",
"S3_RESULTS_BUCKET": "s3://<your-athena-query-results-bucket>/staging/query-results/"
}
}
}
}Cursor
In Cursor Settings $\rightarrow$ Features $\rightarrow$ MCP Servers, add:
Name:
f1-dataType:
commandCommand:
python -m src.server.mcp_server --transport stdio
Deployment
For containerized or remote deployments, run the server using the SSE transport (--transport sse --port 8080). It can be deployed as an AWS ECS Fargate container behind an Application Load Balancer (ALB) or API reverse proxy, with an IAM Task Role configured for least-privilege access to Athena, Glue, and S3.
Available Tools
4 toolsget_sample_dataA
Get sample data (top 10 rows) from a table with optional filters.
Args: table_name: Name of the table to query filters: List of filters with format [{"column": "col_name", "operator": "=", "value": "value"}].(Make sure value is proper format int/string/float) join_logic: Combine filters with "AND" or "OR"
Inputs: table_name (required), filters, join_logic.
list_tablesA
List tables in Gold Schema, optionally filtered by type (marts, facts, dims).
Inputs: table_type.
run_a_queryA
Execute custom queries with joins and filters on F1 data tables.
Args: main_table: Name of the main table to query (e.g 'fct_lap_times', 'fct_results' etc) columns: Dictonary mapping table name to list of columns. Format: {'table_name': ['col1','col2']}. Main table must be included joins: List of joins. Format:[{"table": "dim_table", "join_column": "id", "on_column": "fk_id"}] filters: List of filters. Format: [{"column": "col_name", "operator": "=", "value": "value"}]. (Make sure value is proper format int/string/float) (Use list[number, number] for between operator) filter_logic: Combine filters with "AND" or "OR" limit: Max rows to return (default: 20, max)
Inputs: columns (required), main_table (required), join, limit, +2 more.
tables_schemaC
Schema for a table or multiple tables
Inputs: table_s (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
list_tables and tables_schema are clearly distinct, but get_sample_data and run_a_query overlap significantly—both can query a single table with filters, and run_a_query can reproduce sample-style queries with limit. The descriptions hint at different use cases (quick sample vs. custom joins), but the boundary is not sharply defined.
Names are snake_case and somewhat readable, but styles are mixed: list_tables and get_sample_data use a verb+noun pattern, run_a_query adds an article, and tables_schema uses a noun phrase with no verb. Overall it is still predictable enough to navigate, but not a clean consistent convention.
Four tools is small but appropriate for a read-only F1 data exploration server. Each tool covers a meaningful step: discover tables, inspect schemas, sample data, and run custom queries. It does not feel padded or trivially thin.
The set covers the core read-only workflow well: list available tables, understand their schema, preview data, and execute arbitrary queries. Minor gaps include no pagination/offset support and no explicit relationship metadata, but agents can work around these via run_a_query and tables_schema.
Maintenance
Related MCP Connectors
Your Databricks Lakehouse in natural language: run SQL on your SQL warehouses, track long-running qu
Amazon Ads, Seller Central, Brand Analytics and AMC data in Claude, ChatGPT and any MCP client
691Query BigQuery, Snowflake, Redshift & Azure Synapse with natural language
Amazon Ads, Seller Central, Vendor Central and AMC data for AI agents. Read-only by default.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to execute SQL queries against AWS Athena databases, check query status, retrieve results, and manage saved queries with support for both local and remote deployment via Lambda.5MIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Formula 1 data through LLM interfaces like Claude. Provides access to F1 information including circuits, constructors, drivers, grand prix, manufacturers, races, and seasons.Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables Formula 1 data analysis through natural language, providing tools like track dominance, lap time analysis, and team performance comparisons.Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to query S3 data lakes using natural language, with support for CSV, JSON, Parquet and tools for data discovery, analysis, and metadata exploration.1MIT