# auth.md

You are an agent. Rubric has two endpoints and they are two doors onto the same
room:

| endpoint | protocol | for |
|---|---|---|
| `https://rubric.design/mcp` | MCP, streamable HTTP | you want to call its tools |
| `https://rubric.design/a2a` | A2A 1.0, JSON-RPC | you want to ask it a question |

**One credential covers both.** They are bindings onto a single protected
resource, so a token is bound to `https://rubric.design/mcp` whichever door you use, and
the steps below are the same for either.

Every call is authenticated — there is no anonymous access and no shared demo
key. Follow the steps in order.

The heading and the step structure follow the auth.md convention on purpose, so
a reader that knows the shape can skim it. Where a step does not apply to this
service, it says so rather than being omitted, because a missing step reads as
an oversight.

## Step 1 — Discover

Two hops, and you may already have done the first.

Call the endpoint without a credential. It answers **401** with the pointer:

```http
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer error="invalid_token",
  resource_metadata="https://rubric.design/.well-known/oauth-protected-resource/mcp",
  scope="openid email"
```

1a. Fetch that `resource_metadata` URL. It is RFC 9728 Protected Resource
Metadata and names `resource` and `authorization_servers`.

1b. Fetch `${authorization_servers[0]}/.well-known/oauth-authorization-server`
for the authorization and token endpoints, the JWKS URI and
`code_challenge_methods_supported`.

Rubric is the resource server only. The authorization server is a different
origin, which is why step 1b leaves this domain.

If you would rather not leave it, <https://rubric.design/.well-known/oauth-authorization-server>
relays that same document unchanged and adds an `agent_auth` block naming the
registration URL, the two credential types and the resource indicator. It is a
relay, not a second source — `issuer` in it is still the authorization
server's, and `authoritative_metadata` points back at the original.

## Step 2 — Pick a method

**OAuth 2.1** if you can open a browser for a human to approve. Nothing is
pasted anywhere and the grant is revocable.

**An API key** if you cannot — CI, a scheduled job, a server-side script, or
stdio, where no human can answer a prompt. Skip to Step 6.

## Step 3 — Register

Dynamic client registration (RFC 7591) is supported at the authorization
server's `registration_endpoint`, so no client id has to be arranged in
advance. A pre-registered client works too.

## Step 4 — Claim ceremony

Not applicable. There is no separate claim step: the human approval happens
inside the authorization request in Step 5.

## Step 5 — Exchange for an access token

Authorization code flow with PKCE (`S256`).

Send `resource=https://rubric.design/mcp` (RFC 8707) on **both** the authorization and
the token request. Tokens are audience-bound to that exact string, and one
issued for any other audience is refused here — including a token minted by the
same authorization server for a different purpose.

The person approving sees a consent screen naming your client and the address
the grant will be delivered to.

## Step 6 — Use the access token

Send it as `Authorization: Bearer <token>`, to either endpoint.

Over A2A that is `SendMessage` with your question as a text part, or a data
part naming a skill and its arguments. Rubric answers synchronously and creates
no tasks, so the result is in the response — `GetTask` and the other task
methods answer `-32004 UnsupportedOperation`, which is the truth rather than a
missing feature. The card at <https://rubric.design/.well-known/agent-card.json> lists the
skills.

An API key goes in the same header, as `Authorization: Bearer uxa_live_...`.
Keys are created by an account holder at <https://rubric.design/app/keys>, shown once, and
stored only as a hash.

Calls are metered against the account behind the credential. The free tier is
capped by number of calls per day; a paid plan includes a monthly allowance of
MCP calls (an audit from your own agent uses no runs; runs are for managed runs
on Rubric's browser), shown at
<https://rubric.design/app/plan>. Connecting an account grants nothing on its own.

## Step 7 — Revocation

The account holder can disconnect any client at <https://rubric.design/app/account>, which
revokes the grant, drops that client's sessions and invalidates its refresh
tokens. Your next call then fails at Step 1 again — treat a 401 on a previously
working token as "start over from Discover", not as an error to retry.

---

Machine-readable:

- Protected resource metadata: <https://rubric.design/.well-known/oauth-protected-resource/mcp>
- Authorization server metadata (relayed, with `agent_auth`): <https://rubric.design/.well-known/oauth-authorization-server>
- MCP server card: <https://rubric.design/.well-known/mcp/server-card.json>
- A2A agent card: <https://rubric.design/.well-known/agent-card.json>
- API catalog: <https://rubric.design/.well-known/api-catalog>
