MCP Server for Odoo Integration
Project description
Odoo MCP Server
An MCP server implementation that integrates with Odoo ERP systems, enabling AI assistants to interact with Odoo data and functionality through the Model Context Protocol.
Features
- Comprehensive Odoo Integration: Full access to Odoo models, records, and methods
- XML-RPC Communication: Secure connection to Odoo instances via XML-RPC
- Flexible Configuration: Support for config files and environment variables
- Resource Pattern System: URI-based access to Odoo data structures
- Error Handling: Standardized error codes and messages following MCP specification
- Resource Subscriptions: Support for subscribing to resource changes and notifications
- MCP Specification Compliant: Fully compatible with the latest MCP specification (1.6.0+)
- Progress Reporting: Real-time progress updates during tool execution
Tools
-
execute_method
- Execute a custom method on an Odoo model
- Inputs:
model(string): The model name (e.g., 'res.partner')method(string): Method name to executeargs(optional array): Positional argumentskwargs(optional object): Keyword arguments
- Returns: MCP-compliant response with success indicator and result data
- Features: Progress reporting during execution
-
search_employee
- Search for employees by name
- Inputs:
name(string): The name (or part of the name) to search forlimit(optional number): The maximum number of results to return (default 20)
- Returns: MCP-compliant response with matching employee names, IDs, and count
- Features: Progress reporting during search
-
search_holidays
- Searches for holidays within a specified date range
- Inputs:
start_date(string): Start date in YYYY-MM-DD formatend_date(string): End date in YYYY-MM-DD formatemployee_id(optional number): Optional employee ID to filter holidays
- Returns: MCP-compliant response with holidays, count, and date range details
- Features: Progress reporting during search
All tools follow the MCP specification for error handling with standardized error codes and messages.
Resources
-
odoo://models
- Lists all available models in the Odoo system
- Returns: Resource with MIME type
application/jsoncontaining model information
-
odoo://model/{model_name}
- Get information about a specific model including fields
- Example:
odoo://model/res.partner - Returns: Resource with MIME type
application/jsoncontaining model metadata and field definitions
-
odoo://record/{model_name}/{record_id}
- Get a specific record by ID
- Example:
odoo://record/res.partner/1 - Returns: Resource with MIME type
application/jsoncontaining record data
-
odoo://search/{model_name}/{domain}
- Search for records that match a domain
- Example:
odoo://search/res.partner/[["is_company","=",true]] - Returns: Resource with MIME type
application/jsoncontaining matching records (limited to 10 by default)
Resource Subscriptions
This server implements MCP resource subscriptions, allowing clients to be notified when resources change:
-
resources/subscribe
- Subscribe to changes in a specific resource
- Parameters:
uri- the resource URI to subscribe to - Returns: Confirmation of subscription success
-
resources/unsubscribe
- Unsubscribe from changes in a specific resource
- Parameters:
uri- the resource URI to unsubscribe from - Returns: Confirmation of unsubscription success
Configuration
Odoo Connection Setup
- Create a configuration file named
odoo_config.json:
{
"url": "https://your-odoo-instance.com",
"db": "your-database-name",
"username": "your-username",
"password": "your-password-or-api-key",
"mcp_prefix": "my_odoo_production"
}
- Alternatively, use environment variables:
ODOO_URL: Your Odoo server URLODOO_DB: Database nameODOO_USERNAME: Login usernameODOO_PASSWORD: Password or API keyODOO_MCP_PREFIX: Custom prefix for MCP commands and resources (default: database name)ODOO_TIMEOUT: Connection timeout in seconds (default: 30)ODOO_VERIFY_SSL: Whether to verify SSL certificates (default: true)HTTP_PROXY: Force the ODOO connection to use an HTTP proxy
Multi-Database Support
When running multiple Odoo MCP servers connected to different databases, you can use the ODOO_MCP_PREFIX parameter to create unique command names for each server, avoiding conflicts in AI environments:
# For production Odoo server
export ODOO_MCP_PREFIX="aspire_production"
# Commands will appear as: aspire_production_execute_method
# For development Odoo server
export ODOO_MCP_PREFIX="aspire_dev"
# Commands will appear as: aspire_dev_execute_method
Without this setting, the database name will be used as a prefix by default. The MCP prefix ensures tools and resources have distinct names when using multiple Odoo instances with a single LLM.
Usage with Claude Desktop
Add this to your claude_desktop_config.json:
{
"mcpServers": {
"odoo": {
"command": "python",
"args": [
"-m",
"odoo_mcp"
],
"env": {
"ODOO_URL": "https://your-odoo-instance.com",
"ODOO_DB": "your-database-name",
"ODOO_USERNAME": "your-username",
"ODOO_PASSWORD": "your-password-or-api-key",
"ODOO_MCP_PREFIX": "my_odoo"
}
}
}
}
Docker
{
"mcpServers": {
"odoo": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"ODOO_URL",
"-e",
"ODOO_DB",
"-e",
"ODOO_USERNAME",
"-e",
"ODOO_PASSWORD",
"mcp/odoo"
],
"env": {
"ODOO_URL": "https://your-odoo-instance.com",
"ODOO_DB": "your-database-name",
"ODOO_USERNAME": "your-username",
"ODOO_PASSWORD": "your-password-or-api-key",
"ODOO_MCP_PREFIX": "my_odoo"
}
}
}
}
Installation
Python Package
pip install odoo-mcp
Running the Server
# Using the installed package
odoo-mcp
# Using the MCP development tools
mcp dev odoo_mcp/server.py
# With additional dependencies
mcp dev odoo_mcp/server.py --with pandas --with numpy
# Mount local code for development
mcp dev odoo_mcp/server.py --with-editable .
Build
Docker build:
docker build -t mcp/odoo:latest -f Dockerfile .
Parameter Formatting Guidelines
When using the MCP tools for Odoo, pay attention to these parameter formatting guidelines:
-
Domain Parameter:
- The following domain formats are supported:
- List format:
[["field", "operator", value], ...] - Object format:
{"conditions": [{"field": "...", "operator": "...", "value": "..."}]} - JSON string of either format
- List format:
- Examples:
- List format:
[["is_company", "=", true]] - Object format:
{"conditions": [{"field": "date_order", "operator": ">=", "value": "2025-03-01"}]} - Multiple conditions:
[["date_order", ">=", "2025-03-01"], ["date_order", "<=", "2025-03-31"]]
- List format:
- The following domain formats are supported:
-
Fields Parameter:
- Should be an array of field names:
["name", "email", "phone"] - The server will try to parse string inputs as JSON
- Should be an array of field names:
License
This MCP server is licensed under the MIT License.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file odoo_mcp_beta-0.0.5.tar.gz.
File metadata
- Download URL: odoo_mcp_beta-0.0.5.tar.gz
- Upload date:
- Size: 43.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70f580ba310c5e5ee023da6b95c3b585174f30235dae74953446cbad453f5151
|
|
| MD5 |
7b064f5c93aefd9d1665d9edd1697535
|
|
| BLAKE2b-256 |
4f79621472ea67572c33fdc33ca6e2e3468b1872ff9a5dbb8cc04ba567bef894
|
File details
Details for the file odoo_mcp_beta-0.0.5-py3-none-any.whl.
File metadata
- Download URL: odoo_mcp_beta-0.0.5-py3-none-any.whl
- Upload date:
- Size: 53.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cc9e73fccb968ead2b5a3a69c630e7efce8e6f765502f351f79a7a93499e976
|
|
| MD5 |
90f7dd0ce069ac2b956fb79c80a0d151
|
|
| BLAKE2b-256 |
46a1944934e2277ca6b6f959418d6bfe171d91a74a7ce5f095c72af100c86a25
|