Configuration¶
Environment¶
| Variable | Default | Meaning |
|---|---|---|
MCP_BASE_URL |
required | Public URL of the server; also the OAuth issuer (https, or http only for localhost) |
MCP_OAUTH_SECRET |
required | Encrypts the stored logins in /data; changing it logs every client out |
SESAMCP_CONFIG |
/config/proxy.yaml |
The config file (MCP_PROXY_CONFIG is read too) |
MCP_PORT |
8081 |
Port it listens on inside the container |
MCP_TOOLSETS |
the file's toolsets |
OpenAPI mode: all, a list, or default,<more> |
LOG_LEVEL |
INFO |
Python log level |
| any other | Referenced from the config file as ${NAME}, for secrets such as the user list |
A missing or invalid setting stops the container at startup with a message naming it.
The config file¶
${NAME} is replaced from the environment when the file is loaded; a name that isn't set is an error. {name} placeholders are filled per login or per request from the variables below. {{ and }} are literal braces.
| Key | Default | Meaning |
|---|---|---|
service_name |
required | Shown on the login form |
upstream |
one of the two | Proxy mode: the MCP server's full URL, e.g. http://trilium:8080/mcp; the query string of each request is kept |
openapi |
one of the two | OpenAPI mode: the API to make tools from (below) |
instructions |
none | Added to the server's initialize result as instructions |
fields |
required with a form check, none with oidc alone |
The login form: a list of {name, label, type, required, autocomplete, hint, icon, link, path, bullets} (below) |
theme |
none | The upstream's design on the login pages (below) |
favicon |
none | A URL /favicon.ico redirects to, e.g. the upstream app's own icon, for clients that show a connector with its domain's favicon |
login |
required | At most one form check (users, upstream, exchange, verify) and optionally oidc (below) |
messages |
none | For exchange and verify: an error code from the answer → the text shown on the form |
revoke |
none | A request sent when a client revokes its login: {method, url, headers, json} |
static_tokens |
off | A variable name: a raw Authorization header (with or without Bearer) is accepted as that variable and passed on; the server judges it. Not allowed with users |
vars |
none | Derived variables: {name: {base64: "<template>"}} |
upstream_headers |
none | Headers added to each request to the app, e.g. {Authorization: "Basic {basic}"}. The client's own Authorization is never forwarded. With two ways in, they may use only what both give |
health |
none | A URL /health checks; without it /health only says Sesamcp runs |
token_prefix |
mlpx_ |
Prefix of the OAuth tokens (mcp-login-proxy's default, so its logins stay valid) |
store_salt |
mcp-login-proxy-oauth |
Salt for the store's encryption key |
Text fields are trimmed before they're used; password fields are passed exactly as typed.
fields¶
type is text, password or email. The rest say where the value comes from:
| Key | Shown |
|---|---|
hint |
A sentence above the input |
icon |
key, lock, user or mail, before the label |
link |
{text, url} on the label's line, opening in a new tab |
path |
The way there in the upstream's UI, e.g. [Settings, Security, API tokens] |
bullets |
{label, items}, a list of what the value needs, e.g. {label: Scopes, items: [read, draft]} |
theme¶
The sign-in's PageTheme (sesamcp.signin): light and dark set the page's CSS variables (accent, accent-hover, focus, font, font-heading, bg, card, radius, logo-height and the others in sesamcp/signin/pages.py), dark on top of light. logo is the path of an image file in the container, read at startup and inlined, with logo_ratio its width divided by its height. A monochrome wordmark is drawn in the text colour in place of the name; an app icon in colour sets logo_tint: false and logo_name: true. A bad value or an unreadable logo stops the container at startup.
theme:
light: {accent: "#5340d6", accent-hover: "#3f2fb0", focus: "#5340d6", font: '"DM Sans", system-ui, sans-serif'}
dark: {accent: "#9b82ff", accent-hover: "#b9a8ff", focus: "#9b82ff"}
logo: /config/logo.svg
logo_ratio: 1
logo_tint: false
logo_name: true
openapi¶
| Key | Default | Meaning |
|---|---|---|
api_url |
required | The base URL the spec's paths are relative to, e.g. http://app:8000/api |
spec |
required | Where the spec comes from (below) |
name |
<service_name> MCP |
The MCP server's name |
toolsets |
all | The first path segments that are tools by default; MCP_TOOLSETS overrides |
toolset_prefix |
none | Stripped before taking the first segment, e.g. /api/ |
never_exposed |
none | Path prefixes that never become tools (user admin, token minting) |
guides |
none | operationId → a description that replaces the spec's |
spec is one of: url (the app's own, e.g. /api/schema/); file (a path in the container); version_url with version_field (default version) and template, a URL with {version} such as a release's openapi.json. bundled is a file used when the version route fails. wait (default 60) is how long the app may take to answer at start-up.
A PUT is left out where the same path has PATCH; a body that is an allOf with a oneOf of objects is flattened so every variant's fields are offered.
login.verify¶
{request, error}: the form's values fill one request, GET unless method says otherwise; any 2xx accepts them, and the login keeps the values the headers use. error is the JSON field of a refusal, looked up in messages.
login:
verify:
request: {url: "http://app:8000/api/me", headers: {Authorization: "Bearer {api_key}"}}
login.users¶
A fixed list: name:hash entries separated by spaces or newlines, the hashes argon2id (sesamcp hash makes one). The form must have a user and a password field. The login only keeps {user}, never the password, and static_tokens is refused: the server behind it has no login, so a raw token would let anyone in.
login.upstream¶
upstream: {}. The form's values are rendered into upstream_headers and tried with one initialize request to upstream; any 2xx answer accepts the login. The login keeps the form's values that upstream_headers, vars and revoke use.
login.exchange¶
| Key | Meaning |
|---|---|
request |
{method, url, headers, json} with the form's fields as placeholders. In json, a value that renders empty is left out |
token |
The JSON field of the answer that holds the token |
variable |
The variable it becomes, default token |
error |
The JSON field of a refusal, looked up in messages; otherwise the form shows the HTTP status |
login.oidc¶
People sign in at an OpenID Connect provider (Authentik, Keycloak, …): the login page shows the consent card and a button, "Continue with docs/examples/authentik.yaml.
| Key | Default | Meaning |
|---|---|---|
issuer |
required | The provider's issuer, exactly as published. Authentik: https://<host>/application/o/<slug>/ |
client_id, client_secret |
required, none | The client registered at the provider; without a secret it is public (PKCE only) |
name |
single sign-on |
On the button and in error pages |
scopes |
[openid, profile, email] |
Authentik puts groups into profile |
user_claim |
preferred_username |
The claim that becomes {user} |
allowed_groups, allowed_users |
none | Who gets in: a name in allowed_users or one of the token's groups in allowed_groups. At least one list is required: an account at the provider alone is not enough |
verify_tls |
true |
false turns certificate checks off for the provider |
credential |
none | Turn the sign-in into the upstream's own credential (below) |
link |
false |
Link the app's key to the provider's account once, through the form (link once); needs a form check, excludes credential |
Register <MCP_BASE_URL>/login/callback as the redirect URI at the provider. The login keeps only {user} (plus the linked form values with link); fields and static_tokens are refused with oidc alone. {user} can go upstream, for example upstream_headers: {X-Forwarded-User: "{user}"}.
login.oidc.credential¶
For an upstream that takes a credential of its own on every request and makes one only for its provider's access token. OpenCloud is one: everyone signs in through Authentik, and POST /auth-app/tokens creates an app token for the person whose access token it carries. With credential, Sesamcp sends that one request right after the sign-in, keeps the credential from the answer in the login, and forwards it from then on; the access token is used for this request only and never stored. Nobody makes or pastes a token. Example: docs/examples/opencloud-oidc.yaml.
| Key | Default | Meaning |
|---|---|---|
request |
required | {method, url, headers, json} as in login.exchange; it may use {access_token} (the provider's) and {user} |
token |
required | The JSON field of the answer that holds the credential |
variable |
token |
The variable it becomes, for vars and upstream_headers |
A refused answer or one without the field shows on the login page, and the person is not let in. A credential with an expiry (OpenCloud's expiry=2160h) ends that login when it runs out: the upstream then refuses it, and the client has to sign in again. Pick the expiry with that in mind. The provider's client also needs the scopes the upstream wants in the access token (OpenCloud with roles from Authentik: roles).
In Authentik: Applications → Providers → Create → OAuth2/OpenID Provider, then an application for it. Checked against Authentik 2026.8:
- client type confidential, the redirect URI above (strict), a signing key;
- the scope mappings openid, profile and email (
groupscomes withprofile); without them the token carries no scopes and the userinfo endpoint answers 403; - grant types including authorization_code: a provider made through the API or a blueprint starts with none, and Authentik then refuses the login as "otherwise malformed";
- profile claims don't have to be in the ID token: Sesamcp reads
preferred_usernameandgroupsfrom the userinfo endpoint.
A policy binding on the application can limit who may sign in there as well.
Data volume¶
Mount a volume at /data. It holds the OAuth store (registered clients, tokens and each login's variables), encrypted with a key derived from MCP_OAUTH_SECRET and store_salt. Without the volume, every container restart logs all clients out.
Endpoints¶
| Path | What |
|---|---|
/mcp |
The MCP server, behind the login |
/login/link |
With oidc.link: the form that links a key, once |
/favicon.ico |
A redirect to favicon; 404 without it |
/health |
{"status": "ok"}, plus "upstream": "ok" \| "unreachable" with health set; no login needed |
/.well-known/…, /authorize, /token, /register, /revoke and the login page |
The OAuth endpoints MCP clients find and use on their own |
Moving from mcp-login-proxy¶
Change the image to ghcr.io/marceltov/sesamcp and keep everything else: the config file, MCP_PROXY_CONFIG, MCP_BASE_URL, MCP_OAUTH_SECRET and the /data volume. The defaults of token_prefix and store_salt are mcp-login-proxy's, so every existing login keeps working.