# How to build an MCP server for Odoo

> Source: https://netray.co/integrations/odoo-mcp-server
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Integrations

## Short answer

An Odoo MCP server is a small service that turns a handful of Odoo operations into typed tools any MCP client can call. Authenticate with an Odoo API key, start with read-only tools for items, orders, stock and BOMs, and add audit logging before you add any writes.

## System

Odoo

## Capability

mcp-server

## Intro

The Model Context Protocol gives AI clients a standard way to discover and call tools. For Odoo, that means you write the integration once and use it from Claude, ChatGPT-style clients and internal agents rather than building a separate connector for each.

The quality of an MCP server is mostly tool design. A tool called search_read_any with a free-form domain is easy to write and dangerous to use. A tool called get_open_manufacturing_orders with a status filter is harder to misuse and easier for a model to pick.

This page covers the server itself: what to expose, how to authenticate, how to run it and how to keep it safe.

## Use Cases

### Item and BOM lookup

**Description:** Tools to find product.product by name or code and return the active mrp.bom with components and quantities.

### Order status across documents

**Description:** One tool that follows a sale order through manufacturing orders, pickings and invoices and returns the chain.

### Stock and availability

**Description:** A tool that reads stock.quant by product and location and reports free versus reserved quantity.

### Purchasing visibility

**Description:** List open purchase.order lines by vendor with promised and planned dates, for expediting conversations.

### Controlled drafting

**Description:** Later-phase tools that create a draft RFQ or post a chatter note, always as drafts for a human.

### Shared tool layer for agents

**Description:** Internal agents and chat clients call the same server so permissions and logging live in one place.

## System Surface

XML-RPC endpoints /xmlrpc/2/common (authenticate, version) and /xmlrpc/2/object (execute_kw), plus JSON-RPC at /jsonrpc. Newer releases may add a JSON-over-HTTP style API; verify on your version.

API keys created per user in the user preferences (recent versions), usable where the password would go, which avoids storing real passwords in the server.

ORM methods you will call most: search_read, read, read_group, name_search, fields_get. Use fields_get at startup to adapt to custom x_ fields and version differences.

Access rights (ir.model.access) and record rules (ir.rule) are enforced for the authenticated user, so per-user keys give per-user visibility.

Optional: server actions and webhooks in Odoo can notify the MCP layer of changes, though most MCP tools are request-response and do not need them.

## How It Works

### Pick an SDK and language

**Detail:** The official MCP SDKs for Python and TypeScript are common choices. Python pairs naturally with Odoo's own tooling and xmlrpc.client.

### Design the tool list

**Detail:** Start with 8 to 12 tools: find_product, get_bom, get_stock, get_order_chain, list_open_mos, list_late_po_lines, get_partner, get_invoice_status. Name them by intent.

### Implement the Odoo client

**Detail:** Authenticate once, cache the uid, call execute_kw with explicit field lists and limits. Never request all fields by default.

### Add input validation and output shaping

**Detail:** Validate types, cap limit, return compact JSON with record ids and display names so the model can cite them.

### Choose the transport

**Detail:** stdio suits a single user running a local client. HTTP with authentication suits a shared team server and lets you enforce per-user keys.

### Add auth mapping and audit

**Detail:** Map the caller to an Odoo API key, log tool name, arguments, record counts and timing to a store outside Odoo.

### Test with real clients

**Detail:** Try the same tools from Claude and another MCP client, and write regression tests for tool outputs on a staging database.

## Example Flows

### Stock check through a chat client

**Trigger:** A planner asks a client connected to the server: how much of part 10-4471 is free?

**Steps:**

- Client calls find_product with the code.
- Server resolves product.product and returns the id.
- Client calls get_stock with that id.
- Server reads stock.quant and returns on-hand, reserved and free by location.

**Result:** A sourced answer with locations, without opening Inventory.

### Draft RFQ with approval

**Trigger:** A buyer asks the client to prepare a quote request for a short component.

**Steps:**

- Client reads shortages with list_open_mos.
- It calls create_draft_rfq, which creates a purchase.order in draft state only.
- Server returns the draft record link.
- Buyer reviews and confirms in Odoo themselves.

**Result:** The write is limited to a draft the buyer owns.

## On Prem

An MCP server fits an on-prem Odoo well because it can run on the same internal network and reach Odoo over its internal URL. Pair it with a locally hosted open-weight model that supports tool calling, served by vLLM or Ollama, and an MCP-capable chat client inside your network. Nothing needs to leave your environment, including tool results and audit logs. For a mixed setup, expose the server only inside a VPN or private link if a cloud client must reach it, and consider limiting tool outputs to the minimum the question needs.

## Security

- Authenticate every caller and map them to their own Odoo API key where possible.
- Expose read-only tools first and keep write tools as separate, individually approved additions.
- Never expose arbitrary model names or domains to the client; hard-code which models each tool reads.
- Rate limit and cap result sizes to protect the Odoo instance.
- Log tool calls and review them, and rotate API keys on a schedule.

## Options

### Use an open-source Odoo MCP project

**Fit:** Evaluation and prototypes on a test database.

**Effort:** Hours to install; a code and permissions review before real data.

### Build a custom server

**Fit:** You need curated tools, per-user auth and logging that match your processes.

**Effort:** One to three weeks for a first production read-only set.

### Netray with an Odoo partner

**Fit:** You want the server plus private model hosting and tool design based on your workflows.

**Effort:** A scoped project, typically starting with a pilot of a handful of tools.

## Pitfalls

- A single generic search tool that lets the model query any model and any field.
- Hard-coding field names that differ between Odoo versions or custom databases; use fields_get to check.
- Running the server with an administrator key to avoid permission errors.
- Returning unbounded lists that exhaust the client's context window.
- Not testing multi-company, where record rules quietly filter results.

## Faq

### What is an MCP server for Odoo?

**Answer:** It is a service that wraps Odoo's external API as tools in the Model Context Protocol. An MCP client such as a Claude app or an internal agent can discover and call those tools, so you write the Odoo integration once.

### Does Odoo include an MCP server?

**Answer:** I would not assume so. Check your version and the Odoo app store. In practice teams build a small server over the external API or review an open-source one.

### stdio or HTTP?

**Answer:** Use stdio for a single user running a local client. Use HTTP with authentication for shared team use, because you can enforce per-user identity, central logging and updates in one place.

### Can the server write to Odoo?

**Answer:** It can, but keep it read-only at first. When adding writes, prefer draft creation, chatter notes and activities, each as its own tool with clear naming and logging.

### Does it work with Odoo Online?

**Answer:** Only if your plan allows external API access, which has varied. Confirm with Odoo. Self-hosted and Odoo.sh generally allow it with API keys, subject to your configuration.

## Search terms

odoo mcp server, model context protocol odoo, odoo mcp claude, build mcp server for odoo, odoo mcp chatgpt, odoo mcp xmlrpc, odoo mcp on premise, odoo ai tools api, odoo mcp integration

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
