# Quickstart

Nimble Fox hosts games that anyone plays in a web browser, on computers and phones.
These are the ways a coding agent makes, uploads and hosts one here today.

## Deploy in one command (Node 20+)

With Node.js 20 or later and npm, this command uploads the build in `./dist`, releases it and prints its play link.

```sh
npx --yes \
  https://nimblefox.ai/cli/nf-f9ea467a.tgz \
  deploy --origin https://nimblefox.ai
```

Check the package's SHA-256 before you run it:

```sh
curl -fsSLO \
  https://nimblefox.ai/cli/nf-f9ea467a.tgz &&
  printf '%s  %s\n' \
  'f9ea467a363491d092ea8a01a3faf97ce073a3602e8a3dc9185ec19e1516bae8' \
  'nf-f9ea467a.tgz' |
  sha256sum -c - &&
  npx --yes "file:$PWD/nf-f9ea467a.tgz" \
  deploy --origin https://nimblefox.ai
```

On macOS, use `shasum -a 256 -c -` in place of `sha256sum -c -`.
The hash comes from this site too, so the check catches a damaged or swapped download, not a compromised site.

The package has no dependencies or install scripts. With `--help` in place of `deploy`, the CLI lists its commands.

With `test` in place of `deploy`, the CLI runs the game in headless Chrome or Chromium at a phone's and a desktop's size and checks its files with the server's rules. Without Chrome or Chromium it says so, still runs the checks that need no browser, and exits 0 with the browser step skipped. To run the game in a browser, install Chrome or Chromium or set `CHROME_BIN` to one, or deploy and open the play link.

After `deploy`, the CLI keeps its sign-in for this site. For your own calls to the creator API, get a current access token from it with `token` and send it as a bearer token:

```sh
TOKEN=$(npx --yes \
  https://nimblefox.ai/cli/nf-f9ea467a.tgz \
  token --origin https://nimblefox.ai)
curl -sS -H "Authorization: Bearer $TOKEN" \
  https://nimblefox.ai/api/v1/me
```

`token` prints the token alone, refreshed first when it is close to expiring, and never the refresh token. With no sign-in it prints nothing and exits 3. Don't read the CLI's credentials file: `token` is the way to its sign-in.

When this site creates unclaimed agent accounts, `deploy` with no credentials creates one and prints a claim link. The new game is unlisted, so anyone with its play link can open it while the account is active. To see a valid claim link again, use the same command with `claim` in place of `deploy` and keep `--origin`. [Unclaimed agent accounts](/auth.md#unclaimed-agent-accounts) explains how a person claims the games.

## No Node or npm? Plain HTTPS

An agent needs no sign-in or Nimble Fox tools: over plain HTTPS it makes its own account, uploads the HTML5 build and gives its person a claim link.

- You need `curl`, Node or Python, and your game's build as one file, `dist/index.html`.
- Pick Node or Python once; every block switches.
- Put your names in the first block's `TITLE` and `AGENT` or its fields, then paste blocks in order into one shell.

The title takes 1–80 characters, without `"`, `\` or tabs; the agent's name takes up to 100 letters, digits, spaces and `._()/+:-`, without `://`. Edit both in the first block before you press Enter, writing `'` as `'\''`.

```sh node
TITLE='My game'
AGENT='My agent'
API=https://nimblefox.ai/api/v1
uuid() { node -e 'console.log(crypto.randomUUID())'; }
ACCOUNT_KEY=$(uuid)
GAME_KEY=$(uuid)
RELEASE_KEY=$(uuid)
SHARE_KEY=$(uuid)
```
```sh python
TITLE='My game'
AGENT='My agent'
API=https://nimblefox.ai/api/v1
uuid() { python3 -c 'import uuid; print(uuid.uuid4())'; }
ACCOUNT_KEY=$(uuid)
GAME_KEY=$(uuid)
RELEASE_KEY=$(uuid)
SHARE_KEY=$(uuid)
```

Save the helpers `pow`, `field` and `need` as `nf.mjs` or `nf.py` in a private folder, `$NF`, outside your game's; `pow` takes a few seconds.

```sh node
NF=$(mktemp -d)
cat > "$NF/nf.mjs" <<'EOF'
import { createHash } from "node:crypto";
import { readFileSync } from "node:fs";
const [command, ...args] = process.argv.slice(2);
if (command === "pow") {
  const [challenge, difficulty] = args;
  if (!challenge) process.exit(1);
  const rest = BigInt(256 - Number(difficulty));
  const sha = (text) => createHash("sha256").update(text).digest("hex");
  let nonce = 0;
  // SHA-256 of the challenge, then the nonce, starts with
  // `difficulty` zero bits.
  while (BigInt(`0x${sha(challenge + nonce)}`) >> rest) nonce++;
  console.log(nonce);
}
if (command === "field") {
  // The value at a path of the answer, as game.id; none where its
  // call was refused.
  let value;
  try { value = JSON.parse(readFileSync(0, "utf8")); } catch {}
  for (const key of args[0].split(".")) value = value?.[key];
  if (value == null) process.exit(1);
  console.log(value);
}
EOF
pow() { node "$NF/nf.mjs" pow "$@"; }
field() { node "$NF/nf.mjs" field "$@" < "$NF/answer.json"; }
need() {
  n=1
  for v in "$NONCE" "$TOKEN" "$JOB" "$STORED" "$LIVE" \
    "$RELEASED" "$PLAY"; do
    [ "$n" -lt "$1" ] || break
    if [ -z "$v" ] && [ -z "$(cat "$NF/answer.json" 2>/dev/null)" ]
    then
      echo "Step $n got no answer from $API: check API in the" \
        "first block and your connection, then paste step $n again." >&2
      return 1
    elif [ -z "$v" ] && [ "$n" = 5 ]; then
      echo "Step 5's build isn't live: paste step 5 again," \
        "or if it failed, see If the build fails." >&2
      return 1
    elif [ -z "$v" ]; then
      echo "Step $n was refused: fix what it says," \
        "then paste step $n again." >&2
      return 1
    fi
    n=$((n + 1))
  done
  case $1 in 3|4) [ -f dist/index.html ] || {
    echo "There's no dist/index.html in this folder:" \
      "cd to your game's folder, then paste step $1 again." >&2
    return 1
  };; esac
}
```
```sh python
NF=$(mktemp -d)
cat > "$NF/nf.py" <<'EOF'
import hashlib, json, sys
command, args = sys.argv[1], sys.argv[2:]
if command == "pow":
    if not args[0]:
        sys.exit(1)
    challenge, difficulty = args[0], int(args[1])
    rest = 256 - difficulty
    def sha(text):
        return hashlib.sha256(text.encode()).digest()
    nonce = 0
    # SHA-256 of the challenge, then the nonce, starts with
    # `difficulty` zero bits.
    while int.from_bytes(sha(f"{challenge}{nonce}"), "big") >> rest:
        nonce += 1
    print(nonce)
if command == "field":
    # The value at a path of the answer, as game.id; none where its
    # call was refused.
    try:
        value = json.load(sys.stdin)
    except ValueError:
        value = None
    for key in args[0].split("."):
        value = value.get(key) if isinstance(value, dict) else None
    if value is None:
        sys.exit(1)
    print(value)
EOF
pow() { python3 "$NF/nf.py" pow "$@"; }
field() { python3 "$NF/nf.py" field "$@" < "$NF/answer.json"; }
need() {
  n=1
  for v in "$NONCE" "$TOKEN" "$JOB" "$STORED" "$LIVE" \
    "$RELEASED" "$PLAY"; do
    [ "$n" -lt "$1" ] || break
    if [ -z "$v" ] && [ -z "$(cat "$NF/answer.json" 2>/dev/null)" ]
    then
      echo "Step $n got no answer from $API: check API in the" \
        "first block and your connection, then paste step $n again." >&2
      return 1
    elif [ -z "$v" ] && [ "$n" = 5 ]; then
      echo "Step 5's build isn't live: paste step 5 again," \
        "or if it failed, see If the build fails." >&2
      return 1
    elif [ -z "$v" ]; then
      echo "Step $n was refused: fix what it says," \
        "then paste step $n again." >&2
      return 1
    fi
    n=$((n + 1))
  done
  case $1 in 3|4) [ -f dist/index.html ] || {
    echo "There's no dist/index.html in this folder:" \
      "cd to your game's folder, then paste step $1 again." >&2
    return 1
  };; esac
}
```

1. **Get a challenge.** The helper `pow` solves it for step 2 to send, under the rules in [auth.md](/auth.md#unclaimed-agent-accounts).
   ```sh
   curl -sS -w '\n' \
     "$API/agent-accounts/challenge" |
     tee "$NF/answer.json"
   CHALLENGE=$(field challenge)
   DIFFICULTY=$(field difficulty)
   NONCE=$(pow "$CHALLENGE" "$DIFFICULTY")
   ```
   ```json 200
   {"challenge": "…", "difficulty": 20, "expiresAt": "…"}
   ```
2. **Create the account.** Send the nonce with your agent's name; the block prints the new account's id, or the refusal, and keeps the refresh token for a later session in `~/.config/nimblefox/refresh-token-<account id>`, a file for each account that only you can read.
   ```sh
   need 2 && { curl -sS -o "$NF/answer.json" \
     "$API/agent-accounts" \
     -H "Content-Type: application/json" \
     -H "Idempotency-Key: $ACCOUNT_KEY" \
     -d @- <<EOF || : > "$NF/answer.json"
   {"client": "$AGENT",
    "challenge": "$CHALLENGE", "nonce": "$NONCE"}
   EOF
     ACCOUNT=$(field account.id)
     REFRESH=$(field refresh_token)
     TOKEN=$(field access_token)
     [ -n "$ACCOUNT" ] && [ -n "$REFRESH" ] && [ -n "$TOKEN" ] || {
       TOKEN=; cat "$NF/answer.json"; echo
       echo "Step 2 made no account: fix what it says," \
         "then paste step 2 again." >&2; }
     [ -z "$TOKEN" ] || (umask 077 && mkdir -p ~/.config/nimblefox &&
       rm -f ~/.config/nimblefox/refresh-token-"$ACCOUNT" &&
       echo "$REFRESH" > ~/.config/nimblefox/refresh-token-"$ACCOUNT" &&
       echo "Step 2 made account $ACCOUNT."); }
   ```
   ```json 201
   {
     "access_token": "…",
     "refresh_token": "…",
     "account": {"id": "…", "claimed": false},
     "claim": {"url": "https://nimblefox.ai/claim/…", "code": "…"}
   }
   ```
3. **Create the game.** Send your title and your one file, `dist/index.html`, under `Build/Web/`; a build of more files is under the table.
   ```sh
   need 3 && curl -sS -w '\n' \
     "$API/games" \
     -H "Authorization: Bearer $TOKEN" \
     -H "Content-Type: application/json" \
     -H "Idempotency-Key: $GAME_KEY" \
     -d @- <<EOF | tee "$NF/answer.json"
   {"title": "$TITLE", "runtime": "html5",
    "files": [{"path": "Build/Web/index.html",
               "size": $(wc -c < dist/index.html)}]}
   EOF
   GAME=$(field game.id)
   JOB=$(field upload.job)
   ```
   ```json 201
   {
     "game": {
       "id": "…",
       "visibility": "private",
       "play": "https://nimblefox.ai/…"
     },
     "upload": {
       "job": "…",
       "partSize": 16777216,
       "files": [
         {"index": 0, "path": "Build/Web/index.html", "parts": 1}
       ],
       "partUrl":
         "https://nimblefox.ai/api/v1/uploads/…/files/{index}/parts/{part}"
     }
   }
   ```
4. **Upload the file.** Send each part's bytes to `upload.partUrl`; a file smaller than `upload.partSize` is one part.
   ```sh
   need 4 && curl -sS -w '\n' \
     "$API/uploads/$JOB/files/0/parts/0" \
     -T dist/index.html \
     -H "Authorization: Bearer $TOKEN" |
     tee "$NF/answer.json"
   STORED=$(field stored)
   ```
   ```json 200
   {"stored": true}
   ```
5. **Wait until it's live.** Read the job until it is `live`, or `failed` with an `error` whose `fix` and `detail` say what to change in the build.
   ```sh
   need 5 && {
     for TRY in 1 2 3 4 5 6; do
       curl -sS -w '\n' \
         "$API/jobs/$JOB?wait=40" \
         -H "Authorization: Bearer $TOKEN" |
         tee "$NF/answer.json"
       [ -n "$(cat "$NF/answer.json")" ] || {
         echo "No answer from $API: check API and your connection," \
           "then paste step 5 again." >&2; break; }
       case $(field status) in live|failed) break;; esac
       [ "$TRY" = 6 ] &&
         echo "Not live after 6 tries: run this block again."
     done
     [ "$(field status)" = failed ] &&
       echo "The build failed and its game is gone: fix what its" \
       "error says, then see If the build fails."
   }
   LIVE=$(field version)
   ```
   ```json 200
   {"status": "live", "game": "…", "version": "…"}
   ```
6. **Release it.** Make the version from step 5 the one people play.
   ```sh
   need 6 && curl -sS -w '\n' -X POST \
     "$API/games/$GAME/release" \
     -H "Authorization: Bearer $TOKEN" \
     -H "Idempotency-Key: $RELEASE_KEY" |
     tee "$NF/answer.json"
   RELEASED=$(field release.version)
   ```
   ```json 200
   {"release": {"version": "…", "publishedAt": "…"}}
   ```
7. **Share its link.** Make it unlisted: anyone with the link can play it, and it isn't listed in Explore.
   ```sh
   need 7 && curl -sS -w '\n' -X PATCH \
     "$API/games/$GAME" \
     -H "Authorization: Bearer $TOKEN" \
     -H "Content-Type: application/json" \
     -H "Idempotency-Key: $SHARE_KEY" \
     -d '{"visibility": "unlisted"}' |
     tee "$NF/answer.json"
   PLAY=$(field play)
   ```
   ```json 200
   {"id": "…", "visibility": "unlisted", "play": "https://nimblefox.ai/…"}
   ```
8. **Give the person the claim link.** Print the play and claim links; the person signs in or makes a free account, selects Claim, and the games are theirs ([auth.md](/auth.md#lifetime)).
   ```sh
   need 8 && { curl -sS -w '\n' \
     "$API/me" \
     -H "Authorization: Bearer $TOKEN" |
     tee "$NF/answer.json"
     CLAIM=$(field claim.url) &&
       echo "Play: $PLAY" && echo "Claim: $CLAIM"; }
   ```
   ```json 200
   {
     "kind": "unclaimed",
     "claim": {"url": "https://nimblefox.ai/claim/…", "code": "…"}
   }
   ```
   ```text printed
   Play: https://nimblefox.ai/…
   Claim: https://nimblefox.ai/claim/…
   ```

### How the commands fit together

Each step has its `curl` command and its response, trimmed to the fields the steps after it use. `field` reads a value from the last answer, kept in `$NF/answer.json`. Before a call, `need` checks each earlier step's value, and for steps 3 and 4 that `dist/index.html` is there. The game stays private until step 7.

| Variable | Set by | Read by |
| --- | --- | --- |
| `TITLE` | The first block | Step 3 |
| `AGENT` | The first block | Step 2 |
| `API` | The first block | Steps 1–8 |
| `ACCOUNT_KEY` | The first block | Step 2 |
| `GAME_KEY` | The first block | Step 3 |
| `RELEASE_KEY` | The first block | Step 6 |
| `SHARE_KEY` | The first block | Step 7 |
| `NF` | The helpers, `mktemp -d` | The helpers and steps 1–8 |
| `CHALLENGE` | Step 1, `challenge` | Steps 1 and 2 |
| `DIFFICULTY` | Step 1, `difficulty` | Step 1 |
| `NONCE` | Step 1, from `pow` | Steps 2–8 |
| `TOKEN` | Step 2, `access_token` | Steps 2–8 |
| `ACCOUNT` | Step 2, `account.id` | Step 2, the kept file's name |
| `REFRESH` | Step 2, `refresh_token` | Step 2, which keeps it in a file; the token endpoint, once `TOKEN` has run out |
| `GAME` | Step 3, `game.id` | Steps 6 and 7 |
| `JOB` | Step 3, `upload.job` | Steps 4–8 |
| `STORED` | Step 4, `stored` | Steps 5–8 |
| `LIVE` | Step 5, `version` | Steps 6–8 |
| `RELEASED` | Step 6, `release.version` | Steps 7 and 8 |
| `PLAY` | Step 7, `play` | Step 8 |
| `CLAIM` | Step 8, `claim.url` | Step 8 |

Each call after step 2 sends `Authorization: Bearer <access_token>`, and each `POST` and `PATCH` an `Idempotency-Key` header, one of the first block's keys. The same key within 24 hours replays a call's first answer; use a new key for a new request, not a retry. A key is kept only for a call that went through. Creating the account again with the same key, from the same address, returns the same account and claim link with new tokens; from another address it is a new call. An access token lasts an hour, and the token endpoint trades `REFRESH` for a new pair ([auth.md](/auth.md#where-tokens-go)); the claim link from step 2 stays the same.

A build of more than one file lists each in step 3's `files`. Its answer gives each file's `index` and number of `parts`, and step 4 sends each part to `partUrl` with them filled in.

One address makes at most 3 agent accounts a day, and a challenge lasts 10 minutes, so after a refusal paste the refused step again rather than starting over.

### If the build fails

Step 5 ends `failed` when the server can't take the build, its `error` with a `fix` and a `detail` such as "The build’s index.html must be saved as UTF-8, not UTF-16." The game is then removed: `$GAME` is gone, and it doesn't count toward the account's games.
Every upload counts toward the 10 an unclaimed account makes a day, a failed one included.
Fix the build in `dist/`, then paste `GAME_KEY=$(uuid)` for a new game and steps 3–8 again. With the one command, fix the build in `dist/` and run the same command again.

### If a step is refused

Its answer's `fix` says what to change: change it, then paste that step again, and the first block too if you changed a name.
Each step after it stops before its call and says which step to paste again.
If curl prints `Failed to connect` or `Could not resolve host`, it can't reach the site, so nothing was refused: check `API` in the first block and your connection, then paste the same step again.

[Errors](/docs/agents/errors) gives each refusal's fix.

## Upload a build with the creator API

The creator API v1, under `/api/v1`, takes a game's build files with an access token from Nimble Fox's OAuth server, which the person approves once ([auth.md](/auth.md)): it creates the game, uploads its files in parts, reports the upload's job and releases the game. The [OpenAPI description](/openapi.json) has every operation.

An HTML5 game can't be listed publicly yet, whatever the grant's scope: until Nimble Fox's first-listing review exists, `visibility: "public"` answers 403 `PUBLIC_NEEDS_REVIEW`. Any other game is listed publicly, in Explore under the person's name, by a grant with the `publish` scope or by the person, who selects Publish on its page. [auth.md](/auth.md#listing-a-game-publicly) has the rules.

## Host an HTML5 build

An HTML5 build is a folder with `index.html` at its root and the files it loads beside it, of these types:

| Files | Extensions |
| --- | --- |
| Scripts | `.js`, `.mjs` |
| Styles | `.css` |
| Data | `.json`, `.txt` |
| Pictures | `.png`, `.jpg`, `.jpeg`, `.webp`, `.svg` |
| Sounds | `.mp3`, `.ogg`, `.wav` |
| Fonts | `.woff`, `.woff2`, `.ttf`, `.otf` |
| 3D models in glTF | `.glb`, or `.gltf` with its `.bin` files |
| WebAssembly | `.wasm` |

Any other type is refused with `BUNDLE_FILE_TYPE`, so a Godot web export, which needs its `.pck` file, can't be uploaded yet. The game runs in a sandboxed frame that loads only its own version's files, on computers and phones, so the build's paths are relative to `index.html`, as `assets/game.js` is, never from the site's root, as `/assets/game.js` is. A Vite build gets relative paths with `base: './'` in its config.

The game's frame takes no clicks, keys or focus until the game says it can be played: once it can, it posts `parent.postMessage({type: "nimble-loaded"}, "*")`.
Otherwise, for a game an agent made through the creator API, Nimble Fox posts it about 3 s after the page's `load` event.
A game that loads saves or has a loading screen adds `<meta name="nimble-loaded" content="manual">` to its page and posts the message itself once it can be played, so the frame waits for it.

An agent uploads one through the creator API with `runtime: "html5"`, and the account needs no allow-list. A new game's visibility follows the account's plan, and it can be made private or unlisted. Anyone with an unlisted game's link can play it, and it isn't listed in Explore. Where Nimble Fox's plans are on, a person on a free plan needs Pro to start sharing a game by its link: a new game of theirs stays private, and the API answers `UNLISTED_NEEDS_PRO`. An unclaimed agent account shares its games by link without Pro, and those it shared keep their links after the claim. It can't be listed publicly yet, whatever the grant's scope: until Nimble Fox's first-listing review exists, the API answers `PUBLIC_NEEDS_REVIEW`.

A game that isn't private, whose owner the platform admits, has a QR code of its page for opening it on a phone: an SVG at its page's address with `/qr.svg` added.

### WebAssembly

A build may hold WebAssembly modules (`.wasm`), served as `application/wasm`, so games compiled to WebAssembly run here as single-threaded web builds. `eval` stays blocked in the game's frame, and this works there: `WebAssembly.instantiateStreaming(fetch("game.wasm"))`. Builds that need a preloaded `.data` file, as Emscripten's `--preload-file` makes, or Godot's `.pck` file can't be uploaded yet, and every file has the per-file size cap.

## Credentials

The agent signs in for the person once, with OAuth 2.1 and PKCE. The person signs in and approves the agent; the agent does the rest. [auth.md](/auth.md) has each step.

## Make a game through the MCP server

The MCP server at `https://nimblefox.ai/mcp` (Streamable HTTP) has tools to list the account's games, create one, open it in a studio, read and write its project's files, playtest it and publish it. A game made this way is a Unity project, which the studio builds to play in the browser.

Claude Code connects with:

```sh
claude mcp add --transport http nimble-fox https://nimblefox.ai/mcp
```

Other MCP clients connect to `https://nimblefox.ai/mcp` and sign in with the same OAuth flow.

Claude Code adds the MCP server to this project, its default scope. It shows up in a new Claude Code session. An agent already mid-task can use the creator API over HTTPS instead.

The MCP server's platform tools make the creator API's calls below, with its rules, limits and error codes, for HTML5 and Unity web builds:

- `platform_whoami`
- `platform_limits`
- `platform_list_games`
- `platform_get_game`
- `platform_create_game`
- `platform_set_visibility`
- `platform_start_upload`
- `platform_upload_status`
- `platform_release`
- `platform_report_issue`

A build's bytes never pass through MCP: the agent sends each part over plain HTTPS, a `PUT` to the upload's `partUrl`, with the same access token.

An agent with no person at hand uses the MCP server with no human step until the claim: it makes an account of its own over plain HTTPS ([auth.md](/auth.md#unclaimed-agent-accounts)), sends that account's access token to `/mcp` for the platform tools, and gives its person the claim link to keep the games.

## Public games

`GET /api/public-games` lists the community's public games as JSON. The [OpenAPI description](/openapi.json) has its parameters.

## Errors and limits

[Errors](/docs/agents/errors) lists the creator API's error codes, each with its fix.

Something wrong that the docs don't explain? Tell the Nimble Fox team with `POST /api/v1/feedback`. That covers an error you didn't expect, docs that don't match what the API does, a missing feature, or a security issue. Send `kind` (`bug`, `feedback`, `docs`, `feature_request` or `security`), a one-line `title` and the `details`. Add `steps`, `expected`, `actual` and the `requestId` where you have them. Never include secrets or personal data: a report holding a token, key or password is refused. Only Nimble Fox's operators read security reports.
The MCP server's tool for it is `platform_report_issue`.
The CLI's command for it is `nimblefox feedback "<title>" --details "<what happened>"`.
[Limits](/docs/agents/limits) has the main limits on uploads, games and API calls.
