Repository avatar
Other Tools
v0.1.1
active

odoo-preview-mcp

io.github.Sahajta-AI/odoo-preview-mcp

Work in Odoo as the signed-in user, with a preview and a signed approval before changes.

Documentation

odoo-preview-mcp

tests License: Apache-2.0 Sahajta-AI/odoo-preview-mcp MCP server

An MCP server that lets Claude, Codex or another AI assistant read and change your Odoo data as the signed-in person, with a preview and an approval before changes.

You ask Claude things like "show me open opportunities over 50,000 by stage", "create a quotation for Acme with 3 licences" or "match this bank line with the Northwind bill". Claude does the work in your real Odoo, inside that person's own Odoo permissions.

Safety guarantees

All company data lives in Odoo, so the server is built safety-first:

GuaranteeHow
Claude acts as the person, never through a shared admin keyEach person signs in with their own Odoo API key. Odoo's normal access rights and record rules apply to every call, and Odoo records every change under that person's name. Claude can do only what that person can do in Odoo, so give people normal user accounts, not admin accounts.
A human approves each changeEach change is previewed first: current value → new value, with the names behind ids. To apply it, Claude must send back a token signed for that exact preview. The token works once, expires after an hour by default (at most 24 hours), and stops working if the records changed after the preview. Change tools are also marked destructive, so MCP clients can ask before running them. Two exceptions: internal notes (nobody is e-mailed) have no preview or token and rely on that client prompt only, and MCP_REQUIRE_PREVIEW=false drops the token for creates, updates (removing lines too), buttons and dialogs (sending a quotation by e-mail too), file copies and removing followers. Keep that setting true. The delete tool, messages to followers, adding followers, bank matching, lock dates, bill fixes and custom fields always need the token.
Almost nothing can be deletedDeleting happens only through a few narrow paths, each checked with Odoo right before it runs: (1) the delete tool, for three kinds of records only: draft invoices and bills that never had a number, cancelled quotations, and archived leads, checked with Odoo before the approval and again just before deleting; (2) removing lines from quotations, RFQs and draft invoices; (3) removing a custom field added through Claude, with its place on the form. Undoing a bank match is refused when a payment is linked to the bank line, because Odoo would delete that payment. Every other delete is refused.
Field names are checked against live OdooEvery field name, choice value and record id is checked against the live Odoo database before anything is sent. Unknown names are refused with a "did you mean…?" hint, so a made-up field never reaches Odoo.
Read-only unless you switch it onThe default mode shows only tools that read. Change tools do not appear until you set MCP_ACCESS_MODE=read_write.
Workflows stay intactStatus fields (state) cannot be written directly. Claude can press only real Odoo buttons (Confirm, Validate, …). Cancel, reset, archive and e-mail buttons are off by default.
Secrets stay secretPasswords, API keys, tokens and system settings are never readable. In company mode, the Odoo keys the server stores are encrypted.
Audit trailThe server logs every call: who, which tool, model, record ids, field names and the outcome. It does not log field values or keys, but an error message in the log (up to 300 characters) can quote what was asked.

The full list of protections and the threat model are in docs/SECURITY.md.

How it compares

Two other open-source Odoo MCP servers are well known, and both have been public much longer than this one: erpipe-org/mcp-odoo and ivnvxd/mcp-server-odoo. Both are good choices. They make different trade-offs.

odoo-preview-mcperpipe-org/mcp-odooivnvxd/mcp-server-odoo
Whose Odoo account Claude usesCompany mode: each person signs in with their own key on one shared server. Local mode: your own key.The one login in the server's settings (per Odoo instance). Sign-in per person is part of their hosted product, ERPipe.The one login in the server's settings.
Setup inside OdooNone, only an API keyNoneFor production, the mcp_server module from the Odoo Apps store. Without it, a "YOLO mode" for testing.
Before a changePreview, then a token signed for that exact changePreview and validation, then an approval token, and writes must be switched onOdoo's permissions, plus the per-model permissions set in the Odoo module
DeletingOnly never-numbered drafts, cancelled quotations and archived leads, plus lines on drafts and custom fields it addedDeletes go through the same approval flow as other writesA delete tool, limited by the module's per-model delete permission
Odoo versionsTested on Odoo 19. Earlier versions ran on Odoo 18 and 20 but have not been re-tested.16 to 19, tested against real Odoo 16–19 in Docker16 and later with the module, any version in YOLO mode

What they do well. erpipe-org/mcp-odoo covers more Odoo versions, connects to several Odoo databases from one server, and has diagnostics, upgrade helpers and field-level allow and deny lists. ivnvxd/mcp-server-odoo lets the Odoo administrator choose, inside Odoo, which models the AI may read, change or delete, and it can limit a session to some companies in a multi-company database.

Where this project is different.

  • One server for the whole company, with each person's own sign-in. You deploy once. Each person connects from Claude and enters their own Odoo login and API key. Nobody shares a key. Only adding custom fields needs Odoo admin rights.
  • Changes are previewed and approved. By default Claude cannot apply a change without a preview first (internal notes aside), and the approval token works only for that exact change.
  • Deleting is limited in code to a few narrow cases, not only switched off by a setting.
  • Accounting work that goes past create and update: matching bank lines with bills and invoices (also in another currency and in part), Odoo's official reports (P&L, balance sheet, ledgers, ageing, tax report), moving the tax lock date, and correcting a posted vendor bill step by step.
  • Files and fields: a private upload page where the person sends files from their computer into Odoo, then one approval to put them on their records; and custom fields placed on a form with a "show only when" rule, with a preview and approval.

If you need many Odoo versions or databases from one server, or control from inside Odoo, look at the other two.

Quick start (local, about 5 minutes)

This runs the server on your own computer for one person, with your own Odoo key.

You need: Python 3.11 or later, uv, and an Odoo database where the external API is allowed. On Odoo Online, the external API needs the Custom plan.

  1. Create an Odoo API key. In Odoo: your profile picture → My Preferences → Security tab → Create API Key. If Odoo asks for a scope, choose RPC. Copy the key. (Details: docs/ODOO_SETUP.md.)

  2. Test the connection.

    ODOO_URL=https://mycompany.odoo.com ODOO_LOGIN=you@mycompany.com ODOO_API_KEY=your-key uvx odoo-preview-mcp check
    

    It prints your Odoo user, the Odoo version and the active safety settings.

  3. Add it to your AI app. Pick yours below. Then ask: "Who am I in Odoo?"

Use with Claude

For Claude Code:

claude mcp add odoo -e ODOO_URL=https://mycompany.odoo.com -e ODOO_LOGIN=you@mycompany.com -e ODOO_API_KEY=your-key -- uvx odoo-preview-mcp

For Claude Desktop, open Settings → Developer → Edit Config, add this, and restart Claude Desktop:

{
  "mcpServers": {
    "odoo": {
      "command": "uvx",
      "args": ["odoo-preview-mcp"],
      "env": {
        "ODOO_URL": "https://mycompany.odoo.com",
        "ODOO_LOGIN": "you@mycompany.com",
        "ODOO_API_KEY": "your-key"
      }
    }
  }
}

Use with Codex

The Codex CLI, the Codex IDE extension and the ChatGPT desktop app share one config file, ~/.codex/config.toml (OpenAI's MCP docs). Add:

[mcp_servers.odoo]
command = "uvx"
args = ["odoo-preview-mcp"]
startup_timeout_sec = 60                # the first start downloads the package
default_tools_approval_mode = "writes"  # Codex asks before any tool that is not read-only

[mcp_servers.odoo.env]
ODOO_URL = "https://mycompany.odoo.com"
ODOO_LOGIN = "you@mycompany.com"
ODOO_API_KEY = "your-key"

Or add it from the terminal:

codex mcp add odoo --env ODOO_URL=https://mycompany.odoo.com --env ODOO_LOGIN=you@mycompany.com --env ODOO_API_KEY=your-key -- uvx odoo-preview-mcp

Run codex mcp list to check it is there, and type /mcp inside Codex to see it connected. With default_tools_approval_mode = "writes", Codex asks you before each change tool, on top of this server's own preview and approval.

The server starts read-only. To let Claude make changes (with a preview and an approval), add MCP_ACCESS_MODE=read_write. If you use pipx instead of uv, run pipx install odoo-preview-mcp and use the command odoo-preview-mcp in place of uvx odoo-preview-mcp.

See it on Glama

The server is listed on Glama. There you can browse its tools, see its quality score, and try it online with the MCP Inspector before you install it.

For a whole company

Run the server once with HTTPS, and each person connects from Claude with their own Odoo login and API key:

  1. Prepare Odoo: docs/ODOO_SETUP.md.
  2. Deploy with Docker on any small server (docs/DEPLOY.md), or on Vercel with a Redis database (docs/DEPLOY_VERCEL.md).
  3. In Claude: Settings → Connectors → Add custom connector, with your server's URL followed by /mcp. Each person clicks Connect and signs in on the server's page.

What Claude can do

ToolWhat it doesMode
odoo_whoami, odoo_helpWho am I, what is allowed, and per area of Odoo what Claude can and cannot doalways
odoo_list_models, odoo_describe_modelFind the model for a concept ("invoice" → account.move) and its fieldsalways
odoo_search, odoo_read, odoo_count, odoo_findFind and read records, and turn a name into the right recordalways
odoo_aggregateTotals and breakdowns computed by Odoo (revenue by month, pipeline by stage)always
odoo_reportOdoo's official accounting reports for a period, with a link to open themalways
odoo_list_actionsThe buttons on a model's screens and whether Claude may press themalways
odoo_read_fileRead a file that is already in Odoo (a bill's PDF, a contract)always
odoo_bank_match_candidatesThe items Odoo's bank screen would offer for one bank linealways
odoo_preview_create → odoo_createCreate records (with order lines and so on)read_write
odoo_preview_update → odoo_updateChange field valuesread_write
odoo_preview_action → odoo_run_actionPress a workflow button (confirm an order, validate)read_write
odoo_preview_delete → odoo_deleteDelete a never-numbered draft invoice or bill, a cancelled quotation or an archived leadread_write
odoo_add_noteLog an internal note in the chatter (nobody is e-mailed). No preview or token: the client asks firstread_write
odoo_preview_followers → odoo_change_followersAdd or remove followersread_write
odoo_preview_bank_match → odoo_bank_match, odoo_preview_bank_unmatch → odoo_bank_unmatchMatch a bank line with bills or invoices, in any currency, and undo a matchread_write
odoo_preview_lock_date → odoo_lock_dateMove the tax return lock date forwardread_write
odoo_preview_fix_posted_bill → odoo_fix_posted_billCorrect a posted vendor bill step by stepread_write
odoo_upload_link → odoo_uploaded_filesA private one-hour page where the person uploads files (up to 4 MB each) into Odooread_write, company mode
odoo_preview_custom_field → odoo_add_custom_field, odoo_preview_place_field → odoo_place_field, odoo_preview_remove_custom_field → odoo_remove_custom_fieldAdd a custom field (named x_mcp_…), place it on a form, and remove both againread_write + MCP_ALLOW_CUSTOM_FIELDS
odoo_preview_message → odoo_send_messageMessage a record's followers (this e-mails customers)read_write + MCP_ALLOW_OUTBOUND_MESSAGES

The server uses Odoo's generic model API, so it works with the models of any installed app (CRM, Sales, Invoicing, Inventory, Purchase, Project, HR, Helpdesk, Studio models), always inside the person's permissions. Protected areas, such as security settings, credentials and system configuration, stay blocked.

Configuration

All settings are environment variables. .env.example explains each one. The main ones:

VariableDefaultMeaning
ODOO_URL(required)Your Odoo address, e.g. https://mycompany.odoo.com
ODOO_LOGIN, ODOO_API_KEY(empty)Your Odoo login and API key. Local mode only; in company mode each person signs in.
ODOO_DB(empty)Database name. Needed only with several databases or the legacy API.
ODOO_PROTOCOLautojson2 (Odoo 19+), jsonrpc (older Odoo), or auto to detect
MCP_ACCESS_MODEread_onlyread_write shows the change tools
MCP_REQUIRE_PREVIEWtrueKeep true. false drops the approval token for creates, updates (removing lines too), buttons and dialogs (sending a quotation by e-mail too), file copies and removing followers
MCP_ALLOW_ARCHIVEfalseAllow archiving and unarchiving
MCP_ALLOW_CANCEL_ACTIONSfalseAllow cancel, reset to draft and mark lost buttons
MCP_ALLOW_OUTBOUND_MESSAGESfalseAllow anything that e-mails or messages people
MCP_ALLOW_CUSTOM_FIELDSfalseAllow adding custom fields and placing them on forms (needs Odoo admin rights)
MCP_WRITABLE_MODELS(all business models)Allow changes only on these models, e.g. crm.lead,res.partner,project.task
MCP_BLOCKED_MODELS, MCP_READONLY_MODELS(none)Extra limits; patterns such as hr.* work
MCP_MAX_WRITE_RECORDS100Most records one create or edit may touch (hard limit 100)
MCP_MAX_ACTION_RECORDS20Most records one button, message or delete may touch (hard limit 100)
MCP_CONFIRM_TTL_SECONDS3600How long an approved preview stays usable (hard limit 24 hours)
MCP_DISPLAY_NAMEOdooName shown on the sign-in and upload pages and in Claude, e.g. Acme Odoo
MCP_ADMIN_CONTACTyour administratorWho people should ask when something is switched off
MCP_DEFAULT_TIMEZONEUTCTime zone used when a person's Odoo profile has none
MCP_PUBLIC_URL(empty)Company mode: the public HTTPS address of this server
MCP_SECRET(empty)Company mode: 32+ random characters; encrypts stored keys and signs tokens
MCP_ALLOWED_LOGINS, MCP_ALLOWED_LOGIN_DOMAINS(empty)Company mode: only these logins, or logins on these e-mail domains, may connect
MCP_REDIS_URL(empty)Company mode on serverless hosting: a Redis database for shared state

Contributing

Bug reports, ideas and pull requests are welcome. Please read CONTRIBUTING.md first. In short:

  • Open an issue before a large change, so we can agree on the approach.
  • Keep the safety guarantees above. A change that weakens one will not be merged.
  • Add tests. pytest runs the offline suite in under a minute, with no Odoo needed.
  • Never put real customer data, API keys or company names in code, tests or issues.

Please report security problems privately, as SECURITY.md explains, not in a public issue.

Development

git clone https://github.com/Sahajta-AI/odoo-preview-mcp && cd odoo-preview-mcp
uv venv && uv pip install -e ".[dev]"
.venv/bin/pytest                     # offline tests, no Odoo needed
.venv/bin/pytest -m integration      # against a throwaway Odoo, see tests/test_live_odoo.py

Tested on Odoo 19. Earlier versions ran on Odoo 18 and 20 but have not been re-tested. Built on the official MCP Python SDK.

License

Apache License 2.0. Copyright 2026 Sahajta AI Solution Private Limited. See LICENSE.

PYPI
odoo-preview-mcp
Install Command
pip install odoo-preview-mcp