# Odoo18 Mcp Project

> Odoo 18 MCP Integration - A robust integration server that connects MCP with Odoo 18.0 ERP system

- **Type:** MCP server
- **Install:** `agentstack add mcp-infovpcs-odoo18-mcp-project`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [infovpcs](https://agentstack.voostack.com/s/infovpcs)
- **Installs:** 0
- **Category:** [Integrations](https://agentstack.voostack.com/c/integrations)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [infovpcs](https://github.com/infovpcs)
- **Source:** https://github.com/infovpcs/odoo18_mcp_project

## Install

```sh
agentstack add mcp-infovpcs-odoo18-mcp-project
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

[](https://mseep.ai/app/infovpcs-odoo18-mcp-project)

# Odoo 18 MCP Integration (18.0 Branch)

Last Updated: 2025-06-06

[](https://www.python.org/downloads/)
[](https://www.odoo.com/)
[](https://github.com/modelcontextprotocol/python-sdk)
[]()
[](LICENSE)

A robust integration server that connects MCP (Master Control Program) with Odoo 18.0 ERP system, focusing on efficient data synchronization, API management, and secure communications. This implementation provides a standardized interface for performing CRUD operations on Odoo 18 models through a simple API, with dynamic model discovery and field analysis capabilities.

## Project Structure

```
odoo18_mcp_project/
├── src/                     # Main source code
│   ├── agents/             # AI agents implementation
│   ├── core/               # Core functionality
│   ├── mcp/               # MCP integration code
│   │   ├── server.py     # MCP server implementation
│   │   └── ...           # Other MCP-related modules
│   ├── odoo/              # Odoo integration code
│   │   ├── client.py      # Odoo client implementation
│   │   ├── schemas.py     # Data schemas and models
│   │   └── ...            # Other Odoo-related modules
│   ├── odoo_docs_rag/     # Odoo documentation retrieval
│   ├── odoo_tools/        # Odoo utility tools
│   ├── simple_odoo_code_agent/ # Simplified code agent
│   └── streamlit_client/  # Streamlit UI client
├── tests/                  # Test files
├── exports/                # Exported data files
├── generated_modules/      # Generated Odoo modules
├── logs/                   # Log files
├── odoo_docs/             # Odoo documentation
├── odoo_docs_index/       # Documentation index
└── tmp/                   # Temporary files
```

## Features

- **Odoo Integration**
  - XML-RPC connection to Odoo 18
  - Model discovery using ir.model and ir.model.fields
  - Dynamic field analysis and grouping
  - NLP-based field importance analysis
  - Relationship-aware search and operations

- **CRUD Operations**
  - Create, Read, Update, Delete for any Odoo model
  - Batch operations support
  - Custom method execution
  - Record templates generation

- **Data Management**
  - Export/Import tools for CSV files
  - Related records handling
  - Relationship maintenance
  - Batch processing support

- **AI Integration**
  - DeepWiki integration for documentation
  - Gemini LLM integration
  - Natural language query parsing
  - Code generation capabilities

- **Development Tools**
  - Streamlit UI for module generation
  - Documentation search
  - CRUD testing interface
  - Workflow visualization
  - Mermaid diagram generation

## Setup

1. Clone the repository:

```bash
git clone https://github.com/infovpcs/odoo18_mcp_project.git
cd odoo18_mcp_project
```

2. Create and activate virtual environment:

```bash
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
```

3. Install dependencies:

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

4. Configure environment:

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

Edit `.env` with your Odoo connection details:

```
ODOO_URL=http://localhost:8069
ODOO_DB=llmdb18
ODOO_USERNAME=admin
ODOO_PASSWORD=admin

# Optional AI/LLM integration
GEMINI_API_KEY=your_gemini_api_key_here
GEMINI_MODEL=gemini-2.0-flash
```

## Usage

### Running the Server

```bash
python mcp_server.py
```

### Running Tests

```bash
python -m pytest tests/
```

### Using Streamlit UI

```bash
streamlit run app.py
```

## Tools

1. **Basic CRUD Operations**
   - `search_records`: Search for records in any Odoo model
   - `create_record`: Create new records
   - `update_record`: Update existing records
   - `delete_record`: Delete records
   - `get_record_template`: Get a template for creating records

2. **Advanced Search and Documentation**
   - `advanced_search`: Perform advanced natural language search
   - `retrieve_odoo_documentation`: Retrieve information from Odoo 18 documentation
   - `get_field_groups`: Get field groups for a model
   - `analyze_field_importance`: Analyze field importance using NLP

3. **Export/Import Tools**
   - `export_records_to_csv`: Export records to CSV
   - `import_records_from_csv`: Import records from CSV
   - `export_related_records_to_csv`: Export parent-child related records
   - `import_related_records_from_csv`: Import parent-child related records

4. **Code Generation Tools**
   - `generate_module`: Generate Odoo 18 module code using Simple Odoo Code Agent
   - `generate_npx`: Generate diagrams from Mermaid markdown

## Documentation

For more detailed documentation, see:
- [PLANNING.md](PLANNING.md) - Project planning and architecture
- [TASK.md](TASK.md) - Current tasks and progress
- [MCP_OVERVIEW.md](MCP_OVERVIEW.md) - MCP integration details
- [MCP_SDK_README.md](MCP_SDK_README.md) - MCP SDK documentation
- [CLIENT_README.md](CLIENT_README.md) - Client usage documentation

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Installation

### Prerequisites

- Python 3.10 or higher
- Odoo 18.0 instance
- Access to Odoo database
- Claude Desktop (optional, for AI integration)
- Compatible PyTorch version (2.2.x recommended for macOS)
- NumPy  **Note**: The `BRAVE_API_KEY` is required for the online search functionality in the enhanced RAG tool. You can obtain a Brave Search API key from the [Brave Search Developer Portal](https://brave.com/search/api/).

### Claude Desktop Integration

The project includes comprehensive integration with Claude Desktop, allowing you to use all the Odoo 18 MCP tools directly within the Claude AI assistant interface.

#### Installation Options

##### Option 1: Using the MCP CLI (Recommended)

1. Install the MCP SDK with CLI support:

```bash
pip install "mcp[cli]"
```

2. Install the MCP server in Claude Desktop:

```bash
# Make sure to set these environment variables in your shell or .env file first:
# export ODOO_URL=http://localhost:8069

# export ODOO_PASSWORD=admin
# export GEMINI_API_KEY=your_key
# export BRAVE_API_KEY=your_key

mcp install mcp_server.py --name "Odoo 18 Integration" \
  --command "$(which python3)" \
  --args "$(pwd)/mcp_server.py" \
  --env ODOO_URL=${ODOO_URL} \
  --env ODOO_DB=${ODOO_DB} \
  --env ODOO_USERNAME=${ODOO_USERNAME} \
  --env ODOO_PASSWORD=${ODOO_PASSWORD} \
  --env GEMINI_API_KEY=${GEMINI_API_KEY} \
  --env GEMINI_MODEL=gemini-2.0-flash \
  --env BRAVE_API_KEY=${BRAVE_API_KEY} \
  --env ODOO_DOCS_DIR="$(pwd)/odoo_docs" \
  --env ODOO_INDEX_DIR="$(pwd)/odoo_docs_index" \
  --env ODOO_DB_PATH="$(pwd)/odoo_docs_index/embeddings.db" \
```

This command will:
- Register the MCP server with Claude Desktop
- Configure the necessary environment variables
- Set up the server with the correct name and description

##### Option 2: Using the Automated Script

We provide a convenient script that automatically updates the Claude Desktop configuration:

```bash
# Make the script executable
chmod +x update_claude_config.sh

# Run the script
./update_claude_config.sh
```

This script will:
- Detect your Claude Desktop configuration location based on your OS
- Load environment variables from your `.env` file (including GEMINI_API_KEY)
- Update the Claude Desktop configuration with the correct values
- Handle environment variable substitution automatically
- Create a backup of your existing configuration
- Validate the updated configuration

##### Option 3: Manual Configuration

You can also manually update the Claude Desktop configuration file:

1. Locate your Claude Desktop configuration file:
   - **macOS**: `~/Library/Application Support/Claude/config.json`
   - **Windows**: `%APPDATA%\Claude\config.json`
   - **Linux**: `~/.config/Claude/config.json`

2. Open the `claude_config.json` file in a text editor and add the following to the `servers` section:

```json
{
    "odoo18-mcp": {
        "name": "Odoo 18 Integration",
        "description": "Dynamic Odoo 18 integration with MCP",
        "command": "/full/path/to/your/python",
        "args": ["/full/path/to/your/odoo18_mcp_project/mcp_server.py"],
        "env": {
            "ODOO_URL": "http://localhost:8069",
            "ODOO_DB": "llmdb18",
            "ODOO_USERNAME": "admin",
            "ODOO_PASSWORD": "admin",
            "GEMINI_API_KEY": "your_gemini_api_key_here",
            "GEMINI_MODEL": "gemini-2.0-flash",
            "BRAVE_API_KEY": "your_brave_api_key_here",
            "ODOO_DOCS_DIR": "/full/path/to/your/odoo18_mcp_project/odoo_docs",
            "ODOO_INDEX_DIR": "/full/path/to/your/odoo18_mcp_project/odoo_docs_index",
            "ODOO_DB_PATH" : "/full/path/to/your/odoo18_mcp_project/odoo_docs_index/embeddings.db"
        }
    }
}
```

**Important Configuration Notes**:
- Replace `/full/path/to/your/python` with the actual full path to your Python executable. You can find this by running `which python3` in your terminal. For example, if you're using a virtual environment, it might be something like `/Users/username/workspace/odoo18_mcp_project/.venv/bin/python3`.
- Replace `your_gemini_api_key_here` with your actual Google Gemini API key if you want to use the Odoo Module Generator with Gemini integration.
- Replace `your_brave_api_key_here` with your actual Brave Search API key if you want to use the online search functionality in the enhanced RAG tool. You can obtain a Brave Search API key from the [Brave Search Developer Portal](https://brave.com/search/api/).
- Make sure the path to `mcp_server.py` is correct for your installation.

#### Verifying the Installation

After configuring Claude Desktop:

1. Restart Claude Desktop to apply the changes
2. Open Claude Desktop and click on the server selection dropdown (top-right corner)
3. Select "Odoo 18 Integration" from the list
4. Check the Claude Desktop logs for successful connection to Odoo
5. Try a simple command like `/tool search_records model_name=res.partner query=company` to verify functionality

#### Troubleshooting Claude Desktop Integration

If you encounter issues with the Claude Desktop integration:

1. **Check the Claude Desktop logs**:
   - **macOS**: `~/Library/Logs/Claude/main.log`
   - **Windows**: `%APPDATA%\Claude\logs\main.log`
   - **Linux**: `~/.config/Claude/logs/main.log`

2. **Verify Python path**:
   - Make sure the Python path in the configuration is correct and accessible
   - The Python executable should have the MCP SDK installed

3. **Check environment variables**:
   - Verify that all environment variables are correctly set
   - Make sure the Odoo server is running and accessible at the specified URL

4. **Restart Claude Desktop**:
   - Sometimes a simple restart resolves connection issues

5. **Run the MCP server directly**:
   - Try running `python mcp_server.py` directly to check for any errors

6. **Use the standalone server for testing**:
   - Run `python standalone_mcp_server.py` and test the tools using curl commands

#### Using Claude Desktop with Odoo 18 Integration

Once configured, you can use all the Odoo 18 MCP tools directly within Claude Desktop:

1. **Tool Commands**: Use `/tool` commands to execute specific operations
   ```
   /tool search_records model_name=res.partner query="company"
   /tool get_record_template model_name=product.product
   /tool run_odoo_code_agent query="Create a customer feedback module" use_gemini=true
   ```

2. **Resource Commands**: Use `/resource` commands to access Odoo resources
   ```
   /resource odoo://models/all
   /resource odoo://model/res.partner/metadata
   /resource odoo://model/product.product/records
   ```

3. **Prompt Commands**: Use `/prompt` commands for guided assistance
   ```
   /prompt create_record_prompt model_name=res.partner
   /prompt export_records_prompt model_name=res.partner
   /prompt odoo_code_agent_prompt
   ```

The integration provides a seamless experience, allowing you to work with Odoo directly from Claude Desktop without switching between applications.

### Building from Source

If you want to build the package for distribution:

```bash
python -m pip install build
python -m build
```

This will create distribution packages in the `dist/` directory.

### Docker Support

The project includes comprehensive Docker support for development, testing, and production deployment.

#### Quick Start with Make

We provide a Makefile for common Docker operations:

```bash
# Set up required directories (logs, exports, tmp, data, generated_modules)
make setup

# Build Docker images
make build

# Start development environment
make dev

# Run tests
make test

# Run specific test categories
make test-mcp         # Run MCP server tests
make test-agent       # Run Odoo code agent tests
make test-utils       # Run Odoo code agent utilities tests
make test-export-import  # Run export/import agent tests

# Start production environment
make prod

# View logs
make logs

# Stop all services
make down

# Clean up everything
make clean
```

#### Docker Compose Configuration

The project includes multiple Docker Compose files for different environments:

- `docker-compose.yml`: Base configuration for all environments
- `docker-compose.override.yml`: Development-specific overrides (automatically used with `docker-compose up`)
- `docker-compose.prod.yml`: Production-specific configuration

#### Development Environment

For local development:

```bash
# Start all services in development mode
docker-compose up -d

# Or using the Makefile
make dev
```

This will:
- Mount your local code into the container for live development
- Enable debug mode and detailed logging
- Create required directories for logs, exports, and temporary files
- Set up appropriate environment variables

#### Production Deployment

For production deployment:

```bash
# Start production environment
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

# Or using the Makefile
make prod
```

Production mode includes:
- Multi-stage build for smaller image size
- Non-root user for better security
- Resource limits to prevent container resource exhaustion
- Health checks for better reliability
- Restart policies for automatic recovery
- Log rotation to prevent disk space issues
- Network isolation for better security

#### Container Architecture

The Docker setup includes three main services:

1. **mcp-server**: The main MCP server for integration with Claude Desktop
   - Exposes port 8000 for API access
   - Connects to Odoo via XML-RPC
   - Provides MCP tools for Claude Desktop

2. **standalone-server**: A standalone server for testing MCP tools
   - Exposes port 8001 for API access
   - Provides HTTP endpoints for testing MCP tools
   - Useful for development and testing without Claude Desktop

3. **test-runner**: A service for running automated tests
   - Runs function tests and tool tests
   - Validates the MCP server functionality
   - Useful for CI/CD pipelines

#### Environment Variables

You can customize the Docker environment by setting environment variables:

```bash
# In .env file or command line
ODOO_URL=http://your-odoo-server:8069
ODOO_DB=your_database
ODOO_USERNAME=your_username
ODOO_PASSWORD=your_password
GEMINI_API_KEY=your_gemini_api_key_here
GEMINI_MODEL=gemini-2.0-flash
BRAVE_API_KEY=your_brave_api_key_here
ODOO_DOCS_DIR="/Users/vinusoft85/workspace/odoo18_mcp_project/odoo_docs",
ODOO_INDEX_DIR="/Users/vinusoft85/workspace/odoo18_mcp_project/odoo_docs_index",
ODOO_DB_PATH="/Users/vinusoft85/workspace/odoo18_mcp_project/odoo_docs_index/embeddings.db"
MCP_DEBUG=true
MCP_LOG_LEVEL=DEBUG
```

#### Volume Management

The Docker setup includes several volumes for persistent data:

- `mcp_data`: Persistent data storage
- `mcp_logs`: Persistent logs storage
- `./exports`: Directory for exported files
- `./tmp`: Directory for temporary files
- `./generated_modules`: Directory for Odoo module files generated by the Odoo Module Generator

#### Health Checks

All services include health checks to ensure they're running properly:

```bash
# Check the heal

…

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [infovpcs](https://github.com/infovpcs)
- **Source:** [infovpcs/odoo18_mcp_project](https://github.com/infovpcs/odoo18_mcp_project)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-infovpcs-odoo18-mcp-project
- Seller: https://agentstack.voostack.com/s/infovpcs
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
