Connect MCP clients securely
Enable the project-bound Nibleaf MCP endpoint, connect clients by OAuth sign-in or personal keys, and operate write safety, audit, rate limits, and rollback.
- 22 min read
- Updated
On this page
Nibleaf exposes an authenticated HTTP MCP endpoint at /api/mcp. It is off by
default. Clients connect either by signing in with OAuth, which binds the
connection to one project and a preset the person chooses, or with a personal
API key. Every key is bound to one project, belongs to the member who created
it, carries explicit scopes, and expires. The server derives the project and
organization from the key or connection; tools never accept either as caller
authority.
Read tools cover content, analytics, search, usage, add-ons, themes, exports, deployments, and integrations. Support-writer tools can create and edit page drafts and publish them after an explicit preview and confirmation. Deletion, settings and membership changes, provider credentials, payment actions, database primitives, arbitrary files, and code execution are not available. For the support workflow and the complete tool catalog, see Work on your docs with an AI assistant.
This page describes the support-writer tools and OAuth, which ship in v0.2.1.
The v0.2.0 image shipped only the read-only MCP surface. Apply the release's
migrations before enabling the new capabilities. The pinned production Compose file passes MCP_ENABLED,
MCP_ALLOWED_HOSTS, and MCP_RATE_LIMIT_PER_MIN, but does not pass
MCP_WRITE_RATE_LIMIT_PER_MIN or MCP_PUBLISH_RATE_LIMIT_PER_HOUR. Add explicit
API environment mappings in an override to customize those source-era limits;
.env alone does not pass them through. See the
environment reference.
Set the API service environment:
MCP_ENABLED=true
MCP_ALLOWED_HOSTS=mcp.docs.example.com
MCP_RATE_LIMIT_PER_MIN=120
MCP_WRITE_RATE_LIMIT_PER_MIN=20
MCP_PUBLISH_RATE_LIMIT_PER_HOUR=6
API_URL and APP_URL hostnames are always allowed. Add only additional public
hostnames to MCP_ALLOWED_HOSTS; do not add schemes, paths, user information,
commas inside one host, or wildcard values. Recreate the API service after a
change.
The endpoint validates Host, Origin, X-Forwarded-Host, and
X-Forwarded-Proto before authentication. Configure the public proxy to replace
untrusted forwarded headers and pass one unambiguous host and protocol. Keep MCP
disabled until the public TLS and proxy path return the expected hostname.
Any project member creates their own key in Settings → AI assistants (MCP). They pick a preset (or individual scopes under Advanced: choose individual permissions) and an expiry of 7, 30, 90, 180, or 365 days, then select Create key. The secret is shown once:
| Preset | Offered to | Scopes |
|---|---|---|
| Read only | Editors and above | mcp:connect, projects:read, pages:read, languages:read, versions:read, analytics:read, search:read, deployments:read |
| Support writer | Editors and above | Read only plus analytics:search_terms, pages:write, deployments:publish |
| Full admin | Admins and owners | Every MCP scope |
Presets are a dashboard convenience; the security boundary is the scope set plus
the creator's role. A key acts as its creator. On every request the server
re-reads the creator's current workspace role and suspension state, so a key can
never do more than its owner can do in the dashboard at that moment. Removing or
suspending a member, or deleting their account, stops their keys on the next
request with 401 auth:invalid_api_key. Scopes only narrow what the owner's
role already allows.
Editors see and revoke only their own keys. Admins and owners see every key in the project, with its owner, and can revoke any of them, but only a key's owner can rotate it; rotation re-issues the key as the person rotating. Each key shows its preset, last use, and latest activity, and Test connection checks the key, host, and MCP switch in one step, reporting "Connected · N tools available" on success. Store a secret in the client's secret store, not in source control, shell history, support messages, logs, screenshots, or an MCP configuration committed to a repository.
Every MCP key needs mcp:connect. A scope controls only its named surface and
never widens the key's project binding. Capability discovery reports the tools,
resources, and prompts registered for the exact key. Do not assume a documented
capability exists if it is absent from tools/list or nibleaf://capabilities.
Legacy wildcard keys are intentionally unable to connect. A null expiration,
missing mcp:connect, or migrated legacy state appears as rotation required in
the dashboard. Rotate it into an explicit, expiring scope set rather than
editing its database row.
Use the public API origin and pass the key as a bearer token. A client that supports remote HTTP MCP servers commonly accepts a configuration shaped like:
{
"mcpServers": {
"nibleaf": {
"url": "https://api.docs.example.com/api/mcp",
"headers": {
"Authorization": "Bearer ${NIBLEAF_API_KEY}"
}
}
}
}
Client configuration names differ. Use its HTTP or remote-server option, not a
local command or filesystem adapter. The dashboard's setup panel generates
client-specific commands and links for Claude Code, Claude Desktop, Cursor, and
VS Code; see Connect your assistant
for each snippet. First call tools/list, then get_capabilities. A successful response
includes both MCP protocol content and a structured envelope with the request
ID, bound project ID, and required capability.
Clients that connect through OAuth (ChatGPT, the claude.ai and Claude Desktop
connectors, and, if their users prefer, Claude Code, Cursor, and VS Code) need
only the URL <APP_URL>/api/mcp; see OAuth for MCP clients.
OAuth tokens are bound to that exact URL, so give those clients the dashboard
origin rather than another host listed in MCP_ALLOWED_HOSTS.
- Working copy only.
pages:writetools create and edit drafts. Nothing is live until a publish succeeds. - Project-wide publish after a fresh preview. A publish includes every
unpublished change in the project, including everyone's drafts, not only the
key owner's. The client must call
preview_publish, thenpublish_changeswithconfirm: trueand the preview token. Having a person review the list in between is the recommended step, which the server can't verify (see below). The deployment message records the MCP key name. - What the server can and cannot check. The server verifies that a confirmation matches a fresh preview for the same person and project. It cannot verify that a person read the preview: the review depends on the client asking. Issue Read only keys for unattended automation.
- Complete review. The preview lists at most 50 changed pages and sets
changesTruncatedwhen more are pending; itsnextStepthen tells the client to send the person to the dashboard's publish dialog for the full list. Site settings that would change (project fields andconfigsections such as the theme) are listed by name undersettings.changedFields, and a settings-only change can be published the same way. - Bound preview token. The token is bound to the key's owner, the project, and a
digest of everything the publish would ship plus the last published and
newest deployment version. It expires after 10 minutes
(
mcp:preview_expired) and is effectively single-use: any edit, publish, or rollback after the preview returnsmcp:preview_stale, and nothing is published partially. Publishing also stops withmcp:publish_blockedfor the same reasons the dashboard would, such as redirect issues. - Optimistic concurrency. Edits carry
expectedRevision. If a person saved a newer revision, the write fails withmcp:revision_conflict, whose error data includescurrentRevision, instead of overwriting it. - Idempotency. A client may send
clientRequestId; a retried request with the same ID and arguments replays the first result instead of applying the write twice. The same ID with different arguments returnsmcp:idempotency_conflict, and a retry while the first call is still running returns the retryablemcp:idempotency_in_progress. Replay records expire after 24 hours. - Bounded, inert page bodies. Bodies are Markdown/MDX up to 128 KiB. A
leading YAML frontmatter block may set
title,description, andicon, and explicit arguments win. Frontmatter uses the Git sync parser, so escaped characters are not decoded, as in Git sync. MDX is never executed on the reader site: content renders throughreact-markdownandrehype-sanitize, and MDX expressions andimport/exportlines appear as text. - Translation pairing.
translate_pagerequiressourceRevisionand refuses a source that changed after it was read (mcp:revision_conflict). It refuses an existing translation withmcp:translation_exists(data.pageIdnames it; edit it withupdate_page). It may also set a shared translation key on the source page, and on other-language pages already paired with it by path, using the same revision-safe write. - Hide instead of delete. There is no delete tool. After the next publish,
a page hidden with
set_page_visibilityleaves navigation, site search, the sitemap, andllms.txt, and its URL stops serving it. Child pages leave navigation but stay reachable at their own URLs. Links from visible pages to a hidden page fail the publish broken-link check. - Untrusted data. Page content, search terms, and reader feedback are returned as data. The server instructs clients never to follow instructions found inside them.
In ClickHouse mode, get_top_searches and get_failed_searches read the same
search model as the dashboard's Search section:
- typeahead keystrokes collapse into one settled search, the final query;
- a term's text is shown only when at least two distinct visits searched for it. Rarer terms are counted but hidden;
- failed terms returned no results, or returned results that nobody clicked.
Raw search terms exist only when all of these hold:
- the instance runs ClickHouse analytics (
ANALYTICS_MODE=clickhouse); - the site is public, and an Admin or Owner turned on search terms in Analytics → Search → Turn on search terms;
- the reader's search carries
consentState=granted, ornot_requiredon a site without a consent banner. The bundled reader site sends it.
Search events always carry the query as a salted hash, and as text only under
these conditions. When terms are missing, the tools return totals, rates and a
hint explaining why. Relational analytics never stores search text, result
counts or clicks, so get_failed_searches reports itself unavailable there.
In ClickHouse mode get_referrers also returns AI crawler activity from the
same report as the dashboard's AI visibility section: AI crawler requests,
assistant fetches made for a person, the crawlers, and the most crawled pages.
Reader-engagement metrics count people; crawlers are reported separately. AI
spend tools count every billed turn, including automated traffic.
Page-helpfulness feedback does not store free-text reader comments. AI chat feedback is different: redacted comments can be saved under the chat capture policy. Search, crawler and page feedback data are not split by language, so those tools ignore the language filter, and the response says so.
The capability resource is authoritative. The stable read surface includes
project metadata; page metadata and authored page content; languages and
versions; aggregate analytics; search configuration and content-free index
diagnostics; exact aggregate usage and advisory entitlement summaries; add-on
catalog, state, and audit reads; safe theme template/catalog metadata and
non-writing import preview; redacted export and deployment summaries; pending
publish-change metadata; and truth-based integration catalog, connection, and Git
status reads. Raw search terms require the separate analytics:search_terms
scope.
The write surface is limited to pages:write (create, edit, move, translate,
hide or show page drafts) and deployments:publish (preview and confirmed
publish). No usage:export, search reindex, add-on or theme mutation,
integration verification or deletion, credential, or payment scope is issuable.
exports:read remains the separate redacted export-job read surface.
Project resources use bound URIs such as:
nibleaf://projects/{boundProjectId}
nibleaf://projects/{boundProjectId}/pages
nibleaf://projects/{boundProjectId}/pages/{pageId}
nibleaf://projects/{boundProjectId}/pages/{pageId}/markdown
nibleaf://projects/{boundProjectId}/languages
nibleaf://projects/{boundProjectId}/versions
nibleaf://projects/{boundProjectId}/search/configuration
nibleaf://projects/{boundProjectId}/usage
nibleaf://projects/{boundProjectId}/entitlements
nibleaf://projects/{boundProjectId}/addons
nibleaf://projects/{boundProjectId}/theme-catalog
nibleaf://projects/{boundProjectId}/theme-template
nibleaf://projects/{boundProjectId}/integrations
nibleaf://projects/{boundProjectId}/deployments/latest
The /markdown resource returns one page as text/markdown with frontmatter,
in the same format as Git sync.
A different project ID or a page outside the bound project returns the same
not-found protocol result as a missing resource. Read projections omit provider
payloads, preview bearer URLs, storage keys and checksums, deployment snapshots,
theme filesystem state, raw errors, and credentials. Search diagnostics expose
logical schema/revision/model metadata but not physical collections, content,
vectors, hashes, or raw provider payloads. Usage quantities and limits remain
exact decimal strings or null; partial and unavailable data is never rewritten
as zero, and configured blocking behavior is advisory only. The pages:read
scope does include authored content inside the one bound project; grant it only
when the client needs document bodies.
Every tool and resource call appends a privacy-minimized audit event to the
mcp_audit_event table before success is returned. Every write attempt is
audited, whether it succeeds or ends in a validation error, an authorization
denial, a conflict, a rate limit, or an idempotent replay. The event records the
project, the API key or OAuth connection (apiKeyId or oauthGrantId), acting
user (actorUserId), request ID, operation,
capability, target type and ID (targetType, targetId, such as a page or
deployment), outcome, stable error code, duration, client request ID
(clientRequestId), and timestamp. It never stores tool inputs, results, page
content, bearer tokens, provider payloads, IP addresses, or raw client keys. A write creates a started audit row before it runs and settles that row
afterwards. Failure to create it prevents the write. Failure to settle it can
return a storage error after the draft changed; re-read the target before
retrying, and reuse the same clientRequestId when available.
Three limits apply per key or OAuth connection, per API process:
| Variable | Default | Counts |
|---|---|---|
MCP_RATE_LIMIT_PER_MIN | 120 | All MCP requests per key per minute. |
MCP_WRITE_RATE_LIMIT_PER_MIN | 20 | Every write tool call per key per minute. preview_publish does not count. |
MCP_PUBLISH_RATE_LIMIT_PER_HOUR | 6 | publish_changes attempts per key per hour that pass the preview-token check. |
A rejected write or publish returns http:rate_limited with
data.retryAfterSeconds.
These counters are kept in memory per API process (instance). They are not
deployment-global across replicas and reset when the process restarts. Enforce a deployment-wide limit at the
trusted ingress or shared edge and monitor HTTP 429, Retry-After, and
X-RateLimit-* headers. To bound audit write amplification, the transport
records one transport_rate_limit rejection per key/window instead of one row
for every repeated 429. Never describe an individual process's counter as the
global customer allowance.
Rotation atomically revokes the old key and creates a new expiring key. Update
the client with the once-visible secret, verify tools/list, then remove the old
secret from its store. Revocation is irreversible and requires the dashboard
confirmation dialog. It takes effect on the next request. A database backup is
not a reason to re-enable a leaked key.
Apply the MCP migrations during a low-activity window before enabling the
endpoint, with the release's normal migration step (pnpm db:deploy, or the
migrate step of your deployment). The first adds nullable provenance columns and
two indexes to the existing, operator-managed api_key table, then creates the
initially empty audit table. The write-path migration
20261106090000_mcp_write_audit_idempotency adds the nullable actorUserId,
targetType, targetId, and clientRequestId columns to mcp_audit_event,
and creates the mcp_idempotency_record replay cache, which stores an
arguments hash and a compact result summary but never inputs or content. The
two new indexes on mcp_audit_event (by actor and by OAuth grant) are built
with CREATE INDEX CONCURRENTLY in their own migrations,
20261106130000_mcp_audit_actor_index and
20261106130100_mcp_audit_oauth_grant_index, so audit writes are not blocked
while they build. If a concurrent build is interrupted, drop the INVALID index
it leaves and run the migration step again.
PostgreSQL's standard index and foreign-key DDL can briefly block API-key
create, rotate, or revoke writes. Check the table size and active locks first,
pause those dashboard operations during the migration, and keep MCP disabled
until it completes. The original control-plane migration uses ordinary DDL. The two later audit
index migrations use concurrent index creation and may need failed-migration
recovery before Prisma can continue; do not clear Prisma history manually.
Before application rollback, disable MCP and stop MCP clients. Do not execute
the MCP rollback.sql after a successful Prisma migration. Deploy an
application that does not read MCP audit data or MCP-owned API-key provenance
columns, then ship reviewed down statements as a later forward migration in
reverse dependency order. Use the repository rollback statements directly only
to reverse a failed, partially applied migration; after safely reversing the
partial statements, mark that failed migration rolled back and rerun the
corrected forward migration. Back up audit records first if your retention
policy requires them.
Because MCP is the final dependent migration, disable and reverse it before the integration schema. Follow the complete reverse order in the combined release migration guide.
ChatGPT connectors, the claude.ai and Claude Desktop custom connectors, Claude
Code, Cursor, and VS Code can connect by URL alone: the person adds
<APP_URL>/api/mcp to the client, signs in to Nibleaf in the browser, chooses
one project and a permission preset, and approves. No key is copied. Personal
API keys keep working unchanged beside OAuth.
Nibleaf's authentication server (Better Auth 1.7.18) is the OAuth 2.1
authorization server, through the official @better-auth/mcp plugin with
@better-auth/cimd and the jwt plugin. It turns on together with the MCP
endpoint, so MCP_ENABLED=true on the API service is the only switch.
BETTER_AUTH_URLis the public dashboard origin (the same value asAPP_URLin the bundled Compose files). It must use HTTPS; plain HTTP is accepted only forlocalhostand loopback addresses in development. On any other HTTP origin OAuth stays off, the API logs a warning, and the settings page tells people to use a personal key.- The dashboard must reach the API for
/api/**and for the three discovery prefixes below. The bundled dashboard already proxies them; a reverse proxy in front of it must pass them through unchanged. - Apply the migration
20261106120000_mcp_oauthbefore enabling MCP. It creates the OAuth tables even while MCP stays off.
BETTER_AUTH_URL=https://docs.example.com
MCP_ENABLED=true
| URL | Purpose |
|---|---|
<APP_URL>/api/mcp | The protected MCP resource. Access tokens are audience-bound to exactly this URL. |
<APP_URL>/.well-known/oauth-protected-resource/api/mcp | RFC 9728 protected resource metadata (also served without the /api/mcp suffix). |
<APP_URL>/.well-known/oauth-authorization-server/api/auth | RFC 8414 authorization server metadata for the issuer <APP_URL>/api/auth (also served at the root path). |
<APP_URL>/api/auth/.well-known/openid-configuration | OpenID metadata (also served at /.well-known/openid-configuration and its /api/auth form). |
<APP_URL>/api/auth/oauth2/register | Dynamic client registration (RFC 7591) for public clients. |
<APP_URL>/api/auth/oauth2/authorize, <APP_URL>/api/auth/oauth2/token, <APP_URL>/api/auth/oauth2/revoke | Authorization code with PKCE (S256), token, and revocation endpoints. |
Every 401 from /api/mcp carries an RFC 6750 challenge with the RFC 9728
resource_metadata pointer, which is how a client finds the sign-in flow. Check
an instance with:
curl -s https://docs.example.com/.well-known/oauth-protected-resource/api/mcp
curl -si -X POST https://docs.example.com/api/mcp | grep -i www-authenticate
The challenge looks like this; a token that lacks mcp:connect gets
error="insufficient_scope" with scope="mcp:connect" and status 403:
WWW-Authenticate: Bearer realm="Nibleaf MCP", scope="mcp:connect projects:read ... offline_access", resource_metadata="https://docs.example.com/.well-known/oauth-protected-resource/api/mcp"
Clients register themselves. ChatGPT and claude.ai use dynamic client
registration: open registration is enabled for public clients
(token_endpoint_auth_method: none), PKCE is required, and the
client_credentials grant is not offered, because every token must act as a
person. Clients that publish a Client ID Metadata Document use its HTTPS URL as
their client ID; Nibleaf fetches and validates the document (MCP 2026-07-28
profile) and shows its domain on the consent page as verified. A dynamically
registered client chooses its own name, so the consent page marks it as
unverified and shows where the person will be sent back to.
Session-backed client management (/api/auth/oauth2/create-client,
update-client, delete-client, get-client, get-clients,
client/rotate-secret) and Better Auth's session-JWT route
(/api/auth/token) are disabled.
After sign-in, Nibleaf asks the person which project the connection is for and
which preset it gets (Read only, Support writer, or Full admin). The rules are
the ones for personal keys: the person must belong to the project, and Full
admin is offered only to admins and owners. The choice is stored as an
mcp_oauth_grant row; its ID is Better Auth's consent reference and travels in
every access token as the nibleaf_grant claim, beside nibleaf_project. The
consent page then shows the app, the project, and in plain language what the
app will and will not be able to do. Support sessions (impersonation) cannot
connect apps.
On every MCP request the server verifies the token locally against the
instance's own signing keys (signature, issuer <APP_URL>/api/auth, audience
<APP_URL>/api/mcp, expiry, at+jwt type), then re-reads the grant, the
person's membership, and suspension state. The effective scopes are the grant's
preset ∩ the token's scopes ∩ what the person's current role allows. Revoking
the connection, removing or suspending the person, or lowering their role takes
effect on the next request.
Clients may also sender-constrain their tokens with DPoP (RFC 9449). A
DPoP-bound token must be sent as Authorization: DPoP <token> with a DPoP
proof signed by the bound key for that request's method, the token, and the
public URL <APP_URL>/api/mcp, which is checked even when the request reaches
the API through the dashboard proxy. Each proof works once: its jti is
reserved in Better Auth's verification table, so a replay fails on every API
instance. A DPoP-bound token sent as Bearer is refused. Personal API keys are
always sent as Bearer.
Access tokens are JWTs that last one hour. Refresh tokens are issued when the
client asks for offline_access, last 30 days, and rotate strictly: a refresh
token works once. Every refresh re-checks that the connection is still live.
Settings → AI assistants (MCP) → Connected apps lists live connections with the app, the preset, who connected it, the last use, and the latest activity. Editors see and disconnect their own; admins and owners see and disconnect everyone's. Disconnecting revokes the grant, its refresh tokens, and its consent at once. Connecting the same app to the same project again replaces the person's earlier connection.
Audit rows for OAuth calls record the grant in mcp_audit_event.oauthGrantId
(the API-key column stays empty), so every call is attributable to the person
and the connection. The request, write, and publish limits count per connection
exactly as they count per key. Because hosted clients call the token and
registration endpoints from shared addresses, those endpoints get their own,
larger per-IP bucket.
- Deploy the release and run the normal migration step (
pnpm db:deploy). The migration20261106120000_mcp_oauthcreatesjwks,oauth_client,oauth_resource,oauth_client_resource,oauth_refresh_token,oauth_access_token,oauth_consent,oauth_client_assertion, andmcp_oauth_grant, adds the nullableoauthGrantIdcolumn tomcp_audit_eventandmcp_idempotency_record, and makesmcp_idempotency_record.apiKeyIdnullable. It does not touch existing rows. - Set
BETTER_AUTH_URLto the HTTPS dashboard origin and keepMCP_ENABLED=trueon the API service, then recreate the service. - Check the two
curlcommands above, then connect one client end to end.
Better Auth validates its tables on every authentication request while the MCP
plugins are loaded. Enabling MCP on an image that runs before this migration
breaks all sign-in, not only MCP; apply the migration first. To roll back,
disable MCP, deploy the previous image, and only then apply the migration's
rollback.sql as a reviewed forward migration. It removes OAuth replay rows,
restores the apiKeyId requirement, and drops the OAuth tables, which signs
every OAuth client out.
503 mcp:disabled: enable MCP on the API service and recreate it.400 mcp:invalid_request: correct malformed or ambiguous host/origin forwarding.401 auth:invalid_api_key: replace a malformed, expired, revoked, or null-expiry key, or a key whose owner was removed, suspended, or deleted.401 auth:invalid_token: the OAuth access token expired, was issued for another URL, or its connection was disconnected, or its person was removed or suspended. The client refreshes or signs in again.403witherror="insufficient_scope": the client requested too few scopes; reconnect it so that it asks formcp:connect.404from/.well-known/oauth-protected-resource/api/mcp: MCP is off, orBETTER_AUTH_URLis not HTTPS (or loopback); OAuth stays off in both cases.- "This connection request expired" in the browser: the signed request is older than 10 minutes; start connecting again from the client.
403 auth:insufficient_scopeormcp:scope_required: create or rotate the key withmcp:connectand the exact scope; the owner's current role must also allow it.auth:insufficient_role: the key owner's current role no longer allows the change.mcp:actor_required: the key has no live owner, so writes are impossible; the owner creates a new key.mcp:revision_conflict: re-read the page withget_page, merge, and retry with the new revision; the error data includescurrentRevision.mcp:preview_stale: something changed after the preview; runpreview_publishagain and re-review.mcp:preview_expired: the token is older than 10 minutes; preview again.mcp:preview_invalid: the token is not valid for this person and project; preview again.mcp:confirmation_required:publish_changeswas called withoutconfirm: true. Clients should send it only after the person they are helping has reviewed the preview.mcp:nothing_to_publish: there are no unpublished changes.mcp:publish_blocked: fix the blocking issue, such as redirect issues, in the dashboard, then preview again.mcp:publish_in_progress(409): a deployment is queued or building, so page writes andpublish_changeswait; nothing was saved. Retry afterget_deploymentreports it ready or failed.mcp:translation_exists:data.pageIdis the existing translation; edit it withupdate_page.mcp:idempotency_conflict: the sameclientRequestIdwas reused with different arguments; use a new ID.mcp:idempotency_in_progress: the first call with thisclientRequestIdis still running; retry.404resource error: confirm the URI uses the key's bound project and an in-project resource.429orhttp:rate_limited: honorRetry-Afterordata.retryAfterSeconds; inspect ingress limits and the request, write, and publish limits on the instance.503 storage:error: restore audit persistence before retrying; a call is not reported as successful without its audit event.
Correlate failures with the safe request ID. Never paste an Authorization header, raw MCP arguments/results, document content, or provider response into logs or a support ticket.
The current source registers list_ai_conversations, get_ai_conversation,
get_ai_feedback_summary, list_ai_content_gaps, and get_ai_usage under
analytics:read, for both keys and OAuth. This permission can include saved
redacted transcript text, not just aggregates. Grant it only to trusted clients.
Text exists only under the chat capture policy;
captureOffReason explains setting or instance. Engagement counts people;
get_ai_usage includes all billed model calls, so its totals can differ.
The HTTP body cap is 327680 bytes (320 KiB), allowing JSON escaping for a 128 KiB page or theme template plus its envelope. A request containing more than 16 JSON-RPC messages is rejected before per-call auditing. These transport limits are separate from write/publish quotas.