Skip to content

Deployment

alanogic edited this page Jul 17, 2026 · 3 revisions

Deployment

Deploy the Odoo MCP Server as a production HTTP service behind Nginx with TLS.

Architecture

Claude Desktop / Claude Code / Any MCP Client
        │
        ▼
   HTTPS (TLS)
        │
        ▼
   Nginx reverse proxy
        │
        ▼
   localhost:8080 (Docker)
        │
        ▼
   Odoo MCP Server (streamable-http)
        │
        ▼
   Odoo v2 JSON-2 API

One container per client. Each container gets its own Odoo credentials and MCP API key. Nginx routes by path to the appropriate container port.

Quick start

# 1. Build the image from source
git clone https://github.com/AlanOgic/odoo-mcp-19.git && cd odoo-mcp-19
docker build -t odoo-mcp-19:latest .

# 2. Run the server with HTTP transport
docker run -d -p 127.0.0.1:8080:8080 \
  -e ODOO_URL=https://your-instance.odoo.com \
  -e ODOO_DB=your-database \
  -e ODOO_USERNAME=your-username \
  -e ODOO_API_KEY=your-odoo-api-key \
  -e MCP_TRANSPORT=streamable-http \
  -e MCP_API_KEY=$(python3 -c "import secrets; print(secrets.token_urlsafe(32))") \
  --name odoo-mcp \
  --restart unless-stopped \
  odoo-mcp-19:latest

# 3. Verify it's running
docker ps

Environment variables

Variable Required Description
ODOO_URL Yes Odoo server URL
ODOO_DB Yes Database name
ODOO_USERNAME Yes Username
ODOO_API_KEY Yes Odoo API key
MCP_TRANSPORT Yes Set to streamable-http for remote access
MCP_API_KEY Yes Bearer token for MCP authentication
MCP_HOST No Bind address (default: 0.0.0.0)
MCP_PORT No HTTP port (default: 8080)
ODOO_TIMEOUT No Request timeout (default: 30)
ODOO_VERIFY_SSL No SSL verification (default: true)

Nginx configuration

Add to your Nginx site config:

# MCP protocol endpoint
location /mcp {
    proxy_pass http://127.0.0.1:8080/mcp;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_buffering off;
    proxy_cache off;
    proxy_read_timeout 3600s;
    proxy_send_timeout 3600s;
    client_max_body_size 10m;
}

Critical settings

Setting Why
proxy_buffering off Required for SSE/streaming (MCP uses server-sent events)
proxy_cache off Prevents caching of streaming responses
proxy_read_timeout 3600s MCP sessions can be long-lived
proxy_http_version 1.1 + Upgrade Enables WebSocket upgrade for bidirectional communication

Connecting clients

Claude Desktop

{
  "mcpServers": {
    "odoo": {
      "type": "url",
      "url": "https://your-domain.com/mcp",
      "headers": {
        "Authorization": "Bearer your-mcp-api-key"
      }
    }
  }
}

Claude Code

In .claude/settings.json or project settings:

{
  "mcpServers": {
    "odoo": {
      "type": "url",
      "url": "https://your-domain.com/mcp",
      "headers": {
        "Authorization": "Bearer your-mcp-api-key"
      }
    }
  }
}

Multi-client scaling

Each client gets its own container with isolated Odoo credentials.

1. Run multiple containers on different ports

# Client Alpha
docker run -d -p 127.0.0.1:8081:8080 \
  -e ODOO_URL=https://alpha.odoo.com \
  -e ODOO_DB=alpha-db \
  -e ODOO_USERNAME=alpha-user \
  -e ODOO_API_KEY=alpha-odoo-key \
  -e MCP_TRANSPORT=streamable-http \
  -e MCP_API_KEY=alpha-mcp-key \
  --name odoo-mcp-alpha \
  --restart unless-stopped \
  odoo-mcp-19:latest

# Client Beta
docker run -d -p 127.0.0.1:8082:8080 \
  -e ODOO_URL=https://beta.odoo.com \
  -e ODOO_DB=beta-db \
  -e ODOO_USERNAME=beta-user \
  -e ODOO_API_KEY=beta-odoo-key \
  -e MCP_TRANSPORT=streamable-http \
  -e MCP_API_KEY=beta-mcp-key \
  --name odoo-mcp-beta \
  --restart unless-stopped \
  odoo-mcp-19:latest

2. Route per-client in Nginx

location /mcp/alpha {
    proxy_pass http://127.0.0.1:8081/mcp;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_buffering off;
    proxy_cache off;
    proxy_read_timeout 3600s;
    proxy_send_timeout 3600s;
}

location /mcp/beta {
    proxy_pass http://127.0.0.1:8082/mcp;
    # ... same proxy settings ...
}

Clients connect with https://your-domain.com/mcp/alpha or https://your-domain.com/mcp/beta.

Verification checklist

# Container running
docker ps

# Auth gate works (should return 401)
curl -X POST https://your-domain.com/mcp

# MCP protocol works
curl -X POST https://your-domain.com/mcp \
  -H "Authorization: Bearer your-mcp-api-key" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"initialize","id":1}'

# Logs look clean
docker logs -f odoo-mcp

Troubleshooting

502 Bad Gateway from Nginx

  • Verify the container is running: docker ps
  • Check the container is listening: curl http://localhost:8080/mcp (should return auth error, not connection refused)
  • Ensure Nginx proxy_pass port matches the container port

SSE/streaming not working

  • Verify proxy_buffering off in Nginx config
  • Verify proxy_cache off in Nginx config
  • Check for CDN/proxy layers that might buffer responses

Authentication errors

  • Verify MCP_API_KEY matches the Bearer token sent by the client
  • MCP endpoints require Authorization: Bearer <key> header

See also: Getting-Started for local STDIO setup, Tools for API reference

Clone this wiki locally