Skip to main content

MCP server exposing Odoo model registry without a database connection

Project description

odoo-model-mcp

MCP server that exposes Odoo's model registry (fields, inheritance, methods) without needing a database connection.

Point it at any Odoo project directory and get instant, structured answers about models, fields, method override chains, and inheritance graphs — powered by Odoo's own MetaModel registry loaded in-memory.

Status: Pre-alpha (0.1.0a1). Works with Odoo 16–18. Odoo 19 support is in progress.

How it works

  1. MCP server (this package) receives tool calls via stdio.
  2. It auto-detects the Odoo project structure (odoo-bin, addons paths, venv).
  3. A persistent worker subprocess is spawned in the project's own Python venv, loading the full model registry once (~4 seconds).
  4. Subsequent queries are served over a Unix domain socket in 1–15 ms.
  5. Workers auto-shutdown after 10 minutes of inactivity.

Each project gets its own isolated worker process, so you can work with multiple Odoo versions simultaneously without conflicts.

Installation

# With uv (recommended)
uv tool install odoo-model-mcp

# With pip
pip install odoo-model-mcp

Usage with Claude Code

Add to your ~/.claude.json (global) or project .claude/settings.local.json:

{
  "mcpServers": {
    "odoo-model-registry": {
      "type": "stdio",
      "command": "odoo-model-mcp",
      "args": []
    }
  }
}

If installed with uv and not on PATH:

{
  "mcpServers": {
    "odoo-model-registry": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "--project", "/path/to/odoo-model-mcp", "odoo-model-mcp"]
    }
  }
}

Tools

All tools accept a project_path pointing to the root of an Odoo project. Addons paths and the Odoo source location are auto-detected from the project structure (or can be overridden with addons_paths). Modules can be excluded by name with exclude_modules (useful when a module has unresolvable Python dependencies).

detect_project_info

Detect an Odoo project's structure without loading the registry. Returns odoo_path, addons_paths, python_bin, and odoo_version.

search_models

Search models by name or description substring.

search_models(project_path="/path/to/project", query="sale.order")

model_info

Full metadata for a model: all fields (with types, compute methods, related fields, module overrides), inheritance chain, extending modules (from MRO), and decorated methods.

model_info(project_path="/path/to/project", model_name="sale.order")

field_info

Detailed info for a single field: type, compute method, depends, store, index, related, groups, and which modules defined or overrode it.

field_info(project_path="/path/to/project", model_name="sale.order", field_name="amount_total")

method_overrides

Override chain for a method across the MRO, with source file locations (file path and line number) for each override.

method_overrides(project_path="/path/to/project", model_name="sale.order", method_name="_compute_amounts")

model_graph

Inheritance graph around a model: which modules extend it (same _name), mixin parents (different _name), delegation parents (_inherits), and child models that inherit from it.

model_graph(project_path="/path/to/project", model_name="sale.order")

Project auto-detection

The server detects project structure automatically:

  • Odoo source: looks for odoo-bin or the odoo/ Python package
  • Addons paths: parses odoo.conf / .odoorc, or scans for directories containing modules (subdirs with __manifest__.py)
  • Python venv: checks .venv/, venv/, env/
  • Odoo version: reads from .env (ODOO_VERSION=) or odoo/release.py

Architecture

Claude Code
    |
    | stdio (MCP protocol)
    v
odoo-model-mcp server (lightweight Python process)
    |
    | Unix domain socket (JSON lines)
    v
Worker process (project's own venv)
    - Loads Odoo registry via MetaModel._build_model()
    - Resolves full inheritance (MRO, __bases__, _build_model_attributes)
    - Serves queries from in-memory registry

Development

git clone https://github.com/bemade/odoo-model-mcp.git
cd odoo-model-mcp
uv sync
uv run pytest

License

LGPL-3.0-only

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odoo_model_mcp-0.1.0a1.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

odoo_model_mcp-0.1.0a1-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file odoo_model_mcp-0.1.0a1.tar.gz.

File metadata

  • Download URL: odoo_model_mcp-0.1.0a1.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for odoo_model_mcp-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 a74a91ab64d0e49cdaf3fde180ac4420cad6917a50d6bb90b68def90ca63b60f
MD5 ac45ed214f6220e8566bbc7a8da2e0a6
BLAKE2b-256 5e11150bc575658b4d6191a8c83f568068acb710b745edcbd86589ac0a46962b

See more details on using hashes here.

File details

Details for the file odoo_model_mcp-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: odoo_model_mcp-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for odoo_model_mcp-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 09c5f23a95e00a5ee62ef795dcc45ab9c3f2d5539c20186c61b1070ff571a8cb
MD5 6298aacadcfca21315f10464c375ff12
BLAKE2b-256 3e6c13d102e765265b9c3108a6d736c6651df9a24eb27999a16c7e74028e402b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page