
jerome3o/factorio-mcp
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
Messing around with an MCP server that writes and runs lua scripts on my factorio server
개요
A Model Context Protocol (MCP) server for managing Factorio servers using Claude. This repository contains two main components: 1. An HTTP backend that securely wraps RCON commands (backend/server.py) 2. An MCP server that provides a high-level interface for Claude (factorio_mcp.py) The backend server provides a secure HTTP interface to Factorio's RCON, requiring API key authentication. This isolates the RCON password and provides a clean HTTP interface for the MCP server. - GET / - Health check - POST /execute_command - Execute RCON command - Requires X-API-Key header - Body: {"command": "your command"} The MCP server provides a high-level interface for Claude to interact with Factorio, built using FastMCP.
README
Factorio MCP Server 🏭
A Model Context Protocol (MCP) server for managing Factorio servers using Claude. This repository contains two main components:
- An HTTP backend that securely wraps RCON commands (backend/server.py)
- An MCP server that provides a high-level interface for Claude (factorio_mcp.py)
Architecture
flowchart LR
Claude --> MCP_API --> HTTP_Backend --> Factorio_Server
Backend Server
The backend server provides a secure HTTP interface to Factorio’s RCON, requiring API key authentication. This isolates the RCON password and provides a clean HTTP interface for the MCP server.
Setup
- Install requirements:
pip install fastapi uvicorn python-dotenv mcrcon
- Create a .env file:
RCON_HOST=localhost # Your Factorio server hostname
RCON_PORT=27015 # Your Factorio RCON port
RCON_PASSWORD=xxx # Your Factorio RCON password
API_KEY=xxx # Generate a secure API key (only supports one api key, for your MCP server to use)
- Run the server:
uvicorn backend.server:app --host 0.0.0.0 --port 8000
API Endpoints
GET /- Health checkPOST /execute_command- Execute RCON command- Requires
X-API-Keyheader - Body:
{"command": "your command"}
- Requires
MCP Server
The MCP server provides a high-level interface for Claude to interact with Factorio, built using FastMCP.
Features
- Execute arbitrary Lua commands with explanations
- Player management (teleport, give items)
- Server monitoring
- Screenshot capabilities
Setup
- Install fastmcp:
pip install fastmcp
- Install the MCP server:
fastmcp install factorio_mcp.py -e API_KEY=your_backend_api_key
Available Tools
execute_command(command: str)- Execute raw RCON commandsrun_lua(code: str, explanation: str)- Run Lua code with announcementsget_player_count()- Check online playerssend_message(message: str)- Broadcast to all playersgive_items(player: str, item: str, count: int)- Give items to playersteleport_player(player: str, x: float, y: float)- Teleport playersget_player_info(player: str)- Get player detailstake_screenshot(player?: str, resolution?: Dict)- Take screenshots
설치
This server does not publish a one-line install command.
Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →