# GameFan Wiki

> Wikis for games: pages, infoboxes, images and categories, public or private, many wikis on one install

This app has an interface for AI agents: the same actions and views as its screens, under the same rules, over MCP or JSON.

## Getting access

A person with an account signs in, opens https://gamefan.wiki/_agents and issues a token (full access, or read-only). The token is shown once. Send it as `Authorization: Bearer <token>`: the agent acts as that person, who can revoke it there and see what it did.

## Endpoints

- MCP (streamable HTTP, JSON replies): `POST https://gamefan.wiki/_mcp`. initialize returns instructions: the app's records, its rules and how calls work.
- JSON: `GET https://gamefan.wiki/_agent/describe` lists the callables with their parameters, effects and refusals; `POST https://gamefan.wiki/_agent/call/<name>` takes `{"args": {…}, "dry_run": true|false, "confirm": "…", "idempotency_key": "…"}`.

## Conventions

- In describe, each callable's parameters is a list of {name, type, optional, schema} (schema: JSON Schema); args is an object by those names. A parameter that isn't optional must be given. A row is given by its id (or its address, where the schema says so).
- An action that worked replies with changes: by kind, the ids of the rows it created, updated and deleted (a row it made along the way, like a first page, is found there).
- dry_run: true runs an action, reports what it would change, and keeps nothing.
- An action that deletes rows needs confirm. Called without it, it changes nothing and replies confirm_required with the changes and a confirm value; call again with that value to apply.
- idempotency_key makes a retry safe: the same key returns the first call's result.
- Each token may make so many calls, and so many actions, a minute: describe's limits says how many for yours. Past one, the outcome is blocked, with error.retry_after (and a Retry-After header): the seconds until the count starts again.
- Every reply has an outcome: ok, invalid, forbidden, not_found, unauthenticated, blocked, confirm_required or stale. A refusal carries a message, and often a hint naming the rule.
