Skip to content

Using MCP Clients

saudademjj edited this page Dec 5, 2026 · 1 revision

fai-mcp is an MCP server over stdio. It gives any MCP client the same 15 tools the in-game agent uses, so you can plan and build from Claude Desktop, Cursor, Claude Code or another client. The client's own model does the thinking; no API key is needed on the commander's side.

The game must be running with RCON and the mod enabled, as for the agent: see Command-Line Setup.

Automatic setup

fai setup --write-mcp claude-desktop    # or: --write-mcp cursor

This adds a server named factorio to the client's config file and keeps any servers already there:

Client Config file
Claude Desktop on Windows %APPDATA%\Claude\claude_desktop_config.json
Claude Desktop on macOS ~/Library/Application Support/Claude/claude_desktop_config.json
Claude Desktop on Linux ~/.config/Claude/claude_desktop_config.json
Cursor ~/.cursor/mcp.json

Restart the client afterwards. Without --write-mcp, fai setup prints the same snippet and a ready-made Claude Code command for you to copy.

Manual setup

Point a stdio MCP server at fai-mcp and tell it where the config is:

{
  "mcpServers": {
    "factorio": {
      "command": "C:\\path\\to\\fai-mcp.exe",
      "args": [],
      "env": { "FAI_CONFIG": "C:\\path\\to\\server\\config.toml" }
    }
  }
}

Instead of FAI_CONFIG you can pass the RCON settings directly, for example FAI_RCON_PASSWORD_FILE pointing at server/rcon.pw, plus FAI_RCON_HOST and FAI_RCON_PORT for a remote server. See Configuration.

Claude Code

claude mcp add factorio --env FAI_CONFIG=/path/to/server/config.toml -- /path/to/fai-mcp

Trying it

Ask the client something like "Show me the factory dashboard" or "Plan 30/min red science near the starting area". Good first tools are world_observe for a snapshot and calc_ratio for ratios, which do not build anything. plan_factory can plan only or also build, and execute_plan runs plans step by step. Anything they build follows the build mode and safety rules in Playing with the AI.

All tools and parameters: docs/TOOLS.md.

Clone this wiki locally