MCP authentication

How an MCP client signs in to onefold, what token it receives, and how access ends.

An MCP client signs in to onefold with the OAuth 2.0 authorization code flow and PKCE, the same flow an application uses. The client does all of it for you. This page says what happens, so you know what to expect and what to check when something fails.

What the client does

  1. It calls the server with no credential. The server answers 401 and names a metadata document.

  2. It reads two documents to learn where to send you:

    DocumentURL
    Protected resource metadatahttps://onefold.eitozx.com/.well-known/oauth-protected-resource/api/mcp
    Authorization server metadatahttps://onefold.eitozx.com/.well-known/oauth-authorization-server
  3. It opens your browser on the authorization endpoint, https://onefold.eitozx.com/o/authorize/, with a PKCE challenge, the scopes it wants and the server it wants them for.

  4. You sign in and approve the request on the consent screen, choosing what the client may do and where. See What you approve.

  5. It receives a code on its own redirect URI and exchanges it at the token endpoint, https://onefold.eitozx.com/o/token/, for an access token and a refresh token.

  6. It calls the server again with the access token.

How a client identifies itself

There is nothing to register. A client names itself with a Client ID Metadata Document: its client_id is an HTTPS URL at which the client's vendor publishes its name and redirect URIs. onefold fetches that document and shows the name on the consent screen.

Dynamic client registration is not offered. A client that can only register itself dynamically cannot sign in; give it an agent credential instead. Cursor is the common case.

Redirect URIs

A client's redirect URI must be one its metadata document lists, and must be https or a loopback address (localhost, 127.0.0.1 or ::1).

Command-line and desktop clients listen on a local port they pick at the moment you sign in. For a loopback redirect URI, any port is accepted: a client that publishes http://localhost/callback may be sent to http://localhost:49152/callback. The scheme, host and path still have to match.

PKCE

Every authorization request must carry a PKCE challenge with the S256 method. plain is refused. See PKCE.

The token

  • It works for this server only. The client asks for a token for https://onefold.eitozx.com/api/mcp, and every other onefold endpoint refuses that token.
  • It lasts 15 minutes. The client refreshes it without asking you again.
  • It carries the scopes you approved. See Scopes and permissions.
  • It is not a way to sign in as you. It reaches the MCP server's tools and nothing else: not your profile, your password or your sessions.

The refresh token is replaced each time it is used. See Keep users signed in.

The iss parameter

The redirect back to the client carries iss, the issuer, beside code and state:

http://localhost:49152/callback?code=…&state=…&iss=https%3A%2F%2Fonefold.eitozx.com

An MCP client compares it with the issuer in the metadata before it uses the code, which stops a code from one server being used at another. You do nothing. If you are writing a client, accept the parameter: a callback that rejects parameters it does not recognise fails here.

Ending access

Open the Agents tab of an application the client reaches and choose Disconnect on the client.

  • Its access token and its refresh token stop working at once. There is no delay in which a refresh still succeeds.
  • Connecting again takes a new sign-in and a new consent.
  • Disconnecting is not a ban. The same client can connect again when you approve it.
  • Every API key and agent the client created ends with it.

Resetting your password through Forgot password? and your account being disabled end every connection the same way. See What ends a connection.

A client can also give up its own token at the revocation endpoint, https://onefold.eitozx.com/o/revoke_token/. That takes effect at once too.

Without sign-in

A client that cannot do any of this sends a fixed header instead. See Agent credentials.

On this page