身份与授权 · MCP 客户端登录与已连接客户端 API (0.1.0)

Download OpenAPI specification:

Lets MCP clients such as WorkBuddy, Claude Code and Cursor sign a user in with only an MCP URL (Context Loader's): the client reads the protected-resource metadata (RFC 9728) and the authorization-server metadata (RFC 8414), registers itself (RFC 7591) and opens Hydra's authorize endpoint in the browser. Hydra's own dynamic registration stays disabled; bkn-safe admits only public clients that must sign a user in (authorization_code + PKCE, refresh allowed, no client_credentials) with loopback callbacks, and creates them through Hydra's admin API.

Users list and disconnect the clients they connected; administrators list and remove any self-registered client. First-party clients (Studio, CLI) are never listed or touched.

The discovery and registration routes exist only when config.oauth.dynamicRegistration.enabled is true.

Protected-resource metadata for the MCP endpoint (root form)

Responses

Response samples

Content type
application/json
{}

Protected-resource metadata for one MCP endpoint path

Path-suffixed form (RFC 9728 §3.1). Only MCP paths are answered: Context Loader's (api/agent-retrieval/v1/mcp…, resource_name "OpenBKN Context Loader"); resource echoes the origin the caller used.

path Parameters
resourcePath
required
string
Example: api/agent-retrieval/v1/mcp/

Responses

Response samples

Content type
application/json
{}

Authorization-server metadata with the registration endpoint

Hydra's OIDC discovery document plus registration_endpoint.

Responses

Response samples

Content type
application/json
{}

Register an MCP client (RFC 7591)

Unauthenticated by design: a client registers before anyone has signed in. Requests are rate-limited per client IP. Whatever grant types the client asks for, the created client gets authorization_code and refresh_token and the scope openid offline offline_access.

Request Body schema: application/json
required
redirect_uris
required
Array of strings <uri> non-empty [ items <uri > ]

Loopback callbacks (http://127.0.0.1:*, http://localhost:*, http://[::1]:*) or an origin listed in config.oauth.dynamicRegistration.allowedRedirectOrigins.

client_name
string <= 64 characters
grant_types
Array of strings
Items Enum: "authorization_code" "refresh_token"
response_types
Array of strings
Items Value: "code"
token_endpoint_auth_method
string
Value: "none"

Responses

Request samples

Content type
application/json
{
  • "client_name": "WorkBuddy Connector",
  • "grant_types": [
    ],
  • "response_types": [
    ],
  • "token_endpoint_auth_method": "none"
}

Response samples

Content type
application/json
{
  • "client_id": "string",
  • "client_id_issued_at": 0,
  • "client_name": "string",
  • "redirect_uris": [
    ],
  • "grant_types": [
    ],
  • "response_types": [
    ],
  • "token_endpoint_auth_method": "none",
  • "scope": "string"
}

List the clients the caller connected by signing in

Authorizations:
OAuth2

Responses

Response samples

Content type
application/json
{
  • "entries": [
    ],
  • "total": 0
}

Disconnect a client

Revokes the caller's grant; the client's access and refresh tokens stop working.

Authorizations:
OAuth2
path Parameters
clientId
required
string

Responses

Response samples

Content type
application/json
{
  • "error_code": "string",
  • "description": "string",
  • "error_details": null,
  • "metadata": { }
}

List every self-registered client

Authorizations:
OAuth2

Responses

Response samples

Content type
application/json
{
  • "entries": [
    ],
  • "total": 0
}

Remove a self-registered client

Every grant to the client and every token issued to it stop working.

Authorizations:
OAuth2
path Parameters
clientId
required
string

Responses

Response samples

Content type
application/json
{
  • "error_code": "string",
  • "description": "string",
  • "error_details": null,
  • "metadata": { }
}