# Debug your game with real player data in Claude Code, Cursor or Codex

> Yes, once the agent can read what players hit. Connect an MCP server with your game's player data to Claude Code, Cursor or Codex, then let the agent triage the biggest problem, read the evidence, reproduce and fix it, playtest against a baseline, and confirm the fix with real players in the next version. Commands, config and prompts included.

Website: https://www.glitchless.gg/debug-game-with-real-player-data.html · Claude Code, Cursor and Codex, with web, Unity, Godot, Unreal and GameMaker games

Yes. A coding agent can debug your game from what players actually hit, once it can read that data. Connect an MCP server that serves your players' sessions (frame times, errors with their stacks, where players die or quit, which version they ran) and the agent can pick the biggest problem, find the code behind it, fix it and check the fix. Without that data, it reads your code and guesses.

This guide covers why the data matters, how to connect it in Claude Code, Cursor and Codex, the loop that gets a fix to players, prompts to start with, and what the agent can and can't see.

## The short answer

- An agent fixing a game blind sees the code, not what players hit, so it changes what looks suspicious and can't tell whether that helped.
- Give it player data over MCP: `claude mcp add` in Claude Code, `.cursor/mcp.json` in Cursor, `codex mcp add` in Codex.
- Then let it work a loop: triage the biggest problem, read the evidence, reproduce and measure, fix, playtest against a baseline, ship a new version, and compare versions with real players.
- It sees anonymous sessions: frame times, errors, levels, and devices in coarse tiers. No names, accounts or emails.
- For a browser game, WebMCP lets the agent use the running game too: measure frames, inspect the scene, load a level.

## Why an agent fixing a game blind guesses

Ask a coding agent why your game stutters and it reads the code and lists everything that could be slow. It can't know that the stutter is on level 3, mostly on low-end phones, in the second after the boss spawns, and that it started with your last update. It can't know that most of your crashes are one missing null check in the inventory, either. So it changes what looks suspicious, and it can't tell you whether that helped.

Your players have the evidence: which level, which device, what happened just before. An agent that can read it works the way you would with a dashboard open. It starts with the problem that hits the most players, reads the stack or the hitch, goes to that code, and measures before and after.

What helps most, from any source:

- **Frame times by level, device and version**, as percentiles, with the hitches and what was happening in the second before each one.
- **Errors grouped by cause**, with the stack, how many players hit each one, and the game events just before it.
- **Where players get stuck**: level starts and completions, deaths and where they happen, players who quit right after dying.
- **Versions**, so a fix can be checked against the build before it.

Any MCP server that serves this kind of data works the same way. The examples below use [Glitchless](https://www.glitchless.gg/index.md), which is open source and built for it.

## Connect player data in Claude Code

MCP, the Model Context Protocol, is the open standard coding agents use to call outside tools. You add a server once, and the agent can call its tools in every session.

Glitchless has two servers with the same tools. **glitchless-mcp** runs on your computer with `npx`, and it can also run playtest bots, so it does the whole loop from your game's folder. The **hosted server** at `https://api.glitchless.gg/mcp` signs you in through the browser and suits apps that connect by URL, but it can't run playtests.

Claude Code:

```bash
# Sign in to your Glitchless workspace once: it prints a link and a code to approve
npx -y glitchless-mcp login

# Add the server to Claude Code
claude mcp add glitchless -- npx -y glitchless-mcp

# Or a Glitchless server you run yourself: point it at its address
claude mcp add glitchless -e GLITCHLESS_URL=http://localhost:7777 -- npx -y glitchless-mcp

# Or the hosted server: then run /mcp in Claude Code and choose glitchless to sign in
claude mcp add --transport http glitchless https://api.glitchless.gg/mcp
```

Already connected Glitchless in claude.ai? Claude Code signed in to the same Claude account picks up claude.ai's connectors, so Glitchless is there with nothing to add. `/mcp` lists it.

`login` shows a link and a code, you approve the code in the Glitchless dashboard, and it saves a workspace key in `~/.config/glitchless/credentials.json`, readable only by you. Every tool then takes the game by name. The key acts as you, with your role in the workspace, and never deletes data or touches billing.

`claude mcp add` adds a server for you in the current project. Add `--scope user` to have it in every project.

## Connect player data in Cursor

Cursor reads MCP servers from `.cursor/mcp.json` in the project, or from `~/.cursor/mcp.json` for every project. Sign in first with `npx -y glitchless-mcp login`, then add:

.cursor/mcp.json:

```json
{
  "mcpServers": {
    "glitchless": {
      "command": "npx",
      "args": ["-y", "glitchless-mcp"]
    }
  }
}
```

For a Glitchless server you run yourself, add `"env": { "GLITCHLESS_URL": "http://localhost:7777" }`. For the hosted server, put `"url": "https://api.glitchless.gg/mcp"` in place of the command and arguments; Cursor supports the OAuth sign-in it asks for. If you ever put a key in this file, add the file to `.gitignore`.

## Connect player data in Codex

Codex adds servers with `codex mcp add`, or in `~/.codex/config.toml`.

Codex:

```bash
# Sign in once, then add the server
npx -y glitchless-mcp login
codex mcp add glitchless -- npx -y glitchless-mcp

# Or the hosted server, signing in through the browser
codex mcp add glitchless --url https://api.glitchless.gg/mcp
codex mcp login glitchless
```

In `config.toml` the same server is a `[mcp_servers.glitchless]` table with `command = "npx"` and `args = ["-y", "glitchless-mcp"]`. Any other MCP client works the same way: the command is `npx` and the arguments are `-y glitchless-mcp`.

To check the connection in any of the three, ask the agent to list your games in Glitchless. It calls `glitchless_list_games`.

## The loop: from the biggest problem to a fix players feel

Once it's connected, the agent can work the way you would, one problem at a time. These are the steps, with the Glitchless tool for each:

1. **Triage.** `glitchless_triage` ranks what's wrong by severity and by how many players it hits: stutter on a level and what it lines up with, memory that keeps growing, top errors, difficulty spikes, a new version doing worse than the last. The agent picks the top one and says why.
2. **Read the evidence.** For stutter, `glitchless_performance` with the `level`: what caused the hitches (scripts, shader compiles, garbage collection, asset loads), the gauges that spike and the events just before each one, split by device tier, browser, platform and version. For a crash, `glitchless_get_error` with its fingerprint: the stack and the game events before it. For a level players quit, `glitchless_death_hotspots` and `glitchless_player_funnel`. `glitchless_session` opens one session's whole timeline.
3. **Reproduce and measure.** The agent finds the code from the evidence (an event name, a function in the stack, the level data near a hotspot) and reproduces the problem: in a browser game with the running game's own tools (below), in Unity, Godot, Unreal or GameMaker by running a build with `--glitchless-measure=SECONDS` (`-glitchless-measure` in Unreal and GameMaker). It writes down the 95th percentile, the worst frame and the draw calls.
4. **Save a baseline, then fix.** Before it touches code, `glitchless_playtest` with `save_as: "baseline"` has your autoplay bots play the current build (web games; for an engine build, the measure output is the baseline). Then the agent fixes the cause, not the symptom.
5. **Playtest against the baseline.** It repeats the same reproduction and measures again, then runs `glitchless_playtest` with no arguments to compare every scenario. A FAIL means the work isn't done.
6. **Ship with a new version.** Bump the version the game reports (`version` in `Glitchless.init`, Unity's `Application.version`, Godot's `application/config/version`, Unreal's `ProjectVersion`), so sessions with the fix can be told apart from sessions without it.
7. **Compare versions with real players.** Once players have the new build, `glitchless_compare_versions` puts the two versions side by side: your game's own stats, frame time overall and per level, hitches per minute, crash-free sessions and level completion.

The playtest step can also run on every pull request, without an agent: see [playtest bots in CI](https://www.glitchless.gg/playtest-bots-in-ci.md).

## Prompts to start with

Plain requests work. Naming the step you want (triage, the evidence, a comparison) helps the agent pick the right tool.

Prompts:

```text
What's wrong with my game this week? Use Glitchless to find the problem that hits the most players, show me the evidence, and propose a fix before you change anything.

Players say level-3 stutters. Read its frame times by device tier in Glitchless, tell me what the hitches line up with, then find the code that causes them.

Fix the top crash in Glitchless: read its stack and the events before it, reproduce it, fix it, and tell me how many sessions it hit.

Where do players die on level-2, and where do they quit? Show me the hotspots and suggest a change to the level, but don't edit it until I say so.

I shipped 1.4.1 with the fix. Compare it with 1.4.0 for real players in Glitchless.
```

## What the agent can and can't see

The agent reads what your game's SDK sent, through the permissions you gave its connection.

- **It sees** frame times and hitches by level, device tier, browser, platform and version; errors with their stacks and the game events before them; level starts, completions, deaths and quits; the events and session properties your game sends (a mode, a rank tier); bug reports players chose to send; and on Glitchless Cloud, store reviews and revenue for a game you connected to them.
- **It doesn't see who players are.** By default a session has no player ID at all. Install mode adds a random ID made on the device, for counting returning players, tied to no account, device or advertising ID. The SDKs collect no names, emails or accounts, and they and the server drop session properties that name a person or look like an email address, a phone number or an ID.
- **Positions are off by default.** Where players died or walked is sent only in full privacy mode, or when the game turns positions on.
- **Bots don't count as players.** Sessions a game marks as a bot's (`--autoplay` in the engine SDKs, `sessionType: 'synthetic'` in the browser SDK) stay out of your players' numbers.
- **It can't delete or reconfigure.** A connection acts as you, with your role in the workspace. It can't delete your games' data, change billing or change who's in the workspace.
- **What it reads goes to the agent's provider**, under that provider's terms, like anything else in the chat.

## For a browser game: the running game's own tools

In a Three.js, Phaser, Babylon.js or PlayCanvas game, the Glitchless SDK also hands the agent the running game's tools over WebMCP. So instead of asking you to play and describe what happened, the agent loads the level, triggers the effect and measures it, in the game open in your browser.

The SDK registers `glitchless_live_performance`, `glitchless_measure` (frame stats over 1 to 30 seconds: percentiles, hitches with their causes, draw calls, leaks), `glitchless_inspect_scene`, `glitchless_errors`, `glitchless_game_events`, `glitchless_screenshot`, `glitchless_session` and `glitchless_annotate`, plus any game tool you add with `glitchless.registerTool()`. They're on unless `env` is `'prod'`.

To connect them, add the webmcp.dev bridge as a second MCP server: `claude mcp add webmcp -- npx -y @jason.today/webmcp@latest --mcp` in Claude Code, or the same command and arguments in Cursor and Codex. Open the game, ask the agent for a WebMCP token, and paste it into the WebMCP widget, the small square in the game's bottom-right corner. In a browser with the draft WebMCP API (`document.modelContext`), the SDK registers its tools there as well.

A game tool the agent can call:

```js
// Lets the agent jump to a level to reproduce what players hit there.
glitchless.registerTool(
  'mygame_load_level',
  'Jump straight to a level, as if the player had started it.',
  { type: 'object', properties: { level: { type: 'string', enum: ['level-1', 'level-2', 'level-3'] } }, required: ['level'] },
  async ({ level }) => game.loadLevel(level),
);
```

Unity, Godot, Unreal and GameMaker builds don't need WebMCP: the agent runs them with the measure flag. In the Unreal editor, Unreal MCP with the Glitchless Toolset plugin adds a `Measure` tool for Play In Editor. Setup for each: [web games](https://www.glitchless.gg/web.md), [Unity](https://www.glitchless.gg/unity.md), [Godot](https://www.glitchless.gg/godot.md), [Unreal](https://www.glitchless.gg/unreal.md).

## Set it up with Glitchless

[Glitchless](https://www.glitchless.gg/index.md) is open source: SDKs for web games, Unity, Godot, Unreal and GameMaker record how each session runs, a server turns that into findings, and the [MCP server](https://github.com/glitchless-gg/glitchless/blob/main/packages/mcp/README.md) hands it to your agent. Run the server yourself with Docker, or use Glitchless Cloud ([pricing](https://www.glitchless.gg/pricing.md)).

The setup prompt in the [docs](https://www.glitchless.gg/docs.md) adds the SDK to your game, connects the MCP servers and builds a dashboard, in any coding agent. To connect Claude, ChatGPT or another app by URL, see [connecting apps](https://www.glitchless.gg/connect.md).

Ask your coding agent:

```
Use Glitchless to find the problem that hits the most players in my game. Show me the evidence, save a playtest baseline, fix it, measure again and run the playtest. Then bump the version and tell me what to compare once players have the new build.
```

## Frequently asked questions

### Does the agent see my players' personal data?

No. By default each session is anonymous: no player ID, no name, no account, and the device only in coarse tiers. Install mode adds only a random ID for retention, and positions need full mode or the game turning them on. What the agent reads does go to its provider, under that provider's terms.

### Does it work with agents other than Claude Code, Cursor and Codex?

Yes, with any MCP client. The local server's command is `npx` with the arguments `-y glitchless-mcp`. Apps that connect by URL use `https://api.glitchless.gg/mcp` and sign in with OAuth.

### Can the agent change my game's data?

The read tools change nothing. A few tools change things when your connection allows it: saving a game's dashboard pages, creating a game, and making or revoking a read-only link to a board. No connection can delete your games' data, change billing or change who's in the workspace.

### What's the difference between the local and the hosted server?

They have the same tools, less the ones that act on your own computer. glitchless-mcp, run with `npx`, can also run playtest bots and send builds to a Steam Deck. The hosted server at `https://api.glitchless.gg/mcp` signs in through the browser and works from apps that can't start a process, such as claude.ai and ChatGPT.

### Do I need a browser game?

No. Unity, Godot, Unreal and GameMaker games send the same kind of player data, and their builds measure themselves with the measure flag, so the agent can check a fix. WebMCP is an extra for browser games: the agent drives the running game directly.

## Sources

- [Model Context Protocol: What is MCP?](https://modelcontextprotocol.io/docs/getting-started/intro)
- [Claude Code docs: Connect Claude Code to tools via MCP](https://code.claude.com/docs/en/mcp)
- [Cursor docs: Model Context Protocol](https://cursor.com/docs/context/mcp)
- [OpenAI: Model Context Protocol in Codex](https://developers.openai.com/codex/mcp)
- [WebMCP explainer](https://github.com/webmachinelearning/webmcp)
- [webmcp.dev](https://webmcp.dev)
- [glitchless-mcp README](https://github.com/glitchless-gg/glitchless/blob/main/packages/mcp/README.md)
- [Glitchless SDK README: WebMCP](https://github.com/glitchless-gg/glitchless/blob/main/packages/sdk/README.md#webmcp)
- [Glitchless: Connect Claude, ChatGPT and other apps](https://www.glitchless.gg/connect.html)
