Inspiration

Tabletop role-playing games have a human game master who reacts to the players: opens a secret passage, springs a trap, throws in a monster when the party gets comfortable. Video games lost that. WebMCP gave me a way to bring it back: an AI agent that does not just talk about the game, but changes it, through a contract the browser itself exposes.

The rule of the world comes from the anime Baki and That Time I Got Reincarnated as a Slime: strength is never given, it is unlocked. So the co-game-master never hands out free wins. It sets trials.

What it does

KOTOAGE is a small 3D dungeon (Three.js, WebGL) with a hamlet and five floors. The player explores, fights, levels up (XP, four stats, skill points).

When the page runs in a WebMCP-capable browser (ChatGPT's in-app browser, or Chrome with chrome://flags/#enable-webmcp-testing), the game registers 8 tools on document.modelContext. An agent can then discover them and act on the live game state:

Tool Real effect in the game
etat_joueur reads health, mana, floor, gear, counters
donner_potion heals the player (small +2, large +6), shown on the HUD
ouvrir_mur turns a wall cell into floor; the 3D walls are rebuilt
placer_piege places a trap on a floor cell
inspirer gives a contextual hint about the place or the floor
defier spawns real enemies (guardian, warrior, horde)
raconter narrates a floor (1 to 5, 0 = the hamlet)
braignak_etude asks Braignak, the dungeon's watcher, for one of his five studies — or gives him a new one to run

Every successful call is announced to the player by the "voice of the world" on the HUD. The in-game chat also forwards the player's requests to the co-game-master when the WebMCP bridge is active. Without WebMCP, the game runs exactly the same: the bridge adds zero dependency to rendering.

Braignak, the watcher — the eighth tool is a character

Braignak is one of our own agents, and his job outside the game is the one he keeps inside it: he looks, and he reports. He never touches anything. In the dungeon he floats beside the player and repeats aloud what the co-game-master just did.

The eighth tool interrogates him. He has already led five studies in this dungeon — the walls that open, the guardian of the landing, the traps, the potions, where strength comes from — and answers from his own work. Give him a subject he has never studied and he leaves you: he walks around the room, thinking, then comes back, tells you what he counted, once, and forgets it.

How I built it

  • index.html is a self-contained ES module (Three.js + WebGL). It exposes a small bridge window.__webmcpConnexion (grid, player, walls, traps, creatures, HUD).
  • webmcp/webmcp.js is the pure contract layer: tool names, JSON schemas, validation, no DOM.
  • webmcp/integration.js wires the contract to the live game when document.modelContext exists: a Proxy on the grid, accessors on health, traps and challenges. Each agent call becomes a real world change.
  • Hosting: a public Google Cloud Storage bucket, HTTPS, no server.
  • Proof, with zero dependencies: 35 contract tests, 15 integration tests on a DOM harness, 8 tests on the chat bridge, and a real-browser check (tests/test_webmcp_live_cdp.py) that launches headless Chrome over the Chrome DevTools Protocol, loads the live URL, and verifies the 7 tools are registered and that etat_joueur and donner_potion change the game state.

Challenges I ran into

  • Proving it in a real browser, not just in unit tests: I wrote a tiny CDP client by hand (WebSocket handshake, masked frames) because I wanted a proof with no dependency.
  • Keeping the game intact when WebMCP is absent: the integration layer must do nothing, and that is tested.
  • Making the agent a game master, not a cheat code: the tools give trials (walls, traps, enemies, hints), and the chat bridge answers with an action, never a gift.

Accomplishments that I'm proud of

  • 7 tools, each with a visible, physical effect in a 3D world.
  • 46 automated proofs, plus a live-browser check on the hosted page.
  • A game that stays fully playable without WebMCP.

What I learned

WebMCP turns a web page into something an agent can do things to, not just read. The hard part is not registering tools, it is deciding what an agent should be allowed to change so that the experience stays a game.

What's next

  • structuredContent on every tool result (the official recommendation).
  • Letting the co-game-master read the player's progression (level, stats) to scale the trials.
  • A VR version of the same dungeon, same tools.

Built during the submission period (project existed before August 25)

The dungeon itself (3D world, hamlet, floors, combat) existed before. Added between August 25 and September 3: the whole WebMCP layer (webmcp/webmcp.js, webmcp/integration.js, the 7 tools), the chat bridge to the co-game-master, the progression loop (XP, level, four stats), the test suite, the live-browser CDP check, the Google Cloud Storage deployment and the public repository.

Testing instructions

  1. Open the live URL in ChatGPT's in-app browser, or in Chrome with chrome://flags/#enable-webmcp-testing enabled. No login needed.
  2. Click to enter the dungeon (keyboard: arrows or ZQSD / WASD to move).
  3. Ask the agent, for example: "Read the player state", "Give me a small potion", "Open the wall north of me", "Challenge me with a guardian", "Tell me the story of floor 2".
  4. Watch the HUD: every tool call is announced by the voice of the world, and the 3D world changes (wall opens, enemy appears, health goes up).
  5. To reproduce the proofs locally: python tests/test_webmcp.py, python tests/test_webmcp_integration.py, python tests/test_webmcp_live_cdp.py <url>.
Share this project:

Updates

Submission history