内容
# Odoo MCP
TypeScript MCP server built with `mcp-use` for Odoo 19 External JSON-2 API.
## Documentation
See [docs/SUMMARY.md](docs/SUMMARY.md) for architecture, codebase, code standard, and project context docs.
## Open Source
This project is licensed under the [MIT License](LICENSE).
See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines and [SECURITY.md](SECURITY.md) for vulnerability reporting.
## Configuration
Create `.env` or export these variables:
```bash
ODOO_URL=https://your-odoo.example.com
ODOO_API_KEY=your-api-key
ODOO_DB=your-database-name
```
Optional:
```bash
PORT=3000
MCP_URL=http://localhost:3000
ODOO_CONTEXT={"lang":"en_US"}
ODOO_MCP_MODELS=product.template,product.product,res.partner,sale.order
ODOO_MCP_ALLOW_WRITE=true
ODOO_MCP_ENABLE_METHOD_CALLS=true
```
Write tools are registered but refuse to run unless `ODOO_MCP_ALLOW_WRITE=true`.
The generic method caller refuses to run unless `ODOO_MCP_ENABLE_METHOD_CALLS=true`.
## Run
```bash
npm install
npm run dev
```
Open the inspector at [http://localhost:3000/inspector](http://localhost:3000/inspector).
## Tools
Read tools:
- `odoo_status`
- `list_models`
- `list_resource_templates`
- `get_model_fields`
- `search_records`
- `get_record`
- `count_records`
- `aggregate_records`
Write and escape-hatch tools:
- `create_record`
- `update_record`
- `delete_record`
- `call_model_method`
## Resources
Static resource:
- `odoo://config`
Resource templates:
- `odoo://{model}/record/{id}`
- `odoo://{model}/fields`
- `odoo://{model}/search`
- `odoo://{model}/count`
Products are accessed through the same generic model surface, using models like
`product.template` or `product.product`.
## JSON-2 Notes
The server calls Odoo using:
- `POST /json/2/<model>/<method>`
- `Authorization: bearer <ODOO_API_KEY>`
- `X-Odoo-Database: <ODOO_DB>` when `ODOO_DB` is configured
- JSON bodies with named method arguments such as `domain`, `fields`, `ids`, and `context`
Reference: [Odoo 19 External JSON-2 API](https://www.odoo.com/documentation/19.0/developer/reference/external_api.html).