# auth.md

## Who this is for
AI agents and MCP clients acting on behalf of a Gavril customer (agency owners and project managers with a Gavril account).

## What Gavril offers agents
An MCP server at `https://gavril.me/mcp` (streamable HTTP, JSON responses). Server card: https://gavril.me/.well-known/mcp/server-card.json

## Registration and provisioning

### OAuth 2.1 (recommended)
Dynamic client registration (RFC 7591) is open — no pre-approval needed. Discovery, registration and token endpoints:

```yaml
agent_auth:
  skill: mcp
  register_uri: https://gavril.me/oauth/register
  identity_types_supported: ["anonymous"]
  credential_types_supported: ["client_secret", "none_pkce"]
  authorization_server: https://gavril.me/.well-known/oauth-authorization-server
  protected_resource: https://gavril.me/.well-known/oauth-protected-resource
  grant_types_supported: ["authorization_code", "refresh_token"]
  token_endpoint_auth_methods: ["client_secret_basic", "client_secret_post", "none"]
  code_challenge_methods: ["S256"]
  scopes: ["mcp"]
```

Register a client, then run the authorization-code + PKCE flow; a Gavril user signs in and consents, and the resulting access token is scoped to their account. Tokens can be revoked at the revocation endpoint.

### Static bearer key (simple alternative)
1. A person signs in at https://gavril.me/ and requests the account MCP key: `GET https://gavril.me/api/mcp-key/` (JWT-authenticated dashboard API).
2. The key can be rotated at any time with `POST https://gavril.me/api/mcp-key/`; rotation immediately revokes the previous key.

## Supported method
HTTP Bearer authentication with either credential:

```
POST https://gavril.me/mcp
Authorization: Bearer <oauth-access-token | account-mcp-key>
Content-Type: application/json
```

## Credential use
The key grants read access to the projects, tasks, documents and team data of one Gavril account only, plus scope-guard checks. Treat it as a secret; it is not scoped per agent, so share it only with agents the account owner trusts.