Python MCP server that exposes RimWorld REST API (RIMAPI) endpoints as MCP tools and resources.
- Python 3.10+
mcp>=1.2.0
For this MCP server to work correctly, the RIMAPI mod must be installed and enabled in RimWorld, and a game save must be loaded (a running game session).
If you only need to run the script, install mcp:
python -m venv .venv
.\.venv\Scripts\python -m pip install mcp>=1.2.0RIMAPI_BASE_URL(defaulthttp://localhost:8765)
$env:RIMAPI_BASE_URL = 'http://localhost:8765'
.\.venv\Scripts\python src\mcp_server.pyNote: with stdio transport, the MCP client must start the server process. If you run it manually without a client, it may exit immediately when stdin closes.
Generic example for a MCP client that spawns a stdio server:
MCPServerStdio(
name="rimapi-mcp",
params={
"command": r"c:\\Projects\\RimAPI_MCP_Server\\.venv\\Scripts\\python",
"args": [r"c:\\Projects\\RimAPI_MCP_Server\\src\\mcp_server.py"],
"cwd": r"c:\\Projects\\RimAPI_MCP_Server",
"env": {
"MCP_TRANSPORT": "stdio",
"RIMAPI_BASE_URL": "http://localhost:8765",
},
},
)If the client does not accept absolute paths, set cwd and use args: ["src/mcp_server.py"].
Thanks to the RIMAPI mod by IlyaChichkov for making this MCP server possible:
https://github.com/IlyaChichkov/RIMAPI