loading…
Search for a command to run...
loading…
Bidirectional chat bridge between Factorio and Claude Code via MCP protocol, enabling players to send /companion commands and receive AI responses.
Bidirectional chat bridge between Factorio and Claude Code via MCP protocol, enabling players to send /companion commands and receive AI responses.
Bidirectional chat bridge between Factorio and Claude Code via MCP protocol.
Bidirectional chat working between Factorio and Claude Code via RCON.
bun install
Windows:
xcopy /E /I factorio-mod "%APPDATA%\Factorio\mods\ai-companion"
Linux/Mac: See factorio-mod/README.md
Edit %APPDATA%\Factorio\config\config.ini and add these lines (if not already present):
local-rcon-socket=127.0.0.1:34198
local-rcon-password=factorio
Or use the hidden settings GUI:
local-rcon-socket to 127.0.0.1:34198local-rcon-password to factorioImportant: RCON only works in multiplayer mode (even if playing solo).
bun run src/rcon/test-connection.ts
Expected output:
✅ RCON connected on attempt 1
✅ Connection successful!
✅ RCON is working!
bun run src/index.ts
Expected output:
🚀 Starting Factorio MCP Server...
✅ RCON connected on attempt 1
📡 RCON connected to Factorio
✅ MCP server running on stdio
💡 Server is ready! Claude Code can now use:
- get_companion_messages
- send_companion_message
The .mcp.json file in this project root configures Claude Code to use this server.
Claude Code will automatically start the MCP server when needed.
In Factorio chat:
/companion Hello Claude! Can you help me?
In Claude Code:
Use the get_companion_messages tool
Claude will see:
[
{
"player": "YourName",
"message": "Hello Claude! Can you help me?",
"tick": 12345
}
]
Claude can respond:
Use send_companion_message with "Hello! I'm here to help!"
In Factorio, you'll see:
[AI Companion] Hello! I'm here to help!
get_companion_messagesGet unread messages from Factorio chat starting with /companion.
Returns: Array of {player, message, tick}
send_companion_messageSend a message to Factorio chat as AI Companion.
Input: { message: string }
Factorio (Lua mod captures /companion chat)
↕ RCON (TCP port 27000)
Node.js MCP Server (Bun)
↕ MCP Protocol (stdio)
Claude Code (You!)
"Connection failed"
"No messages"
/companion <message> in Factorio chat (not just "companion")"Command not found"
bun --version to verify# Run tests
bun test
# Test RCON connection
bun run src/rcon/test-connection.ts
# Start MCP server
bun run src/index.ts
Inspired by Factorio Learning Environment patterns and best practices.
Выполни в терминале:
claude mcp add factorio-ai-companion -- npx Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.