odoogen
by FoxPink-dev
README.md
# odoogen — MCP Server for Odoo 19 AI Code Generation
**odoogen** is a specialized MCP (Model Context Protocol) server that turns Cursor, Claude Code, or any MCP-compatible AI agent into an **elite Odoo 19 developer**. It enforces enterprise-grade code conventions across Python models, XML views, OWL components, and module manifests — eliminating the "AI hallucination tax" that plagues generic code generators.
## Why odoogen?
Generic AI code generators produce Odoo code that:
- ❌ Uses deprecated `@api.multi` or `_columns = {}`
- ❌ Generates XML `<xpath>` tags without required `expr` or `position`
- ❌ Builds OWL components without `static template` or proper registry patterns
- ❌ Creates `__manifest__.py` files missing critical keys like `license`, `installable`, or `application`
- ❌ Introduces jQuery in an OWL world
**odoogen fixes all of this** with 9 specialized tools and 22 validation rules.
## Features
### 9 Tools — Full Coverage from Model to Frontend
| Tool | What It Generates | File Type |
|------|------------------|-----------|
| `get_odoo_model_template` | Python model with fields, inherits, computed methods | `.py` |
| `get_odoo_view_template` | XML views (form, tree, kanban, search, activity) | `.xml` |
| `get_odoo_action_template` | Action window + menu item | `.xml` |
| `get_owl_component_js` | OWL 19 component with canvas rendering support | `.js` |
| `get_owl_xml_template` | QWeb template matching the OWL component | `.xml` |
| `get_owl_scss` | SCSS styles for the component | `.scss` |
| `get_owl_wrapper_js` | Registry wrapper to register the component | `.js` |
| `get_owl_client_action_xml` | Client action + menu item for the component | `.xml` |
| `validate_odoo_syntax` | Linter — 22 rules across Python, XML, manifest, JS | All |
### 22 Validation Rules (OD001–OD055)
| Code | Severity | Rule |
|------|----------|------|
| OD001 | warning | Missing `_description` in model |
| OD002 | error | Deprecated `@api.multi` |
| OD003 | warning | Raw domain instead of tuple syntax |
| OD011 | error | `<xpath>` missing `expr` |
| OD012 | error | `<xpath>` missing `position` |
| OD013 | error | Unclosed `</odoo>` tag |
| OD031 | error | Manifest missing `license` |
| OD032 | error | Deprecated `_columns` dict |
| OD033 | warning | Manifest missing `application` |
| OD034 | warning | Manifest missing `installable` |
| OD035 | info | Manifest missing `author` |
| OD036 | error | Manifest uses `update_xml` / `demo_xml` |
| OD038 | warning | Float used for time without explicit digits |
| OD039 | warning | Tree view missing `editable` |
| OD040 | info | Form view needs `<notebook>` grouping |
| OD041 | warning | Deprecated widget detected |
| OD051 | warning | OWL component not PascalCase |
| OD052 | error | OWL class doesn't extend Component |
| OD053 | info | OWL component missing `static props` |
| OD054 | warning | jQuery usage detected |
| OD055 | error | OWL component missing `static template` |
### Architecture
```
odoogen/
├── src/
│ ├── server.py # FastMCP app with stdio/SSE/HTTP transport
│ ├── tools/
│ │ ├── model_templates.py # Model + View + Action generators
│ │ └── owl_templates.py # OWL JS + XML template + SCSS generators
│ └── rules/
│ └── validators.py # 22-rule linter engine (OD001-OD055)
├── tests/
│ ├── run_all.py # Test runner (no pytest needed)
│ ├── test_model_templates.py
│ ├── test_owl.py
│ └── test_validators.py
├── Dockerfile # Python 3.12 slim
├── docker-compose.yml # Standalone + Odoo 19 integration mode
└── entrypoint.sh # Multi-transport launcher
```
## Quick Start
### 1. Pull & Run with Docker
```bash
docker pull foxpink/odoogen:latest
# stdio mode (for Cursor / Claude Code)
docker run -i --rm foxpink/odoogen:latest
# SSE mode (for remote access)
docker run -d --name odoogen -p 8000:8000 \
-e ODOO_MCP_TRANSPORT=sse \
foxpink/odoogen:latest
```
### 2. Configure in Cursor / Claude Code
Add to your MCP settings (`~/.config/Claude/claude_desktop_config.json` or Cursor → Settings → MCP):
```json
{
"mcpServers": {
"odoogen": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"${workspaceRoot}:/workspace",
"foxpink/odoogen:latest"
]
}
}
}
```
> Maps your project directory to `/workspace` inside the container — odoogen writes generated files directly to your Odoo addons folder.
### 3. One-Click Dev Loop
Open Cursor/Claude Code with the MCP server connected and run:
```
Generate a complete Odoo 19 module 'custom_addons/shipment_tracker'
with model, form view, action menu, and OWL dashboard component.
Validate all code using odoogen tools before writing files.
```
## Integration with Odoo 19
### Standalone Mode
```bash
docker compose up -d
```
### Merge with Existing Odoo 19 Instance
```bash
docker compose -f odoogen/docker-compose.yml -f odoo-dev/docker-compose.yml up -d
```
The shared volume `../odoo-dev/addons:/workspace/custom_addons` means:
1. AI generates code into the addons folder
2. Odoo auto-detects changes (`--dev reload`)
3. Zero latency dev loop
## Example Output
After running the full dev loop, a generated module looks like:
```
live_warehouse_map/
├── __manifest__.py # 10 keys + asset declarations
├── models/
│ └── stock_picking.py # Inherited model with 4 coordinate fields
├── security/
│ └── ir.model.access.csv
├── static/src/
│ ├── js/
│ │ ├── live_warehouse_map.js # OWL canvas component
│ │ └── live_warehouse_map_wrapper.js
│ ├── scss/
│ │ └── live_warehouse_map.scss # Enterprise dark theme
│ └── xml/
│ └── live_warehouse_map.xml # QWeb template
└── views/
├── stock_picking_views.xml # Form + kanban + action
└── live_warehouse_map_action.xml # Client action + menu
```
## Development
```bash
# Clone
git clone https://github.com/FoxPink/odoogen && cd odoogen
# Run tests
docker build -t odoogen:latest .
docker run --rm --entrypoint python odoogen:latest /app/tests/run_all.py
# Expected output: 18/18 passed
```
## License
Commercial license required for production use. Contact [FoxPink](https://github.com/FoxPink) for licensing.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessSyncing