Skip to content

Sign-in for MCP clients

MCP clients sign in with OAuth 2.1 and PKCE, so no token is copied by hand. Most clients do all of this themselves after claude mcp add or codex mcp login; this page is for client authors and the curious.

Resource (the MCP server) https://mcp.monitorly.cloud
Authorization server (issuer) https://app.monitorly.cloud
Protected resource metadata (RFC 9728) https://mcp.monitorly.cloud/.well-known/oauth-protected-resource
Authorization server metadata (RFC 8414) https://app.monitorly.cloud/.well-known/oauth-authorization-server
  1. The client calls the server without a token and gets 401 with WWW-Authenticate: Bearer resource_metadata="…".
  2. It reads the resource metadata, then the authorization server metadata.
  3. It identifies itself, preferably with a Client ID Metadata Document: client_id is an HTTPS URL of a JSON document that describes the client. Otherwise it registers dynamically (RFC 7591) and gets a client_id of the form mlyc_…. Only public clients: there are no client secrets.
  4. It opens https://app.monitorly.cloud/oauth/authorize in the browser with response_type=code, a PKCE S256 challenge, resource=https://mcp.monitorly.cloud (RFC 8707) and the scopes it wants.
  5. The person signs in and, on the consent screen, chooses a workspace, optionally a single project, and read or write access, and may narrow the scopes. What is granted is the intersection with what the client asked for.
  6. The browser returns to the client’s redirect URI with code, state and iss (RFC 9207). The code works once, for 60 seconds.
  7. The client exchanges it at https://app.monitorly.cloud/oauth/token with the PKCE verifier.
Token Lifetime
Access token (mly_…, used as Authorization: Bearer) 1 hour
Refresh token (mlyr_…) 30 days; each refresh issues a new pair

A refresh token is always issued. Using a refresh token or a code a second time revokes the whole grant. A refresh may ask for fewer scopes than granted, never more.

An OAuth access token works only on the MCP server; on the REST API it is refused. The one exception is the monitorly CLI’s own sign-in, which works on both.

Redirect URIs are compared exactly. For loopback redirects (http://127.0.0.1, http://[::1], http://localhost), any port is accepted, as RFC 8252 allows. A client document lists 1 to 20 redirect URIs; a registered client 1 to 10, HTTPS or loopback HTTP.

  • Authorization requests: 30 per client address in 15 minutes; then 429 temporarily_unavailable with Retry-After.
  • Dynamic registrations: 10 per client address in 15 minutes; then 429 slow_down.
  • An authorization request waits for consent up to 10 minutes.

Every grant shows in Settings → API tokens with the client’s name. Revoking it there, or calling /oauth/revoke (RFC 7009) with any of its tokens, ends all of its access and refresh tokens at once.

The client’s name and logo on the consent screen are what the client declares about itself. For a metadata document the screen also shows the host the document came from, which is verified; a dynamically registered client is not verified at all.