Factorio LLM Use
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Factorio LLM Use Inspect my oil refinery and tell me what's missing to make plastic."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Factorio LLM Use
A general Factorio 2.1 toolset for an LLM assistant, using MCP, local RCON and a persistent game mod. It operates without desktop input and creates its own AI character, independent of connected human players.
The tool is built first. It does not start a factory project or change a working world merely because it is installed. The human assigns the tasks and their scope.
Get the companion mod from the Factorio Mod Portal. It requires the external MCP server from this repository; follow the setup guide below.
Capabilities
Inspect surfaces, entities, inventories, fluids, recipes, research, rail connections and trains, including installed mod prototypes.
Walk with native pathfinding; mine and craft over game ticks; build from real inventory; transfer items and configure machines and stations.
Read player and game blueprint libraries and nested books directly. Capture built layouts on sandbox surfaces without opening or controlling the sandbox UI.
Preserve blueprint recipes, wires, modules, station names and snapping through Factorio's native blueprint operations.
Search candidate sites, compose multiple blueprints into a persistent plan, show a temporary visual preview, and explicitly place native construction ghosts.
Inspect and update a selected train's basic schedule, operating mode and destination.
Use an explicit advanced Lua tool for capabilities not covered by the normal tools, including other mods' remote interfaces and advanced schedule features.
There is no list of permitted entity names. Placement discovers the installed
item prototype's place_result; inventory access uses the entity's real inventory
indices. Native game restrictions, reach, materials, collision rules and recipe
availability still apply. Unsupported mechanics return an error rather than silently
substituting another entity.
This is not a promise of complete coverage of every game mechanic. Reliable combat has not been established. A bounded shooting primitive runs per tick in the mod; the LLM should not be relied on for frame-by-frame threat response. New capabilities can be added without adding entity whitelists.
Related MCP server: factorio-mcp
Requirements
Factorio 2.1; developed against 2.1.24. Space Age is optional, but clients and server need the same game version, expansion settings and enabled mods.
Python 3.12+ and uv.
A locally hosted or dedicated Factorio server with RCON enabled on loopback.
Setup
See the step-by-step guide for Windows, Linux and macOS. It covers installing the mod, starting a copy of your world, connecting Codex or another MCP client, checking the connection, and saving/resuming progress.
From the repository root, build and register the tool (all platforms):
uv sync --frozen
uv run python scripts/package_mod.py
uv run python scripts/register_mcp.pyStart a copied world on Windows (PowerShell):
.\scripts\start-server.ps1 -FactorioExe 'D:\path\Factorio.exe' -Save 'D:\saves\world.zip'Or on Linux/macOS (leave the server terminal open):
uv run python scripts/start_server.py \
--factorio '/path/to/factorio/bin/x64/factorio' \
--save "$HOME/.factorio/saves/world.zip" --mods "$HOME/.factorio/mods"The guide supplies macOS bundle paths and each platform's stop/resume commands.
The game port defaults to 34199 and RCON to 27075; the random password is kept
in .runtime/rcon-password.txt. The original save stays unchanged. Current progress
lives under .runtime/data/saves/; use -Resume or --resume on later starts.
The server keeps simulating while human clients are disconnected.
Enable Factorio LLM Use in any joining client's mods. The mod creates an empty AI character and does not add starter items or unlock technologies. Refresh the MCP connection or open a new session to discover its tools. Registration alone does not launch Factorio or assign work.
For an existing server, set FACTORIO_RCON_PASSWORD or
FACTORIO_RCON_PASSWORD_FILE, plus FACTORIO_RCON_PORT and optionally
FACTORIO_RCON_HOST, then run uv run factorio-llm-use. Credentials are read from
the environment or a local file, not stored in the repository or the MCP tool schemas.
Assigning work
Tasks may ask for inspection, repair, production changes, transport, blueprint work
or other supported actions. The tool does not impose planning as the only workflow.
For example, an assistant can read an oil-processing layout from a sandbox, inspect
the RAILS book, compare suitable locations and rail approaches, then place the
factory, stations and rail segments as one construction plan.
preview_plan draws temporary footprint overlays only. apply_plan(mode="ghosts")
creates real native ghosts: supplied construction robots can build them immediately.
Actual construction uses the normal factory's materials. The assistant should choose
the action that matches the human's assignment, without silently forcing demolition
or creating free construction items.
Development and verification
uv run ruff check .
uv run ruff format --check .
uv run python -m unittest discover -s tests -p 'test_*.py'Engine verification is separate from Python tests. See architecture and verification for precise coverage and limitations.
Project origin
The MCP plus companion-mod approach was informed by examining menbou404/factorioMCP. That repository had no declared license when inspected. This repository contains an independent implementation and original English documentation, not a redistribution of its code. This project's source is MIT licensed.
Available Tools
29 toolsapply_planA
Place a plan as native ghosts. Supplied construction robots can build them immediately.
Use only when the assigned task authorizes placing ghosts. Normal placement does not force deconstruction. Real construction uses the existing factory's normal materials.
Inputs: mode (required), plan_id (required). Returns: result
blueprint_catalogC
Browse player/game libraries, nested books, inventory and captured blueprints.
Returned references identify exact records. Search RAILS or a project label with query. Original library records are never modified.
Inputs: ref, limit, query, offset, +1 more. Returns: result
cancel_actionA
Stop the AI character and cancel its current action, returning crafting ingredients.
Inputs: no named parameters. Returns: result
capture_blueprintC
Capture a layout, including sandbox surfaces, with native blueprint settings.
Inputs: area (required), surface (required), label, include_tiles, +1 more. Returns: result
configure_entityC
Configure a nearby machine, station or control behavior using native entity methods.
Inputs: name, recipe, rotate, surface, +5 more. Returns: result
craftC
Queue hand crafting using real ingredients and game time. Returns an action ID.
Inputs: recipe (required), count, quality. Returns: result
create_planB
Freeze an ordered plan of native blueprints without building anything.
Each component is {ref,position:{x,y},direction:0|4|8|12,label?}. Include factory blocks, stations, signals and rail book segments in one plan.
Inputs: surface (required), components (required), label. Returns: result
execute_luaA
Run explicit administrative Lua for advanced game/mod capabilities not covered above.
Use rcon.print(helpers.table_to_json(...)) to return data. Obtain the independent character through remote.call('factorio_llm_use','get_agent'). This has full game scripting power: use the specific tools for ordinary gameplay and respect the user's task scope.
Inputs: code (required). Returns: result
export_blueprintB
Export an exact blueprint or book record as a standard Factorio string.
Inputs: ref (required). Returns: result
factorio_pingA
Check the connection, game version and supported operations.
Inputs: no named parameters. Returns: result
find_sitesB
Find candidate footprints without existing structures, water or cliffs.
This is terrain screening. Plan rail approaches, grid alignment, utilities and future expansion separately from the returned footprints, using the user's blueprint standards.
Inputs: ref (required), area (required), surface (required), step, +4 more. Returns: result
get_action_statusB
Read completion, cancellation or failure of the current or most recent action.
Inputs: action_id. Returns: result
get_agent_statusA
Read the independent AI character's actual inventory, position and action.
Inputs: no named parameters. Returns: result
get_worldB
List surfaces, sandbox surfaces, players, forces and simulation state.
Inputs: no named parameters. Returns: result
import_blueprintC
Import an exported blueprint or nested book into bridge-owned storage.
Inputs: data (required). Returns: result
inspect_blueprintB
Read footprint, quantities, stations, grid snapping and optional full native entities.
Inputs: ref (required), include_entities. Returns: result
inspect_entityB
Inspect an entity, including inventory indices and connected rails. No reach required.
Inputs: name, surface, position, unit_number. Returns: result
inspect_planB
Read a persistent construction plan and its application state.
Inputs: plan_id (required). Returns: result
list_prototypesC
Discover installed base, expansion and mod prototypes by name.
Inputs: kind, limit, query, offset. Returns: result
list_recipesC
Read real recipe ingredients, products, category, energy and research availability.
Inputs: limit, query, offset, include_locked. Returns: result
mine_entityC
Mine resources or recover structures using real mining time and interaction reach.
Inputs: name, count, surface, timeout, +2 more. Returns: result
move_toC
Walk with the engine pathfinder. Returns an action ID; never teleports.
Inputs: x (required), y (required), within, surface, +1 more. Returns: result
observeB
Read any entity prototypes in an area. Pagination is independent of entity type.
area: {left_top:{x,y},right_bottom:{x,y}}. Detailed results include fluid, inventory, recipe, power and rail-connection data when supported by the entity.
Inputs: area, limit, names, types, +5 more. Returns: result
place_entityB
Build any item.place_result prototype from the AI inventory within normal reach.
There is no entity whitelist. The engine checks collisions and placement rules. For complete layouts, tiles, wires and settings, use native blueprint plans.
Inputs: item (required), position (required), quality, direction, +1 more. Returns: result
preview_planB
Draw temporary footprint overlays. Does not create ghosts or start robot construction.
Inputs: plan_id (required), seconds. Returns: result
researchC
Read research and available technologies; optionally queue a technology normally.
Inputs: force, start. Returns: result
shoot_atB
Aim/shoot for a bounded duration with real weapons/ammo; executed per tick by the mod.
This primitive does not establish reliable autonomous combat or tactical threat response.
Inputs: position (required), seconds. Returns: result
trainsB
Inspect trains, schedules and carriages; modify one explicit train ID when requested.
schedule uses Factorio's TrainSchedule structure. Groups and interrupts are available through get_schedule() in the advanced Lua tool; a basic schedule is a separate interface.
Inputs: surface, schedule, train_id, manual_mode, +1 more. Returns: result
transfer_itemsB
Transfer real items to/from a nearby entity.
Discover inventory indices with inspect_entity. inventory accepts a numeric index or a defines.inventory name. No per-entity role whitelist.
Inputs: item (required), count (required), direction (required), name, +5 more. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 29 tools
Most tools target clearly distinct resources or actions (move_to, mine_entity, craft, place_entity, trains, research, plan tools, blueprint tools). There is mild overlap in the read/status cluster (observe vs inspect_entity, get_world vs get_agent_status vs get_action_status, factorio_ping), but the descriptions draw usable boundaries (area scan vs single-entity inspection, world state vs agent state vs action state).
The dominant pattern is verb_noun (cancel_action, get_world, mine_entity, transfer_items, capture_blueprint, create_plan, apply_plan). A handful of deviations exist (factorio_ping, and bare verbs/nouns like observe, craft, research, trains), but they are short, idiomatic, and still unambiguous rather than chaotic.
29 tools is heavy by the usual 3-15 guideline, though the Factorio domain genuinely spans world state, entities, crafting, trains, research, blueprints, plans, combat and a Lua escape hatch, so most tools earn their place. It sits just past the threshold where the surface starts to feel like an API dump rather than a scoped set.
Coverage is broad and lifecycle-aware: observation, action execution/status/cancel, placement, configuration, recipes/research, blueprint capture/import/export/inspect, site finding, and plan create/inspect/preview/apply, with execute_lua as a documented escape hatch. Gaps are minor: no explicit deconstruction/ghost-removal operation, and combat is explicitly acknowledged as a non-tactical primitive.
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to control Unreal E…
Manage NodePal Minecraft servers, worlds, mods, backups and console from AI agents.
MCP server for AI dialogue using various LLM models via AceDataCloud
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceBidirectional chat bridge between Factorio and Claude Code via MCP protocol, enabling players to send /companion commands and receive AI responses.16MIT
- AlicenseAqualityDmaintenanceEnables control and inspection of a Factorio 2.0 server via RCON, with tools for administration, player management, game state queries, and Lua execution.19ISC
- FlicenseNot gradedqualityCmaintenanceEnables MCP clients to query a live Factorio 2.0 world through bounded read-only operations covering spatial, inventory, resource, and diagnostic data over loopback RCON.1-
- AlicenseBqualityBmaintenanceEnables an AI agent to control a single Factorio character through normal player mechanics, including job-based walking, mining, crafting, building, and perception within fog-of-war constraints.443MIT