Skip to main content
An AI agent with access to your analytics is a trust decision. This page states what Grain does with the credentials that an MCP client holds, and how you stay in control.

Credential paths

The MCP endpoint accepts three kinds of credentials, in this priority order. Most users use only the first one. Grain 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 → Connectors → MCP clients. For each connection the page shows:

Revoke a connection

  1. Open Settings → Connectors → MCP clients.
  2. Click Revoke on the connection.
  3. Confirm in the dialog. Grain sets the revoked_at timestamp of the session at once.
The next tool call of the client returns 401 with a WWW-Authenticate header. A compliant client then asks you to authorize again or marks the server as disconnected.
Revocation is instant on the Grain side, but some clients cache the tool list in memory. If a revoked client still shows tools, restart the client. Every tool call fails after revocation.

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. Grain 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 a workspace argument. 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

  1. Connect a test tenant first. Send a low-volume or staging site to Grain, connect the AI client to that tenant, and read a few sessions. Move to production after that.
  2. Grant the minimum scope that works. If the agent only writes briefings, mcp:read and mcp:query are enough. Add mcp:investigate when the agent needs it.
  3. 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.
  4. Rotate the tenant API key every year. This applies only to the X-API-Key path. OAuth sessions rotate on refresh.