Connect an AI agent to a gym
Every NinjaHQ gym has an AI connector: a Model Context Protocol (MCP) server with 318 tools. Any app that speaks MCP over HTTP can use it, after a person at the gym signs in and approves it. Nobody copies or pastes an API key.
Quick start: ChatGPT, Claude or another app
- Add a connector. Claude: Settings, Connectors, Add custom connector. ChatGPT: Plugins (on chatgpt.com/plugins), Add, Add MCP server, type Streamable HTTP. Name it NinjaHQ and use the address
https://mcp.ninjahq.ai/mcp. - Pick the gym. Type the gym's website or name.
- Sign in to the gym's back office with your own email and the code NinjaHQ sends you (or a passkey).
- Press Yes, connect. The page shows what the app will be able to do.
- Ask in plain words. "Add a Saturday open gym from 1 to 3." The app reads first, shows the change and asks before it saves.
Plans: OpenAI offers custom connectors on ChatGPT Business, Enterprise and Edu; on other plans they may be missing or read-only. Some Claude plans don't include custom connectors. Step by step: ChatGPT, Claude, a web developer's own agent.
The address
One address for every gym: https://mcp.ninjahq.ai/mcp. When an app connects, NinjaHQ asks which gym, then the person signs in to that gym's own back office. A gym's own address, https://yourgym.com/mcp, works too and skips the question.
| What | Value |
|---|---|
| Transport | MCP Streamable HTTP, stateless: POST JSON-RPC 2.0, the answer is JSON (no event stream, no session). GET and DELETE answer 405. |
| Protocol versions | 2025-06-18, 2025-03-26, 2024-11-05 |
| Sign-in | OAuth 2.1: discovery documents, dynamic client registration, authorization code with PKCE (S256 only), rotating refresh tokens |
| Keys | Access token 1 hour, refresh token 90 days. Tied to one gym, one person and one app. Stored only as SHA-256 hashes. |
| Methods | initialize, ping, tools/list, tools/call (resources/list and prompts/list answer empty lists) |
Who can connect, and what they get
| Role | What the app can do |
|---|---|
| Owner | Every tool (318). Owners can switch the connector off and disconnect anyone's app. |
| Manager | The same list; tools that are owners only answer that an owner has to do it. |
| Web developer | Only the 66 website tools: pages, design, site versions, photos, menus, logo, redirects, the website's words, email drafts, the Help Center and the website's analytics (counts only). No customers, payments, staff or settings. How to give a web developer access |
| Front desk staff | Can't connect an app. |
An owner adds a web developer under Staff with the role Web developer; they sign in with a code sent to their own email. How to give your web developer access.
The OAuth flow, for MCP client authors
| Request | What it does |
|---|---|
POST /mcp without a key | 401 with WWW-Authenticate pointing at the protected-resource document |
GET /.well-known/oauth-protected-resource/mcp | Which authorization server protects /mcp (RFC 9728) |
GET /.well-known/oauth-authorization-server | The endpoints below (RFC 8414) |
POST /oauth/register | Dynamic client registration: the app's name and redirect addresses (https, or this computer for desktop apps; matched exactly) |
GET /connect?client_id=… | The consent step: which gym, sign in, Yes, connect (PKCE S256 required) |
POST /oauth/token | Code for an access token (1 hour) and a refresh token (90 days, a new one each time) |
The calls
With a key, every call is one POST. List the tools:
curl https://mcp.ninjahq.ai/mcp \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Each tool comes with its name, title, description, JSON Schema and annotations (readOnlyHint, destructiveHint, openWorldHint). Call one:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "add_closure",
"arguments": {
"date": "2026-11-26",
"reason": "Thanksgiving",
"dry_run": true
}
}
}
The answer has the result as text and as structuredContent. A mistake the person can fix comes back as isError: true with a plain sentence, such as which option was wrong and what it accepts:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"content": [
{
"type": "text",
"text": "{ …what would change… }"
}
],
"structuredContent": {
"…": "…"
},
"isError": false
}
}
Safety rules every call follows
- One gym only. The key, the address and every database query belong to that gym.
- Same checks as the back office. Writes go through the same validation as the back office forms. Unknown options, missing required ones and values outside a list are refused in plain words.
- dry_run. 166 tools take
dry_run: trueto show what would change and save nothing. - confirm. Turning something off, removing, publishing and restoring take
confirm: true(64 tools). - History. Every change is recorded under "<person's email> (via <app>)" and can be put back with
restore_changeor the History page. - Totals, not people. Reads give totals; they never return a customer's name or contact details.
- Nothing that moves money or reaches people. No payments or refunds; emails are saved as drafts the owner sends; no code runs on the site.
- Limits per gym: 120 changes and 1,500 questions an hour, 40 photos a day.
Discovery files on every live gym site
/.well-known/mcp/server-card.json: the MCP server card/.well-known/api-catalog: the API catalog (RFC 9727)/.well-known/ai-catalog.jsonand/.well-known/agent-skills/index.json: what an agent can do there/auth.md: how an assistant connects, in plain Markdown/llms.txtand/developers.md: the site and the developers' guide for AI assistants
These docs, machine-readable
/developers/llms.txt: a short index for AI assistants/developers/llms-full.txt: everything as one text file/developers/tools.json: every tool's JSON Schema and annotations, by area, with the section types and design tokens