odoo-mcp

odoo-mcp

Enables AI agents to interact with Odoo 19 via JSON-2 API, supporting CRUD operations on Odoo models through MCP tools.

Category
访问服务器

README

odoo-mcp

Docker-first FastMCP server for Odoo 19 JSON-2 integrations.

odoo-mcp exposes Odoo as an MCP server over both HTTP and stdio. It uses the Odoo 19 external JSON-2 API only:

POST /json/2/<model>/<method>
Authorization: bearer <ODOO_API_KEY>
X-Odoo-Database: <optional database>

Legacy XML-RPC and JSON-RPC are intentionally out of scope.

Status

This is an early implementation with a strong v1 foundation:

  • FastMCP 3.2.4
  • Docker Compose first
  • HTTP and stdio transports
  • lazy Odoo credential loading so MCP discovery works before secrets are present
  • guarded write operations with confirm=True
  • generic Odoo tools
  • comprehensive CRM tool pack
  • resources and prompts for safe Odoo work
  • pytest, ruff, mypy, and GitHub Actions CI

Quick Start With Docker

Copy the environment template and edit the Odoo values:

cp .env.example .env

Required for real Odoo calls:

ODOO_URL=https://your-odoo-host.example.com
ODOO_API_KEY=your-odoo-api-key
ODOO_DATABASE=your-database-if-needed

Start the HTTP server:

docker compose up --build

The default MCP endpoint is:

http://localhost:8000/mcp

Check local process readiness:

docker compose exec odoo-mcp uv run --no-sync odoo-mcp healthcheck

Local Development

Install dependencies:

uv sync

Run the full gate:

uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run mypy src

Run HTTP locally:

uv run odoo-mcp http --host 0.0.0.0 --port 8000 --path /mcp

Run stdio locally:

uv run odoo-mcp stdio

Inspect sanitized config:

uv run odoo-mcp inspect-config

MCP Client Config

Stdio example:

{
  "mcpServers": {
    "odoo": {
      "command": "uv",
      "args": ["run", "odoo-mcp", "stdio"],
      "env": {
        "ODOO_URL": "https://your-odoo-host.example.com",
        "ODOO_API_KEY": "your-odoo-api-key",
        "ODOO_DATABASE": "your-database-if-needed"
      }
    }
  }
}

HTTP clients should connect to /mcp. If the server is exposed beyond a trusted network, set MCP_AUTH_MODE=static or MCP_AUTH_MODE=jwt.

Configuration

Variable Purpose
ODOO_URL Base URL for Odoo 19 JSON-2 calls.
ODOO_API_KEY Odoo API key sent as Authorization: bearer ....
ODOO_DATABASE Optional Odoo database header.
ODOO_TIMEOUT_SECONDS HTTP timeout for Odoo calls. Defaults to 30.
ODOO_ALLOWED_GENERIC_METHODS Comma-separated allowlist for otherwise blocked generic methods.
ODOO_CRM_OPTIONAL_FEATURES Comma-separated optional CRM features to expose.
MCP_AUTH_MODE none, static, or jwt. Defaults to none.
MCP_STATIC_TOKEN Bearer token for MCP_AUTH_MODE=static.
JWT_JWKS_URI JWKS URL for MCP_AUTH_MODE=jwt.
JWT_PUBLIC_KEY Public key alternative for JWT verification.
JWT_ISSUER Optional expected JWT issuer.
JWT_AUDIENCE Optional expected JWT audience.
JWT_REQUIRED_SCOPES Optional comma-separated JWT scopes.
MCP_HTTP_HOST HTTP bind host. Defaults to 0.0.0.0.
MCP_HTTP_PORT HTTP bind port. Defaults to 8000.
MCP_HTTP_PATH MCP endpoint path. Defaults to /mcp.
MCP_LOG_LEVEL HTTP server log level. Defaults to info.

Tool Catalog

Generic Odoo tools:

  • odoo_search_read
  • odoo_read
  • odoo_create
  • odoo_write
  • odoo_unlink
  • odoo_action
  • odoo_call_method
  • odoo_current_user
  • odoo_model_fields
  • odoo_list_models

CRM tools:

  • leads and opportunities: crm_list_leads, crm_get_lead, crm_create_lead, crm_update_lead, crm_assign_lead
  • pipeline: crm_list_pipeline_stages, crm_move_lead_to_stage, crm_pipeline_report
  • won/lost lifecycle: crm_mark_won, crm_mark_lost, crm_restore_lead, crm_list_lost_reasons
  • conversion and merge: crm_convert_lead_to_opportunity, crm_merge_opportunities
  • activities: crm_schedule_activity, crm_mark_activity_done, crm_list_activities, crm_list_activity_types, crm_activity_report
  • teams and scoring: crm_list_teams, crm_update_lead_score
  • optional features: crm_enrich_lead, crm_list_scoring_rules, crm_recurring_revenue_report

Optional CRM tools are registered only when their feature key is listed in ODOO_CRM_OPTIONAL_FEATURES.

Resources And Prompts

Resources:

  • odoo://server/info
  • odoo://user/context
  • odoo://model/{model}/fields
  • odoo://crm/pipeline/summary

Prompts:

  • odoo_safe_operation
  • odoo_crm_pipeline_review
  • odoo_record_change_plan

Safety Model

Odoo remains the final authorization layer through its access rights and record rules. The MCP server adds local guardrails:

  • mutating Odoo client calls require confirm=True
  • generic dangerous methods such as call_kw and execute_kw are blocked unless explicitly allowlisted
  • HTTP MCP auth is separate from the server-side Odoo API key
  • inspect-config redacts secrets
  • Odoo API errors redact configured secret values

Use MCP_AUTH_MODE=static for simple private HTTP deployments:

MCP_AUTH_MODE=static
MCP_STATIC_TOKEN=change-me

Use MCP_AUTH_MODE=jwt with JWT_JWKS_URI or JWT_PUBLIC_KEY for production identity-provider-backed deployments.

Extending

Add module packs under src/odoo_mcp/tools/ and register them from src/odoo_mcp/server.py. Prefer typed, curated tools for business workflows and leave odoo_call_method as the explicit escape hatch.

When adding new Odoo workflows:

  1. Write tests first with mocked Odoo JSON-2 behavior.
  2. Prefer single-call Odoo methods like search_read because each JSON-2 call is its own transaction.
  3. Require confirm=True for writes, actions, posting, validation, archive, and delete operations.
  4. Add focused README entries for new tools and optional feature flags.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选