Selected work / Case study

Satisfactory MCP

A remote MCP server that lets Claude look at the Satisfactory factory I’m playing, while I play it. It can tell me what’s stuck and why. It can’t change anything.

When
2026
Built with
TypeScript, MCP TypeScript SDK, zod, Vitest
Runs on
Cloudflare Workers, Cloudflare Tunnel and Access, the Ficsit Remote Monitoring mod
Sign-in
OAuth, through GitHub, for one allowed account
Code
Private repository

01

What it’s for

Satisfactory is a factory-building game. Past a few hundred machines, finding out why something is short means walking the factory and opening menus. The Model Context Protocol is a standard way to give a language model tools, so I gave Claude tools that can read the factory.

  1. What’s slowing my factory down?Calls find_bottlenecks: 149 of 294 machines aren’t at full speed. Worst are 16 copper refineries with full outputs, 695 ingots a minute lost
  2. Why is copper backing up?Calls item_balance for Copper Ingot: the 32 constructors that turn it into copper sheet are all blocked too
  3. So what do I fix first?Nothing takes the copper sheet away. Give it somewhere to go, then add 10 ingots a minute, because at full speed copper falls short
The tool results are real, from my save on 2 November 2026. The last answer is Claude’s reading of them.

02

How a question reaches the game

The game runs on my Linux PC. Claude runs in claude.ai or in Claude Code, anywhere. Four pieces sit between them:

  1. ClaudePicks a tool and calls it with a signed-in token
  2. WorkerChecks the token, runs the tool and turns the game’s data into short text
  3. TunnelCarries the Worker’s requests to my PC, behind Cloudflare Access
  4. FRM modFicsit Remote Monitoring serves the running game’s data as JSON

The tools themselves don’t know which way they’re reached. The same code also runs as a local server for Claude Code on the PC, talking to the mod directly. Only the entry point and the connection settings differ.

03

Seven tools, all read-only

  • factory_overview: power, machine counts by state, and what’s made and used, now and at full speed
  • find_bottlenecks: stalled machines, grouped and ranked by the output they lose
  • item_balance: who makes and who uses one item, what’s in storage, and why it’s short or backed up
  • power_status: each power circuit’s headroom, batteries and fuse risk, and the generators’ fuel
  • storage_search and machines: where an item is kept, and individual buildings by type, recipe or state
  • raw_frm: a last resort that returns one endpoint’s data, filtered and cut short

The mod can also switch buildings on and off and flip power switches. None of that is reachable. The server keeps a fixed list of about ninety read-only endpoints, taken from the mod itself, and the write endpoints aren’t on it. The list is checked again when a request is made, not only by the type checker, because a tool’s input comes from the model at runtime.

One read-only endpoint is left out too: getAll, which bundles everything and is slow enough to stall the game.

Every tool also tells the client that it’s read-only and changes nothing. A model that misreads a question should never be able to turn off half a factory. And the server is reachable from the internet, so the less it can do, the less there is to protect.

04

Summaries, not raw data

The mod answers with large JSON, a record for every machine. Passed straight through, that fills Claude’s context and still leaves it to do the arithmetic. So the tools do the arithmetic and answer in a few lines of text.

The data doesn’t say what’s wrong with a machine, either. The server works it out:

  • Output blocked when an output slot can’t fit another cycle
  • Input starved when an input holds less than one cycle needs
  • Underperforming when it runs below 95% of full speed
  • Paused, unconfigured, no power after a blown fuse, or no fuel

One tool call can read the same endpoint from several places. Each call gets its own small cache, so every endpoint is fetched once per call and all the numbers in one answer come from the same moment:

export function memoizeClient(client: FrmClient): FrmClient {
  const cache = new Map<string, Promise<unknown>>();
  return {
    get<T>(endpoint: ReadEndpoint): Promise<T> {
      let pending = cache.get(endpoint);
      if (!pending) {
        pending = client.get(endpoint);
        cache.set(endpoint, pending);
      }
      return pending as Promise<T>;
    },
  };
}

05

A sign-in only I get through

A remote MCP server is a URL on the internet, so it needs a sign-in. The Worker is its own OAuth server, built on Cloudflare’s OAuth provider library, and Claude registers itself with it the first time it connects. After a consent page, it sends me to sign in with GitHub, and only a fixed list of GitHub accounts gets a token.

  • Checked twice. The account is checked at sign-in and again on every tool call, so taking an account off the list works straight away, without revoking anything.
  • GitHub’s token isn’t kept. The server only needs to know who signed in. It reads the account, then revokes GitHub’s token at once.
  • Tokens are narrow. They last an hour, and they’re for this one server, with a read-only scope.

Behind the Worker, the tunnel has its own lock. Cloudflare Access sits in front of it and lets through only requests carrying the Worker’s service credentials. On my PC, cloudflared keeps an outgoing connection to Cloudflare open, so the tunnel works without opening a single port to the internet.

06

Saying which part is down

There are four things that can be off: the game, the mod’s web server, the tunnel and the Access credentials. “Request failed” doesn’t help with any of them. So every failure becomes one sentence that names the part and what to do about it:

  • the tunnel isn’t connected, so check the service on the PC
  • the tunnel is up but the game isn’t answering, so start the mod’s web server
  • Access rejected the Worker’s credentials, so they were rotated or expired
  • the game didn’t answer within ten seconds, so it may be loading a save

Redirects aren’t followed. If Access ever answers with its login page, that’s reported as a credentials problem, not parsed as game data. And no error ever includes a stack trace.

07

Tests without the game running

I saved the response of every endpoint from the running game, about 65 hours into a save, and the tests run against those files. Fifty-two tests cover the tools, the machine states, the error for each failure, the endpoint list and the sign-in pages. They run in about a third of a second, with no game, no tunnel and no network.

Real data caught things made-up data wouldn’t. Generators burn fuel that the mod’s own production statistics leave out, and fluids aren’t in those statistics at all. A test now checks that the server’s totals match the mod’s for every solid item, except generator fuel, which it counts on purpose.

08

Looking back

  • The saved responses come from one save at one moment. An early-game save, or one with other mods’ buildings, would test the parts this factory doesn’t use.
  • The 95% line for “underperforming” is a guess that worked on my factory. It should be a setting, or come from how much output a machine actually loses.
  • The weakest link isn’t in the code. The mod’s web server has to be started by hand once per game launch, and starting it twice crashes the game. A tool that reports “not started” clearly helps, but it doesn’t fix that.

Get in touch

I'm looking for an internship from autumn 2027. Email is the quickest way to reach me.

My email address appears when JavaScript is on. LinkedIn and GitHub work without it.