MCP OpenAPI Extensions
Scalar MCP servers read a set of OpenAPI vendor extensions. They decide which operations become tools, how the server authenticates to your API, which headers it adds, which responses can be downloaded through a link, and who may connect.
Most extensions can be written in two places:
- The API description, so the setting travels with the API.
- A Config, the per-environment overrides you edit under Configure in your MCP server. A Config uses the same OpenAPI shape as the API description and is merged over it. See MCP Configuration.
Some extensions are read from a Config only, because they name stored secrets or describe one environment.
| Extension | API description | Config | Section |
|---|---|---|---|
x-scalar-expose |
Root, tags, operations | Production's Config only | Tools |
x-scalar-ignore, x-internal |
Operations | — | Tools |
x-scalar-download |
Operations | Operations, any environment | Downloads |
x-scalar-secret-* |
— | Security schemes | Credentials |
x-scalar-credentials-location |
Client credentials flows | Client credentials flows | Credentials |
x-scalar-headers |
— | Root | Additional headers |
x-scalar-access |
— | Root, and on a security scheme | Access |
x-scalar-customization |
— | Root | Landing page |
Values in the API description are treated as untrusted input. A literal credential in an x-scalar-secret-* field of the API description is never sent.
Tools
x-scalar-expose
Use x-scalar-expose at the document root, on tags, or on operations to control which operations become MCP tools. Set enabled to a boolean or use { mcp, sdk } to control exposure separately for MCP tools and SDKs.
On the document root or a tag, name and description describe the tool group. On an operation, they describe the tool itself. Operations can also set annotations. See MCP Tools for the full field list and how settings take precedence.
{
"openapi": "3.1.0",
"info": { "title": "Payments API", "version": "1.0.0" },
"x-scalar-expose": {
"name": "payments",
"description": "Create and look up payments.",
"toolMode": "direct"
},
"tags": [{ "name": "Internal", "x-scalar-expose": false }],
"paths": {
"/payments": {
"get": {
"operationId": "listPayments",
"summary": "List payments",
"x-scalar-expose": {
"name": "list_payments",
"description": "Lists payments, newest first."
},
"responses": { "200": { "description": "List of payments" } }
}
},
"/payments/{id}/refunds": {
"post": {
"operationId": "refundPayment",
"summary": "Refund a payment",
"tags": ["Internal"],
"parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }],
"x-scalar-expose": true,
"responses": { "200": { "description": "Payment refunded" } }
}
}
}
}
The operation's own x-scalar-expose: true exposes refundPayment even though its Internal tag is disabled. See MCP Tools for how x-scalar-ignore, x-internal, and tag settings affect exposure.
In the dashboard, select the production environment and open Configure → Tools. Your choices are saved in production's Config, and every environment uses that tool selection. See MCP Tools.
Downloads
A tool result has a size limit, so the MCP server offers a download link when a response is too large to return whole, or when an operation answers with a file. The link is valid for 30 minutes. Opening it sends a fresh API request each time. It needs no credentials of its own: anyone holding it can make that call, as its caller, until it expires.
Running a request again is safe for a GET, so a GET gets a link by default. Any other method can change something, so a link opened later could undo what happened since: a PUT would revert a resource, and a DELETE would remove one created in the meantime.
x-scalar-download
For methods other than GET, set x-scalar-download: true to enable download links for oversized responses and files discovered after the operation runs. Use it on operations that are safe to run again, such as a POST search or report endpoint.
{
"paths": {
"/reports/search": {
"post": {
"operationId": "searchReports",
"summary": "Search reports",
"x-scalar-download": true
}
}
}
}
For operations that use another method and leave the flag unset, the MCP server truncates oversized responses with a note and omits the download link for files discovered after execution. If the API description declares a file response, the MCP server returns a link for any method and waits until it is opened to send the API request.
The flag can also be set in a Config, for one environment:
{
"paths": {
"/reports/search": {
"post": { "x-scalar-download": true }
}
}
}
The Config validator warns about x-scalar-download on a GET, where it changes nothing. An environment that redacts responses offers no download links, since a download is never redacted.
Credentials
x-scalar-secret-*
These fields on a security scheme in a Config tell the MCP server which credential to send. Each value is a reference, resolved when the call is made. A reference is the whole value, written as a string.
| Field | Scheme | Sends |
|---|---|---|
x-scalar-secret-token |
apiKey, http bearer |
The API key or bearer token. |
x-scalar-secret-username |
http basic |
The username. |
x-scalar-secret-password |
http basic |
The password. |
x-scalar-secret-client-id |
oauth2, in a flow |
The OAuth client ID. |
x-scalar-secret-client-secret |
oauth2, in flows.clientCredentials |
The OAuth client secret. |
| Reference | Resolves to | Allowed in |
|---|---|---|
{{ secrets.NAME }} |
A secret in the team's store, for the environment | Every field |
{{ vars.NAME }} |
A plaintext variable in the team's store | x-scalar-secret-username and x-scalar-secret-client-id only |
{{ group.KEY }} |
The secret the reader's access group names for KEY |
OAuth Gated environments; see Private access for customers |
{{ install.API_KEY }}, {{ install.ACCESS_TOKEN }} |
The token the MCP client sends, as Authorization: Bearer, x-api-key or x-auth-token |
Environments that do not sign clients in with Scalar |
{{ install.OAUTH_TOKEN }} |
The access token the MCP client got from your API's OAuth sign-in | Environments in OAuth passthrough |
{
"components": {
"securitySchemes": {
"apiKey": {
"type": "apiKey",
"in": "header",
"name": "X-Api-Key",
"x-scalar-secret-token": "{{ secrets.PAYMENTS_API_KEY }}"
}
}
}
}
A scheme with no reference field forwards the caller's own credential, read from where the scheme says it travels. See Authentication for the recipes.
x-scalar-credentials-location
In an oauth2 scheme's flows.clientCredentials, x-scalar-credentials-location controls how the client ID and secret are sent to the token endpoint. Use header to send them as HTTP Basic authentication or body to send them as form fields.
{
"components": {
"securitySchemes": {
"oauth": {
"type": "oauth2",
"flows": {
"clientCredentials": {
"tokenUrl": "https://auth.example.com/oauth/token",
"scopes": { "payments:read": "Read payments" },
"x-scalar-secret-client-id": "{{ vars.CLIENT_ID }}",
"x-scalar-secret-client-secret": "{{ secrets.CLIENT_SECRET }}",
"x-scalar-credentials-location": "body"
}
}
}
}
}
}
Additional headers
x-scalar-headers
Root x-scalar-headers in a Config adds headers to every request the MCP server makes to your API, beside the security scheme's credential. A value is text with any number of references inside it. A header whose value resolves to nothing is left off the request, and "" removes a header that production's Config sets.
| Reference | Value |
|---|---|
{{ secrets.NAME }}, {{ vars.NAME }}, {{ group.KEY }} |
As in Credentials |
{{ request.ip }}, country, region, city, continent, timezone |
What the edge knows about the MCP client's connection |
{{ mcp.server }}, environment, version, client, session, tool, operation |
The MCP server and the call being made |
{{ user.id }} |
A stable, opaque ID for the signed-in user, on OAuth Gated environments |
{
"x-scalar-headers": {
"X-Client-Country": "{{ request.country }}",
"X-Mcp-Tool": "{{ mcp.tool }}",
"X-Partner-Id": "{{ vars.PARTNER_ID }}"
}
}
An environment takes at most 20 additional headers, each value at most 1,024 characters. Headers that carry a credential, such as Authorization, and headers the MCP server or the HTTP connection sets cannot be added here: declare a credential in a security scheme. {{ install.* }} references are refused in a header.
Access
x-scalar-access
Root x-scalar-access in a Config says who may connect to an OAuth Gated environment.
| Field | Value |
|---|---|
accessGroups |
The access groups whose members may sign in |
loginPortal |
The login portal that brands the sign-in page |
groupSecrets |
Per access group, the team secret each {{ group.KEY }} reference sends |
On a security scheme, x-scalar-access: true marks an oauth2 scheme as Scalar's own sign-in. Naming that scheme in security makes the environment OAuth Gated. Scalar fills in its flows, so any flows written on it are ignored. See Private access for customers for a complete setup.
Landing page
x-scalar-customization
Root x-scalar-customization in a Config styles the page a browser sees at the environment's address.
| Field | Value |
|---|---|
theme |
A team theme or a Scalar preset, or null for the default |
logo |
The http or https URL of an image, or null for none |
{
"x-scalar-customization": {
"theme": "purple",
"logo": "https://example.com/logo.svg"
}
}
Related
What did you think of this content?