From 91b5fb52ba18ab8201cafd9720989fe4fefc30ee Mon Sep 17 00:00:00 2001 From: David Rojas Date: Tue, 24 Nov 2026 13:30:14 -0600 Subject: [PATCH] docs(sdks): list api.auth scheme types and how MCP servers use them (FERN-261) The sdk-config reference now lists api.auth.schemes, the accepted schemes[].type values with their fields (oauth2 with its flows), and api.auth.requirements. The MCP Pass credentials section explains that a joint spec requirement needs every credential and that api.auth.schemes limits which schemes the server accepts and forwards. Co-Authored-By: Claude --- fern/products/mcp-generator/configure.mdx | 14 ++++++++++++++ .../sdks/reference/sdk-config-reference.mdx | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/fern/products/mcp-generator/configure.mdx b/fern/products/mcp-generator/configure.mdx index 9c69fcc98..d2757722a 100644 --- a/fern/products/mcp-generator/configure.mdx +++ b/fern/products/mcp-generator/configure.mdx @@ -203,6 +203,20 @@ Credentials come from the security schemes in your spec. Agents send them as req - An HTTP bearer scheme reads `Authorization: Bearer `, and an HTTP basic scheme reads `Authorization: Basic `. - An OAuth scheme, including client credentials, reads an access token from the `Authorization` header. The server doesn't get tokens itself, so the agent supplies a valid token. To have MCP clients sign users in with your authorization server instead, turn on [OAuth sign-in](/learn/mcp-generator/get-started/authentication). +When a security requirement in the spec lists several schemes together, a call needs every one of them, and the server's instructions say so. + +To accept a subset of the spec's schemes, list them under `api.auth.schemes` in `sdk-config.yml`, with each `id` matching a scheme name in the spec. The server then advertises and reads only those credentials, and never sends another scheme's credential to your API. A scheme listed together with a listed one in a spec requirement stays, because your API needs both: + +```yaml title="sdk-config.yml" +api: + auth: + schemes: + - id: ApiKeyAuth + type: api-key + location: header + name: X-Api-Key +``` + Parameters that carry a credential aren't tool inputs. When a call is missing a credential, the error names the headers to send. The dashboard's **Connect** button builds each agent's command with the right headers. ## Limits diff --git a/fern/products/sdks/reference/sdk-config-reference.mdx b/fern/products/sdks/reference/sdk-config-reference.mdx index 7151834cb..7cb623e66 100644 --- a/fern/products/sdks/reference/sdk-config-reference.mdx +++ b/fern/products/sdks/reference/sdk-config-reference.mdx @@ -168,6 +168,23 @@ source: Authentication supported by the API. + + The security schemes the SDK supports. Each scheme has an `id`, a `type` and the fields of that type. A scheme whose `id` matches a security scheme in the spec configures that scheme. For an `mcp` target, the list also limits which of the spec's schemes the server accepts: see [Pass credentials](/learn/mcp-generator/get-started/configure#pass-credentials). + + + The kind of credential: + + - `api-key`: a key sent in a `header`, `query` parameter or `cookie`. Takes `location`, `name`, and optionally `prefix` and `environmentVariable`. + - `bearer`: a token in the `Authorization` header. Takes optional `header`, `prefix` and `environmentVariable`. + - `basic`: HTTP Basic credentials. Takes optional `username` and `password` objects, each with `name`, `environmentVariable`, `description` and `omit`. + - `oauth2`: OAuth 2.0. Takes `flows`, optional `clientId` and `clientSecret` objects, and optional `tokenHeader`, `tokenPrefix` and `refreshBufferSeconds`. Each flow has a `type`: `authorization-code` (`authorizationUrl`, `tokenUrl`), `client-credentials` (`tokenUrl`), `implicit` (`authorizationUrl`), `password` (`tokenUrl`) or `device-code` (`clientId`, `deviceAuthorizationUrl`, `tokenUrl`; used only by the CLI target). Every flow also takes optional `refreshUrl` and `scopes`, a list of `name` and `description`. + - `custom`: credentials sent as `parameters`, each with a `location`, a `name`, and optionally `prefix` and `environmentVariable`. + + Every type also takes an optional `description`. + + + Alternative sets of schemes a request can authenticate with. Each entry lists scheme ids under `schemes`, and a request needs every scheme in one entry. For an `mcp` target, requirements in the spec take precedence: an entry can only add an alternative made of schemes the spec's requirements don't use. + Headers added to generated API requests.