Skip to content

Command Line Setup

saudademjj edited this page Dec 5, 2026 · 1 revision

Use the command line when you want a model other than DeepSeek, run on Linux, attach to a dedicated server or script the setup. On Windows the tools are in the release package; on Linux, build them from source (Building and Releasing).

The command-line output is currently in Chinese. Every command accepts --help.

1. Install the mod and create the config

fai setup

fai setup finds Factorio, installs and enables the factorio_ai_bridge mod, creates server/config.toml and an RCON password file server/rcon.pw, and prints an MCP config you can paste into a client.

Option Effect
-y, --yes Non-interactive: accept every detected default
--factorio-dir <dir>, --mods-dir <dir> Point at the game or mods folder when detection fails
--copy Copy the mod instead of linking it
--config <path>, --force-config Write the config elsewhere, or overwrite an existing one
--host, --port RCON address written to the config (default 127.0.0.1:27015)
--mode Default build mode: ghost, character, character_free or instant
--transport fai-command (default, keeps achievements) or silent-command
--enable-client-rcon Turn on local RCON in the game client's config.ini (a backup is made)
--write-mcp claude-desktop or cursor Merge the MCP server into that client's config file

Example that does everything without questions:

fai setup -y --enable-client-rcon --write-mcp claude-desktop

2. Start a game with RCON

  • Playing yourself: with client RCON enabled, open Multiplayer → Host saved game in Factorio. RCON only listens while you host a save.
  • Dedicated server: scripts/start_factorio_rcon.sh <save.zip> [rcon port=27015] [game port=34197] on Linux and macOS, or scripts\start_factorio_rcon.bat with the same arguments on Windows. If the script cannot find the game, set FACTORIO_BIN (the game executable, .sh) or FACTORIO_DIR (the install folder, .bat). The password comes from server/rcon.pw or FAI_RCON_PASSWORD_FILE and is created if missing. RCON listens on 127.0.0.1 only; players join on the game UDP port. The scripts do not install the mod, so run fai setup on that machine first or copy mod/factorio_ai_bridge into the server's mods folder.

3. Check everything

fai doctor          # add --json for machine-readable output

It checks the solver, the mod source, the installed and enabled mod, the config, the RCON password, the RCON connection, and the mod version running in the game. Each failed check prints the command that fixes it; see Troubleshooting.

4. Start the agent

fai agent

The agent watches game chat and answers every message that starts with @ai. It also reacts to events such as power shortages and attacks unless you pass --chat-only.

Option Effect
--provider, --model, --base-url, --api-key Choose the model; see Model Providers
--max-rounds <n> Maximum tool-call rounds per request
--chat-only Only answer chat and finished background tasks
--no-greeting Skip the online message in chat
--once "<request>" Run one request from the terminal and exit
--repl Talk to the agent from the terminal
-v, --verbose Debug logging
--config <path> Use another config file

fai-setup, fai-agent, fai-mcp and fai-rcon are standalone executables for the same entry points. fai-rcon is an RCON self-test.

Next: Model Providers · Using MCP Clients · Configuration.

Clone this wiki locally