civ6
An MCP server that lets LLM agents play Civilization VI.
claude mcp add --transport stdio lmwilki-civ6-mcp uv run --directory /path/to/civ6-mcp civ-mcp
How to use
The civ6 MCP server enables LLM agents to play full Civilization VI games by exposing 70+ tools that cover the entire gameplay loop. The agent reads game state, moves units, manages cities, conducts diplomacy, sets production and research, handles faith/religion, manages government and policies, and can save/load games, end turns, and take screenshots. Communication with Civ 6 happens through a persistent FireTuner-based TCP/stdio interface, while the MCP server provides JSON-RPC style tool calls that the agent can invoke. A companion web app also exists to replay sessions turn by turn. To use it, connect your MCP client (Claude Code, Codex, Gemini CLI, or any compatible client) to the server’s stdio JSON-RPC channel (TCP port 4318 on the Civ 6 side is handled by the server). The server generates Lua code at runtime to query game state and issue commands inside Civ 6’s two Lua VMs, ensuring all game rules are enforced by the engine. The capabilities span exploration, combat, diplomacy, city management, research, and victory tracking, enabling the agent to autonomously play from opening moves to late-game decisions.
Typical workflow: start a game in Civ 6, connect the MCP client to the server, obtain an overview with get_game_overview, inspect units and cities, and proceed to move units, set production and research targets, manage diplomacy, and end the turn. The system is designed for long, multi-turn planning with narration fed back to the agent so it can adapt strategies as the game evolves.
How to install
Prerequisites:
- Civ 6 installed with the FireTuner debug interface enabled (required for the MCP server to connect to Civ 6).
- Python installed (the MCP server runs Python under uv).
- The uv runtime (uvx) installed and configured ( uv sync from the civ6-mcp repository as the quick start).
Step-by-step installation:
-
Clone the repository: git clone https://github.com/lmwilki/civ6-mcp.git cd civ6-mcp
-
Install the MCP server dependencies and prepare the environment: uv sync
-
Install optional launcher dependencies if you plan to use GUI automation features (screenshot and OCR):
macOS
uv pip install 'civ6-mcp[launcher-macos]'
Windows
uv pip install 'civ6-mcp[launcher-windows]'
Linux (Ubuntu/Debian)
sudo apt install xdotool tesseract-ocr uv pip install 'civ6-mcp[launcher-linux]'
-
Start the MCP server (adjust the directory and script name as needed): uv run --directory /path/to/civ6-mcp civ-mcp
-
Ensure Civ 6 is running and listening for the tuner connection (on port 4318) as described in the Quick Start. Then test the connection: uv run python scripts/test_connection.py
Note: The installer assumes a Python environment and the uvx setup is used to run the server. If you’re using a different environment or packaging, adapt the command to your runtime (see mcp_config for integration details).
Additional notes
Tips and common issues:
- Ensure Civ 6 FireTuner is connected and the tuner is not blocked by other software; only one tuner connection is allowed at a time.
- Do not run the server from WSL due to networking instability between WSL2 and Windows networking layers.
- If a connection handshake fails, restart Civ 6 to reset the tuner connection; some handshakes can hang and require a restart.
- On Linux, the native Civ 6 port with the built-in FireTuner must be used; Proton/Wine builds do not expose the tuner API.
- For GUI automation (screenshots/OCR), you’ll need an X11 session (Wayland with XWayland can work, but native X11 is most reliable).
- The MCP client communicates via stdio JSON-RPC; ensure your client is configured to connect to the server’s stdio channel (as demonstrated in the client configuration examples).
- The provided example configurations for Claude Code, Claude Desktop, Codex, Gemini CLI, and other clients assume you will replace /path/to/civ6-mcp with your actual repository path and adjust commands to uv run civ-mcp or similar as appropriate for your environment.
Related MCP Servers
PPTAgent
An Agentic Framework for Reflective PowerPoint Generation
boltmcp
MCP server from boltmcp/boltmcp
MCP-PostgreSQL-Ops
🔍Professional MCP server for PostgreSQL operations & monitoring: 30+ extension-independent tools for performance analysis, table bloat detection, autovacuum monitoring, schema introspection, and database management. Supports PostgreSQL 12-17.
mcp-tool-kit
Agentic abstraction layer for building high precision vertical AI agents written in python for Model Context Protocol.
ContextPods
Model Context Protocol management suite/factory. An MCP that can generate and manage other local MCPs in multiple languages. Uses the official SDKs for code gen.
context-engineering
[WIP] Context engineering: the art and science of shaping context-aware AI systems