Repository navigation
Description
Depends on: nothing
Problem
When a protected (OAuth) MCP server is configured, mecak8s's MCP broker signs each user in to it through ToolHive's embedded authorization server (workspace enrollment). The broker keeps each session's enrollment, the tokens it obtained, and the state of logins in progress in memory. A mecak8s restart loses all of it, so every user has to log in to every protected MCP server again, and a login in progress during the restart fails.
Storing these in Redis is not enough on its own. The embedded authorization server generates a new HMAC secret (which protects its authorization codes and refresh tokens), a new signing key (which signs the access tokens the gateway accepts), and new credentials for the MCP broker's own client at every start. Anything stored before a restart is unusable after it.
The identity broker makes the embedded authorization server's signing key operator-supplied when it is on (#2538). This ticket covers the rest, with the identity broker off or on.
Requirements
- A user's login to a protected MCP server survives a mecak8s restart: the enrollment and the tokens it holds are stored durably (Redis), and a login in progress during a restart either completes or fails cleanly with a prompt to log in again.
- The embedded authorization server's HMAC secret is supplied by the operator: one current secret of at least 32 bytes, plus optional previous secrets accepted for verification only, for rotation.
- Its signing key is supplied by the operator, plus optional previous keys still published for verification. This is the setting Keys and gateway entries for the identity broker #2538 added,
mcp.broker.signing_key_fileandmcp.broker.fallback_key_files, which today is refused with the identity broker off or without a gateway entry; this ticket allows it there. - The MCP broker's own client at the embedded authorization server keeps the same identity across restarts.
- mecak8s refuses to start with durable logins enabled if any of these is missing. Without durable logins they stay optional, and behaviour is unchanged.
- Secrets are read from files mounted from Kubernetes Secrets, never logged, and exposed through the Helm chart.
Done when
- With the operator's secrets and Redis configured, a protected MCP server a user logged in to before a mecak8s restart is still callable after it, and its refresh token still renews, with no new login.
- A token issued under a previous secret or key is accepted while it is configured as previous, and refused once it is removed.
- mecak8s with durable logins on and a missing secret refuses to start with a clear error.
- With durable logins off, mecak8s starts and behaves as it does now, with no new settings required.
Activity
chore(identitybroker): mark the secrets still generated at startup as…