Security & Access

Authentication and Scoped API Keys

Choose OAuth, OAuth plus API keys, bearer token, or no authentication and manage secure user-bound keys through their full lifecycle.

Authentication identifies the Odoo user and limits the allowed operation scopes. It is the first layer; Odoo and MCP access controls still decide which models, records, and fields are available.

Warning: Never use No Authentication on the public internet No Authentication is suitable only for isolated development environments with external network controls.

Warning: API keys are displayed once Copy the complete niyu_mcp_... value when it is generated. Odoo stores only a SHA-256 hash and cannot display the secret later.

Authentication modes

ModeBest useExecution identity
OAuth 2.1 / PKCEChatGPT, Claude, Cursor, and interactive remote clientsThe Odoo user who signs in and approves the connection
OAuth + Scoped API KeysInteractive users plus automations, developer tools, or clients using Authorization headersOAuth user or the user assigned to each API key
Bearer TokenLegacy or controlled service-account integrationOne configured fallback user
No AuthenticationIsolated development onlyOne configured fallback user

OAuth flow

  1. The client discovers the protected resource and OAuth authorization server from the public Odoo origin.
  2. The client dynamically registers when supported.
  3. The browser opens the Odoo login and consent flow.
  4. The user signs in with their own Odoo account and approves scopes.
  5. Odoo issues a short-lived access token and a rotating refresh token bound to the /mcp resource.
  6. The connection appears under MCP Server > Connections.

Generate a scoped API key

  1. Set Authentication to OAuth + Scoped API Keys and save.
  2. Open MCP Server > Generate API Key.
  3. Choose a descriptive key name, client application, and active internal execution user.
  4. Select only required scopes: Read, Update, Create, and Delete.
  5. Optionally set expiry, requests per minute, allowed IPs or CIDR networks, denied networks, and notes.
  6. Generate the key and copy it immediately into the client secret store.

Use an API key

Authorization: Bearer niyu_mcp_your_generated_secret

The key does not bypass the assigned Odoo user, access bundles, fields, forced domains, limits, or tool controls.

Rotate or revoke a key

  • Rotate: open MCP Server > API Keys, open the key, and choose Rotate. The default old-key grace period is seven days and can be changed or set to zero.
  • Revoke: revoke the key for immediate authentication failure and connection revocation.
  • Monitor: review last use, source IP, usage count, expiry, status, and rotation version.