Docs

Web API

REST endpoints for the game state dashboard

The MCP server runs an embedded FastAPI server on port 8000 that exposes read-only game state for the web dashboard. It shares the same GameConnection as the MCP tools — no separate process needed.

When the MCP server is running, interactive API docs (Swagger UI) are available at http://localhost:8000/docs.


Endpoints

All endpoints are GET requests returning JSON. CORS is restricted to localhost:3001 (the dashboard dev server).

EndpointParametersDescription
/api/overviewFull game overview: score, yields, era, victory progress, per-player rankings
/api/unitsAll player units with position, type, HP, movement, available actions
/api/citiesAll cities with yields, population, production, growth, districts
/api/mapx, y, radius (1–5)Tile data in a hex radius: terrain, features, resources, improvements, units
/api/resourcesStrategic and luxury resource stockpiles, owned resources, nearby unimproved resources
/api/techTech and civic tree progress: completed, in-progress, available
/api/diplomacyDiplomatic relationships, modifiers, available actions per civilization

Error responses

StatusMeaning
503Game not connected — FireTuner TCP connection is down
502Lua error — the game returned an error from the Lua query

Example

# Get game overview
curl http://localhost:8000/api/overview

# Get map tiles around coordinate (31, 15) with radius 3
curl "http://localhost:8000/api/map?x=31&y=15&radius=3"

The response format mirrors the MCP tool responses — dataclasses serialized to nested JSON objects.

On this page