# auth.md

Registration and authentication instructions for AI agents connecting to
the Syntology graph API. This document is self-contained; the same
information is also published as structured metadata (see below) for
agents that prefer to parse JSON over Markdown.

## Who this is for

Any agent, script, or client that wants to query the Syntology knowledge
graph programmatically via MCP (`https://syntology.ai/mcp`) or the
underlying `/graph/ask` endpoint.

## Identity model: anonymous

There is no signup, no email, no CAPTCHA, and no identity verification.
POST for a token and use it. There is no `verified_email` or
`identity_assertion` (ID-JAG) flow, because this service doesn't verify
either of those things today.

What bounds usage instead, three separate limits that all apply at once:

* **20 queries per token**, 30-minute expiry. Returned in the mint
  response as `queries_remaining`, and on every answer as
  `X-Token-Queries-Remaining`.
* **50 free questions per IP address per day.** Returned as
  `X-Free-Questions-Limit` / `X-Free-Questions-Remaining`. This is the
  number that surprises people: it is not the same budget as the one
  above, and a token with queries left can still hit it.
* **One token mint per IP per minute.** Hold the token you get.

A decline, or an answer with no results, still spends the daily
allowance -- it cost a real query against the graph. It never spends a
paid balance; that is refunded (see "never charge for a no").

## Get a token

**One call, for an agent, script, or one-off:** `POST` to the token
endpoint. Nothing else is required.

```bash
curl -X POST https://syntology.ai/api/oauth/trial/token \
  -H "Content-Type: application/json" \
  -d '{"grant_type": "client_credentials"}'
```

That is the whole flow for an automated caller. `{"grant_type":
"anonymous"}` is accepted as an alias and returns the same thing.

**Or the standard OAuth path, if your client expects one** (Claude
Desktop and similar): dynamic client registration, then authorization_code
+ PKCE. Same token, same limits -- use it when your MCP client drives the
flow for you, not because the direct call is second-class.

```bash
curl -X POST https://syntology.ai/register \
  -H "Content-Type: application/json" \
  -d '{"redirect_uris": ["http://localhost:PORT/callback"]}'
```

Full flow (register -> authorize -> exchange code for token) is
documented with a worked example at
[/developers](https://syntology.ai/developers).

## Use the token

```bash
curl -X POST https://syntology.ai/mcp \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"your-client","version":"1"}}}'
```

## Structured metadata

- Protected Resource Metadata (RFC 9728):
  [/.well-known/oauth-protected-resource/mcp](https://syntology.ai/.well-known/oauth-protected-resource/mcp)
- Authorization Server Metadata, including the `agent_auth` block this
  file describes in prose:
  [/.well-known/oauth-authorization-server](https://syntology.ai/.well-known/oauth-authorization-server)
- MCP Server Card (tool list, schemas):
  [/.well-known/mcp/server-card.json](https://syntology.ai/.well-known/mcp/server-card.json)

## Scope

The only scope is `graph:ask` -- read-only graph queries. There is
nothing this token can write, delete, or spend.
