
Odoo Mcp Gateway
io.github.parth-unjiyaPublished by GitHub account parth-unjiyav0.1.1Updated Oct 24, 2026
Security-first MCP gateway for Odoo 17/18/19 — YAML-driven security, 27 tools
Overview
A local MCP gateway that lets an assistant log in to an Odoo 17/18/19 ERP and search, create, update or delete records under layered security rules.
- What you can do
- Authenticate to Odoo with an API key, password or existing session, and list accessible models and their fields with metadata and filters. Search, read, count and aggregate records with domain filters, ordering and temporal grouping. Create, update and delete records, with dry-run validation, plus preview Odoo defaults and onchange side effects. Call allowed model methods and look up required fields or available workflow actions before writing. Use bundled HR, Sales, Project and Helpdesk plugin tools, such as attendance, leave requests, quotations, tasks and tickets.
- When to use it
- Useful when an assistant should work directly with an Odoo ERP instance — exploring models, querying business data, or creating and updating records — while keeping access restricted through YAML rules, RBAC, rate limits and audit logging. It suits stock or custom Odoo modules without writing an Odoo-side addon.
- Requirements
- Runs locally as a Python package installed with pip, started as a module. Needs a reachable Odoo 17, 18 or 19 server and the ODOO_URL and ODOO_DB environment variables; Odoo credentials are supplied through the login tool. Optional YAML config files control restrictions, model access and RBAC. Network access to the Odoo instance is required.
Installation
In SourceWeft
- Open Odoo Mcp Gateway in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
odoo-mcp-gateway
Security-first, version-agnostic MCP gateway for Odoo 17/18/19. Works with stock and custom modules via YAML configuration. Zero Odoo-side code required.
[Python 3.10+] [License: MIT] [Odoo] [Tests] [Coverage]
30-Second Quick Start
Add to Claude Desktop config (claude_desktop_config.json):
Restart Claude Desktop. In any conversation:
You're connected. Ask Claude to query, create, or update Odoo records — every call is rate-limited, audit-logged, and runs through two layers of security checks before reaching Odoo.
No Odoo addon required. No Python code to write. Just YAML config for fine-grained access control (optional — secure defaults work out of the box).
What's New in v0.2.1
- Brute-force protection — per-username (5/5min) + per-source (30/15min) lockout
dry_runmode oncreate_record,update_record,delete_record,execute_method— validate without executing- 2 new tools:
get_defaults(preview Odoo defaults),get_onchange(preview field side effects) - Temporal grouping in
read_group:create_date:month,date:quarter, etc. - Hardened blocklists: 32 always-blocked models (was 17), 29 always-blocked methods (was 18), 10 always-blocked write fields, 8 always read-only models
- Server-side admin verification via
has_group('base.group_system')(was trusted from auth response) - Credential wrapper prevents password leakage via
repr()/traceback - JSON-RPC retry only fires on
OdooSessionExpiredError(was retrying on every auth error)
See CHANGELOG.md for the full list of 21 security fixes.
Why This Exists
Existing Odoo MCP servers share common problems: hardcoded model lists that miss custom modules, security as an afterthought, mandatory custom Odoo addons, and single-version targets. This gateway solves all of them:
- Two-layer security — MCP restrictions (YAML) + Odoo's built-in ACLs (ir.model.access + ir.rule)
- YAML-driven configuration — model restrictions, RBAC, field-level access, rate limiting, audit logging
- Custom module support — auto-discovers models via
ir.model, add YAML config and it works - Version-agnostic — Odoo 17, 18, 19 with version-specific adapters
- Zero Odoo-side code —
pip install+ YAML config = done. No custom addon required - Full MCP primitives — 31 Tools + 6 Resources + 12 Prompts (most servers only implement Tools)
- Plugin architecture — extend with pip-installable domain packs via entry_points
Architecture
Security Pipeline
Every tool and resource call passes through this pipeline:
Hardcoded safety guardrails that cannot be overridden by YAML:
- 32 always-blocked models — system internals, auth/TOTP, payment tokens, attachments, mail.mail, base.automation, and more
- 8 always read-only models — mail.message, mail.followers, mail.activity, discuss.channel, mail.notification, mail.compose.message, mail.alias, discuss.channel.member (reads OK, writes blocked for everyone)
- 10 always-blocked write fields — password, password_crypt, groups_id, totp_secret, signup_token/type/expiration, api_key, share, active
- 29 always-blocked methods — sudo, with_user/env/context, _sql, _write, _create, name_create, load, import_data, export_data, and more
- 28 ORM methods blocked in execute_method (prevents bypassing field-level checks)
- Per-username brute-force lockout — 5 failures → 5 minute lockout (fixed duration, cannot be extended)
- Per-source brute-force lockout — 30 failures / 15 min, prevents username-rotation attacks
- Credential wrapper class — passwords stored with leak-safe
__repr__/__str__, cleared on close - Server-side admin verification —
has_group('base.group_system')overrides auth-responseis_admin
Quick Start
Claude Desktop Configuration
Add to claude_desktop_config.json:
Claude Code Configuration
Environment Variables
Security
Two-Layer Security Model
- MCP gateway restrictions (YAML config + hardcoded guardrails) — blocks sensitive models, dangerous methods, privileged fields before any Odoo call is made
- Odoo's built-in ACLs — enforces per-user access on actual records via
ir.model.accessandir.rule
Model Restriction Tiers
Hardcoded Safety Guardrails
These cannot be overridden by YAML configuration:
Blocked models (32): ir.config_parameter, res.users, res.users.apikeys, res.users.log, ir.cron, ir.module.module, ir.model.access, ir.rule, ir.mail_server, ir.ui.view, ir.actions.server, ir.logging, ir.attachment, ir.exports, ir.exports.line, iap.account, auth.totp.wizard, auth.totp.device, payment.token, payment.provider, base.automation, digest.digest, res.config.settings, change.password.wizard, change.password.user, base.module.update, base.module.upgrade, base.module.uninstall, fetchmail.server, bus.bus, mail.mail, mail.template
Read-only models (8): mail.message, mail.followers, mail.activity, discuss.channel, mail.notification, mail.compose.message, mail.alias, discuss.channel.member (reads allowed, writes blocked for everyone)
Blocked write fields (10): password, password_crypt, groups_id, totp_secret, signup_token, signup_type, signup_expiration, api_key, share, active
Blocked methods (29): sudo, with_user, with_company, with_context, with_env, with_prefetch, _auto_init, _sql, _register_hook, _write, _create, _read, _setup_base, _setup_fields, _setup_complete, init, _table_query, _read_group_raw, name_create, load, import_data, export_data, flush_recordset, invalidate_recordset, _search_panel_select_range, _search_panel_select_multi_range, _search_panel_domain_image, _search, _read_progress_bar
Additional Security Features
- Brute-force protection — per-username lockout (5 fails → 5 min) AND per-source IP/connection lockout (30 fails → 15 min, blocks username-rotation attacks). Lockouts have fixed duration — cannot be extended by additional attempts (DoS-resistant).
- Credential wrapper — passwords/session IDs stored in a
Credentialclass with leak-safe__repr__/__str__, explicit.reveal()for use, and.clear()on close - Server-side admin verification —
is_adminis re-verified viahas_group('base.group_system')after authentication, defending against tampered auth responses - Private method guard — underscore-prefixed methods (
_compute_*,_inverse_*, etc.) blocked for everyone including admin unless explicitly whitelisted - Rate limiting — per-session token bucket with separate global and write budgets
- RBAC — tool-level access control by user group, field-level response filtering, transparent drop reporting via
return_dropped=True - Input validation — model names, method names, field names, domain filters, ORDER BY clauses, groupby with temporal operators, write values (size/depth/type)
- IDOR protection — plugin tools scope data access to the authenticated user
- Audit logging — structured JSON logs for all allowed and denied operations
- Error sanitization — strips internal URLs, SQL fragments, file paths, stack traces from error messages
- XXE protection — XML-RPC responses parsed with
defusedxml - Domain validation — Odoo domain filters validated for operators, field names, value types, nesting depth, and list sizes
- Session-expiry retry — JSON-RPC retries only on
OdooSessionExpiredError, not generic auth errors (no double round-trips on access denials)
Authentication
Three stock Odoo auth methods — no custom addon needed:
Core MCP Tools (13)
Workflow Tools (2)
MCP Resources (6)
MCP Prompts (12)
Built-in Domain Plugins
HR Plugin
Sales Plugin
Project Plugin
Helpdesk Plugin
Custom Module Support
Add custom Odoo modules without writing Python code. Edit model_access.yaml:
Then all CRUD tools (search_read, create_record, update_record, delete_record) and execute_method work on the custom models with full security enforcement.
Plugin System
Extend the gateway with pip-installable plugins:
Register via pyproject.toml entry points:
Configuration Files
All files have .example templates with extensive inline documentation. Copy and customize:
Example: Restrict a Model
Example: RBAC by Group
Docker
Services:
- MCP Gateway — port 8080 (streamable-http mode)
- Odoo 18 — internal only (no host port exposed by default)
- PostgreSQL — internal only
The gateway runs as a non-root user in a minimal Python image.
CLI Tools
Development
Source Layout
Testing
1,476 tests passing, 93% code coverage, mypy strict clean, ruff clean:
Error Handling
All Odoo errors are classified into 7 types:
All error messages are sanitized before reaching the MCP client — internal URLs, SQL fragments, file paths, and stack traces are automatically stripped.
Known Limitations
- XML-RPC credential handling: When using API key authentication (XML-RPC), the credential is sent with every RPC call as required by the protocol. Use HTTPS in production. (Note: passwords are stored in a
Credentialwrapper that preventsrepr()/traceback leakage.) - HTTP mode session isolation:
streamable-httptransport currently has known session isolation limitations — the_current_session_keyContextVar is set inside the login tool but subsequent tool calls from different request contexts may fall back to the first available session. Deploy HTTP mode as single-tenant only (one user per server process) until per-request middleware lands in v0.3.0. stdio mode is single-session by design and unaffected.
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Make your changes with tests
- Ensure all checks pass:
pytest && ruff check src/ tests/ && mypy src/ - Submit a pull request
License
Source: README.md at commit 47c4c2b
Tools
0Version history
1- v0.1.1LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts