MCP Odoo
A TypeScript middleware that connects to Odoo via XML-RPC and provides HTTP API endpoints for querying leads, customers, and activities. Enables integration with orchestrators and LLM systems to interact with Odoo data through natural language.
README
MCP Odoo — Middleware (TypeScript)
Mục đích
- Một MCP (middleware) nhỏ viết bằng TypeScript để kết nối tới Odoo (XML-RPC) và expose API HTTP cho các tác vụ phổ biến:
- Truy vấn Lead (crm.lead)
- Truy vấn Customer (res.partner)
- Truy vấn Activities (mail.activity)
Kiến trúc ngắn gọn
src/odooService.ts: wrapper XML-RPC cho Odoo (authenticate + execute_kw + helpers).src/server.ts: Express API endpoints cho các truy vấn.bin/workers-mcp.CMDvàbin/workers-mcp.js: launcher để gọidist/server.jstheo kiểu mà orchestrator (ví dụ Claude worker runner) yêu cầu.
Yêu cầu
- Node.js (>= 18 recommended)
- npm
Cấu hình (environment)
- Copy file
.env.example->.envrồi điền các giá trị sau:- URL_ODOO: URL Odoo (ví dụ https://app.x-or.cloud)
- PORT_ODOO: port (thường 443)
- DBNAME_ODOO: tên database Odoo
- USERNAME_ODOO: username Odoo
- PASSWORD_ODOO: password Odoo
- MCP_PORT: (tuỳ chọn) port để server nghe, default 3000
- (Tuỳ chọn nếu dùng LLM/Discord) LLM_API_KEY, LLM_MODEL, DISCORD_WEBHOOK_URL
Cài đặt & build
- Cài dependency và build TypeScript:
cd "C:\Project\MCP Odoo"
npm install
npm run build
- Sau khi build sẽ có
dist/server.js.
Chạy server (local/test)
- Chạy trực tiếp:
node dist/server.js
- Hoặc dùng launcher CMD (nếu bạn muốn truyền args theo format orchestrator):
& "C:\Project\MCP Odoo\bin\workers-mcp.CMD" run mcp-demo https://mcp-demo.mcpdemo.workers.dev "C:\Project\MCP Odoo"
Chạy production (gợi ý)
- Dùng PM2 (cross-platform):
npm install -g pm2
pm2 start dist/server.js --name mcp-odoo -- run mcp-demo https://mcp-demo.mcpdemo.workers.dev "C:\Project\MCP Odoo"
pm2 save
- Hoặc trên Windows dùng nssm để tạo service chạy node
dist/server.js.
MCP launcher / tích hợp với orchestrator
- Trong một số hệ thống, orchestrator sẽ gọi một command kèm args giống ví dụ bạn đưa. Project này cung cấp hai file trong
bin/:workers-mcp.CMD: shim cho Windows, chạydist/server.jsvới các arg.workers-mcp.js: launcher Node.js (UNIX/Windows friendly).
- Ví dụ cấu hình orchestrator (JSON):
{
"mcpServers": {
"mcp-demo": {
"command": "C:\\Project\\MCP\\mcp-demo\\bin\\workers-mcp.CMD",
"args": [
"run",
"mcp-demo",
"https://mcp-demo.mcpdemo.workers.dev",
"C:\\Project\\MCP\\mcp-demo"
],
"env": {}
}
}
}
Ghi chú: bạn có thể thay đổi command để trỏ trực tiếp tới node dist/server.js nếu thích.
Endpoints hiện có
- GET /mcp/leads?limit=10&offset=0
- query params: domain (JSON-encoded), fields (JSON-encoded), limit, offset
- GET /mcp/customers?limit=10
- GET /mcp/activities?limit=10
Ví dụ gọi:
curl "http://localhost:3000/mcp/leads?limit=5"
Bảo mật
- Không commit
.envhoặc API keys vào git..gitignoređã được thêm. - Đặt biến môi trường trên server (System Environment) khi chạy như service.
Troubleshooting
- Nếu thiếu
dist/server.js: chạynpm run build. - Nếu lỗi kết nối Odoo: kiểm tra
URL_ODOO,DBNAME_ODOO, username/password, và network/firewall. - Nếu orchestrator không tìm thấy
workers-mcp.CMD: sửacommandtrỏ tớibin\\workers-mcp.CMDtrong repo hoặc copy shim vàonode_modules\\.bin.
Các việc tiếp theo (gợi ý)
- Thêm endpoint health
/mcp/healthđể orchestrator kiểm tra trạng thái. - Thêm caching cho uid Odoo để tránh authenticate mỗi lần gọi.
- Thêm adapter LLM (OpenAI/Claude) nếu muốn xử lý văn bản/tóm tắt; hoặc tích hợp Discord webhook (đã có code mẫu trước đó nếu bạn cần tôi phục hồi).
Liên hệ
- Nếu muốn tôi thêm
/mcp/healthvà đọc args từ launcher (MCP name / public URL / root), nói "thêm health"; tôi sẽ cập nhật và build.
MCP Odoo TypeScript Client
Simple TypeScript wrapper to query Leads, Customers, and Activities from an Odoo instance via XML-RPC.
Usage:
- Copy
.env.exampleto.envand fill values. - npm install
- npm run build
- npm start
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.