Integrate with AI agents
Bonus Round is built so your coding agent can do the whole integration: register the game, add the SDK, find the natural breaks in your game loop, load the game to verify it's live, and report back. You review the diff.
The fastest way
Paste this to Claude Code, Cursor, Codex or any agent that can edit your project:
Integrate Bonus Round (bonusround.io) into this three.js game: npm i bonusround and follow
node_modules/bonusround/AGENTS.md. My publisher id is pub_XXXXXXXX. Then play the test round and tell me what you changed.
Don't have a publisher id yet? Leave that line out. The agent writes the placeholder pub_XXXXXXXX, and you paste your id over it later. Or connect the MCP server below, and the agent creates the game for you. Your exact prompt, with your id filled in, is on the Developers page.
Agents that can't reach bonusround.io
Cloud and sandboxed agents (Claude Code on the web, Codex cloud, CI) often allow only the npm registry and GitHub. Everything an agent needs is on npm too:
npm view bonusround readmeprints the full recipe. After install, it's innode_modules/bonusround/AGENTS.md.npm i bonusroundbundles the SDK into the game, so no script tag from bonusround.io is needed to load the code. Ads still come from bonusround.io when players play.npx bonusround init --yesdetects the setup and makes the edit offline. Without an account, it writes thepub_XXXXXXXXplaceholder.- When the ad server is unreachable and the game has no publisher id yet (or it's a test break), the SDK plays a bundled bonusround.io test round. That way the agent's headless browser sees a real Bonus Round, and the console explains what happened. Live ads are never faked.
- No modules? The script tag also works from the npm CDN:
https://cdn.jsdelivr.net/npm/bonusround@1/br.js. Source and examples: github.com/Future-Circus/bonusround.
The MCP server
Add https://bonusround.io/mcp to your agent and sign in with your Bonus Round account. That's it: no key to copy. Your agent can then create and manage games directly instead of asking you to copy ids from the dashboard.
You don't even need to sign in first. bonusround_integration_guide, bonusround_docs and bonusround_register_game work without an account. The first account tool asks you to sign in. An API key header (Authorization: Bearer br_sk_…, from the Developers page) or the local stdio server also work, if your client can't do OAuth.
Hosted server, nothing to install. Add it, then run /mcp, pick bonusround and choose Authenticate to sign in:
claude mcp add --transport http bonusround https://bonusround.io/mcp
Or with an API key instead of signing in:
claude mcp add --transport http bonusround https://bonusround.io/mcp --header "Authorization: Bearer br_sk_…"
Or run it locally over stdio:
claude mcp add --transport stdio --env BONUSROUND_API_KEY=br_sk_… bonusround -- npx -y @bonusround/mcp
Then start a session in your game's folder and run the prompt: /mcp__bonusround__integrate-bonus-round, or just say “Integrate Bonus Round”.
Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project). Cursor asks you to sign in the first time a tool needs your account:
{
"mcpServers": {
"bonusround": { "url": "https://bonusround.io/mcp" }
}
}
Or with an API key (don't commit it):
{
"mcpServers": {
"bonusround": {
"url": "https://bonusround.io/mcp",
"headers": { "Authorization": "Bearer br_sk_…" }
}
}
}
Or the local stdio server:
{
"mcpServers": {
"bonusround": {
"command": "npx",
"args": ["-y", "@bonusround/mcp"],
"env": { "BONUSROUND_API_KEY": "br_sk_…" }
}
}
}
Add https://bonusround.io/mcp as a custom connector. In Claude, that's Settings → Connectors → Add custom connector. In ChatGPT, it's Settings → Apps & Connectors (developer mode). Sign in to Bonus Round when it asks, and pick the workspace. You can see and disconnect connected apps on the Developers page.
From the terminal:
codex mcp add bonusround --env BONUSROUND_API_KEY=br_sk_… -- npx -y @bonusround/mcp
Or in ~/.codex/config.toml:
[mcp_servers.bonusround]
command = "npx"
args = ["-y", "@bonusround/mcp"]
env = { BONUSROUND_API_KEY = "br_sk_…" }
Any MCP client that speaks streamable HTTP can use https://bonusround.io/mcp. It signs in with OAuth 2.1 (discovery, dynamic client registration and PKCE), or takes the header Authorization: Bearer br_sk_…. Stdio clients run npx -y @bonusround/mcp with BONUSROUND_API_KEY in the environment. Point BONUSROUND_URL somewhere else to use a different server. If you've run npx bonusround login, the stdio server reads that saved key too.
Tools
| Tool | What it does |
|---|---|
bonusround_integration_guide | Returns integrate.md, the step-by-step recipe. Agents call this first. |
bonusround_register_game | No account needed. It registers a game by URL and returns its pub id, the snippet and a claimUrl for you. Unclaimed games show free bonusround.io house ads on a public site. Claiming the game (creating your account) turns on paid ads. |
bonusround_claim_game | Signed in. It moves a game registered without an account into your workspace, using its claimToken. |
bonusround_docs | No account needed. It searches and reads these docs. |
bonusround_list_games | Your games with their pub_ ids, status, test mode and when the SDK was last seen. |
bonusround_create_game | Registers a game by URL; returns its pub id and snippet. |
bonusround_get_snippet | The exact script tag, attach line, break/rewarded examples and ads.txt line. |
bonusround_integration_status | Has the SDK been seen (integration.lastSeenAt)? Is the agent learning? With waitSeconds it polls until the SDK shows up. |
bonusround_start_learning | (Re)starts the play agent that learns your game. |
bonusround_get_stats | Requests, fill rate, impressions, engagements, clicks, earnings, eCPM. |
bonusround_update_settings | Name, test mode, rating, categories, formats, triggers, interval, floors, blocked categories, frequency cap. |
There's also a prompt, integrate-bonus-round, that loads the recipe into the conversation. The server's instructions tell agents never to turn off test mode or change floors unless you ask.
The recipe: integrate.md
/integrate.md is written for AI agents: how to detect the three.js setup, where to put the tag, how to find the renderer, scene and camera, how to recognise natural breaks in a game loop, and how to verify the install by loading the game and checking GET /api/games/:id until integration.lastSeenAt is set. It ends with the report the agent should give you.
Also for agents: /llms.txt (an index in the llms.txt format) and /llms-full.txt (all of these docs in one plain-text file).
Claude Code skill
Prefer a skill to an MCP server? Install the integrate-bonus-round skill and Claude Code will pick it up whenever you ask to add Bonus Round or ads to a three.js game:
mkdir -p ~/.claude/skills/integrate-bonus-round
curl -fsSL https://bonusround.io/docs/skill/SKILL.md -o ~/.claude/skills/integrate-bonus-round/SKILL.md
# or from GitHub: https://raw.githubusercontent.com/Future-Circus/bonusround/main/skill/integrate-bonus-round/SKILL.md
The CLI
Agents that prefer shell commands (and humans) can use the CLI. init shows a diff and asks before writing; --yes skips the question, which is what an agent should use after showing you the diff with --dry-run.
npx bonusround login --key br_sk_… # saved to ~/.config/bonusround/credentials (0600)
npx bonusround init --dry-run # show the changes
npx bonusround init --yes # write them
npx bonusround status --wait 60 # wait for the first SDK ping
Keys and safety
- An API key can do anything your account can, including turning test mode off. Create one key per agent or machine, name it (“Claude Code laptop”), and revoke it on the Developers page when you're done.
- Never put a
br_sk_key in client-side code. The game only ever needs its publicpub_id. - Keys are stored hashed. We can't show a key again after it's created.