CodeCobra’s agent can talk to your real Odoo databases through the MCP (Model Context Protocol) bridge. Adding an environment lets the agent read records, run searches, and — if you opt in — write changes in your live Odoo instance instead of only the disposable onboard pod. This guide walks you through every step. No prior MCP knowledge needed.Documentation Index
Fetch the complete documentation index at: https://docs.codecobra.ai/llms.txt
Use this file to discover all available pages before exploring further.
You can add an Odoo environment in two places:
- During project creation, in the Odoo step of the setup wizard.
- Anytime later, in Project → Settings → Odoo Environments.
Before you start
You’ll need three things:- The base URL of your Odoo instance — the same address you’d type into a browser, e.g.
https://acme.odoo.comorhttps://erp.example.com. - An Odoo user that the agent will log in as. We strongly recommend creating a dedicated user instead of reusing your admin account — see Create a dedicated user below.
- An API key for that user (or, on legacy Odoo, the user’s password).
Create a dedicated Odoo user
Skip this if you already have a user you want the agent to act as.Open Odoo's user list
In your Odoo instance, go to Settings → Users & Companies → Users and click New.
Fill in the basics
- Name:
CodeCobra Agent(or whatever you want to see in audit logs) - Email / login: a unique address, e.g.
codecobra@yourcompany.com - User type: Internal User
Grant the right access rights
Under the Access Rights tab, give the user only the modules and
record-rule groups the agent should be able to touch. If you only
want read access, do not grant any manager roles.For a first try, copy the access rights from a normal employee
account — that’s usually enough for the agent to explore data
without being able to break anything sensitive.
Generate an API key
Odoo 14+ supports per-user API keys, which are safer than passwords.Open the user's preferences
Click the user’s avatar in the top-right corner of Odoo (while logged in as that user) and choose My Profile (or Preferences).
Open the Account Security tab
Find the Account Security tab. You’ll see a section labelled Developer API Keys.
Create a new key
Click New API Key. Give it a name like
CodeCobra and a sensible expiration (e.g. 1 year).Odoo will ask you to re-enter the password to confirm.Find the database name
Most users only have one database, in which case CodeCobra will detect it automatically. Some self-hosted setups host multiple databases on a single Odoo instance — here’s how to be sure:- Odoo Online (
*.odoo.com): the database name is the subdomain.acme.odoo.com→acme. - Self-hosted: open
/web/database/manageron your Odoo instance (e.g.https://erp.example.com/web/database/manager). Each row is a database; the column on the left is the name. - Already logged in? In Odoo, open Settings → Technical → Database Structure → Database (or look at the Sentry / Grafana setup your team uses).
list_db = False in odoo.conf (a common production setting). It’s not a bug — type the name in by hand.
Add the environment in CodeCobra
Open the form
- From the project setup wizard: on the Odoo step, click Add Odoo environment.
- From an existing project: open Settings → Odoo Environments, then click Add Odoo environment.
Fill in the connection fields
- Name — a label you’ll see in the chat composer. Use names like
Production,Staging,Demoso it’s obvious what you’re pointing the agent at. - Tier — see Read vs Yolo below. Default to Read if you’re not sure.
- Base URL — paste the URL exactly as you’d open it in a browser. CodeCobra will auto-add
https://if you forget the scheme. A green checkmark next to the field confirms the URL responds to Odoo’s XML-RPC endpoint. - Database — pick from the dropdown. If only one database exists on the server, it’s selected automatically.
- Login — the email / login of the Odoo user you created above.
- Auth method — leave as API key unless you’re on Odoo ≤13.
- API key — paste the key you copied in the previous section.
Test the connection
Click Test connection before saving. CodeCobra will:
- Reach the
/xmlrpc/2/commonendpoint. - Authenticate with your login + key against the chosen database.
- Return the Odoo version it found.
unreachable, auth_failed, etc. — see Troubleshooting.Read vs Yolo
Each environment has a tier that decides which MCP tools the agent can call against it.| Tier | What the agent can do | When to use it |
|---|---|---|
| Read | search_read, read, fields_get, reports — read-only | Production. Always. |
| Yolo | Everything in Read plus create, write, unlink | Staging / sandbox / dev databases you can roll back. |
Use an environment in a chat
Once an environment is saved, every chat in that project gets an Odoo selector in the composer:- Click the database icon in the message bar.
- Tick the environments the agent should have access to in this conversation. You can pick more than one.
- The Onboard pod option always stays available — it’s the disposable Odoo that ships with every chat.
- Type your message. The agent will see the selected environments and can call MCP tools against them.
Troubleshooting
`unreachable` — host or TLS error
`unreachable` — host or TLS error
The XML-RPC endpoint never responded. Common causes:
- Wrong URL — make sure you can open the same URL in a browser and see the Odoo login page.
- VPN / firewall — the CodeCobra backend must be able to reach your Odoo instance from the public internet. Self-hosted instances behind a corporate VPN won’t work without a tunnel.
- Self-signed certificate — CodeCobra refuses unverified TLS. Use a real certificate (Let’s Encrypt is free).
`auth_failed` — login or key rejected
`auth_failed` — login or key rejected
The server replied but Odoo refused the login. Check:
- Did you copy the API key without trailing whitespace?
- Is the login field the user’s email/login (not the display name)?
- Did you pick the right database?
- Is the user Active in Odoo (not archived)?
`Database` dropdown is empty or greyed out
`Database` dropdown is empty or greyed out
Your Odoo instance has
list_db = False in odoo.conf (a common
production setting). It’s not a bug — type the database name in by
hand. See Find the database name above.Test passes, but the agent can't see records
Test passes, but the agent can't see records
Tier (Read / Yolo) only controls the kinds of operations the
agent will attempt. Visibility of specific records is controlled by
the linked Odoo user’s groups and record rules. Open Odoo as that
user and confirm you can see what you expect to see — if you can’t
see it as that user, the agent won’t either.
`XML-RPC fault` with a long Odoo message
`XML-RPC fault` with a long Odoo message
These come straight from Odoo. Read the message carefully — most
are self-explanatory (e.g. “Access Denied”, “Database does not
exist”). If you can’t make sense of it, copy the full text and
contact support.
Edit, test, or delete an environment
In Project → Settings → Odoo Environments:- The Test button on each row re-runs authentication against the live server. Useful when an API key has been rotated.
- Edit lets you change everything except the secret. Leave the API key field blank to keep the existing one — only fill it in to rotate.
- Delete removes the environment. Any chat that had it selected will lose access on the next message.
Security notes
- Secrets are encrypted with Fernet using a per-deployment key (
ODOO_ENCRYPTION_KEY). Plaintext keys never appear in logs or API responses — every response showshas_secret: trueinstead of the key itself. - Each environment is scoped to a single project. Members of other projects in the same organization cannot see or use it.
- Restricting the agent’s footprint inside Odoo is your responsibility via Odoo groups, record rules, and a dedicated user. Tier is a coarse on/off for write actions, not a security boundary.
Next steps
Create a task
Use your new Odoo environment in a real chat.
Explore Odoo
Watch the agent introspect your live data.