A Model Context Protocol (MCP) server that connects to Odoo v18 databases via XML-RPC to extract sales information for LLM interactions.
- π XML-RPC Connection: Direct connection to Odoo v18 via XML-RPC API
- π Sales Data Extraction: Extract sales orders with flexible domain filtering
- π Advanced Filtering: Support for custom Odoo domain filters
- π Sales Analytics: Get sales statistics and summaries
- β Data Validation: Comprehensive input validation using Zod
- π MCP Inspector: Built-in testing support
Extract sales orders from Odoo with optional filtering.
Parameters:
domain(optional): Odoo domain filter as JSON stringlimit(optional): Maximum records to return (default: 100)offset(optional): Records to skip (default: 0)fields(optional): Comma-separated list of fields
Default behavior: Returns confirmed sales orders only (state = 'sale')
Get detailed information for a specific sales order.
Parameters:
order_id(required): Sales order IDinclude_lines(optional): Include order lines (default: true)
Get sales statistics and summaries.
Parameters:
date_from(optional): Start date (YYYY-MM-DD)date_to(optional): End date (YYYY-MM-DD)group_by(optional): Group by field (user_id, team_id, state, partner_id)
git clone [repository-url]
cd odoo-mcp
npm installCopy the environment template and fill in your Odoo credentials:
cp .env.example .envEdit .env:
ODOO_URL=<https://your-odoo-instance.com>
ODOO_DATABASE=your_database_name
ODOO_USERNAME=your_username
ODOO_API_KEY=your_api_keyNote: API keys are more secure than passwords. Generate an API key in Odoo:
- Go to Settings > Users & Companies > Users
- Select your user
- Go to API Keys tab
- Generate a new API key
npm run buildRun the server in development mode with hot reload:
npm run devBuild and run the compiled server:
npm run build
npm startUse the MCP Inspector to test your server before integrating with Claude:
npm run inspectorThis will launch the MCP Inspector where you can:
- Test tool calls
- Inspect responses
- Debug connection issues
Add this server to your Claude configuration:
{
"mcpServers": {
"odoo-sales": {
"command": "node",
"args": ["/path/to/odoo-mcp/dist/server.js"],
"env": {
"ODOO_URL": "<https://your-odoo-instance.com>",
"ODOO_DATABASE": "your_database_name",
"ODOO_USERNAME": "your_username",
"ODOO_API_KEY": "your_api_key"
}
}
}
}Get all confirmed sales orders from this month
Get sales orders for customer "John Smith" that are in draft state
The LLM will automatically construct the appropriate domain filter:
[["partner_id", "ilike", "John Smith"], ["state", "=", "draft"]]Show me sales statistics for the last quarter grouped by salesperson
odoo-mcp/
βββ src/
β βββ clients/
β β βββ odoo-client.ts # XML-RPC client for Odoo
β βββ tools/
β β βββ sales-orders.ts # Sales order tools implementation
β βββ types/
β β βββ odoo.ts # TypeScript interfaces
β βββ server.ts # Main MCP server
βββ dist/ # Compiled JavaScript
βββ package.json
βββ tsconfig.json
βββ .env.example
βββ README.md
- Node.js: 18+
- Odoo: v18 (may work with older versions)
- XML-RPC Access: Odoo instance must allow XML-RPC connections
The server includes comprehensive error handling for:
- Invalid Odoo credentials
- Network connection issues
- Invalid domain filters
- Missing required parameters
- Zod validation errors
- XML-RPC vs HTML response detection
- Automatic URL correction suggestions
- Detailed diagnostic information
When connection issues occur, the server now provides:
- HTTP Endpoint Testing: Verifies if the endpoint is reachable
- Content-Type Validation: Detects if server returns HTML instead of XML-RPC
- URL Suggestions: Provides corrected URLs for common configuration mistakes
- Specific Error Guidance: Explains what each error means and how to fix it
Server returned HTML instead of XML-RPC response (found <TITLE> tag).
Endpoint returns Content-Type: text/html
This suggests:
1. URL might be pointing to Odoo web interface instead of XML-RPC endpoint
2. XML-RPC might be disabled on this Odoo instance
3. Authentication might be required at web server level
4. Wrong port or path
Try these URLs in your .env file:
1. ODOO_URL=https://your-domain.com:8069
2. ODOO_URL=https://your-domain.com/odoo
3. ODOO_URL=https://your-domain.com/web
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details
FReptar0