# MCP authorization

An MCP client connects to your SEC Blast organization with OAuth 2.1. You allow it once, in the browser, and you can end the connection at any time.

## Signing in

The first time a client uses the server, it opens SEC Blast in the browser:

1. You sign in to SEC Blast, or create an account.
2. The consent page shows the app's name, the address it returns to, and the organization it connects to. With several organizations, you choose one.
3. **Allow** returns you to the app. From then on the app calls the API for that organization.

Owners, admins, and developers of an organization can connect an app to it, the same roles that manage SEC Blast API keys.

## Tokens

- The app holds an access token, valid for 10 minutes, and a refresh token, valid for 60 days.
- Each refresh replaces the refresh token. Using a refresh token twice ends the session.

## Connected apps

[Connected apps](https://www.secblast.com/dashboard/apps) lists the apps connected to the organization: each app's name, the address it returns to, who allowed it, when, and when it was last used.

- **Revoke** ends a connection: its refresh token stops at once, and its access token within a minute.
- A revoked app can be allowed again after ten minutes.

## For client developers

- Authorization code with PKCE, `S256` only. No implicit or password grant.
- Clients register dynamically (RFC 7591) or are named by a client ID metadata document: a `client_id` that is an `https` URL. Redirect URIs are `https`, or `http` on `127.0.0.1`, `[::1]`, or `localhost` with any port.
- The `resource` parameter (RFC 8707) is `https://api.secblast.com/mcp` for the MCP server or `https://api.secblast.com/v3` for the API, and the access token is valid for that one only. Without it, the token is for the API.
- Access tokens are ES256 JWTs. The one scope is `api`.
- `POST /oauth/revoke` (RFC 7009) with either token ends the connection.
