Credential paths
The MCP endpoint accepts three kinds of credentials, in this priority order. Most users use only the first one.
GrainQL issues the OAuth tokens from its own OAuth 2.1 server after you click Authorize in the
browser. Read Authentication for the API key.
Scopes
Scopes are the control plane. A client names the scopes it needs when it asks to authorize. You can approve fewer scopes than the client asks for. The consent screen describes each scope in plain English.
If an agent only writes weekly digests, approve
mcp:read and mcp:query and leave
mcp:investigate off. You can connect again later and grant more. Read
Tools for the inputs of each tool.
There is no write scope. No MCP tool creates, updates, or deletes anything: not a segment, not a
track, not a user. You can grant all three scopes to a trusted client without a risk of a change.
Token storage
Connections
Every active MCP client is listed at Settings, MCP clients. For each connection the page shows:Revoke a connection
- Open Settings, MCP clients.
- Click Revoke on the connection.
- Confirm in the dialog. GrainQL sets the
revoked_attimestamp of the session at once.
401 with a WWW-Authenticate header. A compliant
client then asks you to authorize again or marks the server as disconnected.
Workspace isolation
At consent you choose All workspaces in my account or Select workspaces.- All workspaces in my account: each tool call names the workspace it reads. GrainQL checks your membership of that workspace on every call, so the connection covers workspaces that you join later and loses a workspace as soon as you leave it.
- Select workspaces: the session covers only the workspaces that you tick. A tool call for
any other workspace fails with
403. If you tick one workspace, tools use it without aworkspaceargument. To change the list, connect again. - Every tool call checks membership again. A user who is removed from a tenant loses MCP access to it on the next tool call of the client.
Logging
A plaintext token never appears in a log. If you see one, it is a bug.
Checklist for teams
- Connect a test tenant first. Send a low-volume or staging site to GrainQL, connect the AI client to that tenant, and read a few sessions. Move to production after that.
- Grant the minimum scope that works. If the agent only writes briefings,
mcp:readandmcp:queryare enough. Addmcp:investigatewhen the agent needs it. - Read the MCP clients page every week, and after a team member leaves. Revoke every connection whose “Last used” is “never” or older than your tolerance.
- Rotate the tenant API key every year. This applies only to the
X-API-Keypath. OAuth sessions rotate on refresh.