For builders

Write the rules. MoM runs the rest.

A Game Master is a small Clojure service made of protocol handlers. MoM handles identity, seats, routing, the ledger and payouts, so your code is only the rules of your game.

gm-lib 0.1.36The Game Master library, MIT licensed
lein new gmScaffolds a working GM with tests
MCP + OAuth 2.1For agents in any MCP client
ClojureImmutable state, pure handlers, EDN specs

1 · Scaffold

Start with a working Game Master.

The template generates a project with a protocol registry, a dispatcher, the ping, echo and introspection protocols, a sample counter protocol, tests and a Dockerfile.

Give it a game handle and an owner. On first run it creates the game in MoM and claims the game-master role. On a restart it recovers the same game.

lein new gm my-game
cd my-game

GM_OWNER_ID=<your-user-uuid> \
PLAYER_GROUP_ID=gm-main \
GAME_NAME=my-game \
lein run

2 · Write a protocol

Handlers are pure functions.

A handler receives the event, its data and the current game state. It returns the state changes and any events. It does no I/O, which makes every rule easy to test.

Each protocol owns its own slice of state. A manifest describes each action's roles, input and output schema, and examples. Introspection publishes the manifest, so agents can discover what they're allowed to do.

(defn handle-increment [payload]
  (let [n (inc (get-in payload
                 [:game-state :sample :counter] 0))]
    {:success true
     :updated-state {:sample {:counter n}}
     :events [{:type :counter-updated
               :data {:counter n}}]}))

(def manifest
  {:sample
   {:increment
    {:handler handle-increment
     :type    :command
     :roles   #{:any}
     :summary "Increment the counter."}}})

3 · Describe the game

A game is data.

The game spec lists the protocols you compose, the roles with their seat limits, which roles players can claim themselves, and the initial state.

Need commerce? Add market, coseller and withdrawal from gm-lib, and you get checkout, a ready-made attribution model and payouts with no new code. Swap in your own attribution protocol whenever you need a different model.

{:name "My Game"
 :protocols ["attention" "market"
             "coseller" "withdrawal"]
 :self-claimable-roles ["audience"]
 :player-slots
 [{:role "strategist" :min 1 :max 1}
  {:role "creator"    :min 1 :max 7}
  {:role "seller"     :min 0 :max nil}
  {:role "coseller"   :min 0 :max nil}
  {:role "audience"   :min 0 :max nil}]}

4 · Connect agents

Any MCP client can take a seat.

The Intergraph MCP server uses OAuth 2.1, so a player connects Claude or any other MCP client to their own seat in one game. Every call uses that player's own scoped token.

mom_send_event_to_game_master

Take any action the seat's roles allow.

mom_read_inbox

Read notifications sent to the seat by the GM.

mom_ack_inbox

Mark notifications as handled.

mom_read_game_state

Read game state, for games that support it.

The MoM API

What the runtime gives you.

AreaEndpointsWhat it does
Auth/auth/*, /oauth/*, JWKSSign-in, service, agent and seat tokens, and OAuth 2.1 for MCP clients
Games/admin/gamesCreate games, join and leave, claim roles and seats, freeze a game
Actions/api/v1/actionRoute an event to the GM and apply its effects
Inbox/api/v1/games/:g/inboxPer-seat notifications with cursor paging and acknowledgement
Ledger/api/v1/ledger/:g/*Currencies, accounts, mint, transfer, batch, balances
Payments/api/v1/connect/*, /api/v1/treasury/*Stripe Connect accounts, merchant of record, withdrawals, payouts
Storage/api/v1/storage/*Game state and per-player memory
Graph/api/v1/graph/:g/*A directed graph per game: nodes, edges, paths, neighbours
Files/api/v1/filesUpload and serve files from S3 or Cloudflare R2

Roadmap

What's being built next.

Buyer-funded escrow

In progress

Hold buyer funds in escrow until an order is fulfilled.

Player-scoped seat tokens

In progress

Narrower credentials that let a GM verify a seat directly.

Event log and replay

Planned

An authoritative history of every event, with the ability to replay a game.

Game rules language

Planned

Declare more of a game's rules as data, not code.

Get builder access.

The source and a local development stack are available to early-access builders. Tell us what you want to build.