Odoo Rust MCP服务器

用于Odoo集成的模型上下文协议(MCP)服务器,提供安装、配置和管理工具。

  • by rachmataditiya
  • HTML
  • 本地部署
  • 更新于
在 GitHub 查看 rachmataditiya/homebrew-odoo-rust-mcp

使用说明

自制碘锈mcp龙头

这是Homebrew的官方水龙头 碘锈mcp -用于Odoo集成的模型上下文协议(MCP)服务器。

快速开始

# Install
brew tap rachmataditiya/odoo-rust-mcp
brew install rust-mcp

# Configure (edit with your Odoo credentials)
nano ~/.config/odoo-rust-mcp/env

# Start as background service
brew services start rust-mcp

安装

# Add this tap
brew tap rachmataditiya/odoo-rust-mcp

# Install rust-mcp
brew install rust-mcp

或者直接在一个命令中安装:

brew install rachmataditiya/odoo-rust-mcp/rust-mcp

安装什么

安装后,您将拥有:

组件 位置
二进制 /opt/homebrew/bin/rust-mcp
服务包装器 /opt/homebrew/bin/rust-mcp-service
默认配置 /opt/homebrew/share/odoo-rust-mcp/
用户配置 ~/.config/odoo-rust-mcp/
服务日志 /opt/homebrew/var/log/rust-mcp.log

用户配置目录(~/.config/odoo-rust-mcp/)

首次安装时自动创建:

~/.config/odoo-rust-mcp/
├── env              # Environment variables (Odoo credentials, auth settings) - EDIT THIS
├── instances.json   # Multi-instance Odoo configuration (default setup)
├── tools.json       # MCP tools definition
├── prompts.json     # MCP prompts definition
└── server.json      # MCP server metadata

注: 从v0.3.0+开始,将自动设置以下环境变量:

  • MCP_TOOLS_JSON -点到 ~/.config/odoo-rust-mcp/tools.json
  • MCP_PROMPTS_JSON -点到 ~/.config/odoo-rust-mcp/prompts.json
  • MCP_SERVER_JSON -点到 ~/.config/odoo-rust-mcp/server.json

如果默认配置文件不存在,则会自动从Homebrew共享目录复制它们。

配置

步骤1:编辑Odoo凭据

打开env文件:

nano ~/.config/odoo-rust-mcp/env
# or
code ~/.config/odoo-rust-mcp/env

步骤2:为您的Odoo版本进行配置

对于Odoo 19+(API密钥验证):

ODOO_URL=http://localhost:8069
ODOO_DB=mydb
ODOO_API_KEY=your_api_key_here

对于Odoo 18或更早版本(用户名/密码):

ODOO_URL=http://localhost:8069
ODOO_DB=mydb
ODOO_VERSION=18
ODOO_USERNAME=admin
ODOO_PASSWORD=your_password

步骤3:(可选)启用HTTP身份验证

选项1:通过配置UI(推荐)

  1. 启动服务: brew services start rust-mcp
  2. 打开 http://localhost:3008 并登录(默认值: admin / changeme)
  3. 首选 安全 标签
  4. 切换 启用MCP HTTP身份验证
  5. 点击 生成新令牌 (或粘贴现有令牌)
  6. 更改立即生效(无需重新启动)

选项2:通过环境变量 对于生产,添加一个安全令牌:

# Generate a token
openssl rand -hex 32

# Add to ~/.config/odoo-rust-mcp/env
MCP_AUTH_ENABLED=true
MCP_AUTH_TOKEN=your_generated_token_here

然后重新启动服务:

brew services restart rust-mcp

步骤4:配置UI身份验证

配置UI需要登录凭据。默认凭据为:

  • 用户名: admin
  • 密码: changeme

重要: 首次登录后立即更改默认密码:

  1. 打开 http://localhost:3008
  2. 使用默认凭据登录
  3. 首选 安全 标签
  4. 更新用户名和/或密码

凭据存储在 ~/.config/odoo-rust-mcp/env:

CONFIG_UI_USERNAME=admin
CONFIG_UI_PASSWORD=your-secure-password

运行服务器

选项A:后台服务(推荐)

# Start service
brew services start rust-mcp

# Check status
brew services list

# View logs
tail -f /opt/homebrew/var/log/rust-mcp.log

# Stop service
brew services stop rust-mcp

# Restart after config changes
brew services restart rust-mcp

服务运行于:

  • MCP服务器: http://127.0.0.1:8787/mcp
  • 配置UI: http://127.0.0.1:3008 (需要登录)

选项B:手动运行

# HTTP mode (for remote clients)
rust-mcp --transport http --listen 127.0.0.1:8787

# Stdio mode (for Cursor/Claude Desktop)
rust-mcp --transport stdio

光标IDE配置

添加到 ~/.cursor/mcp.json:

使用HTTP(服务运行时):

{
  "mcpServers": {
    "odoo": {
      "url": "http://127.0.0.1:8787/mcp"
    }
  }
}

使用带有承载令牌的HTTP(如果启用了MCP身份验证):

{
  "mcpServers": {
    "odoo": {
      "url": "http://127.0.0.1:8787/mcp",
      "headers": {
        "Authorization": "Bearer your-secure-random-token-here"
      }
    }
  }
}

使用stdio(直接):

{
  "mcpServers": {
    "odoo": {
      "type": "stdio",
      "command": "/opt/homebrew/bin/rust-mcp-service",
      "args": ["--transport", "stdio"]
    }
  }
}

注:使用 rust-mcp-service (不是 rust-mcp)自动加载您的env文件。

Claude桌面配置

添加到您的Claude Desktop配置中:

{
  "mcpServers": {
    "odoo": {
      "command": "/opt/homebrew/bin/rust-mcp-service",
      "args": ["--transport", "stdio"]
    }
  }
}

卸载

# Stop service first
brew services stop rust-mcp

# Uninstall
brew uninstall rust-mcp

# Remove tap (optional)
brew untap rachmataditiya/odoo-rust-mcp

# Remove config files (optional)
rm -rf ~/.config/odoo-rust-mcp

故障排除

服务无法启动

  1. 检查是否配置了凭据:

    cat ~/.config/odoo-rust-mcp/env
    
  2. 检查日志:

    tail -100 /opt/homebrew/var/log/rust-mcp.log
    
  3. 尝试手动运行以查看错误:

    rust-mcp-service --transport http --listen 127.0.0.1:8787
    

连接被拒绝

  1. 确保服务正在运行:

    brew services list | grep rust-mcp
    
  2. 检查端口8787是否正在使用中:

    lsof -i :8787
    

Odoo身份验证错误

  1. 在中验证您的凭据 ~/.config/odoo-rust-mcp/env
  2. 对于Odoo 19+:确保您拥有有效的API密钥
  3. 对于奥多<19:确保 ODOO_VERSION 设置正确

详细信息

  • 主存储库:https://github.com/rachmataditiya/odoo-rust-mcp
  • 报告问题:https://github.com/rachmataditiya/odoo-rust-mcp/issues