F1分析MCP服务器
   ](https://pypi.org/project/f1-mcp/) ](https://github.com/Luffy610/f1-mcp/stargazers) ](https://github.com/Luffy610/f1-mcp/issues) ](https://github.com/Luffy610/f1-mcp/discussions)
MCP(模型上下文协议)服务器提供 118+F1分析工具 由...驱动 FastF1 以及Ergast API。将其连接到Claude Desktop、Claude Code或任何MCP客户端,以分析比赛、比较车手、探索遥测技术,并使用自然语言模拟策略。
特性
- 会话和驾驶员信息 --比赛结果、排名、赛道详情、车手元数据
- 搭接和行业分析 --单圈时间、扇区增量、一致性得分、干净的单圈过滤
- 遥测 --速度/油门/制动器/档位/RPM轨迹、转角分析、制动点
- 战略情报 --轮胎退化、凹坑窗口、底切/过切分析、策略模拟
- 比赛位置 --超车、战斗、差距演变、位置变化、领先变化
- 预测性人工智能 --比赛获胜者预测、超车概率、轮胎悬崖预测、安全车概率
- 可视化 --速度图、比赛进展图、轮胎退化图、赛道优势图
快速开始
pip安装(推荐)
pip install f1-mcp从源代码安装:
pip install git+https://github.com/Luffy610/f1-mcp.git码头工人
docker compose up -dMCP服务器将在 http://localhost:8000/sse.
MCP客户端配置
克劳德桌面/克劳德代码(stdio——推荐)
{
"mcpServers": {
"f1": {
"command": "f1-mcp"
}
}
}SSE模式(远程/Docker)
{
"mcpServers": {
"f1": {
"type": "sse",
"url": "http://localhost:8000/sse"
}
}
}要手动启动SSE服务器,请执行以下操作: python server.py
工具类别
| 类别 | 工具 | 示例 |
|---|---|---|
| 第8节 | 比赛信息、天气、赛道详情、旗帜事件 | |
| 车手 | 8 | 排名、车手信息、车队查询、积分 |
| 圈数 | 10 | 圈数、分布、干净圈数、删除圈数 |
| 部门 | 8 | 部门时间、增量、一致性、改进趋势 |
| 遥测 | 12 | 速度/制动/油门/档位轨迹,转角分析 |
| 策略 | 10 | 轮胎策略、轮胎长度、复合材料使用、退化 |
| 进站 | 6 | 进站时间、进站车道损失、进站总结 |
| 比赛位置 | 8 | 超车、战斗、差距演变、领先优势变化 |
| 策略情报 | 10 | 欠切/过切,最佳坑窗,策略模拟 |
| 遥测情报 | 10 | 制动分析、转弯速度、污浊空气、能量部署 |
| 高级分析 | 8 | 驾驶员风格聚类、攻击性/风险指数、一致性 |
| 预测AI | 14 | 比赛获胜者、超车概率、轮胎悬崖、安全车 |
| 可视化 | 6 | 速度图、比赛进展、轮胎退化图 |
示例提示
Analyze why Verstappen won the 2023 Bahrain GP. Break down his tyre strategy,
pit stops, race pace trend, and any overtakes he made.Compare Verstappen and Leclerc through Turn 10 at the 2023 Bahrain GP.
Who brakes later, carries more apex speed, and gets on the throttle earlier?Simulate how the 2023 Bahrain GP would have played out if Verstappen used
a two-stop strategy instead of his actual strategy.看 example.md 有关它们触发的特定工具的更详细的示例提示。
贡献
我们欢迎捐款!这 master 分支受到保护--请 克隆仓库,创建一个功能分支,并提交一个pull请求。
- 分叉存储库
- 创建功能分支(
git checkout -b feature/my-new-tool) - 进行更改并确保测试通过(
python -m pytest tests/ -v) - 提交拉取请求
看 贡献.md 有关项目结构、添加工具和代码风格的详细指南。
报告问题和请求功能
发展
# Install in editable mode with dev dependencies
pip install -e ".[dev]"
# Run all tests
python -m pytest tests/ -v
# Run specific test group
python -m pytest tests/ -v -k "test_lap"
# Start SSE server for development
python server.py建筑
f1_mcp/ → Python package
server.py → Entry point, registers all tool modules
config.py → FastF1 cache configuration
connectors/ → Data sources (FastF1Loader, ErgastClient)
core/ → Caching layer + serialization utilities
models/ → Pydantic schemas
services/ → Business logic (14 service classes)
tools/ → MCP tool registrations (14 modules, 1:1 with services)
tests/ → End-to-end test suite (118 tests)环境变量
| 变量 | 默认值 | 描述 |
|---|---|---|
F1_CACHE_DIR | ./cache | FastF1数据缓存目录 |
