Notes /
Building an MCP server for a video game
I wanted to ask Claude why my Satisfactory factory was short on screws without digging through menus. So I built an MCP server that lets it look at the factory while I play. It can only look.
01
What MCP is
The Model Context Protocol is a standard way to give a language model tools: a server lists what it can do, and the model calls those tools when a question needs them. Claude speaks it in claude.ai and in Claude Code, so one server works in both.
02
The path a question takes
The game runs on my Linux PC. Claude runs somewhere else entirely. Four pieces connect them:
- ClaudeDecides it needs a tool, say
find_bottlenecks, and calls it - WorkerThe MCP server on Cloudflare Workers. Checks that it’s me, then asks the game for data
- TunnelA Cloudflare Tunnel carries the request to my PC, behind Cloudflare Access
- FRM modFicsit Remote Monitoring runs a small web server inside the game and answers with JSON
The tunnel is the part I like most. A small program on my PC keeps an outgoing connection to Cloudflare open, so nothing on my PC is open to the internet. Cloudflare Access sits in front of it, and only the Worker has the credentials to get through. The Worker itself only lets one account sign in: mine.
The same tools also run as a local server for Claude Code on the PC itself. That version talks to the mod directly, with no Worker and no tunnel.
03
Why it can only read
The mod can also change things. It has endpoints that switch buildings on and off and flip power switches. I left every one of them out. The server only calls endpoints on a fixed list of read-only ones, and every tool tells Claude that it doesn’t change anything.
Two reasons. A model that misreads a question should never be able to turn off half my factory. And the server is reachable from the internet, so the less it can do, the less there is to protect. Finding out what’s wrong is what I wanted help with. Fixing it is the part of the game I enjoy.
04
What I learned
- Raw data is the wrong answer. The mod returns large JSON with every machine in it. Passing that through fills Claude’s context, and it still has to do the maths. So the tools do the maths and return short text: how much of an item is made and used now and at full speed, or which stalled machines cost the most output per minute.
- The data doesn’t say what’s wrong. Nothing in it says “blocked”. The server works it out: a machine whose output can’t fit another cycle is blocked, one without enough input for a cycle is starved, and one below 95% is underperforming.
- Test against the real thing. I saved each endpoint’s response from the running game and the tests run against those files, so they don’t need the game open.
- Games aren’t servers. Starting the mod’s web server a second time in one session crashes the game. That one is in the README now, in bold.
The case study goes further into the tools, the sign-in and the error messages.