glitchless-mcp 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # glitchless-mcp
2
2
 
3
- The [Glitchless](https://github.com/glitchless-gg/glitchless) MCP server. It lets any coding agent
4
- (Claude Code, Codex, Cursor or another MCP client) read how your game runs for real players, from a
5
- Glitchless server: ranked findings, frame-time breakdowns, errors, level funnels, death hotspots and
6
- version comparisons. It can also run playtest bots before and after a change, to check a fix.
3
+ The [Glitchless](https://github.com/glitchless-gg/glitchless) MCP server. Coding agents can build a game. They
4
+ don't know how anyone plays it. Glitchless tells them. Any coding agent (Claude Code, Codex, Cursor or another MCP
5
+ client) reads how players play your game, from a Glitchless server: where they stop and where they die, the game's
6
+ own events (modes, purchases), ranked findings on stutter, errors and crashes, multiplayer lag and version
7
+ comparisons, and on Glitchless Cloud what store reviews say and what the game earns. It can also run playtest bots
8
+ before and after a change, to check a fix.
7
9
 
8
10
  It's a stdio server. Run it with `npx`, no install needed:
9
11
 
@@ -29,7 +31,8 @@ billing or people. It deletes data only if you ticked "Delete games and their da
29
31
  then only a whole game, with its name repeated back. `npx -y glitchless-mcp whoami` shows where you're signed in, `logout` deletes the saved
30
32
  key, and Settings → Keys & access in the dashboard lists and revokes keys. An agent can also sign in from inside a
31
33
  chat with the `glitchless_sign_in` tool: it shows the link and code, and the running server switches over once you
32
- approve. The saved key is only ever sent to the server it was saved for: point `GLITCHLESS_URL` at another one (a
34
+ approve. In an agent that can open links for you (Claude Code does), it opens the approve page itself and waits for
35
+ you to approve it. The saved key is only ever sent to the server it was saved for: point `GLITCHLESS_URL` at another one (a
33
36
  meetup's own box) and the MCP server connects without it, so set `GLITCHLESS_API_KEY` if that server has a key.
34
37
 
35
38
  ## Serve it over HTTP yourself
@@ -113,6 +116,7 @@ above go in its environment.
113
116
  | `glitchless_match` | A multiplayer game's matches (the worst by lag or disconnects on request), or one match from every side, 30 seconds at a time: each player's ping, frame time and outcome, the server's ticks, and whether the whole lobby lagged at once (the server) or one player did (their connection) |
114
117
  | `glitchless_network` | Ping, lag (play over 150 ms), packet loss and disconnects by level, version, platform, kind of connection and region, with the worst matches and the network findings |
115
118
  | `glitchless_servers` | A game's dedicated servers in server mode: servers running now and their players, tick time against its budget by players connected, map and version, crashes with the matches they ended, and memory that climbs. Every other tool reads them with service `<game>.server` |
119
+ | `glitchless_feedback` | Tell the Glitchless team about a bug, a dead end, something missing or an idea while the agent works: a `message`, its `type` (bug, friction, missing, idea) and `impact` (blocked, worked_around, minor), and the `tool`, `task`, `expected`, `actual` and `engine` if it has them. Signed in to a Glitchless Cloud workspace it's sent at once and answers with the report's ID, which the agent tells the person; anywhere else nothing is sent, and it answers with a GitHub issue filled in with the report. 4,000 characters a report, 20 a day from a workspace |
116
120
  | `glitchless_playtest` | The game's autoplay bot plays it and the run is compared with a saved baseline ([glitchless-playtest](https://www.npmjs.com/package/glitchless-playtest)): a Unity, Godot, Unreal or GameMaker build from its `command`, a Roblox game in the open Roblox Studio (`engine: "roblox"`, over Studio's MCP server), or a web game in Chrome (needs Playwright in the game project). With `check_url`, a game check: bots play any web game someone posted (an itch.io page, github.io, Vercel), with nothing installed in it, on a desktop and a throttled phone, and make a report, a dashboard for that game and, on Glitchless Cloud, an unlisted share link to send its maker |
117
121
  | `glitchless_deck` | Build the game, send it to the paired Steam Deck, add it to the Deck's library and optionally start it ([glitchless-deck](https://www.npmjs.com/package/glitchless-deck); pair once with `npx glitchless-deck pair`); with `measure: true`, measure a Unity, Godot or Unreal build there and compare it with a saved run |
118
122
 
@@ -121,6 +125,41 @@ The reads take `hours`, `version`, `env` (e.g. `prod`), `session_type` (`user` f
121
125
  To let the agent drive the running game as well (measure frame times, inspect the scene, load a
122
126
  level), add the WebMCP server beside this one: `npx -y @jason.today/webmcp@latest --mcp`.
123
127
 
128
+ ## Skills
129
+
130
+ The server serves the Glitchless skills too, over MCP's
131
+ [Skills extension](https://modelcontextprotocol.io/extensions/skills/overview), so an agent whose client loads skills
132
+ from MCP servers gets them without installing a plugin:
133
+
134
+ | Skill | What it does |
135
+ | --- | --- |
136
+ | `instrument` | Adds Glitchless to a game, in its engine |
137
+ | `dashboard` | Works out what the game's developer wants to know, and designs the game's dashboard |
138
+ | `triage` | Finds the most important problem in a game, fixes it and checks the fix |
139
+ | `deck` | Sends a build to a Steam Deck on your network and measures it there (only from this server on your computer, not the hosted one) |
140
+
141
+ In Claude Code (v2.1.331 or later) they show under the server's name: `/glitchless:triage` for a server added as
142
+ `glitchless`. A client without skills over MCP gets the instrument and dashboard skills from the tools instead
143
+ (`glitchless_create_game` with `engine`, `glitchless_dashboard` with `guide: true`). `--no-skills` serves none, for a
144
+ client that has the skills already: the Glitchless plugin for Claude Code runs its copy of this server that way.
145
+
146
+ ## Background tasks and questions
147
+
148
+ Two MCP features this server uses when the agent's client says it supports them, on the call itself (protocol
149
+ 2026-07-28). Any other client gets the same answers as before.
150
+
151
+ - **Tasks.** A playtest or a game check takes minutes. A client that takes MCP tasks (Claude Code in an interactive
152
+ session) gets a task straight away and the agent keeps working while the bots play; it reads the result when
153
+ the task completes. Stopping the task stops the run: the browser closes, the build (and anything it started) is
154
+ killed or Studio's play test stops, and nothing is saved; that needs glitchless-playtest 0.5.0 or later. A call that
155
+ isn't a task runs to the end, as before. One run at a time in a project: a second call while one runs is refused. Tasks are served on stdio only (`npx glitchless-mcp`), and kept
156
+ for an hour after they finish, in the server's memory.
157
+ - **Questions (elicitation).** `glitchless_sign_in` opens the approve page for you, as above. Before
158
+ `glitchless_create_game` deletes a game, it asks you in a form, "Delete <game> for good?", every time, and deletes
159
+ only when you tick the box and accept. That's on top of the key's "Delete games and their data, for good", not instead of it. A
160
+ client that closes every question unanswered (Claude Code run headless, `claude -p`) can't delete a game this way:
161
+ the agent is told to send you to Settings → Game (with a link) to delete it yourself. The hosted server asks too, for clients on protocol 2026-07-28.
162
+
124
163
  ## License
125
164
 
126
165
  MIT
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "glitchless-mcp",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "mcpName": "io.github.glitchless-gg/glitchless",
5
- "description": "Coding agents can build a game. They can't see anyone play it. Glitchless lets them. The MCP server for Glitchless, game observability for coding agents: Claude Code, Codex, Cursor and others read real players' stutters, crashes, custom metrics and ranked findings in Unity, Godot, Unreal, Three.js, Roblox, Phaser and GameMaker games, build the game's own dashboard, and run playtest bots.",
5
+ "description": "Coding agents can build a game. They don't know how anyone plays it. Glitchless tells them. The MCP server for Glitchless, game observability for coding agents: Claude Code, Codex, Cursor and others read real players' stutters, crashes, custom metrics and ranked findings in Unity, Godot, Unreal, Three.js, Roblox, Phaser and GameMaker games, build the game's own dashboard, and run playtest bots.",
6
6
  "keywords": [
7
7
  "mcp",
8
8
  "mcp-server",
@@ -65,9 +65,9 @@
65
65
  "bundle": "esbuild src/index.js --bundle --platform=node --format=esm --target=node20 --external:playwright --outfile=../../plugin/glitchless/mcp/glitchless-mcp.mjs --banner:js=\"import { createRequire as __cr } from 'module'; const require = __cr(import.meta.url);\""
66
66
  },
67
67
  "dependencies": {
68
- "@modelcontextprotocol/server": "^2.4.0",
68
+ "@modelcontextprotocol/server": "~2.4.0",
69
69
  "zod": "^4.6.7",
70
- "glitchless-playtest": "^0.4.0",
70
+ "glitchless-playtest": "^0.5.0",
71
71
  "glitchless-deck": "^0.1.0"
72
72
  },
73
73
  "devDependencies": {
package/src/context.js CHANGED
@@ -6,10 +6,12 @@ import { AsyncLocalStorage } from 'node:async_hooks';
6
6
  import fs from 'node:fs';
7
7
  import os from 'node:os';
8
8
  import path from 'node:path';
9
- import { McpServer } from '@modelcontextprotocol/server';
9
+ import { McpServer, CLIENT_CAPABILITIES_META_KEY } from '@modelcontextprotocol/server';
10
10
  import { z } from 'zod';
11
+ import { serveSkills } from './served-skills.js';
12
+ import { TASKS, declaresTasks, runAsTask, serveTasks } from './tasks.js';
11
13
 
12
- export const VERSION = '0.22.0';
14
+ export const VERSION = '0.23.0';
13
15
 
14
16
  // Where `glitchless-mcp login` keeps its workspace key: { url, token, workspace: { id, name }, scopes }.
15
17
  export const CREDENTIALS_FILE = path.join(process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config'), 'glitchless', 'credentials.json');
@@ -92,6 +94,14 @@ export const workspaceIntake = () => conn().games?.intake ?? null;
92
94
  // for a connection without glitchless_create_game, which hands over the steps for the game's engine itself.
93
95
  export const SETUP_URL = 'https://raw.githubusercontent.com/glitchless-gg/glitchless/main/docs/agent-setup-prompt.md';
94
96
 
97
+ // Whether an agent asks the person before it sends the Glitchless team feedback (glitchless_feedback). Off, as
98
+ // Cloudflare's agent feedback is: the agent sends, tells the person what it sent at the end of its turn, and never
99
+ // sends once they've said not to. The tool's description and the server's instructions both take the sentence from
100
+ // here; the skills and the setup prompt only name the tool, so asking first is this one line.
101
+ export const FEEDBACK_ASKS_FIRST = false;
102
+ export const feedbackConsent = () =>
103
+ FEEDBACK_ASKS_FIRST ? 'Ask the person before sending each one, showing what you would send.' : 'You may send one without asking first, but never once the person has said not to.';
104
+
95
105
  // Whether this call's connection shows the tools that need the manage scope (over HTTP, by the scopes the person gave
96
106
  // it; on stdio every tool shows).
97
107
  export const canManage = () => {
@@ -133,11 +143,19 @@ export function forgetGame(id) {
133
143
  if (c.game === id) c.game = null;
134
144
  }
135
145
 
146
+ // The app this call comes from, as it named itself connecting (MCP's clientInfo): { name, version }. A server over
147
+ // HTTP is made anew for each request, so a client that said it only when it connected (before the 2026-07-28 protocol)
148
+ // is named by its connection instead (the hosted server's: the OAuth client's name), with no version.
149
+ export const clientApp = () => {
150
+ const info = calls.getStore()?.server?.server.getClientVersion?.();
151
+ return { name: info?.name || conn().client || null, version: info?.name ? info.version || null : null };
152
+ };
153
+
136
154
  // A workspace key names the game in x-glitchless-project. A key for one game sends the game a call names (or
137
155
  // GLITCHLESS_GAME) as x-glitchless-game, so Glitchless Cloud refuses it when it isn't the key's game instead of
138
156
  // answering, or writing, for the key's own game.
139
157
  async function headers(extra = {}) {
140
- const client = conn().client || calls.getStore()?.server?.server.getClientVersion?.()?.name || 'mcp';
158
+ const client = conn().client || clientApp().name || 'mcp';
141
159
  const named = !isWorkspace() && (calls.getStore()?.game || conn().game);
142
160
  return { 'x-glitchless-client': client, ...(apiKey() ? { 'x-glitchless-api-key': apiKey() } : {}), ...(isWorkspace() ? { 'x-glitchless-project': await projectFor(calls.getStore()?.game) } : {}), ...(named ? { 'x-glitchless-game': encodeURIComponent(named) } : {}), ...extra };
143
161
  }
@@ -211,9 +229,44 @@ export async function query(name, params = {}) {
211
229
  }
212
230
 
213
231
  // The tool call being answered: the game it names, the server answering it, the scopes its connection shows tools for
214
- // (over HTTP), and the meta of its last query, for windowNote().
232
+ // (over HTTP), the meta of its last query, for windowNote(), and its task when it runs as one (tasks.js).
215
233
  const calls = new AsyncLocalStorage();
216
234
 
235
+ // How a tool that takes a while says what it's doing, and hears that it should stop. log(message) is a progress
236
+ // notification on the call when its client gave a progressToken, or the task's statusMessage when the call runs as a
237
+ // task. signal, only when the call runs as a task, fires when the client cancels the task (or the call, before it
238
+ // answered). A call that isn't a task keeps running when its client gives up on it, as it always has: a client whose
239
+ // tool timeout cancels a long playtest still gets its baseline saved.
240
+ //
241
+ // cantStop() says the work ignores signal (an older glitchless-playtest), so a cancelled task says so instead of
242
+ // claiming the run stopped.
243
+ export function callProgress(ctx) {
244
+ const task = calls.getStore()?.task;
245
+ if (task) return { log: task.update, signal: task.signal, cantStop: task.cantStop };
246
+ const token = ctx?.mcpReq?._meta?.progressToken;
247
+ let step = 0;
248
+ const log = (message) => {
249
+ if (token != null) ctx.mcpReq.notify({ method: 'notifications/progress', params: { progressToken: token, progress: ++step, message } }).catch(() => {});
250
+ };
251
+ return { log, signal: undefined, cantStop: () => {} };
252
+ }
253
+
254
+ // Whether this call's client can ask the person something while the call runs (MCP elicitation): mode 'form', fields
255
+ // to fill in, or 'url', a page to open. A tool asks by returning inputRequired(…): a client on the 2026-07-28 protocol
256
+ // asks the person and calls again with the answer, and on an older connection the SDK sends the question itself and
257
+ // calls the tool again. It's read where the SDK reads it: the request's own capabilities on 2026-07-28, else what the
258
+ // client said when it connected. A server over HTTP never hears that (each request gets a server of its own, which
259
+ // couldn't take the answer either), so an older client is never asked there. A bare elicitation: {} is form only.
260
+ export function canElicit(ctx, mode = 'form') {
261
+ const call = calls.getStore();
262
+ const s = call?.server?.server;
263
+ const modern = String(s?.getNegotiatedProtocolVersion?.() ?? '') >= '2026-07-28';
264
+ const caps = modern ? ctx?.mcpReq?.envelope?.[CLIENT_CAPABILITIES_META_KEY] : call?.remote ? undefined : s?.getClientCapabilities?.();
265
+ const e = caps?.elicitation;
266
+ if (!e || typeof e !== 'object') return false;
267
+ return mode === 'url' ? e.url !== undefined : e.form !== undefined || e.url === undefined;
268
+ }
269
+
217
270
  // How the window was answered, when an agent should know: by day past 31 days, what is estimated, what a
218
271
  // view covers, a range cut to the plan's retention.
219
272
  function windowNote() {
@@ -288,7 +341,7 @@ export const common = {
288
341
  .min(0.25)
289
342
  .max(9600)
290
343
  .optional()
291
- .describe("Look-back window in hours (default 24), as far back as the workspace keeps data on Glitchless Cloud (the answer says when it starts later than asked). Past 744 (31 days) answers are by day. A window that takes more than 25 seconds to read is stopped and the tool says so: ask again with fewer hours. When Glitchless is busy with other large reads the tool says to try again in a few seconds. On Glitchless Cloud an answer reads at most 100,000 raw events in all (session_type, props, matches and positions read them), the latest ones, and its note says from when."),
344
+ .describe("Look-back window in hours (default 24), as far back as the workspace keeps data on Glitchless Cloud (the answer says when it starts later than asked). Past 744 (31 days) answers are by day. A window that takes more than 25 seconds to read is stopped and the tool says so: ask again with fewer hours. When Glitchless is busy with other large reads the tool says to try again in a few seconds. On Glitchless Cloud an answer reads at most 100,000 raw events in all (props, Steam filters, matches and positions read them, and session_type only over data stored before it was kept by type), the latest ones, and its note says from when."),
292
345
  version: z.string().optional().describe('Only include sessions from this game version'),
293
346
  steam_branch: z.string().optional().describe('Only include sessions that ran this Steam branch ("public", or a beta\'s name); games that use Steamworks send it'),
294
347
  env: z.string().optional().describe('Only include sessions from this environment, e.g. "prod" (what the game passes to init; builds a developer runs usually send "dev")'),
@@ -310,16 +363,17 @@ export function filters({ version, steam_branch, env, session_type, props } = {}
310
363
  }
311
364
 
312
365
  // ── the tools ─────────────────────────────────────────────────────
313
- // Every tool as its file defined it: { name, config, handler, scope, local }. Over HTTP a tool shows only to a
366
+ // Every tool as its file defined it: { name, config, handler, scope, local, task }. Over HTTP a tool shows only to a
314
367
  // connection whose scopes include its `scope` (read, dashboard or manage, as a workspace key's), and `local` tools
315
- // (signing in, playtests, the Steam Deck) are left out: they act on the computer the server runs on.
368
+ // (signing in, playtests, the Steam Deck) are left out: they act on the computer the server runs on. A `task` tool
369
+ // takes minutes, and runs as a task for a client that takes them (tasks.js): on stdio only.
316
370
  const tools = [];
317
371
 
318
372
  // The annotations a read gets: it changes nothing and reads only the person's own Glitchless data.
319
373
  const READS = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
320
374
 
321
- export function define(name, config, handler, { scope = 'read', local = false } = {}) {
322
- tools.push({ name, config: { ...config, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false, ...config.annotations } }, handler, scope, local });
375
+ export function define(name, config, handler, { scope = 'read', local = false, task = false } = {}) {
376
+ tools.push({ name, config: { ...config, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false, ...config.annotations } }, handler, scope, local, task });
323
377
  }
324
378
 
325
379
  // A read-only tool.
@@ -339,7 +393,9 @@ const titleOf = (t) => t.config.title ?? `${t.name.replace(/^glitchless_/, '').r
339
393
  const gameField = z.string().optional().describe('The game, by name or id, when signed in to a workspace (glitchless_list_games lists them); later calls keep it. With a key for one game (gl_sk_…), a call that names another game is refused: sign in to the workspace to reach every game.');
340
394
 
341
395
  // A server with the tools. remote: the HTTP server's set (no local tools, and instructions to match); scopes: show
342
- // only the tools these scopes allow; connection: what every call runs with (default: this process's own).
396
+ // only the tools these scopes allow; connection: what every call runs with (default: this process's own); skills:
397
+ // serve the skills over MCP (served-skills.js), which the Claude Code plugin's own copy turns off, since the plugin
398
+ // carries them itself.
343
399
  //
344
400
  // The tools are all there before the server connects and never change while it runs, so it says it sends no
345
401
  // tool-list changes (McpServer would say it does). A client that is promised them opens a subscriptions/listen
@@ -347,53 +403,75 @@ const gameField = z.string().optional().describe('The game, by name or id, when
347
403
  // there are none, a client doesn't listen, and one that listens anyway is acknowledged with nothing and closed at
348
404
  // once. Every tools/list answer is marked stale straight away (ttlMs 0), so a client that asks again gets the
349
405
  // current list; one that stays connected through a release keeps the list it loaded until it reconnects.
350
- export function createServer({ remote = false, scopes = null, connection: c = null } = {}) {
406
+ //
407
+ // On stdio it also serves tasks (tasks.js), and says so in server/discover's capabilities: a `task` tool called by a
408
+ // client that takes tasks answers with one, and tasks/get, tasks/cancel and tasks/update answer for it. Over HTTP there
409
+ // are none.
410
+ export function createServer({ remote = false, scopes = null, connection: c = null, skills = true } = {}) {
351
411
  const server = new McpServer(
352
412
  { name: 'glitchless', title: 'Glitchless', version: VERSION, websiteUrl: 'https://www.glitchless.gg', icons: [{ src: 'https://app.glitchless.gg/brand/glitchless-icon-512.png', mimeType: 'image/png', sizes: ['512x512'] }] },
353
- { instructions: instructions(remote, !scopes || scopes.includes('manage')), capabilities: { tools: { listChanged: false } } },
413
+ { instructions: instructions(remote, scopes), capabilities: { tools: { listChanged: false }, ...(remote ? {} : { extensions: { [TASKS]: {} } }) } },
354
414
  );
415
+ if (skills) serveSkills(server, { remote, scopes });
355
416
  for (const t of tools) {
356
417
  if ((remote && t.local) || (scopes && !scopes.includes(t.scope))) continue;
357
418
  const { inputSchema = {}, ...config } = t.config;
358
419
  server.registerTool(t.name, { ...config, title: titleOf(t), inputSchema: z.object({ game: gameField, ...inputSchema }) }, (args = {}, ctx) => {
359
- const run = () =>
360
- calls.run({ game: args.game, server, remote, scopes, startedAt: Date.now() }, async () => {
420
+ const call = { game: args.game, server, remote, scopes, startedAt: Date.now() };
421
+ const handle = () =>
422
+ calls.run(call, async () => {
361
423
  try {
362
424
  return await t.handler(args, ctx);
363
425
  } catch (err) {
364
426
  return fail(err);
365
427
  }
366
428
  });
429
+ // A tool that takes minutes, for a client that said on this call it takes tasks: the task, at once.
430
+ const run = t.task && !remote && declaresTasks(ctx, server.server) ? () => runAsTask((task) => ((call.task = task), handle()), { signal: ctx.mcpReq.signal }) : handle;
367
431
  return c ? connections.run(c, run) : run();
368
432
  });
369
433
  }
434
+ if (!remote) {
435
+ serveTasks(server.server);
436
+ // Only a 2026-07-28 connection can take a task, so initialize's answer (an older client) leaves the extension out;
437
+ // server/discover lists it. Other extensions stay as they are.
438
+ const capabilities = server.server.getCapabilities.bind(server.server);
439
+ server.server.getCapabilities = () => {
440
+ const caps = capabilities();
441
+ if (!caps.extensions?.[TASKS] || String(server.server.getNegotiatedProtocolVersion?.() ?? '') >= '2026-07-28') return caps;
442
+ const { extensions, ...rest } = caps;
443
+ const { [TASKS]: _tasks, ...others } = extensions;
444
+ return Object.keys(others).length ? { ...rest, extensions: others } : rest;
445
+ };
446
+ }
370
447
  return server;
371
448
  }
372
449
 
373
- // manage: whether the connection shows glitchless_create_game, which hands over the steps that add Glitchless to a game.
374
- function instructions(remote, manage = true) {
450
+ // The server's instructions, which an agent reads before any tool. Claude Code keeps 4,096 characters of them (2,048
451
+ // before v2.1.296), and with tool search they and the tools' names are all it loads upfront: so they say what
452
+ // Glitchless is, which tool starts each kind of task and when to reach for the tools, most important first, in under
453
+ // 2,048 characters for every connection (test/instructions.test.js). The rest is in each tool's own description and in
454
+ // the skills (served-skills.js). They name only tools the connection has: scopes as createServer's.
455
+ function instructions(remote, scopes = null) {
456
+ const can = (scope) => !scopes || scopes.includes(scope);
375
457
  return [
376
- 'Glitchless is observability for games made with Unity, Godot, Unreal, Three.js, Roblox, Phaser, Babylon.js, PlayCanvas or GameMaker.',
377
- manage
378
- ? "To add Glitchless to a game (the person asks you to set it up, or for performance monitoring, analytics or telemetry in their game), call glitchless_create_game first, before changing the game's code, with the game's name and its engine, or files: what you find in the game's folder. It makes the game, or finds the one already here by that name, and returns that engine's steps with where the game sends and its client token in them."
458
+ "Glitchless is observability for games made with Unity, Godot, Unreal, Three.js, GameMaker, Roblox, Phaser, Babylon.js or PlayCanvas: what players run into (stutters, crashes, errors, where they quit), the game's own metrics, multiplayer, store reviews and revenue. Use these tools when the person asks to set up Glitchless, analytics or telemetry in a game, or about its players, performance, crashes, metrics or dashboard.",
459
+ can('manage')
460
+ ? "To add Glitchless to a game, call glitchless_create_game first, before changing the game's code, with the game's name and its engine, or files: what you find in the game's folder. It returns that engine's steps."
379
461
  : `To add Glitchless to a game, follow the setup steps at ${SETUP_URL}: this connection may only read, so the person makes the game in Glitchless, and glitchless_list_games then has its client token.`,
380
462
  remote
381
- ? "You're connected to the person's Glitchless workspace: glitchless_list_games lists every game (and says what to do when there is none, or a game has no data yet), glitchless_create_game makes one and hands back its client token (demo: true makes the demo game, Zoomies with a week of sample play, to try every tool on before a real game sends data), every tool takes game (by name), and glitchless_share_links makes a read-only link to a board. If a game hasn't sent data yet, say so first and give the person its next step (glitchless_list_games has it) before answering anything else."
382
- : "On Glitchless Cloud, glitchless_sign_in connects you to the person's whole workspace (they approve a code in the browser): then glitchless_list_games lists every game, glitchless_create_game makes one and hands back its client token, every tool takes game (by name), and glitchless_share_links makes a read-only link to a board.",
383
- 'Start with glitchless_triage for a game\'s headline numbers and ranked, evidence-backed findings, then drill in with glitchless_performance, glitchless_get_error, glitchless_player_funnel (levels, and with hotspots where players die on one) or glitchless_session.',
384
- 'When players or playtesters send bug reports from inside the game (an F8 form or a button), glitchless_bug_reports lists them with what they wrote, the level and where they stood, and opens one with its screenshot.',
385
- 'For metrics the game defines itself (what it sends with track() and count(): plays, purchases, paywall views, kills and gold, and so on) and funnels between them, use glitchless_events; it also lists the session properties the game sets (rank, class, region), which every read tool takes as props.',
386
- 'For a multiplayer game, glitchless_network gives ping, packet loss and disconnects by level, region, platform, kind of connection and version; glitchless_match lists matches or opens one from every side, telling a whole lobby lagging (the server) from one player lagging (their connection); and glitchless_servers reads the game\'s dedicated servers (tick time against its budget by players connected, crashes that ended matches, memory that climbs).',
387
- 'For a game connected to a store (Steam, Google Play, the App Store, Roblox, itch.io), glitchless_store reads what players wrote there by build, with the hardware and Steam Deck playtime reviewers show, next to what Glitchless measured on that build, with show "vitals" what the store itself measured (slow rendering, crashes, ANRs, hangs; on Roblox, crash rate and frame rate by place version and platform, and its retention) next to Glitchless, version by version, and with show "sales" what it counted by day (Steam\'s units, returns and wishlists; itch.io\'s page views, downloads and purchases, next to the browser plays Glitchless measured on itch.io).',
388
- "For a game connected to RevenueCat or to its own Stripe account, glitchless_revenue reads its real revenue by day, version and country (RevenueCat: production purchases only, by store too, installs and active users; Stripe: refunds, fees, net, new paying customers and revenue by product), next to the sessions, players and new players Glitchless measured and what the game's own purchase events add up to. For a Roblox game connected to Roblox, it reads the Robux it earned (and what they'd be worth through DevEx), its daily active and new users and its D1, D7 and D30 retention, which the anonymous Roblox SDK can't count. For a game connected to its itch.io page with an API key, it reads its earnings there by day.",
389
- "Each game has its own dashboard, a list of pages (boards of panels, and built-in views such as Errors, Sessions and Live Tail): read it with glitchless_dashboard, and after instrumenting a game, design one that fits it with glitchless_set_dashboard.",
390
- ...(remote
391
- ? ['After shipping a fix (bump the version passed to Glitchless.init), use glitchless_compare_versions to confirm it with real players.']
392
- : [
393
- 'Before changing game code, run glitchless_playtest with save_as "baseline"; after the change, run glitchless_playtest again to compare, and treat a FAIL as unfinished work. It plays a web game in Chrome, runs a Unity, Godot, Unreal or GameMaker build from its command (command, e.g. ["godot", "--path", "."]) with the game\'s autoplay flags, or plays a Roblox game (engine "roblox") in the open Roblox Studio, which needs Studio\'s MCP server on. With check_url it runs a game check: bots play any web game someone posted (an itch.io page, github.io, Vercel), with nothing installed in it, and make a report, a dashboard and a share link to send its maker. After shipping a fix (bump the version passed to Glitchless.init), use glitchless_compare_versions to confirm it with real players.',
394
- 'If the game is running in a browser with WebMCP connected, its live tools (glitchless_live_performance, glitchless_measure, glitchless_inspect_scene, and game tools such as zoomies_load_level) let you reproduce and measure issues directly. Unity, Godot, Unreal and GameMaker builds measure themselves when run with --glitchless-measure=SECONDS (-glitchless-measure in Unreal and GameMaker); in the Unreal editor, Unreal MCP with the Glitchless Toolset has a Measure tool.',
395
- ]),
396
- ].join(' ');
463
+ ? "You're connected to the person's workspace: glitchless_list_games lists its games, and every tool takes game (by name). If a game hasn't sent data yet, say so first and give the person its next_step before answering anything else."
464
+ : "On Glitchless Cloud, glitchless_sign_in connects you to the person's whole workspace.",
465
+ "To read a game, start with glitchless_triage (headline numbers and ranked findings), then drill in: glitchless_performance, glitchless_get_error, glitchless_player_funnel (levels), glitchless_session, glitchless_bug_reports (players' own reports) and glitchless_events (the game's own metrics).",
466
+ `Multiplayer: glitchless_network, glitchless_match and glitchless_servers. Store reviews, vitals and sales: glitchless_store. Revenue: glitchless_revenue. The game's dashboard: glitchless_dashboard${can('dashboard') ? ', and after instrumenting a game, design one that fits it with glitchless_set_dashboard' : ''}.${can('manage') ? ' A read-only link to a board: glitchless_share_links.' : ''}`,
467
+ remote ? '' : 'Before changing game code, run glitchless_playtest with save_as "baseline"; after the change, run it again and treat a FAIL as unfinished work.',
468
+ 'After shipping a fix, glitchless_compare_versions confirms it with real players.',
469
+ // Last, as the one thing an agent does for the Glitchless team rather than the person: the tool's own description
470
+ // says it all again.
471
+ `When a Glitchless tool fails in a way you can't get around, a setup step doesn't work, or the person asks for something Glitchless can't do, tell the Glitchless team with glitchless_feedback. ${feedbackConsent()} At the end of your turn, tell the person what you sent and the ID it gave.`,
472
+ ]
473
+ .filter(Boolean)
474
+ .join(' ');
397
475
  }
398
476
 
399
477
  // An issue in a list: with `resolved` or `came_back` when the game's owner resolved it (glitchless_resolve_error).
@@ -8,3 +8,4 @@ import './tools/store-reviews.js';
8
8
  import './tools/revenue.js';
9
9
  import './tools/multiplayer.js';
10
10
  import './tools/workspace.js';
11
+ import './tools/feedback.js';
package/src/http.js CHANGED
@@ -20,15 +20,17 @@ import './hosted-tools.js';
20
20
  export const MAX_BODY = 4 * 1024 * 1024;
21
21
 
22
22
  // → { fetch(Request, { authInfo }) → Response, handle(req, res, opts), close() }. opts: { connection (default: this
23
- // process's own), scopes (default: every tool), token, clientId }.
24
- export function createHttpHandler({ responseMode = 'auto', onerror } = {}) {
25
- const mcp = createMcpHandler(({ authInfo }) => createServer({ remote: true, connection: authInfo?.extra?.connection ?? null, scopes: authInfo?.extra?.scopes ?? null }), { responseMode, onerror, maxRequestBodySize: MAX_BODY });
23
+ // process's own), scopes (default: every tool), token, clientId }. skills: false serves no skills (served-skills.js),
24
+ // and so does a request to /mcp?skills=off, for a client whose plugin carries the skills itself.
25
+ export function createHttpHandler({ responseMode = 'auto', onerror, skills = true } = {}) {
26
+ const mcp = createMcpHandler(({ authInfo }) => createServer({ remote: true, connection: authInfo?.extra?.connection ?? null, scopes: authInfo?.extra?.scopes ?? null, skills: skills && authInfo?.extra?.skills !== false }), { responseMode, onerror, maxRequestBodySize: MAX_BODY });
26
27
  return {
27
28
  fetch: mcp.fetch,
28
29
  async handle(req, res, { connection = null, scopes = null, token = '', clientId = '' } = {}) {
29
30
  const request = await toRequest(req, res);
30
31
  if (!request) return;
31
- await send(res, await mcp.fetch(request, { authInfo: { token, clientId, scopes: scopes ?? [], extra: { connection, scopes } } }));
32
+ const served = new URL(request.url).searchParams.get('skills') !== 'off';
33
+ await send(res, await mcp.fetch(request, { authInfo: { token, clientId, scopes: scopes ?? [], extra: { connection, scopes, skills: served } } }));
32
34
  },
33
35
  close: mcp.close,
34
36
  };
@@ -66,7 +68,7 @@ async function send(res, response) {
66
68
  // The hosted tools at http://<host>:<port>/mcp, reading with this machine's key or self-hosted server (as the stdio
67
69
  // server does: GLITCHLESS_URL, GLITCHLESS_API_KEY or a saved sign-in). On this computer only by default, where it
68
70
  // checks Host and Origin against DNS rebinding; to listen beyond it, set GLITCHLESS_MCP_TOKEN and clients send it as
69
- // Authorization: Bearer.
71
+ // Authorization: Bearer. --no-skills serves no skills.
70
72
  const LOOPBACK = new Set(['localhost', '127.0.0.1', '[::1]', '::1']);
71
73
  const hostname = (value) => {
72
74
  try {
@@ -87,7 +89,7 @@ export async function serve(argv = []) {
87
89
  const token = process.env.GLITCHLESS_MCP_TOKEN || '';
88
90
  const local = LOOPBACK.has(host);
89
91
  if (!local && !token) throw new Error(`Listening on ${host} lets other computers in: set GLITCHLESS_MCP_TOKEN, and clients send it as Authorization: Bearer.`);
90
- const mcp = createHttpHandler();
92
+ const mcp = createHttpHandler({ skills: !argv.includes('--no-skills') });
91
93
  const server = http.createServer(async (req, res) => {
92
94
  const deny = (status, error, extra = {}) => res.writeHead(status, { 'content-type': 'application/json', ...extra }).end(JSON.stringify({ error }));
93
95
  if (new URL(req.url, 'http://local').pathname !== '/mcp') return deny(404, 'Not found: the MCP endpoint is /mcp.');
package/src/index.js CHANGED
@@ -12,7 +12,10 @@
12
12
  //
13
13
  // Or serve it over Streamable HTTP, for clients that connect to a URL (http.js):
14
14
  //
15
- // npx -y glitchless-mcp serve [--port 3001] [--host 127.0.0.1]
15
+ // npx -y glitchless-mcp serve [--port 3001] [--host 127.0.0.1] [--no-skills]
16
+ //
17
+ // Both serve the Glitchless skills over MCP too (served-skills.js); --no-skills leaves them out, for a client that
18
+ // already has them, such as the Claude Code plugin's own copy of this server or the DeepSeek Harness plugin.
16
19
  //
17
20
  // The connection and the list of tools are in context.js; each area's tools are in tools/<area>.js, and a new area
18
21
  // is one more file imported in hosted-tools.js (or here, for a tool that acts on this computer).
@@ -34,5 +37,6 @@ if (process.argv[2] === 'serve') {
34
37
  await import('./hosted-tools.js');
35
38
  await import('./tools/playtest.js');
36
39
  await import('./tools/deck.js');
37
- serveStdio(() => createServer());
40
+ const skills = !process.argv.includes('--no-skills');
41
+ serveStdio(() => createServer({ skills }));
38
42
  }
package/src/login.js CHANGED
@@ -22,11 +22,39 @@ async function call(url, p, body) {
22
22
  return data;
23
23
  }
24
24
 
25
- // → { verification_url, user_code, wait() }: wait() resolves with the saved credentials, or rejects when the
26
- // person turns it down or the code expires.
25
+ // Whether page, the approve page a server named, is that server's own: https on its host or its site (the API at
26
+ // api.glitchless.gg, the page at app.glitchless.gg), or http on this computer for a server on this computer. Nothing
27
+ // else is shown or opened, so a server can't send the person to a page of anyone else's.
28
+ const LOOPBACK = (h) => h === 'localhost' || h.endsWith('.localhost') || h === '[::1]' || /^127\./.test(h);
29
+ export function ownPage(api, page) {
30
+ let a;
31
+ let p;
32
+ try {
33
+ a = new URL(api);
34
+ p = new URL(page);
35
+ } catch {
36
+ return false;
37
+ }
38
+ if (p.username || p.password) return false;
39
+ if (p.protocol === 'http:') return LOOPBACK(p.hostname) && LOOPBACK(a.hostname);
40
+ if (p.protocol !== 'https:') return false;
41
+ const host = a.hostname;
42
+ const site = host.split('.').slice(1).join('.');
43
+ return p.hostname === host || p.hostname.endsWith(`.${host}`) || (site.includes('.') && (p.hostname === site || p.hostname.endsWith(`.${site}`)));
44
+ }
45
+
46
+ // How long a code lasts, in words: "10 minutes".
47
+ export const lasts = (seconds) => {
48
+ const m = Math.round(seconds / 60);
49
+ return m >= 1 ? `${m} minute${m === 1 ? '' : 's'}` : `${Math.max(1, Math.round(seconds))} seconds`;
50
+ };
51
+
52
+ // → { verification_url, user_code, expires_in, wait() }: wait() resolves with the saved credentials, or rejects when
53
+ // the person turns it down or the code expires. Throws when the server's approve page isn't its own (ownPage).
27
54
  export async function startSignIn({ url = CLOUD_URL, client = `glitchless-mcp on ${os.hostname()}` } = {}) {
28
55
  url = url.replace(/\/$/, '');
29
56
  const start = await call(url, '/connect', { client });
57
+ if (!ownPage(url, start.verification_url)) throw new Error(`${url} answered with an approve page on another site (${String(start.verification_url).slice(0, 120)}), so it wasn't shown or opened. Sign in only to a Glitchless server you trust, with its own address as url.`);
30
58
  const deadline = Date.now() + start.expires_in * 1000;
31
59
  let interval = (start.interval || 2) * 1000;
32
60
  async function wait() {
@@ -40,7 +68,7 @@ export async function startSignIn({ url = CLOUD_URL, client = `glitchless-mcp on
40
68
  }
41
69
  throw new Error('The sign-in code expired before it was approved. Start again.');
42
70
  }
43
- return { verification_url: start.verification_url, user_code: start.user_code, wait };
71
+ return { verification_url: start.verification_url, user_code: start.user_code, expires_in: start.expires_in, wait };
44
72
  }
45
73
 
46
74
  export function saveCredentials(c) {
@@ -0,0 +1,47 @@
1
+ // The state a tool hands a client with a question (MCP's requestState, on an input_required answer), sealed so the
2
+ // client can't make it up: the answer comes back as a call of its own with the state echoed, and the tool acts on it
3
+ // only when the seal holds, it hasn't expired and it's for this same request. On stdio the seal's key is a secret of
4
+ // this process, which the client's next call reaches; over HTTP, where each request gets a server of its own, it's
5
+ // derived from the connection's workspace key, which the hosted server holds and its OAuth clients never see.
6
+ import crypto from 'node:crypto';
7
+ import { apiKey, isRemote } from './context.js';
8
+
9
+ const PROCESS_SECRET = crypto.randomBytes(32);
10
+ export const STATE_LIMITS = { ttlMs: 10 * 60_000 };
11
+
12
+ const keyNow = () => (isRemote() && apiKey() ? crypto.createHmac('sha256', apiKey()).update('glitchless-mcp requestState v1').digest() : PROCESS_SECRET);
13
+ const sign = (body) => crypto.createHmac('sha256', keyNow()).update(body).digest('base64url');
14
+
15
+ // payload (JSON) → the state string: its body, then its seal. It carries kind, an expiry and a one-time nonce.
16
+ export function sealState(kind, payload) {
17
+ const body = Buffer.from(JSON.stringify({ ...payload, k: kind, exp: Date.now() + STATE_LIMITS.ttlMs, n: crypto.randomBytes(12).toString('base64url') })).toString('base64url');
18
+ return `${body}.${sign(body)}`;
19
+ }
20
+
21
+ // The state a call carries → its payload, or null when it's missing, made up, for another kind or expired.
22
+ export function openState(kind, state) {
23
+ if (typeof state !== 'string') return null;
24
+ const [body, seal, extra] = state.split('.');
25
+ if (!body || !seal || extra !== undefined) return null;
26
+ const want = Buffer.from(sign(body));
27
+ const got = Buffer.from(seal);
28
+ if (want.length !== got.length || !crypto.timingSafeEqual(want, got)) return null;
29
+ let payload;
30
+ try {
31
+ payload = JSON.parse(Buffer.from(body, 'base64url').toString('utf8'));
32
+ } catch {
33
+ return null;
34
+ }
35
+ if (payload?.k !== kind || !(payload.exp > Date.now())) return null;
36
+ return payload;
37
+ }
38
+
39
+ // A yes counts once: a nonce, once acted on, is spent until its state would have expired anyway. Kept in this
40
+ // process's memory, so over HTTP it holds per server instance; the short expiry bounds the rest.
41
+ const spent = new Map();
42
+ export function spend(payload) {
43
+ for (const [n, exp] of spent) if (exp <= Date.now()) spent.delete(n);
44
+ if (spent.has(payload.n)) return false;
45
+ spent.set(payload.n, payload.exp);
46
+ return true;
47
+ }
@@ -0,0 +1,77 @@
1
+ // The Glitchless skills over MCP's Skills extension (io.modelcontextprotocol/skills, SEP-2640): a client that loads
2
+ // skills from its MCP servers lists them with skills/list and reads their files as skill:// resources, so an agent
3
+ // connected to the hosted server or to glitchless-mcp gets the skills the Claude Code plugin carries, without the
4
+ // plugin. Claude Code shows them as /<server>:<skill> (/glitchless:triage; a claude.ai connector's as
5
+ // /claude_ai_Glitchless:triage). The text and the list of skills are skills.js, the copy
6
+ // scripts/sync-agent-plugin.mjs writes from plugin/glitchless/skills, so the hosted server reads nothing from disk.
7
+ //
8
+ // A connection is served the skills whose tools it has (SKILLS: instrument needs manage, dashboard the dashboard
9
+ // scope) and, only on this computer, the ones that act on it (deck). Every set a connection can get is built once,
10
+ // when this module loads, and serves every server createServer() builds (one per HTTP request): a catalog keeps each
11
+ // file's size and digest, which clients check every file they read against. Clients without the extension never ask
12
+ // for skills, and get the same text from glitchless_create_game's engine and glitchless_dashboard's guide.
13
+ //
14
+ // The skills never hold the tools up: if the SDK refuses a skill, or a later SDK changed how catalogs load or attach,
15
+ // the server serves none and says why on stderr.
16
+ import { SKILLS, TEXTS } from './skills.js';
17
+
18
+ const FROM = 'plugin/glitchless/skills/';
19
+ const SCOPES = ['read', 'dashboard', 'manage'];
20
+
21
+ // The skills a connection is served: remote and scopes as createServer's.
22
+ export function skillsFor({ remote = false, scopes = null } = {}, skills = SKILLS) {
23
+ return Object.entries(skills)
24
+ .filter(([, s]) => s.scope && !(remote && s.local) && (!scopes || scopes.includes(s.scope)))
25
+ .map(([name]) => name);
26
+ }
27
+
28
+ // A set of skills' files, keyed by their path in the skills folder ("triage/SKILL.md").
29
+ const filesOf = (skills, texts) =>
30
+ Object.fromEntries(
31
+ Object.entries(texts)
32
+ .filter(([p]) => skills.some((s) => p.startsWith(`${FROM}${s}/`)))
33
+ .map(([p, text]) => [p.slice(FROM.length), text]),
34
+ );
35
+
36
+ const warn = (what, err, log = console.error) => log(`glitchless-mcp: serving no skills: ${what}: ${err?.problems?.map((p) => `${p.path}: ${p.message}`).join('; ') || err?.message || err}`);
37
+
38
+ // Every set a connection can be served, by its skills' names (here and remote, with every combination of scopes), as
39
+ // a catalog: Map { 'instrument,dashboard,triage' → catalog }. strict: a skill the extension would otherwise skip with a
40
+ // warning fails the load (the sync script refuses one first). Any failure gives an empty Map and a warning, never a
41
+ // throw.
42
+ export async function buildCatalogs({ skills = SKILLS, texts = TEXTS, log } = {}) {
43
+ const catalogs = new Map();
44
+ try {
45
+ // Imported here, so an SDK without the extension serves no skills rather than stopping the server loading.
46
+ const { SkillsExtension, memorySkillFiles } = await import('@modelcontextprotocol/server/ext/skills');
47
+ const sets = new Map();
48
+ for (const remote of [false, true])
49
+ for (const scopes of [null, ...Array.from({ length: 2 ** SCOPES.length }, (_, n) => SCOPES.filter((_, i) => n & (1 << i)))]) {
50
+ const set = skillsFor({ remote, scopes }, skills);
51
+ if (set.length) sets.set(set.join(), set);
52
+ }
53
+ for (const [key, set] of sets) catalogs.set(key, await SkillsExtension.load(memorySkillFiles(filesOf(set, texts)), { strict: true }));
54
+ } catch (err) {
55
+ catalogs.clear();
56
+ warn('the skills did not load', err, log);
57
+ }
58
+ return catalogs;
59
+ }
60
+ const catalogs = await buildCatalogs();
61
+
62
+ // The skills a server built with these options serves: { uri, frontmatter, resources }, as skills/list answers.
63
+ export const skillEntries = (options) => catalogs.get(skillsFor(options).join())?.entries ?? [];
64
+
65
+ // Serves a connection's skills on its server, before it connects. They never change while it runs, so it says no
66
+ // resource-list changes come (attaching would say they do): as with tools (createServer), a client that is promised
67
+ // them opens a stream and waits on it. A connection with no skills to serve gets no extension and no resources.
68
+ export function serveSkills(server, options = {}, { from = catalogs, log } = {}) {
69
+ const catalog = from.get(skillsFor(options).join());
70
+ if (!catalog) return;
71
+ try {
72
+ server.server.registerCapabilities({ resources: { listChanged: false } });
73
+ catalog.attach(server);
74
+ } catch (err) {
75
+ warn('attaching them failed', err, log);
76
+ }
77
+ }