Skip to main content
Glama
Odoo MCP Server

Odoo MCP Server

by ajmalj
README.md
# Odoo MCP Server

A Model Context Protocol (MCP) server that enables AI assistants (like Claude) to interact with Odoo ERP systems through standardized tools for data retrieval and manipulation.

## Features

- 🔍 **Search Models**: Find installed Odoo models by name pattern
- 📋 **List Fields**: Inspect model structure and field properties
- 📖 **Get Record**: Retrieve specific records by ID
- 🔎 **Search Records**: Query records using Odoo domain filters
- ➕ **Create Record**: Create new records with field validation
- âœī¸ **Update Record**: Modify existing records
- đŸ—‘ī¸ **Delete Record**: Remove records from the database
- đŸ”ĸ **Count Records**: Count matching records
- â„šī¸ **Server Info**: Get Odoo version and connection details

## Prerequisites

- Python 3.10 or higher
- Access to an Odoo instance (any version with XML-RPC enabled)
- Odoo user with appropriate permissions

## Installation

#### 1. Clone or Copy Files

```bash
git clone https://github.com/ajmalj/mcp-odoo-server.git
cd mcp-odoo-server
```

```bash
pip install -r requirements.txt
```

Or install directly:

```bash
pip install fastmcp python-dotenv
```

### Option 2: Install as Package

Install in editable mode for development:

```bash
pip install -e .
```

Or install with development dependencies:

```bash
pip install -e ".[dev]"
```


## Configuration

Copy the example environment file and fill in your Odoo credentials:

```bash
cp .env.example .env
```

Edit `.env` with your values:

```env
ODOO_URL=http://localhost:8069
ODOO_DB=your_database_name
ODOO_USER=admin
ODOO_PASSWORD=your_password_or_api_key
```

> **Tip**: For better security, use an [API key](https://www.odoo.com/documentation/17.0/developer/reference/external_api.html#api-keys) instead of your password.

## Running the Server

### Direct Execution

```bash
python server.py
```

### Using FastMCP CLI

```bash
fastmcp run server.py:mcp
```

### With HTTP Transport (for debugging)

```bash
fastmcp run server.py:mcp --transport http --port 8000
```

## Claude Desktop Configuration

Add the following to your Claude Desktop configuration file:

### macOS
`~/Library/Application Support/Claude/claude_desktop_config.json`

### Windows
`%APPDATA%\Claude\claude_desktop_config.json`

### Configuration

```json
{
  "mcpServers": {
    "odoo": {
      "command": "python",
      "args": ["/absolute/path/to/mcp_odoo_server/server.py"],
      "env": {
        "ODOO_URL": "http://localhost:8069",
        "ODOO_DB": "your_database_name",
        "ODOO_USER": "admin",
        "ODOO_PASSWORD": "your_password_or_api_key"
      }
    }
  }
}
```

### Alternative: Using UV (Recommended)

If you have [UV](https://github.com/astral-sh/uv) installed:

```json
{
  "mcpServers": {
    "odoo": {
      "command": "uv",
      "args": [
        "run",
        "--with", "fastmcp",
        "--with", "python-dotenv",
        "python",
        "/absolute/path/to/mcp_odoo_server/server.py"
      ],
      "env": {
        "ODOO_URL": "http://localhost:8069",
        "ODOO_DB": "your_database_name",
        "ODOO_USER": "admin",
        "ODOO_PASSWORD": "your_password_or_api_key"
      }
    }
  }
}
```

## Available Tools

### search_models

Search for installed Odoo models.

```
Arguments:
  - name_pattern: Pattern to filter model names (optional)
  - limit: Maximum results (default: 50)
```

### list_fields

List all fields of a specific model.

```
Arguments:
  - model: Technical model name (e.g., 'res.partner')
  - field_pattern: Pattern to filter field names (optional)
```

### get_record

Retrieve a specific record by ID.

```
Arguments:
  - model: Technical model name
  - record_id: ID of the record
  - fields: List of fields to retrieve (optional)
```

### search_records

Search records using domain filters.

```
Arguments:
  - model: Technical model name
  - domain: Odoo domain filter (e.g., [['is_company', '=', True]])
  - fields: List of fields to retrieve (optional)
  - limit: Maximum results (default: 50)
  - offset: Skip records for pagination
  - order: Sort order (e.g., 'name asc')
```

### create_record

Create a new record.

```
Arguments:
  - model: Technical model name
  - values: Dictionary of field values
```

### update_record

Update an existing record.

```
Arguments:
  - model: Technical model name
  - record_id: ID of the record to update
  - values: Dictionary of field values to update
```

### delete_record

Delete a record.

```
Arguments:
  - model: Technical model name
  - record_id: ID of the record to delete
```

### count_records

Count records matching a domain.

```
Arguments:
  - model: Technical model name
  - domain: Odoo domain filter (optional)
```

### get_server_info

Get Odoo server version and connection info.

```
Arguments: None
```

## Usage Examples

Once configured in Claude Desktop, you can ask Claude:

- "List all models in Odoo that contain 'sale'"
- "Show me the fields of the res.partner model"
- "Search for all company contacts in the system"
- "Create a new customer named 'ACME Corp' with email 'contact@acme.com'"
- "Update the phone number of partner ID 42"
- "How many sale orders are in confirmed state?"

## Security Considerations

1. **Use API Keys**: Instead of passwords, generate API keys in Odoo (Settings > Users > API Keys)
2. **Limit Permissions**: Create a dedicated Odoo user with only the necessary access rights
3. **Secure Credentials**: Never commit `.env` files to version control
4. **Network Security**: Use HTTPS in production and consider firewall rules

## Troubleshooting

### Connection Refused

- Verify Odoo is running and accessible at the configured URL
- Check if XML-RPC is enabled (it's enabled by default)

### Authentication Failed

- Double-check credentials in `.env` file
- Ensure the database name is correct
- Verify the user has XML-RPC access

### Permission Denied

- The Odoo user needs appropriate access rights for the models you're querying
- Check security groups and access rules in Odoo

## License

MIT License - Feel free to modify and use as needed.

TDQS

A3.5/5.0

Scored across 9 tools

Disambiguation5/5

Each tool maps to a distinct action on a distinct target: model introspection (search_models, list_fields), single-record access (get_record), filtered queries (search_records, count_records), mutations (create/update/delete_record), and server metadata (get_server_info). The only near-overlap, search_records vs count_records, is clearly separated by one returning records and the other an aggregate count. An agent can pick correctly from names alone.

Naming Consistency5/5

Every tool follows a strict verb_noun snake_case pattern (search_models, list_fields, get_record, create_record, update_record, delete_record, count_records, get_server_info). No camelCase, no stray verbs, and plural/singular usage is logical (models/records plural for sets, record singular for single-ID ops).

Tool Count5/5

Nine tools is well within the sweet spot and every tool earns its place: a clean introspection layer, full record CRUD, and two supporting utilities. Nothing feels redundant or bolted on for a generic Odoo ORM surface.

Completeness4/5

CRUD plus schema introspection and counting gives solid lifecycle coverage for generic record manipulation. The notable gap is method invocation (Odoo workflows like confirming orders or posting invoices typically require calling model methods) along with bulk operations and aggregation/grouping, which agents will have to work around.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues