html5-games-token-saver
Checks a built HTML5 game against CrazyGames portal rules and returns dense JSON of failures, warnings and unreachable rules (it exposes three tools in this schema).
cg_build_check— browser-free, millisecond static checks of a dist folder, build folder or release zip: total size, file count,index.htmlat root, absolute paths, resources from foreign hosts, zip slashes, SDK version.cg_sdk_session— plays the build in an emulated portal iframe with an SDK v3 emulator, then idles and hides the tab; verdicts on gameplay start/stop pairs, pause on windows, SDK reads without input, autosave, save on hide,localStoragewrites, sound during ads, rewarded cooldown, bytes loaded before gameplay, console errors.cg_frame_audit— measures the DOM at boot, at everycheckstep and at the end in each frame size (defaults 800x450, 1080x607, 1920x1080, 390x664 touch, 666x380 touch; customWxH/m): windows inside the frame, reachable controls, rendered text size (minTextPx), rewarded vs no-ad button size, page overflow, scrollers missing a custom bar on phones; optional PNG shots of failures.Scenario-driven runs —
init,query,dialog, andsteps(click,tapviewport fractions,press,wait,waitFor,eval,check,rewardedTwice), defaulting tocg-scenario.jsonin the game root.Tuning options —
engine(chromium/webkit),adOutcome(finished/unfilled/adblock/other),idleSeconds(0–300, ≥32 for autosave), customsizes.Honest coverage — rules a run cannot reach are returned as
uncheckedwith a reason, never as passes.Note: the README's
game_checkcanvas probe is not present in this server schema.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@html5-games-token-saver check my dist build against the CrazyGames rules and list failures"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
html5-games-token-saver
MCP server that checks a built HTML5 game against the CrazyGames portal rules and answers with dense JSON:
a list of failures, warnings and rules it could not exercise, instead of screenshots and one-off Playwright
scripts in the agent context. game_check does the same inside the game: a scenario played in every size and
language, what a player would see wrong in a Phaser canvas UI as text.
Install
claude mcp add html5-games-token-saver -- npx -y @alex-apps/html5-games-token-saverThe game needs Playwright with Chromium (npm i -D @playwright/test && npx playwright install chromium); the server
takes it from the game's node_modules. Build the game before a check: the tools read dist, not src.
Related MCP server: flowcheck
Tools
Tool | What it does | Time |
| Size, file count, | ms |
| Plays the build in an emulated portal frame with an SDK v3 emulator, idles, hides the tab. Verdicts below. | ~10 s + idle |
| DOM in each frame size at boot, at each | seconds per size |
| Plays a scenario inside the game in sizes x languages. At each | seconds per run |
cg_sdk_session rules: first gameplayStart, bytes loaded before it, loading order, start/stop pairs, a pause on
every window and a resume on close, an SDK member hit repeatedly (a render loop or a per-second timer), SDK reads
with no input, autosave every 30 s, save on hide, localStorage writes on the portal, sound during an ad, rewarded
cooldown, banner refresh, console errors, 404s inside the frame, requests to foreign hosts, SDK members the emulator
does not implement.
A rule the run could not reach comes back in unchecked with the reason; it is never reported as a pass.
How it emulates the portal
No server and no port. page.route answers www.crazygames.com/game/<slug> with a page holding an iframe of
games.crazygames.com/en_US/<slug>/index.html, serves the build from disk (folder or zip) under that path, and
serves the SDK emulator at sdk.crazygames.com. A host check or an iframe check in the game sees the portal.
Foreign requests get an empty 204 and are listed. A probe injected before the game scripts records SDK calls and
property reads, localStorage writes, windows opening and closing (role=dialog, dialog[open], aria-modal), and
the audio level tapped in front of AudioContext.destination, so the mute check works for any engine.
Playwright is taken from the game's node_modules (its e2e already installs it and its browsers), then from next to
this package.
Scenario
The only game-specific part. cg-scenario.json in the game root, or the same fields as tool arguments:
{
"init": "window.__mtDebug = true",
"query": "?debug=1",
"dialog": "[role=dialog]",
"steps": [
{ "waitFor": "data-testid=settings-open" },
{ "click": "data-testid=settings-open" },
{ "check": "settings" },
{ "tap": [0.005, 0.005] },
{ "press": "Escape" },
{ "eval": "window.__mt.requestMidgame()" },
{ "rewardedTwice": "[data-testid=bonuses-modal] button:has-text(\"Watch\")" },
{ "wait": 2500 }
]
}Selectors are Playwright selectors inside the game frame; taps are viewport fractions, so one scenario serves every
frame size and canvas games. A click is a player's click at the element's centre (game buttons pulse and never look
stable to Playwright); on phone sizes clicks and taps are touches. waitFor takes timeoutMs for slow 3D boots.
check holds the screen 4.5 s in a session (a per-second timer shows) and measures in the audit, after finite CSS
animations end. rewardedTwice watches a rewarded ad, then clicks the same button again at once.
Windows and their gameplayStop are matched by order, not by clock: a 3D game under SwiftShader sent the stop
10 s after the click and showed the window 3.5 s later.
game_check
The game side is a folder in the game root: game-check/adapter.js and scenarios game-check/<name>.json. The
adapter runs before the game scripts and sets window.__check: game() returns the Phaser.Game, ui lists the
UI scene keys (their objects must stay on screen), skip(o) marks UI objects pinned to the world (names over units),
and short game steps the scenarios call (start a level, grant gold, select, open a tab, where a card is). The
internals a check needs change with the game; the adapter changes with them, not every check.
{
"init": "__check.save({ tutored: true })",
"ready": "__check.menu()",
"sizes": ["desk", "phone", "land"],
"langs": ["en", "ru", "de"],
"steps": [
{ "eval": "__check.start(1)" },
{ "until": "__check.deckOpen()" },
{ "value": "__check.armySize()", "as": "army" },
{ "tapAt": "__check.card('warrior')" },
{ "check": "after hiring" },
{ "shot": "deck", "box": [0, 0.6, 1, 0.4] },
{ "textures": "^warrior-", "sheet": true }
]
}Steps of the portal scenario work as there; the canvas adds until (a JS condition), value (a JS value reported
with its label), tapAt (a JS point {x, y} in CSS px), check with probe thresholds in opts (minText 11,
minTarget 44, overlap 0.33, spill 2), shot of the whole viewport or a box (viewport shares or a JS box),
and textures (keys matching a regex: a PNG and a pixel fingerprint each; prep runs first, sheet glues them).
Sizes are desk 1280x720, small 800x450, cg 1080x607, phone 390x844, land 844x390, tablet 1024x768
(the last three touch, pixel ratio 2) or any WxH with m for a touch phone. The locale of each run is also in
window.__CHECK_ENV.lang for a game that keeps its language in a save.
The answer folds runs: one line per finding with the checks and runs it appeared in (* every run, phone/* every
language of a size, */de every size of a language). A label under an image drawn later (a window over the deck) is
hidden and not checked. With base set to the out of an earlier run, each shot reports its share of changed pixels
and where, and each inventory its changed, added and removed keys with one was|now sheet of only those. The build
opens in the emulated portal frame; url opens a dev server instead, where adapter steps can import /src/ modules.
Verified on
A fixture game (
fixtures/mini-game) where each reviewer rule is broken by a query flag: the clean run passes every rule, each flag fails its rule (npm run smoke).Muscle Titans 1.7.0 and 2.0.1, built from git before the fixes for two reviewer emails: the session finds
inviteLinkcalled every second, the save copy inlocalStorage, autosave once a minute, unlimited rewarded ads,isUserAccountAvailableread every second; the audit finds the missing iOS scrollbar. 2.0.2, the fixed version, passes all of them. Not checkable by the tool: the midgame countdown text and the banner suggestion.Blocky Barber and TowerDefence (three.js; TowerDefence renders over a second per frame under SwiftShader): scenarios open every window and both pass; their ads are off before Full Launch, so the ad rules stay unchecked.
game_check: a canvas fixture (fixtures/canvas-game) where each probe finding is planted once and a label under a window must not be found, plus the inventory comparison (npm run smoke). A Phaser 4 strategy game in development, on its dev server: 7 languages x 3 sizes found a card cut by the right edge on phones, captions under the bottom edge in landscape and 40 px buttons; the inventory of 2571 textures takes 7 s and showed a loading change left every picture identical.
Limits
Chromium under SwiftShader: WebGL works, timings are slower than a real GPU.
The portal's real iframe
allowlist is not known; the emulated one is permissive.textSizeuses 12 px, the owner's threshold, not a docs number.Custom iOS scrollbars are recognised by class names and roles; a miss is a warning.
A canvas-drawn interface cannot be measured from the DOM; the audit says so in
unchecked;game_checkreads it from the Phaser scene, through the game's adapter. Other canvas engines need their own probe.Unity and Godot export plugins are assumed to call the same JS SDK; not verified.
Commands
npm test build + unit tests (node:test)
npm run smoke real MCP client over stdio against the fixture game
node tools/run.mjs build|session|audit|game <path> [...] one tool without a clientAvailable Tools
3 toolscg_build_checkA
Static portal checks of a built game or its zip: size, file count, index.html at root, absolute paths, resources from foreign hosts, zip slashes, SDK version. No browser, milliseconds.
Inputs: path (required).
cg_frame_auditB
Measures the DOM in each portal frame size at boot, at every check step and at the end: windows inside the frame, reachable controls, rendered text size, rewarded vs no-ad button size, page overflow, scrollers without a custom bar on phones.
Inputs: path (required), init, query, shots, +5 more.
cg_sdk_sessionB
Plays the build in an emulated CrazyGames frame with an SDK emulator, then idles and hides the tab. Verdicts for gameplay pairs, pause on windows, SDK reads while idle, autosave, save on hide, localStorage, sound during ads, rewarded cooldown, initial download, console errors.
Inputs: path (required), init, query, steps, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool targets a different validation phase—static build checks, SDK/runtime behavior, and DOM/layout measurement—with no overlapping scope. Descriptions clearly delineate what each covers.
All tools share the cg_ prefix and snake_case, forming a predictable namespace. However, they use noun phrases rather than a verb_noun pattern, so naming is consistent but not action-oriented.
Three tools is on the low side but each covers a broad, distinct area of game validation (static, SDK, frame). The count is reasonable for a focused audit suite, though additional specialized checks would not be unexpected.
Covers static build checks, runtime SDK behavior, and layout auditing, forming a solid validation surface for HTML5 game portals. Minor gaps could include performance/network diagnostics or automated fix suggestions, but core workflows are addressed.
Related MCP Connectors
Read-only web QA agent: scans a site in a real browser and returns evidence-backed findings
Audit public webpages and supplied markup for HTML, CSS, SEO, JSON-LD, and link issues.
Review frontend code and live pages against 386 quality-gated web development rules.
Website checker for AI coding agents. Measures your site in a real browser, with evidence.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables coding agents and CI to verify rendered web UIs against design token usage, layout constraints, and accessibility rules, returning concise pass/fail verdicts with actionable findings.12 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables coding agents to validate web pages and run repeatable JSON browser scenarios, returning pass/fail results with local Playwright evidence such as screenshots, traces, and JUnit XML.1Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI clients to validate game level progression data, audit localization packs for missing translations and dynamic-token mismatches, and run deterministic evaluations of generated puzzle or notification content.1MIT
- AlicenseNot gradedqualityCmaintenanceProvides deterministic, offline, sourced resolutions for 44 mobile game development problems spanning performance, memory, rendering, store policies, IAP billing, crash vitals, live-ops emergencies, and store-policy deadlines, along with pre-launch checklists and launch-day runbooks. It also statically audits project directories for Google Play and App Store compliance, including target SDK, 16 KB ELF alignment, privacy manifests, and secret-file exposure, without any network calls or shell execution.MIT