Odoo 18 MCP Server
by deevando
README.md
# Odoo 18 MCP Server
An [MCP](https://modelcontextprotocol.io) server that connects an AI assistant (such as Claude) directly to **Odoo 18** to create and manage sales quotations ("presupuestos").
Uses Odoo's official [External API](https://www.odoo.com/documentation/18.0/developer/reference/external_api.html) (XML-RPC), so it works with any stock Odoo 18 instance — no extra Odoo modules required.
Compatible with:
- ✅ Odoo 18 Online (Odoo Cloud)
- ✅ Odoo 18 On-Premise (self-hosted)
- ✅ Odoo 18 Development (local)
- ✅ Custom fields/models added via Odoo Studio (as long as they're on `sale.order` / `sale.order.line` / `res.partner`, add them to the tool code)
This repository contains **no credentials**. Every user configures their own Odoo URL, database and API key locally (via `installer.py`, environment variables, or their MCP host's configuration screen).
---
## Tools provided
| Tool | What it does |
|---|---|
| `check_odoo_connection` | Verifies the connection/authentication and reports the Odoo server version |
| `create_quotation` | Creates a new quotation for a customer, with one or more lines |
| `list_quotations` | Lists recent draft/sent quotations, optionally filtered by customer |
| `get_quotation` | Returns full details (including lines) of one quotation |
| `update_quotation` | Appends lines and/or updates the note on an existing quotation |
---
## Setup
### 1. Get your Odoo API key
In Odoo: **Settings → Users & Companies → Users → (your user) → Account Security tab → API Keys → New API Key**.
Use this key instead of your account password — it can be revoked independently at any time.
### 2. Install dependencies
```bash
git clone https://github.com/YOUR_USERNAME/odoo18-mcp-server.git
cd odoo18-mcp-server
pip install -r requirements.txt
```
### 3. Configure your connection
Either run the interactive installer:
```bash
python installer.py
```
...or copy `.env.example` to `.env` and fill in the values yourself, or export the same variables directly in your shell / MCP host configuration:
```bash
ODOO_URL=https://your-company.odoo.com
ODOO_DB=your_database_name
ODOO_USERNAME=you@example.com
ODOO_API_KEY=your_api_key_here
```
`.env` is listed in `.gitignore` and is never uploaded by this project.
### 4. Run it
```bash
python odoo_mcp_server.py
```
By default this starts the server on **stdio**, ready to be used by a local MCP client (Claude Desktop, Claude Code, etc.).
When a `PORT` environment variable is set (as hosting platforms like MCPmarket do automatically), the server instead serves the **streamable-http** MCP transport on `0.0.0.0:$PORT`, mounted at `/mcp` — this is what lets a hosted deployment expose an HTTPS endpoint. You can force either mode explicitly with `MCP_TRANSPORT=stdio` or `MCP_TRANSPORT=streamable-http`.
---
## Connecting to Claude
**Claude Desktop / Claude Code** (local stdio server): add to your MCP config, pointing `command`/`args` at `python odoo_mcp_server.py` in this folder, with the four environment variables above set either in your shell or in the MCP config's `env` block.
**A hosted MCP directory (e.g. MCPMarket)**: point it at this GitHub repository URL, then fill in `ODOO_URL`, `ODOO_DB`, `ODOO_USERNAME` and `ODOO_API_KEY` in its own configuration screen — never inside the repo itself.
Once connected, you can ask Claude things like:
```
Create a quotation in Odoo 18 for John Smith:
- Diagnostics: 50
- Repair: 105
```
```
List my open quotations
```
---
## Security
- ✅ Repository is public and contains **no credentials**.
- ✅ Credentials live only in your local `.env` (git-ignored) or your MCP host's own secret storage.
- ✅ Uses an Odoo **API key**, not your account password — revoke it any time from Odoo without changing your login password.
- ✅ Rotate your API key periodically (Settings → Users & Companies → Users → API Keys).
---
## Troubleshooting
**"Odoo authentication failed"**
Double-check `ODOO_DB` (exact database name), `ODOO_USERNAME` and `ODOO_API_KEY`. Try `check_odoo_connection` first.
**Connection refused / timeout**
Verify `ODOO_URL` (include `:8069` for on-premise instances that need it) and that the Odoo server is reachable from wherever this server runs.
**"Missing required environment variable(s)"**
Run `python installer.py`, or set the four `ODOO_*` variables manually before starting the server.
---
## Development
```bash
# Edit odoo_mcp_server.py
# Run locally to test
ODOO_URL=... ODOO_DB=... ODOO_USERNAME=... ODOO_API_KEY=... python odoo_mcp_server.py
git add .
git commit -m "Update: description"
git push
```
## License
MIT
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues