Skip to main content

Mcp byok oauth API

This page documents the 9 gateway endpoints tagged mcp_byok_oauth in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.

MethodPathSummary
GET/.well-known/oauth-authorization-serverRead the gateway's OAuth sign-in addresses
GET/.well-known/oauth-authorization-server/mcpRead the sign-in addresses of the shared MCP endpoint
GET/.well-known/oauth-authorization-server/mcp/{mcp_server_name}Read the sign-in addresses of one MCP server
GET/.well-known/oauth-authorization-server/{mcp_server_name}Read the sign-in addresses of one MCP server, short address
GET/.well-known/oauth-authorization-server/{mcp_server_name}/mcpRead the sign-in addresses of one MCP server, older address
GET/.well-known/oauth-protected-resourceFind where to sign in for the gateway
GET/.well-known/oauth-protected-resource/mcpFind where to sign in for the shared MCP endpoint
GET/.well-known/oauth-protected-resource/mcp/{mcp_server_name}Find where to sign in for one MCP server
GET/.well-known/oauth-protected-resource/{mcp_server_name}/mcpFind where to sign in for one MCP server, older address

Endpoints​

GET /.well-known/oauth-authorization-server​

Read the gateway's OAuth sign-in addresses

List the sign-in, token and registration addresses of the gateway. When exactly one MCP server signs in through OAuth, its addresses are shown. MCP clients fetch this document by themselves when they connect, so people rarely call it by hand. Anyone may call it without a key, and nothing is changed.

Parameters:

NameInTypeRequiredDescription
mcp_server_namequerystring or nullNo

Example request:

curl -X GET "http://localhost:4000/.well-known/oauth-authorization-server"

Responses:

StatusDescriptionBody
200The sign-in addresses for this MCP serverapplication/json AuthorizationServerMetadata
404No OAuth MCP server has that nameapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
authorization_endpointstringYesWhere the browser goes to sign in
code_challenge_methods_supportedarray of stringYesAlways S256, PKCE is required
grant_types_supportedarray of stringYesThe grants the token endpoint accepts
id_token_signing_alg_values_supportedarray of string or nullNoSignature algorithms, present when MCP token signing is on
introspection_endpointstring or nullNoToken check address, aggregate only
issuerstringYesThe authorization server's identifier, checked by strict clients
jwks_uristring or nullNoSigning keys, present when MCP token signing is on
registration_endpointstringYesWhere the client registers itself before signing in
response_types_supportedarray of stringYesAlways code
scopes_supportedarray of stringYesThe scopes the client may ask for
token_endpointstringYesWhere the client trades the code for tokens
token_endpoint_auth_methods_supportedarray of stringYesHow a client proves itself

GET /.well-known/oauth-authorization-server/mcp​

Read the sign-in addresses of the shared MCP endpoint

List the sign-in, token, registration and token check addresses the gateway offers to MCP clients of the shared /mcp endpoint. Clients register themselves without a secret and must use PKCE. MCP clients fetch this document by themselves when they connect, so people rarely call it by hand. Anyone may call it without a key, and nothing is changed.

Example request:

curl -X GET "http://localhost:4000/.well-known/oauth-authorization-server/mcp"

Responses:

StatusDescriptionBody
200The gateway's own sign-in addresses for the shared /mcp endpointapplication/json AuthorizationServerMetadata

Response fields (200):

FieldTypeRequiredDescription
authorization_endpointstringYesWhere the browser goes to sign in
code_challenge_methods_supportedarray of stringYesAlways S256, PKCE is required
grant_types_supportedarray of stringYesThe grants the token endpoint accepts
id_token_signing_alg_values_supportedarray of string or nullNoSignature algorithms, present when MCP token signing is on
introspection_endpointstring or nullNoToken check address, aggregate only
issuerstringYesThe authorization server's identifier, checked by strict clients
jwks_uristring or nullNoSigning keys, present when MCP token signing is on
registration_endpointstringYesWhere the client registers itself before signing in
response_types_supportedarray of stringYesAlways code
scopes_supportedarray of stringYesThe scopes the client may ask for
token_endpointstringYesWhere the client trades the code for tokens
token_endpoint_auth_methods_supportedarray of stringYesHow a client proves itself

GET /.well-known/oauth-authorization-server/mcp/{mcp_server_name}​

Read the sign-in addresses of one MCP server

List the sign-in, token and registration addresses an MCP client uses for /mcp/{mcp_server_name}, with the scopes the server's provider offers. A name that is unknown, hidden or not an OAuth server answers 404. MCP clients fetch this document by themselves when they connect, so people rarely call it by hand. Anyone may call it without a key, and nothing is changed.

Parameters:

NameInTypeRequiredDescription
mcp_server_namepathstringYes

Example request:

curl -X GET "http://localhost:4000/.well-known/oauth-authorization-server/mcp/mcp_server_name-123"

Responses:

StatusDescriptionBody
200The sign-in addresses for this MCP serverapplication/json AuthorizationServerMetadata
404No OAuth MCP server has that nameapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
authorization_endpointstringYesWhere the browser goes to sign in
code_challenge_methods_supportedarray of stringYesAlways S256, PKCE is required
grant_types_supportedarray of stringYesThe grants the token endpoint accepts
id_token_signing_alg_values_supportedarray of string or nullNoSignature algorithms, present when MCP token signing is on
introspection_endpointstring or nullNoToken check address, aggregate only
issuerstringYesThe authorization server's identifier, checked by strict clients
jwks_uristring or nullNoSigning keys, present when MCP token signing is on
registration_endpointstringYesWhere the client registers itself before signing in
response_types_supportedarray of stringYesAlways code
scopes_supportedarray of stringYesThe scopes the client may ask for
token_endpointstringYesWhere the client trades the code for tokens
token_endpoint_auth_methods_supportedarray of stringYesHow a client proves itself

GET /.well-known/oauth-authorization-server/{mcp_server_name}​

Read the sign-in addresses of one MCP server, short address

The same document as /.well-known/oauth-authorization-server/mcp/{mcp_server_name}, for clients that insert the well-known segment before the server name. MCP clients fetch this document by themselves when they connect, so people rarely call it by hand. Anyone may call it without a key, and nothing is changed.

Parameters:

NameInTypeRequiredDescription
mcp_server_namepathstring or nullYes

Example request:

curl -X GET "http://localhost:4000/.well-known/oauth-authorization-server/mcp_server_name-123"

Responses:

StatusDescriptionBody
200The sign-in addresses for this MCP serverapplication/json AuthorizationServerMetadata
404No OAuth MCP server has that nameapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
authorization_endpointstringYesWhere the browser goes to sign in
code_challenge_methods_supportedarray of stringYesAlways S256, PKCE is required
grant_types_supportedarray of stringYesThe grants the token endpoint accepts
id_token_signing_alg_values_supportedarray of string or nullNoSignature algorithms, present when MCP token signing is on
introspection_endpointstring or nullNoToken check address, aggregate only
issuerstringYesThe authorization server's identifier, checked by strict clients
jwks_uristring or nullNoSigning keys, present when MCP token signing is on
registration_endpointstringYesWhere the client registers itself before signing in
response_types_supportedarray of stringYesAlways code
scopes_supportedarray of stringYesThe scopes the client may ask for
token_endpointstringYesWhere the client trades the code for tokens
token_endpoint_auth_methods_supportedarray of stringYesHow a client proves itself

GET /.well-known/oauth-authorization-server/{mcp_server_name}/mcp​

Read the sign-in addresses of one MCP server, older address

The same document as /.well-known/oauth-authorization-server/mcp/{mcp_server_name}, for clients set up with the older /{mcp_server_name}/mcp address. MCP clients fetch this document by themselves when they connect, so people rarely call it by hand. Anyone may call it without a key, and nothing is changed.

Parameters:

NameInTypeRequiredDescription
mcp_server_namepathstringYes

Example request:

curl -X GET "http://localhost:4000/.well-known/oauth-authorization-server/mcp_server_name-123/mcp"

Responses:

StatusDescriptionBody
200The sign-in addresses for this MCP serverapplication/json AuthorizationServerMetadata
404No OAuth MCP server has that nameapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
authorization_endpointstringYesWhere the browser goes to sign in
code_challenge_methods_supportedarray of stringYesAlways S256, PKCE is required
grant_types_supportedarray of stringYesThe grants the token endpoint accepts
id_token_signing_alg_values_supportedarray of string or nullNoSignature algorithms, present when MCP token signing is on
introspection_endpointstring or nullNoToken check address, aggregate only
issuerstringYesThe authorization server's identifier, checked by strict clients
jwks_uristring or nullNoSigning keys, present when MCP token signing is on
registration_endpointstringYesWhere the client registers itself before signing in
response_types_supportedarray of stringYesAlways code
scopes_supportedarray of stringYesThe scopes the client may ask for
token_endpointstringYesWhere the client trades the code for tokens
token_endpoint_auth_methods_supportedarray of stringYesHow a client proves itself

GET /.well-known/oauth-protected-resource​

Find where to sign in for the gateway

Tell an OAuth client which authorization server signs it in for the gateway itself. MCP clients fetch this document by themselves when they connect, so people rarely call it by hand. Anyone may call it without a key, and nothing is changed.

Example request:

curl -X GET "http://localhost:4000/.well-known/oauth-protected-resource"

Responses:

StatusDescriptionBody
200Where the client signs inapplication/json ProtectedResourceMetadata

Response fields (200):

FieldTypeRequiredDescription
authorization_serversarray of stringYesWhere the client signs in for that resource
resourcestringYesThe URL the client presents its token to
scopes_supportedarray of stringYesThe scopes the client may ask for, often empty

GET /.well-known/oauth-protected-resource/mcp​

Find where to sign in for the shared MCP endpoint

Tell an MCP client connecting to the shared /mcp endpoint that the gateway itself signs it in. Which servers the person may use is decided after sign-in, so no server names appear here. MCP clients fetch this document by themselves when they connect, so people rarely call it by hand. Anyone may call it without a key, and nothing is changed.

Example request:

curl -X GET "http://localhost:4000/.well-known/oauth-protected-resource/mcp"

Responses:

StatusDescriptionBody
200Where the client signs in for /mcpapplication/json ProtectedResourceMetadata

Response fields (200):

FieldTypeRequiredDescription
authorization_serversarray of stringYesWhere the client signs in for that resource
resourcestringYesThe URL the client presents its token to
scopes_supportedarray of stringYesThe scopes the client may ask for, often empty

GET /.well-known/oauth-protected-resource/mcp/{mcp_server_name}​

Find where to sign in for one MCP server

Tell an MCP client connecting to /mcp/{mcp_server_name} where to sign in. A server whose own provider checks the token gets that provider's details, any other OAuth server gets the gateway's sign-in. A name that is unknown, hidden from the caller or not an OAuth server answers 404. MCP clients fetch this document by themselves when they connect, so people rarely call it by hand. Anyone may call it without a key, and nothing is changed.

Parameters:

NameInTypeRequiredDescription
mcp_server_namepathstringYes

Example request:

curl -X GET "http://localhost:4000/.well-known/oauth-protected-resource/mcp/mcp_server_name-123"

Responses:

StatusDescriptionBody
200Where the client signs in for this MCP addressapplication/json ProtectedResourceMetadata
404No OAuth MCP server has that nameapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
authorization_serversarray of stringYesWhere the client signs in for that resource
resourcestringYesThe URL the client presents its token to
scopes_supportedarray of stringYesThe scopes the client may ask for, often empty

GET /.well-known/oauth-protected-resource/{mcp_server_name}/mcp​

Find where to sign in for one MCP server, older address

The same answer as /.well-known/oauth-protected-resource/mcp/{mcp_server_name}, for clients set up with the older /{mcp_server_name}/mcp address. New setups should use /mcp/{mcp_server_name}. MCP clients fetch this document by themselves when they connect, so people rarely call it by hand. Anyone may call it without a key, and nothing is changed.

Parameters:

NameInTypeRequiredDescription
mcp_server_namepathstring or nullYes

Example request:

curl -X GET "http://localhost:4000/.well-known/oauth-protected-resource/mcp_server_name-123/mcp"

Responses:

StatusDescriptionBody
200Where the client signs in for this MCP addressapplication/json ProtectedResourceMetadata
404No OAuth MCP server has that nameapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
authorization_serversarray of stringYesWhere the client signs in for that resource
resourcestringYesThe URL the client presents its token to
scopes_supportedarray of stringYesThe scopes the client may ask for, often empty