Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions fern/products/mcp-generator/configure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <token>`, and an HTTP basic scheme reads `Authorization: Basic <base64 of username:password>`.
- 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
Expand Down
17 changes: 17 additions & 0 deletions fern/products/sdks/reference/sdk-config-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,23 @@ source:
<ParamField path="api.auth" type="object" required={false} toc={true}>
Authentication supported by the API.
</ParamField>
<ParamField path="api.auth.schemes" type="list<object>" required={true} toc={true}>
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).
</ParamField>
<ParamField path="api.auth.schemes[].type" type="&quot;api-key&quot; | &quot;bearer&quot; | &quot;basic&quot; | &quot;oauth2&quot; | &quot;custom&quot;" required={true} toc={true}>
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`.
</ParamField>
<ParamField path="api.auth.requirements" type="list<object>" required={false} toc={true}>
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.
</ParamField>
<ParamField path="api.headers" type="list<object>" required={false} toc={true}>
Headers added to generated API requests.
</ParamField>
Expand Down
Loading