Skip to content

Add an MCP server of one's own​

POST
/api/user-tool-servers

Adds a server for the caller (ADR 0046). Needs tools.user.add, which no role holds by default. Everything is checked before anything is written: the name (1 to 80 characters, one line), the URL (https, a host, no user information, query or fragment, at most 2 KiB, and the deployment's egress lists: a refusal is a 400 url_refused whose detail is the guard's reason for a person, never the precise rule and never an address), the header of an api_key (not one the orchestrator owns: Authorization, Host, Content-Type, Mcp-*, ...), the scopes and the client id of an oauth2, and the secret (8 to 4096 printable ASCII characters, none at either end a space; 8 is the shortest the relay can take out of what a server says back without redacting ordinary words, so a shorter secret is a 400, ADR 0046 slice 5a review).

  • none: no secret. The server is connected at once.
  • bearer and api_key: the secret is required, the token or the key. The definition is written added, the secret goes to the credential broker, and the definition is replaced connected with the reference it gave. If the broker cannot keep the secret the definition is taken back: the answer is a 503 broker_down, the server is gone and no place of the eight is spent. The add runs to its end on the server whether or not the client waits: a client that hangs up, or the API's own timeout (30 s, which answers 503 and stops waiting), ends the response and not the add. Two things still leave a server behind: the take-back itself failing (the definitions' store is down at that moment), and the process stopping in the middle. The server is then added (needs_auth, not_connected), holds its place, and its owner gives it a key or deletes it.
  • oauth2: no secret. The server is stored added and has status: needs_auth, reason: not_connected; the person authorizes it with authorizeUserToolServer, and the browser comes back to finishUserToolAuthorization, which makes it connected.

A deployment with no secrets section keeps no credentials: only none can be added (422 credentials_not_kept). At most 8 servers per person: the ninth is a 409 too_many_servers.

secret is write-only: it is in no response, error or log line (see the description of this API).

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)

Request Body​

JSON
{
  
"name": "string",
  
"url": "string",
  
"auth": {
  
  
"kind": "none",
  
  
"header": "string",
  
  
"scopes": [
  
  
  
"string"
  
  
],
  
  
"clientId": "string"
  
},
  
"secret": "string"
}

Responses​

The server, as the listing shows it

JSON
{
  
"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"
}

Samples​

Powered by VitePress OpenAPI