feat(32.2-01): admin consent endpoint for administrator-only MCP grants

- pact: MCPAdminConsent provider interface, MCPAdminConsentRequest,
  MCPAdminConsentDecision, ErrMCPConsentNotFound, ErrMCPConsentNoScopes
- cabana: GET/POST {api}/mcp/consent/{request}, interactive-only, scope
  policy of personal tokens (requested, catalog, owned; * collapses)
- cabana: TokenScopeNames and TokenScopeLabels export the token-scope catalog
- swag views and annotations; admin.json and schema.d.ts regenerated so the
  contract and conformance inventories stay green
- phrasebook keys mcp_connect.request_not_found and no_grantable_scopes
This commit is contained in:
Jakub Zych
2026-11-21 00:14:43 +01:00
parent c63bfa3ef2
commit 97d7ee0586
18 changed files with 1296 additions and 3 deletions

View File

@@ -1338,6 +1338,36 @@
],
"type": "object"
},
"cabana.Envelope-cabana_MCPConsentDecisionView": {
"properties": {
"data": {
"$ref": "#/components/schemas/cabana.MCPConsentDecisionView"
},
"meta": {
"$ref": "#/components/schemas/cabana.SuccessMeta"
}
},
"required": [
"data",
"meta"
],
"type": "object"
},
"cabana.Envelope-cabana_MCPConsentView": {
"properties": {
"data": {
"$ref": "#/components/schemas/cabana.MCPConsentView"
},
"meta": {
"$ref": "#/components/schemas/cabana.SuccessMeta"
}
},
"required": [
"data",
"meta"
],
"type": "object"
},
"cabana.Envelope-cabana_PartialView": {
"properties": {
"data": {
@@ -2586,6 +2616,123 @@
],
"type": "object"
},
"cabana.MCPConsentAdminView": {
"properties": {
"email": {
"type": "string"
},
"login": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"email",
"login",
"name"
],
"type": "object"
},
"cabana.MCPConsentClientView": {
"properties": {
"id": {
"type": "string"
},
"logo_url": {
"type": "string"
},
"name": {
"type": "string"
},
"redirect_host": {
"type": "string"
}
},
"required": [
"id",
"logo_url",
"name",
"redirect_host"
],
"type": "object"
},
"cabana.MCPConsentDecisionRequest": {
"properties": {
"decision": {
"enum": [
"allow",
"deny"
],
"type": "string"
},
"offline_access": {
"type": "boolean"
},
"scopes": {
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"decision",
"offline_access",
"scopes"
],
"type": "object"
},
"cabana.MCPConsentDecisionView": {
"properties": {
"redirect_uri": {
"type": "string"
}
},
"required": [
"redirect_uri"
],
"type": "object"
},
"cabana.MCPConsentView": {
"properties": {
"admin": {
"$ref": "#/components/schemas/cabana.MCPConsentAdminView"
},
"client": {
"$ref": "#/components/schemas/cabana.MCPConsentClientView"
},
"consent_required": {
"type": "boolean"
},
"expires_at": {
"type": "string"
},
"offline_access": {
"type": "boolean"
},
"request_id": {
"type": "string"
},
"scopes": {
"items": {
"$ref": "#/components/schemas/cabana.AdminAPITokenScope"
},
"type": "array"
}
},
"required": [
"admin",
"client",
"consent_required",
"expires_at",
"offline_access",
"request_id",
"scopes"
],
"type": "object"
},
"cabana.MarketplaceMeta": {
"properties": {
"categories": {
@@ -4960,6 +5107,169 @@
]
}
},
"/mcp/consent/{request}": {
"get": {
"description": "Shows a pending MCP authorization request of an administrator-only grant to the signed-in admin, as the plugin that owns the MCP authorization server resolves it. Only requested scopes the admin can grant are listed. 404 request_not_found when the request is missing, expired or used, or no plugin serves admin consent. Personal API tokens are refused (403 interactive_only).",
"parameters": [
{
"description": "Pending request id",
"in": "path",
"name": "request",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.Envelope-cabana_MCPConsentView"
}
}
},
"description": "OK"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Unauthorized"
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Forbidden"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Not Found"
}
},
"security": [
{
"BackendBearer": []
}
],
"summary": "Show an MCP consent request",
"tags": [
"admin"
]
},
"post": {
"description": "Allows or denies a pending MCP authorization request for the signed-in admin and answers the client redirect URI. Submitted scopes that were not requested or that the admin cannot grant are dropped, * collapses as for personal tokens, and 422 no_grantable_scopes answers when nothing is left. Needs X-Requested-With; the body is capped at 16 KiB and unknown fields are refused (400). Personal API tokens are refused (403 interactive_only).",
"parameters": [
{
"description": "Pending request id",
"in": "path",
"name": "request",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.MCPConsentDecisionRequest"
}
}
},
"description": "Decision",
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.Envelope-cabana_MCPConsentDecisionView"
}
}
},
"description": "OK"
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Bad Request"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Unauthorized"
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Forbidden"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Not Found"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
}
}
},
"description": "Unprocessable Entity"
}
},
"security": [
{
"BackendBearer": []
}
],
"summary": "Allow or deny an MCP consent request",
"tags": [
"admin"
]
}
},
"/navigation": {
"get": {
"responses": {

View File

@@ -1559,6 +1559,151 @@ export interface paths {
patch?: never;
trace?: never;
};
"/mcp/consent/{request}": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* Show an MCP consent request
* @description Shows a pending MCP authorization request of an administrator-only grant to the signed-in admin, as the plugin that owns the MCP authorization server resolves it. Only requested scopes the admin can grant are listed. 404 request_not_found when the request is missing, expired or used, or no plugin serves admin consent. Personal API tokens are refused (403 interactive_only).
*/
get: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Pending request id */
request: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["cabana.Envelope-cabana_MCPConsentView"];
};
};
/** @description Unauthorized */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["cabana.ErrorEnvelope"];
};
};
/** @description Forbidden */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["cabana.ErrorEnvelope"];
};
};
/** @description Not Found */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["cabana.ErrorEnvelope"];
};
};
};
};
put?: never;
/**
* Allow or deny an MCP consent request
* @description Allows or denies a pending MCP authorization request for the signed-in admin and answers the client redirect URI. Submitted scopes that were not requested or that the admin cannot grant are dropped, * collapses as for personal tokens, and 422 no_grantable_scopes answers when nothing is left. Needs X-Requested-With; the body is capped at 16 KiB and unknown fields are refused (400). Personal API tokens are refused (403 interactive_only).
*/
post: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Pending request id */
request: string;
};
cookie?: never;
};
/** @description Decision */
requestBody: {
content: {
"application/json": components["schemas"]["cabana.MCPConsentDecisionRequest"];
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["cabana.Envelope-cabana_MCPConsentDecisionView"];
};
};
/** @description Bad Request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["cabana.ErrorEnvelope"];
};
};
/** @description Unauthorized */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["cabana.ErrorEnvelope"];
};
};
/** @description Forbidden */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["cabana.ErrorEnvelope"];
};
};
/** @description Not Found */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["cabana.ErrorEnvelope"];
};
};
/** @description Unprocessable Entity */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["cabana.ErrorEnvelope"];
};
};
};
};
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/navigation": {
parameters: {
query?: never;
@@ -6429,6 +6574,14 @@ export interface components {
data: components["schemas"]["cabana.ListSchema"];
meta: components["schemas"]["cabana.SuccessMeta"];
};
"cabana.Envelope-cabana_MCPConsentDecisionView": {
data: components["schemas"]["cabana.MCPConsentDecisionView"];
meta: components["schemas"]["cabana.SuccessMeta"];
};
"cabana.Envelope-cabana_MCPConsentView": {
data: components["schemas"]["cabana.MCPConsentView"];
meta: components["schemas"]["cabana.SuccessMeta"];
};
"cabana.Envelope-cabana_PartialView": {
data: components["schemas"]["cabana.PartialView"];
meta: components["schemas"]["cabana.SuccessMeta"];
@@ -6911,6 +7064,35 @@ export interface components {
column: string;
direction: string;
};
"cabana.MCPConsentAdminView": {
email: string;
login: string;
name: string;
};
"cabana.MCPConsentClientView": {
id: string;
logo_url: string;
name: string;
redirect_host: string;
};
"cabana.MCPConsentDecisionRequest": {
/** @enum {string} */
decision: "allow" | "deny";
offline_access: boolean;
scopes: string[];
};
"cabana.MCPConsentDecisionView": {
redirect_uri: string;
};
"cabana.MCPConsentView": {
admin: components["schemas"]["cabana.MCPConsentAdminView"];
client: components["schemas"]["cabana.MCPConsentClientView"];
consent_required: boolean;
expires_at: string;
offline_access: boolean;
request_id: string;
scopes: components["schemas"]["cabana.AdminAPITokenScope"][];
};
"cabana.MarketplaceMeta": {
categories: string[];
registry: components["schemas"]["cabana.RegistryState"];