Skip to content

Sign-in

Every MCP client that connects gets the same thing: an OAuth 2.1 authorization server with dynamic client registration and PKCE, as the MCP spec asks for. What differs is the page the person signs in on. It offers one or both of two ways in.

A form

The person types what your app checks: an API key, a user name and password, a 2FA code. Sesamcp checks it one of four ways (login in the configuration):

Check What happens Fits
verify one request with the values (e.g. GET /api/me); a 2xx accepts them an API with personal keys
exchange the values are sent to the app's login URL; a token from the answer is kept an app that mints a token from a password
upstream one MCP initialize with the values (proxy mode) an MCP server that checks its own token
users a fixed list of argon2id hashes a server with no login of its own

Nothing typed into the form is logged; the login keeps only what the calls to the app need.

Single sign-on

With login.oidc, the page shows Continue with Authentik (or your provider's name). Sesamcp does the authorization-code round trip with PKCE, checks the ID token, and lets in whoever is in allowed_users or one of allowed_groups. An account at the provider alone is never enough.

What the person then gets at the app depends on the app:

  • It trusts the provider's user (OpenBB behind Authentik): {user} is passed on, for example as a header.
  • It makes a credential from the provider's token (OpenCloud's app tokens): credential sends one request with the access token right after the sign-in and keeps the answer. Nobody pastes anything.
  • It knows nothing about the provider: link once, below.

Both on one page

Give both oidc and a form check, and the page leads with the provider's button; the form folds under Use an API key or password instead. Each button says which way it is, so pressing one never sends the other. This is how one deployment serves people with an account at your provider and people without one.

flowchart TD
  S[Continue with Authentik] --> G{in allowed_groups?}
  G -- no --> R[refused]
  G -- yes --> L{a key linked<br/>to this account?}
  L -- yes --> D[signed in with that key]
  L -- no --> F[the form: paste your key, once]
  F --> V{the app accepts it?}
  V -- yes --> K[linked, then signed in]
  V -- no --> F

Start at the provider's button: after the first time, a sign-in at the provider is all it takes.

With oidc.link: true, the provider decides who it is, and the app's own key decides what they may do. The first sign-in asks for that key on the form and stores it, encrypted, under the provider's issuer and the person's sub. Every later sign-in, from any client, uses it. Link a different key on the page replaces it; revoking one connector leaves the link in place, because the next sign-in needs it.

Tokens

The client gets opaque access and refresh tokens with your token_prefix; they mean nothing outside this deployment. Logins are kept in /data, encrypted with a key from MCP_OAUTH_SECRET. A client that revokes its token ends that login, and revoke can tell the app to end its token too.