# starryai auth.md

The starryai MCP server runs at https://app.starryai.com/mcp over Streamable HTTP. Use the
[creator guide](https://starryai.com/mcp) for examples and the [API catalog](https://starryai.com/.well-known/api-catalog) for discovery.

## Public tools

List tools and workflows with tools/list and prompts/list. Calls such as edit_costs,
list_recipes and list_photoshoots work without signing in. The public catalog is free to read.

## Register an agent with verified email

An agent can request a one-hour access token with the `catalog.read` scope for public MCP tools.
A creator can authorize `creator.tools` separately for their account, private media and paid actions.
Use the registration flow when the person at the mailbox has asked to register the agent.

1. Read the [resource metadata](https://app.starryai.com/.well-known/oauth-protected-resource/mcp) and follow its authorization server to the
   [issuer metadata](https://app.starryai.com/.well-known/oauth-authorization-server). The `agent_auth` block
   advertises `verified_email` and the registration and claim URLs.
2. POST JSON to `https://app.starryai.com/agent/auth`. Replace the example address with the user's email.

       {"type":"identity_assertion","assertion_type":"verified_email","assertion":"user@example.com","requested_credential_type":"access_token"}

   Keep the returned `claim_token` in memory. The user receives a six-digit agent registration
   code by email. The claim expires after ten minutes.
3. With the user's approval, POST the `claim_token` and the six-digit `otp` as JSON to
   `https://app.starryai.com/agent/auth/claim/complete`. The response includes `registration_id`,
   `credential`, `credential_expires` and `scopes`. Each claim can issue one credential.
4. Send `Authorization: Bearer <credential>` to `https://app.starryai.com/mcp`. To revoke it early, POST
   the `token` as form data to `https://app.starryai.com/mcp/revoke`. An expired credential requires a fresh
   registration. If a claim expires or reaches its attempt limit, restart with a new claim.

## Authorize a creator

1. Read the [protected resource metadata](https://app.starryai.com/.well-known/oauth-protected-resource/mcp) for the MCP endpoint
   and the [authorization server metadata](https://app.starryai.com/.well-known/oauth-authorization-server) for its issuer and endpoints.
2. Register the public client with POST https://app.starryai.com/mcp/register, the advertised registration_endpoint.
   Supply client_name and redirect_uris with an HTTPS or loopback redirect URI.
   The response supplies a client_id.
3. Start an authorization code flow with PKCE S256, state, the registered redirect_uri,
   resource=https://app.starryai.com/mcp and scope=creator.tools. The creator signs in with Google or Apple
   and approves the named client. Request offline_access only when refresh access is needed.
4. Exchange the code and code_verifier at the advertised token_endpoint. Send the access token
   in the Authorization header using the Bearer scheme. Use the advertised revocation_endpoint
   to revoke access. Tokens and costs belong to the authorizing creator.

## Edit cost example

Ask “What would it cost to edit this photo at each quality level?” Call edit_costs
with an empty arguments object. A production response on 2026-11-30 returned
the following Lumens per image.

    {"standard": 1, "better": 6, "best": 14}

At those prices, editing two photos at better quality would cost 12 Lumens.
Fetch a fresh quote and confirm the total with the creator before running a paid edit.
Each paid action takes a fresh requestKey. Reuse that key only to retry the same action.
After edit_image returns an editId, poll get_edit for completion and the result URL.