Authentication
How agents authenticate to HeyBrain MCP: workspace keys sent as a bearer token, or MCP authorization (OAuth 2.1 with PKCE) in the browser.
Every request to the HeyBrain MCP server must carry a credential. A credential always belongs to one person in one workspace, so an agent can never see more than the person who connected it.
Workspace keys#
Generate a key on the HeyBrain MCP page and send it as a bearer token:
POST /mcp HTTP/1.1
Host: mcp.heybrain.io
Authorization: Bearer REPLACE_WITH_YOUR_KEY| Property | Value |
|---|---|
| Format | Starts with ak_live_. HeyBrain stores only a hash; the full key is shown once, when it is created or rotated. |
| Scope | The workspace it was created in, acting as the member who created it. |
| Lifetime | 90 days from creation. An expired key is refused and shows as Key expired in the dashboard. |
| Name | Required, up to 120 characters. The dashboard suggests “Tool · OS”. |
| Last used | Updated on every authenticated request. The dashboard shows Connected when the key was used in the last 7 days. |
Rotate and revoke#
- Rotate in Settings → API to get a new key with the same name and tool. The old key stops working at the same moment. Update the tool with the dashboard’s Update your key command.
- Revoke to disconnect a tool. Its tool calls are refused straight away, and the MCP connection itself is refused within 60 seconds. If the tool is running, quit and reopen it.
- A key also stops working when the member who created it is removed or deactivated, or the workspace is closed.
Browser sign-in (MCP authorization)#
Clients that implement the MCP authorization spec can connect with the URL alone. The flow is standard OAuth 2.1 for public clients:
Discover
An unauthenticated request returns
401with aWWW-Authenticateheader. Itsresource_metadataparameter points to the protected-resource metadata (RFC 9728), which names the authorization server. That server publishes its metadata at/.well-known/oauth-authorization-server(RFC 8414).Register
Clients register dynamically (RFC 7591) or identify themselves with a client ID metadata document. No client secret is used.
Authorize
The authorization code flow with PKCE (
S256). The person signs in to HeyBrain, chooses a workspace, reviews the access requested and approves.Call the server
Send the access token as
Authorization: Bearer …. Access tokens last one hour. Refresh tokens last 30 days and rotate on each use; reusing an old refresh token revokes the whole connection.
| Metadata | Value |
|---|---|
| Grant types | authorization_code, refresh_token |
| PKCE | S256 (required) |
| Client authentication | none (public clients) |
| Scopes | brain.read, brain.write |
| Bearer methods | header only |
curl -i -X POST https://mcp.heybrain.io/mcp -H "Content-Type: application/json" -d '{}'Browser connections appear in Settings → API, where you can disconnect them, and count toward your plan’s agent limit as the platform “browser sign-in”.
What a credential can reach#
- Only knowledge the connecting person can open in that workspace. Source permissions and governance rules apply to every call.
- Never another workspace. Use a separate key or connection for each workspace.
- Every tool call is recorded with the identity behind it. See Security and privacy.
Warning: Treat a key like a password. Don’t paste it into chats, tickets or shared documents, and revoke it as soon as you think it has leaked.
Last checked against the product on November 25, 2026.