← Back to Blog
Engineering by Featured

Odoo 19 as Its Own OAuth Server: Connecting Claude and ChatGPT with the MCP Server Module

Odoo 19 as Its Own OAuth Server: Connecting Claude and ChatGPT with the MCP Server Module

Summary

In April, every MCPAn open protocol developed by Anthropic that standardizes how AI models connect to external tools, data sources, and services. MCP allows LLMs to call tools (file systems, APIs, databases) in a… option for Odoo made you paste a tokenThe basic unit of text processed by an LLM. A token is roughly 4 characters or 0.75 words in English. LLMs process and generate text as sequences of tokens. Tokenization varies by model and language. into a config file. The MCPAn open protocol developed by Anthropic that standardizes how AI models connect to external tools, data sources, and services. MCP allows LLMs to call tools (file systems, APIs, databases) in a… Server module for Odoo 19 turns Odoo itself into the OAuth server, so you connect Claude or ChatGPT by logging in. I installed it on Odoo.sh, connected both assistants and wrapped a few sales actions in custom tools.

Connecting AI Agents to Odoo with MCP, Seven Months Later looked at where MCP for Odoo stands now. In April, none of the options had OAuth sign-in. To connect anything, someone had to generate a token in Odoo and paste it into a config file, where it sat forever with nobody’s name on it.

One of the newer modules in that update is the MCP Server1 module by much. Consulting, and it handles the gap the simplest way I can think of: Odoo itself becomes the OAuth 2.1 server. You paste one URL into Claude or ChatGPT, the Odoo login page opens, you approve a consent screen, and the assistant works as you, with your access rights. Nobody copies a key anywhere.

I installed it on an Odoo 19 database on Odoo.sh, connected Claude and ChatGPT to it, and built a few custom tools on top of CRM, Sales and Invoicing. This is what I did and what I would tell a colleague before they try it.

Everything here is Odoo 19. Odoo 20 ships its own MCP server with OAuth built in, which the update post covers.

What the module adds

The module serves MCP at POST /mcp from inside Odoo, so there is no extra process or container to run.1 Here is what you get, as far as I tested it:

Tools 17 built in: search, read, create, update, delete, batch create and update, read_group-style aggregation, field introspection, attachments, chatter posts, calls to business methods
Custom tools An admin turns a Python server action into a named tool, such as confirm_quotation
Login An OAuth 2.1 server with dynamic client registration and PKCE for browser clients, plus per-user API keys (with an “MCP only” scope) for local tools
Who can connect Only users in the MCP User group
What they can touch A Read / Create / Write / Delete switch per model, with Odoo’s own ACLs and record rules on top
Read-only sessions At consent, unticking “Allow creating and modifying data” gives a session that cannot even see the write tools
Tracking An audit log of every call, rate limiting, and one-click revocation of OAuth clients and tokens
License OPL-1, bought through the Odoo Apps store, Odoo 19 only

The login row is the one that changes things compared with April. A pasted token never expires and carries no person. Here, each OAuth session belongs to whoever logged in. The access token lives one hour and gets renewed through a refresh token that rotates, and an admin can cut a client off from Odoo in one click.

Where the assistant runs

This decides whether your setup can work at all, so it is worth checking first.

Client Runs on Reaches localhost? Logs in with
Claude Code, Cursor, VS Code, MCP Inspector your machine yes API key or OAuth
Claude.ai, Claude Desktop connectors, ChatGPT the vendor’s servers no OAuth

Claude.ai and ChatGPT call your Odoo from their own infrastructure, so Odoo needs a public HTTPS address. Odoo.sh gives you one, which is why I tested there. If you want to start on your laptop instead, a later section covers the tunnel.

Installing on Odoo.sh

I pushed the module to a GitHub repository linked to an Odoo.sh project. The module needs three Python packages (authlib, defusedxml, packaging) and lists them in a requirements.txt inside its own folder. Odoo.sh does not read that file. It installs the requirements.txt at the branch root and looks for others in the parent folder of each module.2 So I added one at the root of the repository:

authlib>=1.6.12,<1.7.0
defusedxml
packaging

The authlib cap comes from the module’s README: 1.7 pulls a newer cryptography that clashes with the system packages on Odoo.sh images.

A note on the build status. My first builds came back red, then yellow, even though all 557 tests passed. None of it was a bug in what the module does. Some tests send bad credentials or fake a failure on purpose, and the code logs the handled error, which Odoo.sh counts against the build. A couple of calls also use APIs that Odoo 19 deprecated. If you see the same, read the log before you panic.

One more Odoo.sh detail: a development branch gets a new database and a new URL on every build, and the database only lives a day or two. Your connectors go with it. For anything longer than an afternoon of testing, use a staging or production branch.

Configuring Odoo

Three steps, in this order.

  1. In Settings > MCP Server, turn on Enable MCP Server and leave Allow OAuth 2.1 login on.
  2. In Settings > Technical > MCP > MCP Available Models, add each model the assistant may see and set its Read / Create / Write / Delete switches. I would start with read only and leave Delete off on business models.
  3. Put the user in the MCP User group. Without it, even a correct login gets a 403.

For my tests I opened res.partner, crm.lead, sale.order, sale.order.line, hr.employee and calendar.event for read, create and write. I kept account.move (invoices) read only on purpose, to check that the assistant gets refused when it tries to create one.

Small trap in the model picker: type “link tracker” and two models come up. link.tracker is the Link Tracker app. sms.tracker is an internal SMS model whose display name also starts with “Link”.

Connecting Claude

The module’s authors made this two-minute walkthrough.3 In Claude.ai it goes like this:

  1. Go to Settings > Connectors > Add custom connector.
  2. Give it a name and paste your Odoo URL with /mcp at the end, for example https://your-db.odoo.com/mcp.
  3. Claude probes the server and picks the options itself. Keep what it detects: Sign in now for authentication, Register automatically for the OAuth client, and no extra headers.
Claude's Add custom connector dialog with 'Sign in now' and 'Register automatically' detected for an Odoo MCP server

“Register automatically” means Claude registers itself as an OAuth client in Odoo (dynamic client registration). I would not pick “Use Claude’s published identity”, because the module does not support that method.

  1. Click Connect, log in to Odoo in the window that opens, and approve the consent screen.
  2. In a chat, turn the connector on from the tools menu.

The connector then shows up in Claude Desktop and the mobile apps as well. After I added mine, it even appeared in Claude Code on the same account, with my five custom tools listed next to the built-in ones.

Claude Code can also skip OAuth and use an API key, since it runs on your machine. Create the key under My Profile > Account Security > New API Key, pick “MCP only”, then:

claude mcp add --transport http odoo https://your-db.odoo.com/mcp \
  --header "Authorization: Bearer YOUR_API_KEY"

Connecting ChatGPT

This video from Atharva System shows the ChatGPT side, which is creating a custom plugin that points at an MCP server.4 On the Odoo side nothing changes: same module, same /mcp URL as for Claude.

ChatGPT’s settings move around a lot. Many guides still tell you to switch on Developer Mode under “Apps & Connectors”. In the version I used, connectors are called plugins and you add your own from the plugin directory:5

  1. Open Settings > Plugins and click Browse directory.
  2. Click Add, then Add custom MCP server.
  3. Fill in the form:
    • Name, for example “Odoo AI Demo”. The icon and description are optional.
    • Connection: keep Server URL and paste the /mcp URL.
    • Authentication: OAuth. You can leave Advanced OAuth settings alone, because ChatGPT registers itself with Odoo the same way Claude does, so you need no client ID or secret.
    • Tick “I understand and want to continue”.
ChatGPT's Add custom MCP server form with name, server URL connection and OAuth authentication
  1. Click Create as a plugin, log in to Odoo and approve.
  2. ChatGPT lists the tools it found. Pick the plugin in a new chat and ask away. Before anything that writes, ChatGPT asks you to confirm.

If you cannot find the Add button, look at which account you are in. In a Business or Enterprise workspace, custom MCP servers follow the workspace policy, and an admin may have to allow them first.

You do not need anything extra on the Odoo side. ChatGPT wants PKCE with S256, and it uses its stable redirect URI when the server sends back the iss parameter at the end of login (RFC 9207).6 The module does both.

Custom tools: verbs, not tables

Generic create and write are fine for “add this contact”. For real business actions I prefer custom tools. You write a Python server action, the module publishes it as a tool, hands it the arguments in mcp['args'] and returns whatever you put in mcp['result']. The action runs as the calling user, and only users in the action’s Allowed Groups ever see the tool.

This is pipeline_summary, the simplest one from my test:

# Settings > Technical > Server Actions > New
# Model: Lead · Type: Execute Code · Allowed Groups: Sales / User: Own Documents Only
leads = env['crm.lead'].search([('type', '=', 'opportunity')])
stages = {}
for lead in leads:
    s = stages.setdefault(lead.stage_id.name or 'No stage', {'count': 0, 'expected_revenue': 0.0})
    s['count'] += 1
    s['expected_revenue'] += lead.expected_revenue
mcp['result'] = {'total': len(leads), 'currency': env.company.currency_id.name, 'by_stage': stages}

Then under Settings > Technical > MCP > Custom Tools I created a tool named pipeline_summary, linked it to that action, ticked Read-only and gave it the schema {"type": "object", "properties": {}}. The description field matters more than it looks, because it is what the model reads to decide when to call the tool. Say plainly what the tool returns.

I built five of these and ran each one on an Odoo 19 database with demo data:

Tool What it does Read-only Allowed group
pipeline_summary opportunities and expected revenue per stage yes Sales / User: Own Documents Only
customer_360 one customer across CRM, Sales, Invoicing and Calendar in a single call yes Sales / User: Own Documents Only
overdue_invoices posted customer invoices past their due date, with days late yes Accounting / Invoicing
mark_lead_won moves one opportunity to Won no Sales / User: Own Documents Only
confirm_quotation confirms a draft quotation and refuses one already confirmed no Sales / User: Own Documents Only

Two things I only learned by running them. A user with just the sales group saw four tools, not five: overdue_invoices was hidden from the list, not merely refused when called. And overdue_invoices first returned the same invoice number twice. I thought it was a bug in my code until I checked: two companies, same numbering sequence, two different invoices. The tool now returns the company as well.

Review a custom tool before you switch it on. The per-model switches do not apply to it, so a tool can write to a model whose Write switch is off. The caller’s own Odoo access rights still do.

Prompts worth trying

Once connected, these cover most of what the module does in a few minutes:

  • “Who am I and which company am I in?” The assistant gets the user, timezone and allowed companies from get_current_context.
  • “Summarize the pipeline and chart expected revenue by stage.”
  • “Create a lead for Saigon Coffee Co, 20 office desks, 15,000 USD expected.” Then “Make them a quotation with 20 Office Chairs and 10 Large Desks”, and “Confirm it”.
  • “Give me the full picture for Gemini Furniture.”
  • “Which invoices are overdue? Draft a polite reminder for each customer.”
  • “Read the PDF attached to this contact and summarize the payment terms.” This goes through read_attachment, which needs the standard attachment_indexation module to extract PDF text.

Then try to break it:

  • “Delete the customer Gemini Furniture.” It gets refused, since no model has Delete on.
  • “Create an invoice for S00003.” Also refused, since account.move is read only.
  • Reconnect and untick “Allow creating and modifying data” at consent. Only the read tools are left.
  • Open Settings > Technical > MCP > MCP Logs and read back every call the assistant made.

Here are two answers from my test database. I asked Claude to count the employees and to create one named Xaviê if it did not exist. It searched first, found the record, and did not create a duplicate:

Claude answering that there are 22 active employees and that the employee Xaviê already exists, so no record was created

ChatGPT got “which employee had the most orders last month?”. It grouped confirmed sales orders by salesperson with the aggregation tool, left out quotations and cancelled orders, and said so in the answer:

ChatGPT ranking salespeople by confirmed sales orders in October 2026, with Marc Demo first at 4 orders out of 5

Both answers say what was counted. That is the part I check before I trust a number.

Trying it on a local Odoo first

Claude Code talks to a local Odoo over plain HTTP with an API key, no problem. Claude.ai and ChatGPT need HTTPS, so you need a tunnel, and I hit two snags.

OAuth over plain HTTP only works on loopback. Authlib accepts http:// for 127.0.0.1 and localhost and nothing else. My dev server listened on 127.0.19.1, so OAuth was refused while API keys kept working.

--proxy-mode alone did not fix the URLs. Behind a tunnel, Odoo has to trust the X-Forwarded-* headers or it builds http:// OAuth URLs that the assistants reject. Odoo 19 only applies that fix when the request carries X-Forwarded-Host.7 A Cloudflare quick tunnel sends X-Forwarded-Proto but not X-Forwarded-Host, so the discovery document came back with the right host and the wrong scheme.

What fixed it was setting the missing header between the tunnel and Odoo. We have an frp server at the office, and frp can add request headers per proxy:

[odoo19-mcp]
type = http
local_ip = 127.0.19.1
local_port = 8069
subdomain = yourname-mcp
header_X-Forwarded-Host = yourname-mcp.frp.example.com
header_X-Forwarded-Proto = https

A small reverse proxy such as Caddy in front of Odoo would do the same. Before adding a connector, open https://<host>/.well-known/oauth-authorization-server and check that every URL in it starts with https://.

Where this leaves us

On Odoo 19, this is the setup I would recommend today. It is the first one we tried where a business user connects Claude or ChatGPT by logging in, and no one has to generate or pass around a token. Odoo keeps control of access through the MCP User group, the per-model switches, read-only consent, custom tools limited to the groups you choose, and an audit log you can actually read.

It costs an OPL-1 license, a public HTTPS address for the browser clients, and an hour or two of setup. If something does not work, check the requirements.txt at the repository root and the X-Forwarded-Host header first.

Ready to put AI to work?

Let's explore how Trobz AI can automate your processes, enhance your ERP, and help your team make better decisions — faster.