# auth.md - agent authorisation for ChangeCoin

```json
{
  "agent_auth": {
    "skill": "https://changecoin.com/auth.md",
    "register_uri": "https://changecoin.com/oauth/register",
    "identity_endpoint": "https://changecoin.com/oauth/register",
    "claim_endpoint": "https://changecoin.com/oauth/token",
    "claim_uri": "https://changecoin.com/oauth/authorize",
    "identity_types_supported": [
      "anonymous"
    ],
    "anonymous": {
      "credential_types_supported": [
        "oauth2_access_token"
      ],
      "claim_uri": "https://changecoin.com/oauth/authorize"
    },
    "events_supported": []
  }
}
```

Most tools on this MCP server are public and need no token: `list_currencies`,
`get_exchange_range`, `estimate_exchange_amount`,
`estimate_private_transfer`, `get_transaction`, `read_document`.

Two tools are protected. `create_exchange` and `create_private_transfer` are
the only write paths on this site, so they require an access token with scope
`exchange:write`.

Creating an order moves no money. It returns a deposit address and waits; if
nothing is sent, the order expires. The gate exists so that the calls with a
side effect are deliberate and attributable to a registered client, not because
funds are at risk at that moment.

## Registering

Dynamic client registration (RFC 7591) is open - no pre-approval:

    POST https://changecoin.com/oauth/register
    Content-Type: application/json

    { "client_name": "Your agent", "redirect_uris": ["https://your.app/callback"] }

The returned `client_id` is self-describing and never expires.

## Getting a token

Authorization code flow with PKCE (S256 required):

1. `GET https://changecoin.com/oauth/authorize?response_type=code&client_id=...&redirect_uri=...&scope=exchange:write&code_challenge=...&code_challenge_method=S256`
2. `POST https://changecoin.com/oauth/token` with `grant_type=authorization_code`, `code`,
   `code_verifier`, `client_id`, `redirect_uri`

Access tokens last 3600 seconds. There are no refresh tokens -
repeat the flow.

An authorization code can be redeemed more than once until it expires - nothing is
stored, so nothing marks a code spent. Redeeming still requires the matching
`code_verifier`, so treat the two together as the credential.

There is no consent screen. ChangeCoin has no user accounts, so a consent
screen would have nobody to authenticate and would be ceremony rather than
control. `redirect_uri` is checked against the signed registration, which is
what stops the endpoint being an open redirect.

## Before you call create_exchange or create_private_transfer

You must already have the user's payout address, on the correct network, given
in this conversation. Never invent one and never reuse one from an earlier
session. If the destination network needs a memo or tag, you need that too -
funds sent without it are lost.

## Discovery

- Protected resource metadata: https://changecoin.com/.well-known/oauth-protected-resource
- Authorization server metadata: https://changecoin.com/.well-known/oauth-authorization-server
- MCP server card: https://changecoin.com/.well-known/mcp/server-card.json
