Change an MCP server of one's own, or give it a new key
Changes the caller's server (ADR 0046). Needs tools.user.add. The members are name, url, auth, secret and revision, at least one of the first four; a value is checked as createUserToolServer checks it, before anything is read or written.
| The change | What happens |
|---|---|
name, or the header of an api_key |
The definition is replaced. The credential is kept: it is bound to the URL, the kind and, for OAuth, the scopes and the client, not to a name or a header. |
secret, nothing else of the table below |
The secret goes to the broker (only if the server still has the revision that was just read), then the definition is replaced connected with the new reference. Re-keys a bearer or api_key server, and brings a needs_reauth or revoked one back. |
url, the kind, the scopes (as a set) or the clientId of an oauth2 |
The credential was issued for the old ones, so the definition is replaced added with no credential first (a compare-and-swap on the revision: a write that fails, or a race that is lost, has revoked nothing), and then the broker revokes the credential. A revoke that fails is a 503 broker_down and leaves the server added, ready for a key; what the broker still holds is not named by the server and is not lent. With a secret for a bearer or api_key, the broker then keeps it for the new definition and the server is connected. A change to none makes it connected. |
| nothing that differs | Nothing is written and the revision does not change. |
revision is the one listUserToolServers gave: when the server changed since (the broker marked a grant that ended, another request edited it), the answer is 409 stale_revision and nothing is written; read it again and decide again. The one exception is a new key: the broker keeps it in place of the old one before the definition is written (and only if the server still has the revision just before), so a writer that gets in within those milliseconds can leave the new key kept (and used) beside the 409 when the server still has a credential; a key kept for a server that the other writer moved, which then has none, is forgotten. Once the change has written the definition its revision is spent: a later conflict is read again and the change finished, never a 409 over a change that was made. Without a revision the change is made to the server as it is now (read again, up to three times, when the broker wrote in between; 503 after). A deployment that keeps no credentials refuses a change that would need the broker (a new URL or kind for a server that holds a credential, a kind that wants one): 422 credentials_not_kept; the person deletes the server instead. A change runs to its end on the server whether or not the client waits (as the add does): a client that hangs up, or the API's own timeout, ends the response and not the change; the list says what was done. secret is write-only.
Authorizations
A JWT signed by the configured issuer (RS256, RS384, ES256 or EdDSA), with the configured audience. Read when auth.mode is jwt or jwt_or_proxy_header. A missing or refused token gets 401 with WWW-Authenticate: Bearer; an issuer whose keys cannot be fetched gets 503.
A JWT as bearerToken, bound to the key of the client (cnf.jkt, RFC 7638), sent as Authorization: DPoP <token> with one DPoP header holding a proof signed by that key (RFC 9449, ADR 0054). Read only when auth.dpop is configured. A bad proof gets 401 with WWW-Authenticate: DPoP error="invalid_dpop_proof", algs="ES256 EdDSA", a bad or unbound token error="invalid_token".
Set by oauth2-proxy after OIDC login; requests without it get 401. Read when auth.mode is proxy_header (the default) or jwt_or_proxy_header without a bearer token.
Request Body
Responses
The server as it is now