# FxFeed auth.md

FxFeed supports OAuth authorization for its MCP resource and API keys for its
REST API. Both use the account owner's organization plan and monthly allowance.
The human account owner first completes [signup](https://fxfeed.io/signup), email
verification and organization setup. Never accept terms or approve application
access on the owner's behalf without their authorization.

## MCP OAuth

The resource is `https://fxfeed.io/mcp`. Discover the authorization server through
`https://fxfeed.io/.well-known/oauth-protected-resource/mcp` or the `WWW-Authenticate`
header of a 401 response. Authorization-server metadata is available at
`https://fxfeed.io/.well-known/oauth-authorization-server`.

Register a public client using the advertised registration endpoint (RFC 7591):
provide `client_name`, `redirect_uris`, `token_endpoint_auth_method: "none"`,
`grant_types: ["authorization_code", "refresh_token"]`, and
`response_types: ["code"]`. Registration creates an application identifier,
not a user account or permission to call tools. Unused registrations expire
after one day. HTTPS callbacks and explicit HTTP loopback IP callbacks are
supported; redirects must match exactly, including the port. Client names are
self-reported. Client ID Metadata Documents and confidential clients are not
supported in this release.

Use the authorization-code flow with PKCE `S256`, a fresh random `state`, the
exact registered `redirect_uri`, and `resource=https://fxfeed.io/mcp` in both the
authorization and token requests. Request `fx:read` for the three tools; add
`offline_access` only if a refresh token is needed. Open the authorization URL in
the owner's browser. The owner signs in, reviews the app and organization, and
explicitly allows or denies access. Codes expire after two minutes and are
single-use. The token endpoint accepts form-encoded POST bodies; credentials in
URLs or HTTP Basic authentication are not supported.

Send `Authorization: Bearer ACCESS_TOKEN` on every `POST https://fxfeed.io/mcp`,
including initialization, with `Content-Type: application/json` and
`Accept: application/json, text/event-stream`. Access tokens expire in five
minutes. Refresh tokens rotate on every use and expire after seven days without
a refresh; consent lasts at most 90 days. Store each replacement refresh token
atomically and serialize refresh attempts. Reusing a code or refresh token
revokes that authorization and its entire token family.

The scopes allow only `get_latest_rates`, `get_historical_rates` and `convert`.
They do not provide dashboard, billing, team-management or direct REST access.
Tokens are bound to this MCP resource and must not be forwarded to other APIs.

## API keys and revocation

Existing API-key clients can continue sending
`Authorization: Bearer YOUR_FXFEED_API_KEY` to MCP. For the REST API at
`https://api.fxfeed.io/v2`, use the documented `api_key` parameter and keep full URLs out of
logs. Provision or rotate keys in [API keys](https://fxfeed.io/dashboard/settings/api-keys).

Revoke an OAuth token using the advertised revocation endpoint with form fields
`client_id` and `token`, or revoke the entire connection in
[Connected apps](https://fxfeed.io/dashboard/settings/connections). API-key rotation
does not revoke OAuth connections. Losing organization membership invalidates
delegated access. A 401 requires reconnection, a 402 requires the owner to review
the plan's allowance, and a 429 requires bounded backoff. Keep codes, verifiers,
access tokens and refresh tokens out of prompts, source code, analytics and logs.
