Skip to main content

Model Context Protocol server for Odoo module development with version-aware documentation and code generation tools

Project description

Odoo Development MCP Server

A Model Context Protocol (MCP) server for Odoo module development with AI assistance. Provides version-aware documentation access (17.0, 18.0, 19.0), intelligent code generation, and development workflow automation.

๐Ÿš€ Quick Start | ๐Ÿ“– OpenCode Setup | ๐Ÿ”ง Troubleshooting | ๐Ÿ“‹ Changelog

Features

  • ๐Ÿ“š Documentation Access: 302+ Odoo documentation files searchable across all versions
  • ๐Ÿ”ง Version-Aware Code Generation: All generated code includes version info and relevant documentation links
  • ๐Ÿ“‹ Integrated Development Guidelines: Built-in Odoo coding standards and best practices enforcement
  • ๐Ÿ’ก Smart Prompts: Guided workflows with rules-aware feature development, debugging, and upgrades
  • ๐ŸŽฏ Automatic Context: Generated code includes references to official Odoo documentation and development rules

Installation

Prerequisites

# Ensure Python 3.12+ is installed
python --version

# Install MCP CLI (if not already installed)
pip install "mcp[cli]"

For Claude Desktop

  1. Quick Install (Recommended):

    mcp install odoo_mcp_server.py --name "Odoo Dev"
    
  2. Manual Install:

    Edit your Claude Desktop config file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json

    Add this configuration:

    {
      "mcpServers": {
        "odoo-dev": {
          "command": "python",
          "args": ["/absolute/path/to/odoo-dev-mcp/odoo_mcp_server.py"]
        }
      }
    }
    
  3. Restart Claude Desktop

For OpenCode

๐Ÿ“– Complete OpenCode Setup Guide โ†’

Quick setup - add to ~/.opencode/config.jsonc:

Option 1: Using uv (Recommended)

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "odoo-dev": {
      "type": "local",
      "command": ["uv", "run", "/absolute/path/to/odoo-dev-mcp/odoo_mcp_server.py"],
      "enabled": true,
      "environment": {
        "PATH": "/home/user/.local/bin:/usr/local/bin:/usr/bin:/bin"
      }
    }
  }
}

First, install dependencies:

cd /path/to/odoo-dev-mcp
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync

Option 2: Using Python directly

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "odoo-dev": {
      "type": "local",
      "command": ["python3", "/absolute/path/to/odoo-dev-mcp/odoo_mcp_server.py"],
      "enabled": true,
      "environment": {
        "PYTHONPATH": "/absolute/path/to/odoo-dev-mcp"
      }
    }
  }
}

Note: Requires pip install mcp first.

Then use in OpenCode:

Search Odoo documentation for "fields.Command"
Set Odoo version to 19.0
Create model library.book with fields: name, author
Get development guidelines

See OPENCODE_SETUP.md for complete guide with examples, troubleshooting, and workflows.

Quick Start

1. Test the Server

python test_server.py

You should see all tests pass with โœ“ marks.

2. Basic Usage in Claude/OpenCode

# Set your Odoo version
Set Odoo version to 19.0

# Create a module
Create an Odoo module called "library_management" with display name "Library Management"

# Create a model
Create a model library.book with fields: name (char), author_id (many2one to res.partner), isbn (char)

# Generate views
Create a form view for library.book with fields: name, author_id, isbn

# Add security
Create security rules for library.book in module library_management

# Search documentation
Search Odoo documentation for "computed fields"

Available Tools

Version Management

  • set_odoo_version(version) - Switch between 17.0, 18.0, 19.0
  • get_current_version() - Check current version

Documentation & Guidelines

  • search_documentation(query, version) - Full-text search across docs
  • get_development_guidelines(context) - Get context-specific coding guidelines
    • Contexts: general, models, views, security, all

Code Generation (Version-Aware)

  • create_odoo_module(name, display_name, description, ...) - Generate module structure with version-specific manifest
  • create_odoo_model(model_name, description, fields, inherit) - Create Python models with ORM documentation links
  • create_odoo_view(model_name, view_type, fields_to_display) - Generate XML views with architecture references
  • create_security_rules(model_name, module_name, groups) - Create security config with security documentation

Development Prompts

  • develop_odoo_feature(description) - Guided feature development
  • debug_odoo_error(error, context) - Error debugging assistance
  • upgrade_odoo_module(module, from_version, to_version) - Migration guidance
  • review_odoo_code(code) - Code review with best practices

Resources

Access Odoo documentation and development rules:

Documentation:

  • odoo://docs/19.0/index - Documentation index
  • odoo://docs/19.0/reference/backend/orm - ORM reference
  • odoo://docs/18.0/howtos/create_reports - How-to guides

Development Rules:

  • odoo://rules/all - All development guidelines
  • odoo://rules/clean-code - Clean code principles
  • odoo://rules/odoo-development - Odoo-specific conventions

Examples

Complete Module Creation

# In Claude/OpenCode:

1. Set Odoo version to 19.0
2. Create module "task_manager" with display name "Task Manager"
3. Create model task.task with fields:
   - name (char, required)
   - description (text)
   - priority (selection: low, medium, high)
   - assigned_to (many2one: res.users)
   - deadline (date)
4. Create form view for task.task
5. Create tree view for task.task
6. Create security rules for task.task

Field Types Examples

All Odoo field types are supported:

fields = [
    {"name": "name", "type": "Char", "required": True},
    {"name": "description", "type": "Text"},
    {"name": "amount", "type": "Float"},
    {"name": "quantity", "type": "Integer"},
    {"name": "active", "type": "Boolean"},
    {"name": "date", "type": "Date"},
    {"name": "partner_id", "type": "Many2one", "comodel_name": "res.partner"},
    {"name": "line_ids", "type": "One2many", "comodel_name": "model.line", "inverse_name": "parent_id"},
    {"name": "tag_ids", "type": "Many2many", "comodel_name": "model.tag"},
    {"name": "state", "type": "Selection", "selection": "[('draft', 'Draft'), ('done', 'Done')]"}
]

Development

Run Tests

python test_server.py

Test with MCP Inspector

mcp dev odoo_mcp_server.py

Architecture

odoo_mcp_server.py
โ”œโ”€โ”€ Resources (Documentation)
โ”‚   โ”œโ”€โ”€ 302 RST files indexed
โ”‚   โ”œโ”€โ”€ Version-specific content
โ”‚   โ””โ”€โ”€ Full-text search
โ”œโ”€โ”€ Tools (Code Generation)
โ”‚   โ”œโ”€โ”€ Module scaffolding
โ”‚   โ”œโ”€โ”€ Model definitions
โ”‚   โ”œโ”€โ”€ View generation
โ”‚   โ””โ”€โ”€ Security rules
โ””โ”€โ”€ Prompts (Workflows)
    โ”œโ”€โ”€ Feature development
    โ”œโ”€โ”€ Error debugging
    โ”œโ”€โ”€ Module upgrades
    โ””โ”€โ”€ Code review

Development Guidelines

The server includes comprehensive Odoo development guidelines that are automatically applied:

Built-in Rules

  • Clean Code Principles - General software engineering best practices
  • Odoo Conventions - Odoo-specific naming, structure, and coding standards
    • Module structure and naming
    • Model and field naming conventions
    • View architecture standards
    • Security rules patterns
    • ORM best practices
    • Performance optimization tips

Rules Integration

All code generation tools automatically include:

  • โš ๏ธ Naming convention warnings
  • ๐Ÿ“‹ Context-specific guidelines
  • ๐Ÿ”— Links to relevant rules sections
  • โœ… Best practice recommendations

Access Guidelines

# Get general guidelines
get_development_guidelines("general")

# Get model-specific rules
get_development_guidelines("models")

# Access all rules
View resource: odoo://rules/all

Documentation Structure

The server provides access to Odoo documentation organized by version:

docs/
โ”œโ”€โ”€ 17.0/ (102 files)
โ”œโ”€โ”€ 18.0/ (100 files)
โ””โ”€โ”€ 19.0/ (100 files)

rules/
โ”œโ”€โ”€ clean-code.mdc
โ””โ”€โ”€ odoo-development.mdc

docs/ โ”œโ”€โ”€ 17.0/ (102 files) โ”œโ”€โ”€ 18.0/ (100 files) โ””โ”€โ”€ 19.0/ (100 files)


## Supported Platforms

- โœ… Windows, macOS, Linux
- โœ… Claude Desktop
- โœ… OpenCode (VS Code extension)
- โœ… Any MCP-compatible client

## Requirements

- Python 3.12+
- MCP SDK 1.4.1+
- FastMCP

## Troubleshooting

### Server not showing in Claude?
1. Check config file is valid JSON
2. Verify absolute paths
3. Restart Claude Desktop completely

### Import errors?
```bash
pip install "mcp[cli]"

Documentation not found?

Ensure docs/ directory exists with version folders (17.0, 18.0, 19.0)

Tips

  1. Always set the Odoo version first - All code generation adapts to the selected version
  2. Review development guidelines - Use get_development_guidelines() for context-specific rules
  3. Follow naming conventions - Generated code includes rules warnings for common mistakes
  4. Use descriptive model names - e.g., library.book (with dots), not lib_b (with underscores)
  5. Check rules in generated code - Each tool output includes relevant naming and coding rules
  6. Search before asking - Use search_documentation() for specific questions
  7. Test incrementally - module โ†’ models โ†’ views โ†’ security
  8. Review code against rules - Use the review_odoo_code prompt for rule compliance checks

License

MIT License

Contributing

Contributions welcome! This server follows clean code principles and Odoo best practices.

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

iflow_mcp_mart337i_odoo_dev_mcp-1.0.0.tar.gz (8.5 MB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file iflow_mcp_mart337i_odoo_dev_mcp-1.0.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_mart337i_odoo_dev_mcp-1.0.0.tar.gz
  • Upload date:
  • Size: 8.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_mart337i_odoo_dev_mcp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8294611d19b7aa05f660fb71795fdfd46d568bcc83038ce1ad532d24725d74b0
MD5 dd7fc01bb2072477e57253894ae2386f
BLAKE2b-256 91e48808c52b3c08b6761070d8125c6c554255003be1555071869da3c059e1d9

See more details on using hashes here.

File details

Details for the file iflow_mcp_mart337i_odoo_dev_mcp-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_mart337i_odoo_dev_mcp-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_mart337i_odoo_dev_mcp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 085c35745fa6991855e4b603ca4cda984bf20d319b436058fc406e2bd251aadd
MD5 486b281fa021b4f1ad640ec2a6e561b5
BLAKE2b-256 5b2dc104d9b868031596528203a1dcb9f68850b6d2fda9d22f73789888ed4a65

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