Skip to main content
Glama
golfamigo

Odoo MCP Unified Server

by golfamigo
README.mdβ€’6.67 kB
# Odoo MCP Unified Server πŸš€ **Unified Odoo Model Context Protocol (MCP) Server** with dual transport support (stdio + SSE), enhanced business tools, and type-safe configuration management. ## ✨ Features ### πŸ”Œ Dual Transport Support - **stdio**: For Claude Desktop integration - **SSE**: For web deployment (Zeabur, Railway, etc.) - **No Supergateway needed!** ### πŸ› οΈ Complete Tool Set (17+ Tools) #### Core Tools (3) - `execute_method` - Execute any Odoo method (most powerful) - `search_employee` - Search for employees - `search_holidays` - Search for holidays/time-off #### Sales Tools (3) - `search_sales_orders` - Search sales orders - `create_sales_order` - Create new sales order - `analyze_sales_performance` - Analyze sales performance with trends #### Purchase Tools (3) - `search_purchase_orders` - Search purchase orders - `create_purchase_order` - Create new purchase order - `analyze_supplier_performance` - Analyze supplier on-time delivery #### Inventory Tools (2) - `get_stock_levels` - Get current stock levels - `predict_stock_needs` - Predict future stock needs #### Accounting Tools (2) - `get_financial_summary` - Get financial overview - `analyze_receivables` - Analyze accounts receivable ### πŸ“¦ Resources (4) - `odoo://models` - List all available models - `odoo://model/{model_name}` - Get model information - `odoo://record/{model_name}/{record_id}` - Get specific record - `odoo://search/{model_name}/{domain}` - Search records ### βš™οΈ Configuration Management - Type-safe configuration with Pydantic - Support for environment variables and JSON config - Validation on startup ## πŸš€ Quick Start ### For Claude Desktop (stdio mode) 1. **Install** ```bash cd E:\gitHub\odoo-mcp-unified python -m venv venv venv\Scripts\activate pip install -r requirements.txt pip install -e . ``` 2. **Configure** - Add to Claude Desktop config (`%APPDATA%\Claude\claude_desktop_config.json`): ```json { "mcpServers": { "odoo-unified": { "command": "E:\\gitHub\\odoo-mcp-unified\\venv\\Scripts\\python.exe", "args": ["E:\\gitHub\\odoo-mcp-unified\\run_server.py"], "env": { "ODOO_URL": "https://alpha-goods-corporation.odoo.com", "ODOO_DB": "alpha-goods-corporation", "ODOO_USERNAME": "your-username", "ODOO_PASSWORD": "your-password", "MCP_TRANSPORT": "stdio" } } } } ``` 3. **Restart Claude Desktop** ### For Zeabur Deployment (SSE mode) 1. **Connect GitHub repo to Zeabur** 2. **Set environment variables**: ``` ODOO_URL=https://your-company.odoo.com ODOO_DB=your-database ODOO_USERNAME=your-username ODOO_PASSWORD=your-password MCP_TRANSPORT=sse PORT=8000 ``` 3. **Deploy** - Zeabur will automatically: - Build using Dockerfile - Expose SSE endpoint at `/sse` - No Supergateway needed! ## πŸ“‹ Environment Variables ### Required - `ODOO_URL` - Odoo instance URL - `ODOO_DB` - Database name - `ODOO_USERNAME` - Username - `ODOO_PASSWORD` - Password ### Optional - `MCP_TRANSPORT` - Transport mode: `stdio` or `sse` (default: `stdio`) - `ODOO_TIMEOUT` - Request timeout in seconds (default: `60`) - `ODOO_VERIFY_SSL` - Verify SSL certificates (default: `false`) - `PORT` - Server port for SSE mode (default: `8000`) - `HOST` - Server host for SSE mode (default: `0.0.0.0`) - `LOG_LEVEL` - Logging level (default: `INFO`) ## πŸ“– Usage Examples ### Execute Any Odoo Method ```python # Get product.product records execute_method( model="product.product", method="search_read", args=[], kwargs={"fields": ["name", "list_price"], "limit": 10} ) ``` ### Analyze Sales Performance ```python analyze_sales_performance( params={ "start_date": "2024-01-01", "end_date": "2024-12-31", "group_by": "month" } ) ``` ### Check Supplier Performance ```python analyze_supplier_performance( params={ "supplier_id": 123, "start_date": "2024-01-01", "end_date": "2024-12-31" } ) ``` ## πŸ—οΈ Project Structure ``` odoo-mcp-unified/ β”œβ”€β”€ src/odoo_mcp/ β”‚ β”œβ”€β”€ __init__.py β”‚ β”œβ”€β”€ __main__.py β”‚ β”œβ”€β”€ server.py # Main MCP server β”‚ β”œβ”€β”€ config.py # πŸ†• Configuration management β”‚ β”œβ”€β”€ odoo_client.py # Odoo XML-RPC client β”‚ β”œβ”€β”€ extensions.py # Extension registration β”‚ β”œβ”€β”€ models.py # Pydantic models β”‚ β”œβ”€β”€ prompts.py # MCP prompts β”‚ β”œβ”€β”€ resources.py # MCP resources β”‚ β”œβ”€β”€ tools_sales.py # Sales tools β”‚ β”œβ”€β”€ tools_purchase.py # Purchase tools β”‚ β”œβ”€β”€ tools_inventory.py # Inventory tools β”‚ └── tools_accounting.py # Accounting tools β”œβ”€β”€ run_server.py # πŸ†• Unified server runner (stdio + SSE) β”œβ”€β”€ requirements.txt # Fixed FastMCP version β”œβ”€β”€ pyproject.toml β”œβ”€β”€ Dockerfile # πŸ†• Zeabur-ready └── README.md ``` ## πŸ”§ Development ### Run Tests ```bash pytest tests/ ``` ### Run Server Locally (stdio) ```bash export ODOO_URL=https://your-company.odoo.com export ODOO_DB=your-database export ODOO_USERNAME=your-username export ODOO_PASSWORD=your-password python run_server.py ``` ### Run Server Locally (SSE) ```bash export MCP_TRANSPORT=sse export PORT=8000 python run_server.py # Access: http://localhost:8000/sse ``` ## πŸ› Troubleshooting ### βœ… Using Latest Stable Versions This project uses the **latest stable versions** of FastMCP (>=0.7.0) and MCP (>=1.0.0): - Modern FastMCP API without deprecated parameters - Enhanced performance and stability - Latest features and improvements ### SSL Certificate Error If you see SSL errors: ```bash export ODOO_VERIFY_SSL=false ``` ### Connection Timeout Increase timeout: ```bash export ODOO_TIMEOUT=120 ``` ## πŸ“¦ What's New in v2.0 ### πŸ†• Compared to odoo-mcp-improved - βœ… SSE Transport support (Zeabur deployment without Supergateway) - βœ… Unified config.py module (type-safe configuration) - βœ… Dual transport mode in single codebase - βœ… Enhanced documentation ### πŸ†• Compared to mcp-odoo - βœ… All basic features (execute_method, resources) - βœ… 12+ additional business tools - βœ… Extension system - βœ… SSE support - βœ… Better error handling ## πŸ“„ License MIT License ## 🀝 Contributing Contributions welcome! Please open an issue or PR. ## πŸ”— Links - [Model Context Protocol](https://modelcontextprotocol.io/) - [Odoo Documentation](https://www.odoo.com/documentation/) - [FastMCP](https://github.com/jlowin/fastmcp) --- **Made with ❀️ for Alpha Goods Corporation**

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/golfamigo/odooMcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server