WF

widami/factomcp

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

10 stars 4 forks 品質 69 トレンド 18MIT

Basic MCP server to control a Factorio Player via RCON

概要

An MCP server that lets Claude play Factorio. Claude can walk around, mine resources, place buildings, manage research, and build out a factory — all through natural language. It's slow, makes spatial reasoning mistakes, and burns through tokens fast. But it works, and it's genuinely fun to watch. The server connects to a running Factorio instance via RCON and exposes a set of MCP tools that execute Lua commands in the game. Claude uses these tools to perceive the game state and take actions as the player. - Factorio (tested on 2.0) - Python 3.10+ - Claude Code (or any MCP-compatible client) - The server must run on the as Factorio RCON only works in multiplayer mode. You need to either: Then start Factorio normally and open a multiplayer (LAN) game. Factorio supports a number of hidden configuration options that are not normally shown in the GUI.

README

以下は原文 README の抜粋です。原文を見る。

FactoMCP

An MCP server that lets Claude play Factorio. Claude can walk around, mine resources, place buildings, manage research, and build out a factory — all through natural language.

Fair warning: It’s slow, makes spatial reasoning mistakes, and burns through tokens fast. But it works, and it’s genuinely fun to watch.

How it works

The server connects to a running Factorio instance via RCON and exposes a set of MCP tools that execute Lua commands in the game. Claude uses these tools to perceive the game state and take actions as the player.

Requirements

  • Factorio (tested on 2.0)
  • Python 3.10+
  • Claude Code (or any MCP-compatible client)
  • The server must run on the same machine as Factorio

Setup

1. Configure RCON in Factorio

RCON only works in multiplayer mode. You need to either:

Option A — start from the command line:

factorio --start-server mysave.zip --rcon-port 25575 --rcon-password CHANGE_ME

Option B — start a local multiplayer game and set RCON in config.ini:

[rcon]
rcon-port=25575
rcon-password=CHANGE_ME

Then start Factorio normally and open a multiplayer (LAN) game.

Option C — configure via the in-game GUI:

Factorio supports a number of hidden configuration options that are not normally shown in the GUI. They can be accessed by holding CTRL + ALT when clicking the “Settings” button in the pause menu, which will cause a new button labeled “The rest” to appear. The RCON port and password settings are in there.

2. Install the server

git clone https://github.com/WidAmi/FactoMCP.git
cd FactoMCP
python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -r requirements.txt

3. Configure the MCP connection

The repo includes a mcp.json.example you can use as a starting point. Copy it to .mcp.json and edit it to match your setup:

{
  "mcpServers": {
    "factomcp": {
      "type": "stdio",
      "command": "/path/to/FactoMCP/.venv/bin/python",
      "args": ["/path/to/FactoMCP/server.py"],
      "env": {
        "RCON_HOST": "127.0.0.1",
        "RCON_PORT": "25575",
        "RCON_PASSWORD": "CHANGE_ME"
      }
    }
  }
}

Or set the environment variables manually and run:

RCON_PASSWORD=CHANGE_ME python server.py

4. Connect Claude Code

From the FactoMCP directory, start Claude Code:

claude

Claude Code will automatically pick up .mcp.json. You can verify the server connected with /mcp.

5. Start playing

With Factorio running and Claude Code connected, just tell Claude what to do:

Take a look around and find the ore patches
Build a basic iron smelting setup near the iron ore
Set up automated coal mining to keep the furnaces running

Environment variables

Variable Default Description
GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "factomcp": { "type": "stdio", "command": "/path/to/FactoMCP/.venv/bin/python", "args": ["/path/to/FactoMCP/server.py"], "env": { "RCON_HOST": "127.0.0.1", "RCON_PORT": "25575", "RCON_PASSWORD": "CHANGE_ME" } } } }