AI assistants (MCP)
Connect Claude Code, Cursor, VS Code or any MCP client to Kraty. Your assistant integrates the SDK into your game and runs your live ops (events, leaderboards, rewards, bots), acting as you with a personal key.
The Kraty MCP server lets an AI assistant work with Kraty for you. One server does two jobs:
- Integrate the SDK. In your game's codebase, the assistant detects the engine, installs the right Kraty SDK, creates a test key, wires up events, leaderboards and rewards, and checks that Kraty sees your players.
- Run your live ops. From chat: create events from templates, tune leaderboards, add currencies and items, simulate loot tables and bots, look up players, and review what's live.
It acts as you, with your role in the studio, through a personal key. Everything it changes is in the audit log, marked as made via MCP.
Set it up
Generate your personal key
In the dashboard, open AI & MCP in the studio sidebar and click Generate key. Pick:
- Access: Read & write (default) or Read only.
- Expires after: 7 days, 30 days, 90 days (default) or 1 year.
The key (kraty_pk_…) is shown once. Each member has one key per studio; generating a new one revokes the old one.
Connect your AI tool
The AI & MCP page gives you a copy-paste snippet with your key already filled in. They all install at user level, so the key never lands in your repo.
claude mcp add --scope user --transport http kraty https://api.kraty.io/mcp \
--header "Authorization: Bearer kraty_pk_..."In ~/.cursor/mcp.json:
{
"mcpServers": {
"kraty": {
"url": "https://api.kraty.io/mcp",
"headers": { "Authorization": "Bearer kraty_pk_..." }
}
}
}Command palette → MCP: Open User Configuration. VS Code asks for the key once and stores it securely:
{
"inputs": [
{ "type": "promptString", "id": "kraty-key", "description": "Kraty personal key", "password": true }
],
"servers": {
"kraty": {
"type": "http",
"url": "https://api.kraty.io/mcp",
"headers": { "Authorization": "Bearer ${input:kraty-key}" }
}
}
}In ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"kraty": {
"serverUrl": "https://api.kraty.io/mcp",
"headers": { "Authorization": "Bearer kraty_pk_..." }
}
}
}Settings → Developer → Edit Config (needs Node.js for the mcp-remote bridge):
{
"mcpServers": {
"kraty": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://api.kraty.io/mcp", "--header", "Authorization:${KRATY_AUTH}"],
"env": { "KRATY_AUTH": "Bearer kraty_pk_..." }
}
}
}Any MCP client that supports Streamable HTTP with a custom header:
- URL:
https://api.kraty.io/mcp - Header:
Authorization: Bearer kraty_pk_...
Ask
- "Integrate Kraty into this Unity project and show a leaderboard on the main menu."
- "Create a weekend race against bots that pays 500 gems to the top 3, staged for testing."
- "Why didn't player
kp_123get their daily reward yesterday?" - "Review our live events and flag anything misconfigured."
In Claude Code the server's prompts are also slash commands: /mcp__kraty__integrate_sdk, /mcp__kraty__design_event and /mcp__kraty__review_live_ops.
Integrating the SDK
Open your game project in your assistant and ask it to integrate Kraty. It follows the same path every time:
- Reads the project to detect the platform: Unity, TypeScript/JavaScript, Flutter, or a Node or Python game backend.
- Calls
get_sdk_setup, which returns your game's context (API URL, existing keys) plus the full SDK guide for that platform, straight from these docs. - Creates a test key with
create_api_keyand puts it where the guide says. Client keys go in one config spot; server keys go in environment variables, never in git. - Installs the SDK at the documented version, creates one client at startup, and wires the flows your game needs.
- Generates a typed constants file with
generate_keys_file(C#, TypeScript, Dart or Python), so your code usesKratyKeys.Events.WildRace.Keyinstead of hand-typed strings. - After you run the game, calls
check_integrationto confirm Kraty saw your test player.
Live keys for your release build are created by you in the dashboard. See API keys.
Running live ops
The assistant uses the same admin API as the dashboard, with the same validation. It works the safe way by default:
- Templates first. New events come from the template gallery (race, milestone track, league with divisions, daily login streak) where one fits.
- Test before live. New events go to
staging, which only test keys see. It can drive the test environment withrun_test_action(end a window now, roll a leaderboard over, inject scores, add bots) without waiting for the clock. - It asks before touching live players. Making an event live, editing a live event, taking one offline, changing a live guild config, moderating a live guild, or granting to, adjusting or banning a live player all need your explicit confirmation first.
What your key can do
A personal key acts as you, with your current role in the studio it was made for. Change your role and the key changes with it; leave the studio and it stops working.
Some things stay in the dashboard, where you're signed in, whatever your role:
| Dashboard only | Why |
|---|---|
| Inviting, removing and changing the roles of members | People decisions stay with people |
| Billing | Same |
| Renaming the studio, deleting a game | Hard to undo |
| Resetting test data, merging players, flagging debug players, disbanding a guild | Irreversible or rewrites reports |
| Rotating or revoking API keys | Can take your live game offline |
| Creating live API keys and live webhooks | They would outlive the personal key if it leaked |
| Publishing bots to the marketplace | Public, cross-studio |
| Creating, listing or revoking personal keys | A key can never mint its own replacement |
Test API keys and test webhooks can be created through MCP; that's what integration needs.
Read-only keys can list and read everything your role can see, and nothing else. The assistant only sees read tools with one.
Managing keys
- Regenerate or Revoke from the AI & MCP page. The old key stops working immediately.
- The page shows when and from which client your key was last used.
- Owners and admins see every member's key on the same page and can revoke any of them, for example when someone leaves or a key may have leaked.
- Removing a member from the studio revokes their key.
- Every change made with a key is in the audit log under your name, with
via: "mcp"in the actor details.
Treat a personal key like a password. If one ends up somewhere it shouldn't (a pasted log, a committed file), revoke it from the AI & MCP page and generate a new one.
Tools
| Area | Tools |
|---|---|
| Start | whoami, list_games, create_game, update_game |
| SDK integration | get_sdk_setup, create_api_key, list_api_keys, generate_keys_file, check_integration |
| Events | list_events, get_event, list_event_templates, create_event_from_template, create_event, update_event, set_event_state, preview_event_schedule, get_daily_login, update_daily_login |
| Leaderboards | list_leaderboards, get_leaderboard, get_leaderboard_standings, get_event_standings, create_leaderboard, update_leaderboard |
| Guilds | get_guild_config, update_guild_config, list_guilds, get_guild, update_guild, remove_guild_member, set_guild_leader |
| Catalog | list_catalog, get_catalog_entry, create_catalog_entry, update_catalog_entry, simulate_reward_table |
| Bots | list_bots, get_bot, create_bot, update_bot, simulate_bot |
| Players | search_players, get_player, grant_to_player, adjust_player_balance, set_player_ban |
| Test & ops | run_test_action, list_webhooks, create_webhook, send_test_webhook, get_game_overview, get_audit_log |
| Reference | search_docs, read_doc, get_config_schema, search_event_catalog, call_admin_api |
search_event_catalog explains what an event name means (Lava Quest, Sky Race, King's Cup, Team Battle, season pass, regional or Halloween leaderboards, …): its rules and typical numbers in top games, what its screens usually look like (layout and motion, never art style, which is your game's), and whether Kraty builds it from a template, from an event config, or doesn't support it yet. Co-op kinds (team chest, alliance raid, team tournament, team race, team league, partner event, country cup) are built from the team templates. Besides the templates in the dashboard gallery, the MCP can create a set of agent-only templates (item sprint, group, weekly, flash, weekend, milestone and holiday tournaments, end-game league, step collector, personal sprint, daily quests). They don't appear in the gallery yet, but the events they create show up in the dashboard like any other. When an event runs is your call: the MCP asks, and uses the dates or cadence you give. If you give none, the event gets the template's default schedule (modeled on what top games run for that kind) and the MCP tells you which one it used, so you can change it before the event goes live.
get_event_standings reads any event's current (or a past) window: every board with ranks and scores and, on team events, every team with its score, goal and milestones; pass an eventTeamId for one team's members and milestone payouts. Team events are created like any other (create_event_from_template with a team template, or create_event with a teams block, see get_config_schema("event_teams")), and run_test_action drives them in the test environment: inject_event_scores seats sim players in teams through the real pipeline, set_team_roster, contribute_event_team, recompute_event_team, retry_team_payout.
get_config_schema returns the exact JSON Schema the API validates each payload with, and the registered event types, score formulas, reward policies and bot building blocks. call_admin_api reaches any studio admin route that has no dedicated tool, with the same checks as the dashboard.
Fewer tools
Some clients cap how many tools they load (Cursor, for one). Add a toolsets query to the URL to load one half:
https://api.kraty.io/mcp?toolsets=integrate: SDK integration only.https://api.kraty.io/mcp?toolsets=manage: live ops only.
Using a personal key in scripts
The key also works directly against the studio-scoped admin API, with the same rules:
curl https://api.kraty.io/admin/v1/studios/<studio-slug>/games \
-H "Authorization: Bearer kraty_pk_..."It's limited to /admin/v1/studios/<its studio>/… and to 600 requests a minute (240 a minute on /mcp).
Troubleshooting
| You see | Meaning | Fix |
|---|---|---|
401 / "invalid, expired or revoked" | The key was regenerated, revoked or expired, or you left the studio | Generate a new key and update your client config |
403 with reason: "human_only" | That action is dashboard-only (table above) | Do it in the dashboard |
403 with reason: "personal_key_test_only" | Live API keys and live webhooks can't be made with a key | Create it in the dashboard |
403 personal_key_read_only | The key is read-only | Generate a read & write key if you want changes made |
403 tenant_mismatch | The key belongs to a different studio | Use that studio's key; keys are per studio |
"pass game" | The studio has several games | Name the game (its slug) in your request |
429 rate_limited | Too many requests in a minute | Wait for the window to reset |