# Docker Deployment Guide
## Prerequisites
- Docker installed
- Docker Compose installed (optional)
- `.env` file configured with your Odoo credentials
## Quick Start
### Option 1: Using Docker Compose (Recommended)
```bash
# Build and start the container
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the container
docker-compose down
```
### Option 2: Using Docker directly
```bash
# Build the image
docker build -t mcp-odoo-server:latest .
# Run the container
docker run --env-file .env -it --name mcp-odoo-server mcp-odoo-server:latest
# Run in detached mode
docker run --env-file .env -d --name mcp-odoo-server mcp-odoo-server:latest
# Stop the container
docker stop mcp-odoo-server
docker rm mcp-odoo-server
```
### Option 3: Using the build script
```bash
# Make script executable
chmod +x docker-build.sh
# Build
./docker-build.sh
# Run
docker-compose up -d
```
## Configuration
The Docker container reads environment variables from your `.env` file:
```env
ODOO_HOST=your-odoo-host.com
ODOO_DATABASE=your_database
ODOO_USERNAME=admin
ODOO_API_KEY=your_api_key
ODOO_PROTOCOL=https
```
## Using with Claude Desktop
Since MCP servers communicate via stdio, you need to update your Claude Desktop config to use the Docker container:
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
```json
{
"mcpServers": {
"odoo": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--env-file",
"/Users/malvernbright/development/Odoo/odoo-17.0+e.20251121/mcp-odoo-server/.env",
"mcp-odoo-server:latest"
]
}
}
}
```
## Development
### Rebuild after changes
```bash
# Stop existing container
docker-compose down
# Rebuild and start
docker-compose up --build -d
```
### View logs
```bash
# Using docker-compose
docker-compose logs -f
# Using docker
docker logs -f mcp-odoo-server
```
### Test the container
```bash
# Execute test inside container
docker run --env-file .env -it mcp-odoo-server:latest node test-connection.js
```
## Troubleshooting
### Container exits immediately
- Check logs: `docker logs mcp-odoo-server`
- Verify `.env` file exists and has correct values
- Ensure all required env variables are set
### Cannot connect to Odoo
- Verify ODOO_HOST doesn't include `http://` or `https://`
- Check ODOO_PROTOCOL matches your host (http/https)
- Ensure API key is valid
- Test connection: `docker run --env-file .env -it mcp-odoo-server:latest node test-connection.js`
### Permission issues
```bash
# Fix file permissions
chmod 644 .env
chmod +x docker-build.sh
```
## Production Deployment
### Push to Docker Hub
```bash
# Tag the image
docker tag mcp-odoo-server:latest yourusername/mcp-odoo-server:latest
# Push to Docker Hub
docker push yourusername/mcp-odoo-server:latest
```
### Deploy to server
```bash
# Pull the image
docker pull yourusername/mcp-odoo-server:latest
# Run with custom .env
docker run --env-file /path/to/.env -d --name mcp-odoo-server yourusername/mcp-odoo-server:latest
```
## Cleanup
```bash
# Stop and remove container
docker-compose down
# Remove image
docker rmi mcp-odoo-server:latest
# Remove all stopped containers, unused networks, and dangling images
docker system prune
```