MCP Odoo Server

MCP Odoo Server

Enables AI assistants to interact with Odoo databases via XML-RPC and JSON-RPC for performing CRUD operations and managing modules. It supports advanced features like domain-based searching, field metadata inspection, and administrative task execution.

Category
访问服务器

README

MCP Odoo Server

A Model Context Protocol (MCP) server for connecting to Odoo databases via XML-RPC and JSON-RPC. This server enables AI assistants and other MCP clients to interact with Odoo databases, performing CRUD operations, managing modules, and executing administrative tasks.

Features

  • Database Connection: Connect to any Odoo instance using host, database name, username, and API key
  • CRUD Operations: Create, Read, Update, and Delete records in any Odoo model
  • Search & Query: Powerful search capabilities with domain filters
  • Module Management: Install, uninstall, and upgrade Odoo modules
  • Field Inspection: Get detailed field definitions and metadata
  • Access Control: Check user permissions for operations
  • Version Info: Get Odoo server version and capabilities

Installation

  1. Navigate to the MCP server directory:
cd mcp-odoo-server
  1. Install dependencies:
npm install
  1. Build the TypeScript code:
npm run build

Configuration

MCP Client Configuration

Add this server to your MCP client configuration (e.g., Claude Desktop):

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "odoo": {
      "command": "node",
      "args": [
        "/Users/malvernbright/development/Odoo/odoo-17.0+e.20251121/mcp-odoo-server/build/index.js"
      ]
    }
  }
}

Odoo API Key

  1. Log into your Odoo instance
  2. Go to SettingsUsers & CompaniesUsers
  3. Open your user record
  4. Go to the Preferences tab
  5. Click New API Key button
  6. Copy the generated API key (you'll use this as the password)

Usage

1. Connect to Odoo Database

First, establish a connection to your Odoo database:

// Parameters
{
  host: "localhost",           // or "example.odoo.com"
  database: "mydb",
  username: "admin@example.com",
  apiKey: "your-api-key-here",
  port: 8069,                  // optional, default: 8069
  protocol: "http"             // optional, default: "http", can be "https"
}

2. Search Records

Search for records matching specific criteria:

// Find all customers named "John"
{
  model: "res.partner",
  domain: [["name", "ilike", "John"], ["customer_rank", ">", 0]],
  limit: 10,
  order: "name ASC"
}

3. Search and Read Records

Get full record data in one call:

{
  model: "sale.order",
  domain: [["state", "=", "sale"]],
  fields: ["name", "partner_id", "amount_total", "date_order"],
  limit: 20
}

4. Read Specific Records

Read records by their IDs:

{
  model: "res.partner",
  ids: [1, 2, 3],
  fields: ["name", "email", "phone"]
}

5. Create Records

Create a new record:

{
  model: "res.partner",
  values: {
    name: "New Customer",
    email: "customer@example.com",
    phone: "+1234567890",
    is_company: true
  }
}

6. Update Records

Update existing records:

{
  model: "res.partner",
  ids: [123],
  values: {
    phone: "+0987654321",
    street: "123 Main St"
  }
}

7. Delete Records

Delete records:

{
  model: "res.partner",
  ids: [123, 456]
}

8. Get Field Definitions

Inspect model fields:

{
  model: "sale.order",
  fields: ["state", "amount_total"],  // empty array for all fields
  attributes: ["string", "type", "required", "help"]
}

9. Module Management

Install a module:

{
  module_name: "sale_management";
}

Uninstall a module:

{
  module_name: "sale_management";
}

Upgrade a module:

{
  module_name: "sale_management";
}

List installed modules:

{
  limit: 50;
}

Available Tools

Tool Description
odoo_connect Connect to an Odoo database
odoo_search Search for record IDs matching criteria
odoo_search_read Search and read records in one call
odoo_read Read specific records by ID
odoo_create Create a new record
odoo_write Update existing records
odoo_delete Delete records
odoo_fields_get Get field definitions for a model
odoo_execute Execute any method on a model (advanced)
odoo_version Get Odoo server version info
odoo_check_access_rights Check user permissions
odoo_get_installed_modules List installed modules
odoo_install_module Install a module
odoo_uninstall_module Uninstall a module
odoo_upgrade_module Upgrade a module

Odoo Domain Syntax

Domains use Polish notation (prefix notation) and consist of tuples:

# Simple conditions
[["field_name", "operator", "value"]]

# Multiple conditions (AND by default)
[["name", "ilike", "John"], ["age", ">", 18]]

# OR operator
["|", ["name", "=", "John"], ["name", "=", "Jane"]]

# NOT operator
["!", ["active", "=", False]]

# Complex example
["|", "&", ["name", "ilike", "John"], ["age", ">", 18], ["vip", "=", True]]

Common Operators

  • = - equals
  • != - not equals
  • > - greater than
  • >= - greater than or equal
  • < - less than
  • <= - less than or equal
  • like - SQL LIKE
  • ilike - case-insensitive LIKE
  • in - in a list
  • not in - not in a list
  • child_of - child of (hierarchical)
  • parent_of - parent of (hierarchical)

Common Odoo Models

Model Description
res.partner Contacts and Companies
res.users Users
sale.order Sales Orders
purchase.order Purchase Orders
account.move Journal Entries (Invoices)
stock.picking Transfers/Deliveries
product.product Products (variants)
product.template Product Templates
ir.module.module Installed Modules
res.company Companies
hr.employee Employees

Development

Watch Mode

For development with auto-rebuild:

npm run watch

Run in Development

npm run dev

Troubleshooting

Connection Issues

  1. Check Odoo is running: Ensure your Odoo server is accessible
  2. Verify credentials: Make sure the API key is valid
  3. Check firewall: Ensure port 8069 (or your custom port) is accessible
  4. Protocol: Use http for local development, https for production

Authentication Errors

  • Verify your API key is correct
  • Ensure the user has sufficient permissions
  • Check that the database name is correct

Module Installation Issues

  • Only users with admin rights can install modules
  • Some modules have dependencies that must be installed first
  • Check the Odoo logs for detailed error messages

Integration with odoo.conf

While this MCP server uses XML-RPC for remote connections, your local odoo.conf file is used to configure the Odoo server itself. Here's how they work together:

odoo.conf (for Odoo Server)

[options]
db_host = localhost
db_port = 5432
db_user = odoo
db_password = your_postgres_password
db_name = False

MCP Server (for Remote Access)

The MCP server connects to a running Odoo instance (which may be local or remote) using the XML-RPC API, similar to how the Odoo web interface or mobile apps connect.

Security Notes

  • API Keys: Never commit API keys to version control
  • Access Control: The MCP server respects Odoo's security rules and access rights
  • HTTPS: Always use HTTPS in production environments
  • Permissions: Operations are limited by the authenticated user's permissions

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选