Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

API Reference

Internal API documentation for odoo-rust-mcp developers.


MCP Protocol Methods

initialize

Called by clients to establish a session.

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2025-03-26",
    "clientInfo": {
      "name": "cursor",
      "version": "1.0.0"
    }
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "protocolVersion": "2025-03-26",
    "serverInfo": {
      "name": "odoo-rust-mcp",
      "version": "0.5.0"
    },
    "capabilities": {
      "tools": {},
      "prompts": {},
      "resources": {}
    }
  }
}

tools/list

List available tools.

Request:

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/list"
}

Response:

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "tools": [
      {
        "name": "odoo_search",
        "description": "Search for Odoo records...",
        "inputSchema": { ... }
      }
    ]
  }
}

tools/call

Execute a tool.

Request:

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "odoo_search_read",
    "arguments": {
      "instance": "production",
      "model": "res.partner",
      "domain": [["is_company", "=", true]],
      "fields": ["name", "email"],
      "limit": 10
    }
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\"records\":[...],\"count\":10}"
      }
    ]
  }
}

prompts/list

List available prompts.

Response:

{
  "result": {
    "prompts": [
      {
        "name": "odoo_common_models",
        "description": "List of commonly used Odoo models"
      }
    ]
  }
}

prompts/get

Get prompt content.

Request:

{
  "method": "prompts/get",
  "params": {
    "name": "odoo_domain_filters"
  }
}

resources/list

List Odoo resources.

Response:

{
  "result": {
    "resources": [
      { "uri": "odoo://instances", "name": "Odoo Instances" },
      { "uri": "odoo://production/models", "name": "Models" }
    ]
  }
}

Operation Types

Internal operation types mapped from tools.json via op.type:

TypeTool NameDescription
searchodoo_searchSearch for record IDs
search_readodoo_search_readSearch and read records
readodoo_readRead records by IDs
createodoo_createCreate new record
writeodoo_updateUpdate records
unlinkodoo_deleteDelete records
search_countodoo_countCount records
executeodoo_executeExecute model method
workflow_actionodoo_workflow_actionCall workflow action
generate_reportodoo_generate_reportGenerate PDF report
get_model_metadataodoo_get_model_metadataGet model fields
list_modelsodoo_list_modelsList available models
check_accessodoo_check_accessCheck permissions
create_batchodoo_create_batchBatch create records
read_groupodoo_read_groupAggregate data
name_searchodoo_name_searchAutocomplete search
name_getodoo_name_getGet display names
default_getodoo_default_getGet default values
copyodoo_copyDuplicate record
onchangeodoo_onchangeSimulate onchange
database_cleanupodoo_database_cleanupClean database
deep_cleanupodoo_deep_cleanupDeep clean database

MCP HTTP Endpoints

When running in HTTP transport mode (--transport http):

MCP Streamable HTTP (per MCP spec)

EndpointMethodDescription
/mcpPOSTSend JSON-RPC messages
/mcpGETOpen SSE stream for server-to-client notifications
/mcpDELETETerminate a session

Legacy Endpoints

EndpointMethodDescription
/sseGETLegacy SSE transport
/messagesPOSTLegacy message endpoint

Public Endpoints (no auth)

EndpointMethodDescription
/healthGETHealth check
/openapi.jsonGETOpenAPI specification

Health Check Response

{
  "service": "odoo-rust-mcp",
  "status": "ok"
}

Config UI API (Port 3008)

Authentication

The Config UI uses Bearer token authentication. Token is stored in localStorage as mcp_config_token and sent via the Authorization: Bearer {token} header.

Public Endpoints (no auth required)

EndpointMethodDescription
/healthGETConfig server health check
/api/auth/statusGETCheck authentication status
/api/auth/loginPOSTLogin with username/password
/api/auth/logoutPOSTLogout and invalidate token

Protected Endpoints (require auth)

EndpointMethodDescription
/api/config/instancesGETGet instances configuration
/api/config/instancesPOSTSave instances configuration; triggers OdooClientPool.reload()
/api/config/instances/{name}/testPOSTTest connectivity for a specific instance
/api/config/toolsGETGet tools configuration
/api/config/toolsPOSTSave tools configuration
/api/config/promptsGETGet prompts configuration
/api/config/promptsPOSTSave prompts configuration
/api/config/serverGETGet server configuration
/api/config/serverPOSTSave server configuration
/api/auth/change-passwordPOSTChange Config UI password
/api/auth/mcp-auth-statusGETGet MCP HTTP auth status
/api/auth/mcp-auth-enabledPOSTEnable/disable MCP HTTP auth
/api/auth/generate-mcp-tokenPOSTGenerate new MCP auth token

Instance connection test

POST /api/config/instances/{name}/test

Tests the connection to a named Odoo instance by loading its config from instances.json, creating a client, and calling health_check() (which runs a lightweight search_count on ir.model). The test runs server-side so it bypasses browser CORS restrictions.

Response (success):

{ "ok": true, "latency_ms": 142 }

Response (failure):

{ "ok": false, "error": "Connection refused (os error 111)" }

Static Files and Documentation

PathSourceNotes
/ (fallback)static/dist/Built React UI via ServeDir
/docs/docs/book/Built mdBook docs; only mounted when directory exists

The documentation route is discovered at startup by find_docs_dir(), which searches for docs/book/ relative to the working directory and executable path. If the docs have not been built (mdbook build), the /docs/ route is simply not registered — the server starts normally.

Config Server Health Check Response

{
  "service": "odoo-rust-mcp-config",
  "status": "ok"
}

Odoo API Mapping

JSON-2 API (v19+)

POST /json/2/{db}/{model}/{method}
Authorization: Bearer {api_key}
Content-Type: application/json

JSON-RPC API (<v19)

POST /jsonrpc
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "method": "call",
  "params": {
    "service": "object",
    "method": "execute_kw",
    "args": [db, uid, password, model, method, args, kwargs]
  }
}

Error Codes

CodeCategoryDescription
-32700Parse errorInvalid JSON
-32600Invalid requestMalformed JSON-RPC
-32601Method not foundUnknown MCP method
-32602Invalid paramsMissing or invalid parameters
-32603Internal errorServer-side error
-32000Odoo errorError from Odoo API
-32001Authentication errorInvalid credentials
-32002Access deniedInsufficient permissions