Approve or deny an MCP connector
const url = 'https://example.com/api/mcp/consent';const options = { method: 'POST', headers: {'Remote-User': '<Remote-User>', 'Content-Type': 'application/json'}, body: '{"client_id":"example","redirect_uri":"example","code_challenge":"example","code_challenge_method":"S256","state":"example","csrf":"example","action":"approve","grants":[{"kind":"group","target":"example","permissions":["publish"]}],"acknowledge_global":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/mcp/consent \ --header 'Content-Type: application/json' \ --header 'Remote-User: <Remote-User>' \ --data '{ "client_id": "example", "redirect_uri": "example", "code_challenge": "example", "code_challenge_method": "S256", "state": "example", "csrf": "example", "action": "approve", "grants": [ { "kind": "group", "target": "example", "permissions": [ "publish" ] } ], "acknowledge_global": true }'Available only when GOTIFACTS_MCP_ENABLED=true. Records the user’s
decision on the consent screen and answers with the URL to send the browser
to (window.location.assign): the client’s redirect_uri carrying a code
(approve), error=access_denied (deny), or error=invalid_scope with an
error_description (invalid grants), plus the client’s state.
The grants are validated server-side: 1 to 16 grants; each kind is group
or site; targets are lower-cased, trimmed of / and checked as site-path
labels; permissions is non-empty and limited to the capabilities returned
by GET /api/mcp/consent, which include read. A global grant (kind
group, empty target) needs acknowledge_global: true.
Errors before the redirect URI is trusted (bad CSRF token, unknown client,
unregistered redirect URI, malformed body) are 400 JSON.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”The user’s decision on the MCP consent screen.
object
The token from GET /api/mcp/consent.
Required for approve; ignored for deny.
object
A group path (e.g. docs, empty = all sites) or a group/slug for a single site.
Must be true when any grant is global (group kind, empty target).
Responses
Section titled “ Responses ”Where to send the browser next.
object
The client’s redirect URI with code or error (and state) in the query.
Examplegenerated
{ "redirect_url": "example"}Invalid request (bad path, malformed body, or missing content).
object
Examplegenerated
{ "error": "example"}Missing or invalid credentials.
object
Examplegenerated
{ "error": "example"}Authenticated, but not permitted for this target/capability.
object
Examplegenerated
{ "error": "example"}