Files

55 lines
2.2 KiB
Markdown

# Odoo Plugin Creation
Claude Cowork plugin that connects to MPM's Odoo V18 instance at [mpmedia.odoo.com](https://mpmedia.odoo.com) via the XML-RPC API. No Odoo-side modules required — upgrade safe.
## Modules Covered
| Module | Odoo Model(s) | Tools |
|--------|--------------|-------|
| Products | `product.template`, `product.product` | search, get, stock levels |
| Knowledge | `knowledge.article` | search, get, create, update |
| Contacts | `res.partner` | search, get, create |
| Sales | `sale.order` | search, get, create |
| CRM | `crm.lead` | search, get, create, update, list stages |
| Project | `project.project`, `project.task` | list, get, search tasks, create/update tasks |
| Helpdesk | `helpdesk.ticket` | search, get, create, update, list teams |
| Purchase | `purchase.order` | search, get (with line items) |
| Inventory | `stock.quant`, `stock.move` | search stock, moves, list locations |
| Employees | `hr.employee`, `hr.department` | search, get, list departments |
## Architecture
- **Transport**: stdio (local Python process)
- **API**: Odoo XML-RPC at `/xmlrpc/2/` — no Odoo module needed
- **Auth**: API key (generated per-user in Odoo profile → Account Security)
- **Compatible**: Odoo V18 now; V19 JSON/2 API migration path available
## Configuration
Credentials are stored in `.mcp.json` under the `env` block:
```json
{
"ODOO_URL": "https://mpmedia.odoo.com",
"ODOO_DB": "mpmedia-odoo-sh-main-13285275",
"ODOO_USERNAME": "bgilliom@mpmedia.tv",
"ODOO_API_KEY": "your-api-key-here"
}
```
To rotate the API key: generate a new one in Odoo (My Profile → Account Security → API Keys), update `.mcp.json`, and rebuild the `.plugin` file.
## Rebuilding the Plugin
After making changes to `server/odoo_mcp.py`, `skills/`, or `.mcp.json`:
```bash
cd /path/to/odoo-mpm && zip -r odoo-mpm.plugin . -x "*.DS_Store" -x "__pycache__/*" -x "*.pyc" -x ".git/*"
```
Then reinstall the `.plugin` file in Cowork.
## V19 Upgrade Notes
When upgrading to Odoo V19, the XML-RPC endpoint remains available (removal scheduled for V22). To migrate to the new JSON/2 API, replace the `_connect()` and `_call()` functions in `server/odoo_mcp.py` with HTTP requests to `/json/2/<model>/<method>` using Bearer token auth.