Skip to content

The person's own MCP servers, with what each is to them now​

GET
/api/user-tool-servers

The caller's own servers (ADR 0046), sorted by name, each with the URL they typed, the shape of its authentication (never a secret), its state, the status and reason the picker shows and the revision an edit sends back. Needs no permission of its own (tools.user.add gates changes, not reading what one added); another person's servers are not here, for any role. limit is the most one person holds (8) and kinds the kinds of authentication this deployment accepts: all four (none, bearer, api_key, oauth2) where it keeps credentials, and only none where it keeps none (it has no secrets section) (orch_app::user_tool_kinds, orchestrator/crates/app/src/user_tools.rs).

status is the definition's state and the deployment's rules, with the first of these that holds: unavailable / not_permitted when the caller's roles lack tools.user.add; unavailable / egress_refused when today's egress lists refuse the server's address; unavailable / broker_down when the server wants a credential and this deployment keeps none; otherwise ready for connected, and needs_auth for added (not_connected), needs_reauth (reauthorize) and revoked (disconnected). It asks the broker for nothing: no token is refreshed for a listing.

When a definition of the caller's does not read back, the store fails the listing as a whole: the answer is 200 with no servers and an error (unreadable), because the other servers are not lost and none of the deployment's depends on this. Each server can still be deleted by its id (deleteUserToolServer reads nothing of the row); the answer cannot name the damaged one, and the orchestrator's log does (one warning per damaged row, by its id). A store that is down is a 503. Never cached. 404 when the feature is off.

Client recipe: the person's own servers (what the web's "My tool servers" page does; a client needs nothing else, and the server enforces every step, so a client only offers what the server would accept).

  1. Whether to offer the screen. getMe lists tools.user.add for a person whose roles hold it. It does not say whether the deployment has the feature on: a holder in a deployment with it off gets a 404 from this route, which the screen says in words ("this deployment does not let people add servers") and offers nothing under. A person without the permission still reads their servers here and deletes them (deleteUserToolServer needs none); the screen says that their roles do not let them add or change one, and offers only Delete.
  2. Add. Offer the kinds of this answer and no others (a deployment that keeps no credentials lists only none). POST {name, url, auth} and, for bearer or api_key, secret; an api_key also names its auth.header, an oauth2 its optional scopes and clientId. The answer is the server as listed: show its status, and for oauth2 (needs_auth, not_connected) the Connect step below. Hold at most limit servers: when the list is that long the client does not offer Add, and the server's 409 too_many_servers is the race only. The secret is typed once, kept nowhere (not in storage, a URL or a log), cleared when the request is sent, and never filled in from an answer: no answer holds one.
  3. Change. PATCH takes any non-empty combination of name, url, auth and secret, and the revision of the row as listed (orchestrator/crates/app/src/user_tools.rs, edit_user_tool_server; an edit that names none of the first four is a 400). A client sends only what differs from the row the person opened the form on, with that row's revision (a form that is open while the list is read again keeps its own revision, so a stale edit is a 409 and never overwrites a newer change). What each does: name, or the header of an api_key, is written and the credential kept; secret alone (the kind must be bearer or api_key, else a 400) re-keys it and the server is connected, which also brings a needs_reauth or revoked one back; a new url, a new auth.kind, other scopes or another clientId forgets the credential first (the server is added, or connected if the kind is none), and a secret in the same request (kind bearer or api_key) is then kept for the new definition and the server is connected; any other combination is those effects together. A client says before it sends that a move forgets the credential. Delete: DELETE the id; it takes no revision, and a 404 answering it means the server is already gone, which is what was asked. A 409 stale_revision is not to be retried: read the list again and let the person decide again.
  4. Connect (an oauth2 server that is needs_auth; and an oauth2 server that is not, to authorize it again with another account or a wider scope, which the server allows): POST .../authorize with no body. Show the person where they are being sent, before anything opens, and open authorizeUrl only when it parses, is https: (or http: on a loopback host, for a development authorization server) and has no user information; javascript:, data:, a relative or a malformed link is never opened, and the client says the server gave a link that cannot be opened. The orchestrator takes the authorization endpoint from the authorization server's own RFC 8414 metadata and judges its shape (https, a public host, no fragment: orchestrator/crates/credential-broker/src/discovery.rs, found_in), not that it is on the issuer's host, so the client shows the host of authorizeUrl itself as the destination and, when it differs from the issuer's, names both. Open it in a browser the client cannot lose control of: a link the person clicks (target="_blank", no opener, no referrer) on the web, the system browser on the desktop, an in-app tab on mobile. A client cannot know that a window it opened stayed open (a pop-up blocker returns the same as success), so it says "waiting for you to finish signing in", never that a window opened, and offers Check now and Open the sign-in page again (authorizeUserToolServer again: a later call ends the earlier flow). It never logs or keeps the URL. The browser comes back to finishUserToolAuthorization, which no client calls. The client learns the outcome by reading this list again: when the person returns to the app (the window regains focus; the web reads at most once in a quarter second, so a focus and a visibility change together are one read) and on the person's request. ready is done; anything else after expiresAt is "not finished; connect again". A 429 rate_limited carries Retry-After.
  5. Attach. The picker is listToolServers: the person's own servers have own: true. Offer a ready one like any other and send the whole set with putThreadTools. One that is not ready is not offered for attaching: needs_auth says what to do (give a key, or Connect, on the screen above: ToolServer does not say which, so a client takes the kind from this list's auth.kind by id), unavailable says its reason. A 422 tool_server_needs_auth or tool_server_unavailable from putThreadTools is the race only.
  6. Errors, by code (a client chooses its words from the status and the code, and shows detail only where it is a person's own words: a 400's, which never quotes a value): 400 url_refused (the address is refused: detail says why for a person); 403 forbidden (the permission is gone) or no_access; 404 (the server is gone, or the feature is off: read the list); 409 too_many_servers, stale_revision; 422 credentials_not_kept (add, change and authorize), egress_refused and oauth_not_configured (authorizeUserToolServer only: add and change answer a refused address as the 400 url_refused, orchestrator/crates/app/src/user_tools/authorize.rs); 429 rate_limited; 503 broker_down, authorization_unavailable, or no code (the server is being changed: wait Retry-After and try again). After any failed write whose outcome is unknown (a 500, a 503, a lost connection) the client reads this list again: a write runs to its end on the server whether or not the client waits.

Authorizations​

bearerToken

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.

Type
HTTP (bearer)
or
dpopToken

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".

Type
HTTP (DPoP)
or
proxyIdentity

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.

Type
API Key (header: X-Auth-Request-Email)

Responses​

The person's servers

JSON
{
  
"servers": [
  
  
{
  
  
  
"id": "string",
  
  
  
"name": "string",
  
  
  
"own": true,
  
  
  
"status": "ready",
  
  
  
"reason": "not_connected",
  
  
  
"url": "string",
  
  
  
"auth": {
  
  
  
  
"kind": "none",
  
  
  
  
"header": "string",
  
  
  
  
"scopes": [
  
  
  
  
  
"string"
  
  
  
  
],
  
  
  
  
"clientId": "string"
  
  
  
},
  
  
  
"state": "added",
  
  
  
"hasCredential": true,
  
  
  
"last4": "string",
  
  
  
"revision": "string"
  
  
}
  
],
  
"limit": 0,
  
"kinds": [
  
  
"none"
  
],
  
"error": {
  
  
"code": "unreadable",
  
  
"detail": "string"
  
}
}

Samples​

Powered by VitePress OpenAPI