MCP Grand Prix
MCP Grand Prix
一个 LLM 驱动的 3D 赛车游戏 的 MVP。LLM 智能体在一个共享赛道上通过一个混合式比赛循环——策略规划、物理模拟和短时响应决策窗口——驾驶 Formula 1 赛车,同时浏览器观赛客户端实时观看比赛。
该项目是一个 MCP 服务器,向 LLM 智能体暴露游戏状态与策略工具,外加一个 Three.js 观赛仪表盘和一小队脚本化/LLM 智能体。
架构
┌────────────┐ MCP (SSE) ┌───────────────┐ tool calls ┌──────────────┐
│ LLM agents│ ────────────▶ │ src/mcp │ ◀───────────── │ RaceEngine │
│ (LLM or │ │ server.ts │ JSON-RPC │ (authoritative)
│ scripted) │ └───────────────┘ └──────┬───────┘
│ │ │ push
│ │ ┌───────────────┐ │ snapshot
│ │ │ src/server │◀─────────────┘
│ │ HTTP + WS (/ws) │ index.ts │
└────────────┘ ◀────────────────── │ spectator │
Browser spectator └───────────────┘
(Three.js, www/client.js)src/game/raceEngine.ts—— 服务器权威的游戏核心。它持有所有游戏状态,并提供确定性、幂等的工具方法(startRace、submitPhaseStrategy、reactToEvent、step)。这些相同的方法既通过 MCP 暴露给真实的 LLM,也可供进程内脚本化智能体调用,因此无论调用者是谁,行为都完全一致。src/mcp/server.ts—— MCP(JSON-RPC/SSE)服务器,将引擎的工具暴露给智能体。src/game/raceRunner.ts—— 逐 tick 驱动混合式比赛循环(策略 → 模拟 → 响应窗口)。src/server/—— HTTP + WebSocket 服务与观赛数据流。www/—— 浏览器观赛客户端(Three.js)。
Related MCP server: fastf1-mcp
比赛循环
策略阶段 —— 每一圈,所有智能体提交一个
StrategyPacket(轮胎配方、驾驶模式、省油设置、可选的进站圈)。模拟阶段 —— 引擎每个 tick 推进物理模拟。
响应窗口 —— 触发事件(近距离缠斗、安全车、天气、轮胎磨损)会在圈中打开短时响应窗口,让相关智能体在其中做出响应(
push/save/pit_now/attack/defend)。
快速开始
npm install
npm run build # prebuild copies three.js into www/lib
npm start # serves the spectator app + MCP server在 http://localhost:3000 打开观赛仪表盘并开始一场比赛:
curl -X POST http://localhost:3000/race浏览器会通过 WebSocket(/ws)连接到相同的主机/端口,以获取实时更新。
从 CLI 运行脚本化比赛
npm run agents # launches 4 scripted agents in a full race (demo)配置(环境变量)
变量 | 默认值 | 用途 |
|
| HTTP + 观赛 WebSocket 端口 |
|
| MCP JSON-RPC/SSE 端口 |
| — | HTTP 端口(当 |
使用
PORT是为了让应用兼容无服务器平台,例如 Vercel 会设置PORT。
脚本
脚本 | 描述 |
| 编译 TypeScript( |
| 使用 |
| 运行构建后的服务器 |
| 启动一个脚本化演示比赛 |
| 运行维特单元测试(Vitest) |
| 运行 Playwright 端到端测试套件 |
| 使用 |
测试
单元测试(
npm test)针对真实引擎核心,覆盖比赛引擎的公开契约——生命周期、策略提交、响应事件和比赛完成——并验证引擎核心。端到端(
npm run test:e2e)启动服务器,开始一场比赛,断言浏览器渲染赛车和实时排行榜,并检查比赛进行、结束且有胜者,同时响应窗口 UI 会出现。
MCP 工具
服务器暴露四个 MCP 工具(见 src/mcp/server.ts):
工具 | 描述 |
| 当前完整比赛状态:赛车、位置、差距、轮胎、燃油、圈数、事件。 |
| 提交一组车队在下次策略窗口中的计划(幂等)。 |
| 对某个公开的响应窗口及其相关赛车做出反应(幂等)。 |
| 服务器对策略决策和响应操作维护的调试日志。 |
真实的 LLM 智能体通过 MCP 客户端(SSE)连接并调用这些工具;脚本化智能体调用引擎的方法(in-process,进程内)。startRace 和逐 tick 的 step 属于 running runner,内部使用,不作为 MCP 暴露。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables AI assistants to access real-time iRacing telemetry, race information, camera control, pit operations, and replay features through the MCP protocol.171MIT
- AlicenseAqualityCmaintenanceA local MCP server that gives Claude (or any MCP-compatible AI client) access to Formula 1 race data. Load any session from 2018 onwards, ask questions in natural language, and get answers backed by real telemetry, timing, and strategy data.171MIT
- AlicenseAqualityDmaintenanceEnables LLMs and AI agents to interact with AFSIM through standardized MCP tools for scenario management, entity/component control, simulation execution, and results analysis.3721MIT
- FlicenseNot gradedqualityBmaintenanceEnables AI agents to investigate and manipulate live network simulations via MCP, including protocol debugging and fault injection.
Related MCP Connectors
MCP server exposing the Backtest360 engine API as tools for AI agents.
Build, validate, and deploy multi-agent AI solutions from any AI environment.
MCP server for OpenMM — exposes market data, account, trading, and strategy tools to AI agents
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/pefman/mcpGrandPrix'
If you have feedback or need assistance with the MCP directory API, please join our Discord server