Build with AI
Statpad has three tools for AI agents. Two of them help a coding agent, such as Claude Code, Cursor or Codex, write code that calls Statpad. The third gives an agent live game data while it runs.
For a coding agent, install the skill and connect the docs. The skill carries the rules, and the docs carry the details the rules point to.
Set up a coding agent
Install the Statpad skill
The skill is a SKILL.md file in the Agent Skills format. Install it with the skills CLI, which needs Node.js 22.20 or newer:
The CLI finds the skill at statpad.dev/.well-known/agent-skills and asks which agents to install it for. It installs into the current project by default. Add -g to install it for every project.
Without the CLI, download the file into your agent’s skills folder. For Claude Code, that’s ~/.claude/skills for every project or .claude/skills in one project:
The agent loads the skill when a task involves Statpad. Its rules cover:
- keeping keys on your server
- reading a game over REST, then subscribing from the response’s
seq - replacing entities by
entity_typeandentity_id, and keeping the highestversion - resuming from the last applied seq, backing off, closing silent connections, and stopping on close code
1008 - polling the changes feed on Developer, which has no stream
- pagination, dates and the TypeScript SDK
Each rule names the docs page with the detail. Read the whole skill at statpad.dev/.well-known/agent-skills/statpad/SKILL.md.
Connect the docs
The docs MCP server at https://statpad.dev/docs/_mcp/server has one tool, searchDocs. The agent asks it a question and gets an answer drawn from these docs, with a link to each page it used. It needs no key.
For Cursor, add the entry to ~/.cursor/mcp.json, or to .cursor/mcp.json in one project. Other clients take the same URL as a remote HTTP server.
An agent without MCP can read the docs directly:
statpad.dev/docs/llms.txtlists every page, guides and API reference, with a one-line summary each.- Every page has a Markdown version. Append
.mdto its URL, such ashttps://statpad.dev/docs/streaming.md.
Ask for what you want
Describe the program in plain words, and name the league, the language and the library. For example:
The stream comes with Pro, Business and the Pro trial. On Developer, which is REST only, ask for a script that polls the game’s changes feed instead. If no game is on, ask the agent to test the script against the recorded game on Sample responses, which needs no key.
The skill steers the agent toward the client the Quickstart builds by hand, with the four rules from Live updates added. In TypeScript, that’s a script with the SDK and ws that finds tonight’s game, reads it, subscribes from its seq, and applies each change. Review it before you run it, as you would any generated code.
Check the agent’s code
Compare what the agent wrote with the whole client on Live updates. A correct client does each of these:
To test it, run the script during a game and turn off Wi-Fi for 30 seconds. The client should close the silent connection, retry with backoff until the network returns, then print the changes it missed, once each and in order. With no game on, Sample responses feeds a recorded game through the same change handler without a key.
Compare a Developer client that polls the changes feed with Without the stream. If it stores state, check that on resync_required it reads again everything it keeps, not just the game.
Give an agent live data
@statpad/mcp is an MCP server with six read-only tools, such as find_games, get_game and get_plays. Every result about one game carries its seq, so the agent can ask for only what changed since. It runs on your computer and reads with your API key, on any plan. In Claude Code:
MCP server covers the other clients, every tool and what each call costs.