Authentication
How calls to the SQL Cockpit portal API are authenticated: portal API keys, OAuth for the hosted MCP server, scopes and rights.
The header
Guide
The credential goes in the authorization header as a bearer token: authorization: Bearer $SQL_COCKPIT_API_KEY.
Portal API keys
Guide
Create a key in the portal under Settings > Developer access, or through the hosted MCP server with the keys:write permission. It is shown once, works until you revoke it or it expires, and the SDKs and CLI read it from SQL_COCKPIT_API_KEY.
An assistant acting for you
Guide
Assistants connect to the hosted MCP server at https://mcp.sql-cockpit.com/mcp with the OAuth 2.1 authorization code flow and PKCE. Access tokens are bound to the MCP server; refresh tokens rotate.
Scopes
Guide
portal:read reads your account, usage, tenants, team, Agents, instances, tickets and API key names. team:write manages team members. support:write opens support tickets. keys:write creates expiring API keys and revokes them; only an OAuth sign-in that ticked it can hold it, never an API key.
Rights
Guide
A credential never holds more than you do: your role in each tenant still applies. Plans, billing and deleting anything other than a team membership stay in the portal.