Use Statpad from a coding agent
A coding agent can write and run code that calls Statpad. It needs three things from you: a key it reads from the environment, a first request that proves the key works, and the MCP servers that let it look things up. Build with AI adds the Statpad skill and a checklist for the code the agent writes.
Get a key
Create an account. It starts on the Free plan, with no card: live data over REST for every league, 2,500 requests a month and 1 key. Sign-up creates that first key and shows it once, so copy it straight into the environment variable below. On a paid plan, open Keys and choose Create key to give the agent a key of its own, named after where it runs, such as coding-agent, so you can revoke it on its own later. API keys has the key limit for each plan.
Give the key to the agent
Put the key in the STATPAD_API_KEY environment variable, and have the agent’s code read it from there. The agent can then run requests that use the key without the key ever appearing in the conversation.
Start the agent from the shell where you exported the key, or keep the key in a .env file that your code loads, such as with node --env-file=.env. Add .env to .gitignore before you write the key into it.
Three rules keep the key safe:
- Don’t paste the key into the chat. Your prompt goes to the model provider and stays in the agent’s history. Tell the agent the key is in
STATPAD_API_KEY, and ask it not to print the key or write it to a file. - Keep the key on a server or your own machine. Anyone who opens a web page or a mobile app can read a key inside it. The REST API sends no CORS headers, so browser code can’t call it anyway. Ask for a backend that calls Statpad and serves your users.
- Give the agent its own key when your plan has a spare slot (Free has one key). Every key on an account shares one request rate and one monthly allowance. A separate key shows its own usage on the Keys page, and you can revoke it without touching your apps.
Make the first request
Ask the agent to run this, or run it yourself:
A working key gets 200 and the leagues it can read, one object each:
A 401 with code unauthorized means the variable is empty, or holds a key that’s mistyped or revoked. A 403 with code forbidden means the key is valid but the account has no active access, so check your plan at app.statpad.dev. Pass a league’s alias in every other path, such as /v1/nfl/games?date=2026-11-09. Then describe the program you want, and compare what the agent writes with the Quickstart.
Connect the MCP servers
Statpad has two MCP servers. Most coding agents want both.
Replace sporty_... with your key where a client needs it written out.
Claude Code
Cursor
Claude Desktop
Codex
By default, Claude Code keeps both in ~/.claude.json for the current project, outside the repository, with the key in plain text. Don’t add @statpad/mcp with --scope project, which writes it and the key into .mcp.json at the project root, a file meant to be committed.
An agent without MCP can read the docs directly: statpad.dev/docs/llms.txt lists every page, and appending .md to a page’s URL returns its Markdown. statpad.dev/llms.txt lists the rest of the site the same way.
Common mistakes
These are the mistakes coding agents make most with Statpad. Each one is cheap to catch in review.