Deployment
Related Topics: Configuration (profiles, secrets) | Monitoring (observability) | Admin Socket (health checks)
This guide covers deploying MXCP to production environments.
Deployment Options
Section titled “Deployment Options”| Method | Best For | Complexity |
|---|---|---|
| stdio | Claude Desktop, local development | None |
| Docker | Containerized environments, CI/CD | Low |
| Docker Compose | Multi-service setups, development | Low |
| systemd | Bare-metal Linux servers | Medium |
| Kubernetes | Orchestrated container platforms | High |
Local Development (stdio)
Section titled “Local Development (stdio)”For direct connection to Claude Desktop:
mxcp serve --transport stdioAdd to Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{ "mcpServers": { "my-project": { "command": "mxcp", "args": ["serve", "--transport", "stdio"], "cwd": "/path/to/project" } }}Multiple Environments
Section titled “Multiple Environments”Run different profiles as separate instances:
# Production on port 8000mxcp serve --profile production --port 8000
# Staging on port 8001mxcp serve --profile staging --port 8001Each MXCP instance:
- Serves one project’s tools
- Uses one DuckDB file
- Runs as a single process
- Uses DuckDB’s single-writer model (multiple instances need separate DuckDB files)
Prerequisites
Section titled “Prerequisites”Before deploying, ensure you have:
-
Project files ready:
mxcp-site.ymlwith production profile configured- Endpoint definitions in
tools/,resources/,prompts/ - Python dependencies documented (if using Python endpoints)
-
Secrets configured:
- User config (
~/.mxcp/config.yml) or environment variables - Vault/1Password tokens (if using secret managers)
- User config (
-
Infrastructure prepared:
- Persistent storage for DuckDB (if not read-only)
- Network access to required services (databases, APIs)
-
Validation passed:
Terminal window mxcp validatemxcp test
Production Checklist
Section titled “Production Checklist”Pre-Deployment
Section titled “Pre-Deployment”- All endpoints validated:
mxcp validate - All tests passing:
mxcp test - Security policies defined
- Secrets in secure storage (not in code)
- Backup procedures documented
Deployment
Section titled “Deployment”- Use specific image tags (not
:latest) - Configure resource limits (memory, CPU)
- Set up health checks (admin socket)
- Enable audit logging
- Set up log rotation
- Configure TLS/SSL
Post-Deployment
Section titled “Post-Deployment”- Verify health checks passing
- Test authentication flow
- Verify audit logging working
- Test each endpoint
- Set up monitoring alerts
- Document operational procedures
Ongoing Operations
Section titled “Ongoing Operations”- Monitor disk space (logs, database)
- Review audit logs regularly
- Rotate credentials periodically
- Update dependencies monthly
- Test backup restoration quarterly
- Monitor for drift:
mxcp drift-check
Resource Requirements
Section titled “Resource Requirements”| Workload | Memory | CPU | Storage |
|---|---|---|---|
| Minimal | 256MB | 0.25 cores | 100MB |
| Typical | 512MB-1GB | 0.5-1 core | 1GB |
| Heavy queries | 2-4GB | 2-4 cores | 10GB+ |
DuckDB memory usage scales with query complexity. For large analytical queries, allocate more memory.
Docker Deployment
Section titled “Docker Deployment”Official MXCP Image
Section titled “Official MXCP Image”The recommended approach for Docker deployments is to use the official MXCP base image from GitHub Container Registry:
ghcr.io/raw-labs/mxcp:latestWhat’s included:
| Component | Details |
|---|---|
| Base | Python 3.11 slim |
| MXCP | Pre-installed with Vault and 1Password integrations |
| User | Non-root mxcp user (UID 1000) |
| Tools | curl for health checks |
| Admin socket | Enabled by default at /run/mxcp/mxcp.sock |
| Security | Vulnerability-scanned, minimal attack surface |
Available tags:
latest- Latest stable release0.10.0,0.9.0, etc. - Specific stable versions0.10.0-rc12, etc. - Pre-release versions
Using the Official Image (Recommended)
Section titled “Using the Official Image (Recommended)”Option 1: Mount your MXCP site (development)
docker run -d \ --name mxcp \ -p 8000:8000 \ -v $(pwd)/my-mxcp-site:/mxcp-site:ro \ -v mxcp-data:/mxcp-site/data \ -v mxcp-audit:/mxcp-site/audit \ ghcr.io/raw-labs/mxcp:latestOption 2: Extend the image (production)
FROM ghcr.io/raw-labs/mxcp:latest
# Copy your MXCP siteCOPY --chown=mxcp:mxcp . /mxcp-site/
# Install additional Python dependencies (optional)COPY --chown=mxcp:mxcp requirements.txt /tmp/RUN /mxcp-site/.venv/bin/pip install -r /tmp/requirements.txt && \ rm /tmp/requirements.txtBuild and run:
docker build -t my-mxcp-app .docker run -p 8000:8000 my-mxcp-appDirectory structure in the official image:
/mxcp-site/ # Working directory (mount your site here)├── mxcp-site.yml # MXCP site configuration├── mxcp-config.yml # User configuration (optional)├── tools/ # Tool definitions├── resources/ # Resource definitions├── prompts/ # Prompt definitions├── python/ # Python endpoints├── sql/ # SQL files├── data/ # DuckDB databases (writable)├── audit/ # Audit logs (writable)└── drift/ # Drift snapshots (writable)
/run/mxcp/mxcp.sock # Admin socket for health checksBuilding Your Own Image
Section titled “Building Your Own Image”If you need a custom base image, you can build from scratch:
Basic Dockerfile
Section titled “Basic Dockerfile”FROM python:3.11-slim
WORKDIR /app
# Install MXCP and curl for healthchecksRUN apt-get update && apt-get install -y --no-install-recommends curl \ && rm -rf /var/lib/apt/lists/* \ && pip install --no-cache-dir mxcp
# Copy project filesCOPY mxcp-site.yml .COPY tools/ tools/COPY resources/ resources/COPY prompts/ prompts/COPY sql/ sql/COPY python/ python/
# Create directoriesRUN mkdir -p /data /var/log/mxcp /run/mxcp
# Set environmentENV MXCP_PROFILE=productionENV PYTHONUNBUFFERED=1
# Expose portEXPOSE 8000
# Run serverCMD ["mxcp", "serve", "--port", "8000"]Note: The server binds to the host configured in user config (transport.http.host). To bind to all interfaces, set host: "0.0.0.0" in your user config or mount a config file. Health checks require the admin socket - see Docker with Admin Socket.
Production Dockerfile (Multi-Stage)
Section titled “Production Dockerfile (Multi-Stage)”# Build stageFROM python:3.11-slim AS builder
WORKDIR /buildRUN pip install --no-cache-dir mxcp
# Runtime stageFROM python:3.11-slim
WORKDIR /app
# Install curl for healthchecksRUN apt-get update && apt-get install -y --no-install-recommends curl \ && rm -rf /var/lib/apt/lists/*
# Copy Python packages from builderCOPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packagesCOPY --from=builder /usr/local/bin/mxcp /usr/local/bin/mxcp
# Copy project filesCOPY mxcp-site.yml .COPY tools/ tools/COPY sql/ sql/COPY python/ python/
# Create non-root userRUN useradd -m -u 1000 mxcp \ && mkdir -p /data /var/log/mxcp /run/mxcp \ && chown -R mxcp:mxcp /app /data /var/log/mxcp /run/mxcp
USER mxcp
ENV MXCP_PROFILE=production
EXPOSE 8000
CMD ["mxcp", "serve", "--port", "8000"]Docker with Admin Socket
Section titled “Docker with Admin Socket”To enable health checks, you must enable the admin socket:
FROM python:3.11-slim
WORKDIR /app
# Install MXCP and curl for healthchecksRUN apt-get update && apt-get install -y --no-install-recommends curl \ && rm -rf /var/lib/apt/lists/* \ && pip install --no-cache-dir mxcp
COPY mxcp-site.yml .COPY tools/ tools/COPY sql/ sql/COPY python/ python/
RUN mkdir -p /data /var/log/mxcp /run/mxcp
ENV MXCP_PROFILE=productionENV MXCP_ADMIN_ENABLED=trueENV MXCP_ADMIN_SOCKET=/run/mxcp/mxcp.sockENV PYTHONUNBUFFERED=1
EXPOSE 8000
# Health check via admin socketHEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ CMD curl -sf --unix-socket /run/mxcp/mxcp.sock http://localhost/health || exit 1
CMD ["mxcp", "serve", "--port", "8000"]Configuring Host Binding
Section titled “Configuring Host Binding”MXCP binds to localhost by default. For Docker containers, you need to bind to all interfaces (0.0.0.0). Create a user config file:
mxcp: 1
transport: http: host: "0.0.0.0" port: 8000Mount it in your container:
docker run -v ./config:/config -e MXCP_CONFIG=/config/config.yml mxcp:latestOr in Docker Compose:
volumes: - ./config:/config:roenvironment: - MXCP_CONFIG=/config/config.ymlVolume Mounts
Section titled “Volume Mounts”Essential volumes for Docker deployment:
# Project files (read-only)-v /path/to/project:/app:ro
# User configuration (read-only, contains host binding)-v /path/to/config:/config:ro
# Persistent data (read-write)-v mxcp-data:/data-v mxcp-audit:/var/log/mxcp-v mxcp-drift:/app/driftDocker Compose
Section titled “Docker Compose”version: '3.8'
services: mxcp: build: . ports: - "8000:8000" volumes: - ./data:/data - ./audit:/var/log/mxcp - mxcp-socket:/run/mxcp environment: - MXCP_PROFILE=production - MXCP_DUCKDB_PATH=/data/mxcp.duckdb - MXCP_ADMIN_ENABLED=true - MXCP_ADMIN_SOCKET=/run/mxcp/mxcp.sock - VAULT_TOKEN=${VAULT_TOKEN} restart: unless-stopped deploy: resources: limits: memory: 2G cpus: '1.0'
# Optional: nginx reverse proxy nginx: image: nginx:alpine ports: - "443:443" volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro - ./certs:/etc/nginx/certs:ro depends_on: - mxcp
volumes: mxcp-socket:Docker Compose with Admin Sidecar
Section titled “Docker Compose with Admin Sidecar”For environments where you need admin socket access from outside the container:
version: '3.8'
services: mxcp: build: . ports: - "8000:8000" volumes: - mxcp-socket:/run/mxcp - ./data:/data environment: - MXCP_ADMIN_ENABLED=true - MXCP_ADMIN_SOCKET=/run/mxcp/mxcp.sock
# Sidecar for admin operations admin: image: curlimages/curl volumes: - mxcp-socket:/run/mxcp:ro entrypoint: ["sh", "-c", "while true; do sleep 3600; done"] # Execute admin commands: # docker compose exec admin curl --unix-socket /run/mxcp/mxcp.sock http://localhost/health
volumes: mxcp-socket:systemd Service
Section titled “systemd Service”Service File
Section titled “Service File”Create /etc/systemd/system/mxcp.service:
[Unit]Description=MXCP MCP ServerAfter=network.targetDocumentation=https://mxcp.dev/docs
[Service]Type=simpleUser=mxcpGroup=mxcpWorkingDirectory=/opt/mxcp
# EnvironmentEnvironment="MXCP_PROFILE=production"Environment="MXCP_ADMIN_ENABLED=true"EnvironmentFile=-/etc/mxcp/environment
# Process managementExecStart=/usr/local/bin/mxcp serve --port 8000ExecReload=/bin/kill -HUP $MAINPID
# Security hardeningNoNewPrivileges=trueProtectSystem=strictProtectHome=trueReadWritePaths=/data /var/log/mxcp /run/mxcp
# Resource limitsMemoryMax=2GCPUQuota=200%
# Restart behaviorRestart=on-failureRestartSec=5StartLimitInterval=60StartLimitBurst=3
[Install]WantedBy=multi-user.targetEnvironment File
Section titled “Environment File”Create /etc/mxcp/environment:
MXCP_PROFILE=productionMXCP_DUCKDB_PATH=/data/mxcp.duckdbMXCP_CONFIG=/etc/mxcp/config.ymlVAULT_TOKEN=hvs.your-vault-tokenANTHROPIC_API_KEY=your-api-keyUser Configuration
Section titled “User Configuration”Create /etc/mxcp/config.yml to configure host binding:
mxcp: 1
transport: http: host: "0.0.0.0" # Bind to all interfaces port: 8000Set permissions: chmod 600 /etc/mxcp/config.yml
Service Management
Section titled “Service Management”# Reload systemd configurationsudo systemctl daemon-reload
# Enable service to start on bootsudo systemctl enable mxcp
# Start servicesudo systemctl start mxcp
# Check statussudo systemctl status mxcp
# View logssudo journalctl -u mxcp -f
# Hot reload configuration (sends SIGHUP)sudo systemctl reload mxcpAudit Cleanup Timer
Section titled “Audit Cleanup Timer”Automatically clean old audit logs with a systemd timer.
Create /etc/systemd/system/mxcp-log-cleanup.service:
[Unit]Description=MXCP Audit Log CleanupAfter=network.target
[Service]Type=oneshotUser=mxcpGroup=mxcpWorkingDirectory=/opt/mxcpExecStart=/usr/local/bin/mxcp log-cleanup --retention-days 90
# Security hardeningNoNewPrivileges=trueProtectSystem=strictReadWritePaths=/var/log/mxcpCreate /etc/systemd/system/mxcp-log-cleanup.timer:
[Unit]Description=Run MXCP Audit Cleanup daily at 2 AMRequires=mxcp-log-cleanup.service
[Timer]OnCalendar=dailyAccuracySec=1hPersistent=trueRandomizedDelaySec=30min
[Install]WantedBy=timers.targetEnable the timer:
sudo systemctl enable mxcp-log-cleanup.timersudo systemctl start mxcp-log-cleanup.timerMultiple Profiles with systemd
Section titled “Multiple Profiles with systemd”Run different profiles as separate services:
# Copy and customize for each profilesudo cp /etc/systemd/system/mxcp.service /etc/systemd/system/mxcp-prod.servicesudo cp /etc/systemd/system/mxcp.service /etc/systemd/system/mxcp-staging.serviceEdit each service file:
# mxcp-prod.serviceExecStart=/usr/local/bin/mxcp serve --profile production --port 8000
# mxcp-staging.serviceExecStart=/usr/local/bin/mxcp serve --profile staging --port 8001Signal Handling
Section titled “Signal Handling”MXCP handles Unix signals for graceful operations:
| Signal | Action | Use Case |
|---|---|---|
SIGTERM | Graceful shutdown | Normal stop, container termination |
SIGHUP | Hot reload | Refresh secrets, reconnect DB |
SIGINT | Immediate shutdown | Development, Ctrl+C |
SIGTERM - Graceful Shutdown
Section titled “SIGTERM - Graceful Shutdown”SIGHUP - Hot Reload
Section titled “SIGHUP - Hot Reload”What reloads:
- Vault/1Password secrets
- File references (
file://) - Environment variables
- DuckDB connections
- Python runtime configs
What does NOT reload:
- Configuration file structure
- OAuth settings
- Server host/port
- Endpoint definitions
Kubernetes Deployment
Section titled “Kubernetes Deployment”Deployment
Section titled “Deployment”apiVersion: apps/v1kind: Deploymentmetadata: name: mxcp labels: app: mxcpspec: replicas: 1 # See Scaling Considerations selector: matchLabels: app: mxcp template: metadata: labels: app: mxcp spec: containers: - name: mxcp image: your-registry/mxcp:latest ports: - containerPort: 8000 env: - name: MXCP_PROFILE value: production - name: MXCP_ADMIN_ENABLED value: "true" - name: MXCP_ADMIN_SOCKET value: /run/mxcp/mxcp.sock - name: VAULT_TOKEN valueFrom: secretKeyRef: name: mxcp-secrets key: vault-token volumeMounts: - name: data mountPath: /data - name: admin-socket mountPath: /run/mxcp resources: requests: memory: "512Mi" cpu: "250m" limits: memory: "2Gi" cpu: "1000m" livenessProbe: exec: command: - curl - -sf - --unix-socket - /run/mxcp/mxcp.sock - http://localhost/health initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 readinessProbe: exec: command: - curl - -sf - --unix-socket - /run/mxcp/mxcp.sock - http://localhost/health initialDelaySeconds: 5 periodSeconds: 5 timeoutSeconds: 3 volumes: - name: data persistentVolumeClaim: claimName: mxcp-data - name: admin-socket emptyDir: {}Service
Section titled “Service”apiVersion: v1kind: Servicemetadata: name: mxcpspec: selector: app: mxcp ports: - port: 80 targetPort: 8000 type: ClusterIPIngress
Section titled “Ingress”apiVersion: networking.k8s.io/v1kind: Ingressmetadata: name: mxcp annotations: nginx.ingress.kubernetes.io/ssl-redirect: "true" nginx.ingress.kubernetes.io/proxy-read-timeout: "300"spec: tls: - hosts: - mxcp.example.com secretName: mxcp-tls rules: - host: mxcp.example.com http: paths: - path: / pathType: Prefix backend: service: name: mxcp port: number: 80ConfigMap for Site Configuration
Section titled “ConfigMap for Site Configuration”apiVersion: v1kind: ConfigMapmetadata: name: mxcp-site-configdata: mxcp-site.yml: | mxcp: 1 project: my-project profile: production
profiles: production: duckdb: path: /data/mxcp.duckdb readonly: false audit: enabled: true path: /var/log/mxcp/audit.jsonlStateless Mode
Section titled “Stateless Mode”For environments without persistent connections (load balancers, some proxies), use stateless mode:
mxcp serve --stateless --port 8000Configuration
Section titled “Configuration”mxcp: 1project: my-projectprofile: stateless
profiles: stateless: duckdb: path: /tmp/mxcp.duckdb # Ephemeral or shared storage readonly: true # Recommended for statelessWhen to Use Stateless Mode
Section titled “When to Use Stateless Mode”- Load balancers that don’t support sticky sessions
- Horizontal scaling with multiple instances
- Serverless-like environments where instances are ephemeral
Stateless Considerations
Section titled “Stateless Considerations”- No session state: Each request is independent
- Read-only recommended: Use external databases for writes
- Shared storage: If using DuckDB, ensure all instances can access the same file (NFS, EFS)
Reverse Proxy Configuration
Section titled “Reverse Proxy Configuration”upstream mxcp { server localhost:8000; keepalive 32;}
server { listen 443 ssl http2; server_name mxcp.example.com;
ssl_certificate /etc/nginx/certs/cert.pem; ssl_certificate_key /etc/nginx/certs/key.pem;
location / { proxy_pass http://mxcp; proxy_http_version 1.1; 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_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";
# Timeouts for long-running requests proxy_read_timeout 300s; proxy_send_timeout 300s; }}Traefik
Section titled “Traefik”http: routers: mxcp: rule: "Host(`mxcp.example.com`)" service: mxcp tls: certResolver: letsencrypt middlewares: - headers
services: mxcp: loadBalancer: servers: - url: "http://localhost:8000"
middlewares: headers: headers: stsSeconds: 31536000 stsIncludeSubdomains: trueNote: Health checks require the admin socket. External load balancers should use TCP health checks on port 8000, or configure a sidecar to expose the admin socket health endpoint.
Admin Socket Health Checks
Section titled “Admin Socket Health Checks”For detailed health monitoring, use the admin socket:
# Enable admin socketexport MXCP_ADMIN_ENABLED=trueexport MXCP_ADMIN_SOCKET=/run/mxcp/mxcp.sock
# Basic health checkcurl --unix-socket /run/mxcp/mxcp.sock http://localhost/health# Response: {"status": "healthy"}
# Detailed statuscurl --unix-socket /run/mxcp/mxcp.sock http://localhost/status# Response: {"status": "healthy", "uptime": 3600, "requests": 1000, ...}See Admin Socket for complete API reference.
Scaling Considerations
Section titled “Scaling Considerations”Single Instance (Recommended)
Section titled “Single Instance (Recommended)”- Simplest deployment
- DuckDB works best with single writer
- Suitable for most use cases
- Use vertical scaling (more CPU/memory) for higher throughput
Read Replicas
Section titled “Read Replicas”For read-heavy workloads with a shared DuckDB file:
# Writer instancemxcp: replicas: 1 env: MXCP_READONLY: "false" volumes: - type: nfs source: mxcp-data target: /data
# Reader instancesmxcp-reader: replicas: 3 env: MXCP_READONLY: "true" volumes: - type: nfs source: mxcp-data target: /data read_only: trueRequirements:
- Shared filesystem (NFS, EFS, GlusterFS)
- Single writer, multiple readers
- Readers use
--readonlyflag
Horizontal Scaling with External Database
Section titled “Horizontal Scaling with External Database”For true horizontal scaling, use external databases instead of DuckDB file:
- PostgreSQL via
postgres_scannerextension - MySQL via
mysql_scannerextension - Cloud data warehouses (Snowflake, BigQuery)
Backup Strategy
Section titled “Backup Strategy”Database Backup
Section titled “Database Backup”# Option 1: File copy (requires brief stop or read-only mode)mxcp serve --readonly &cp /data/mxcp.duckdb /backup/mxcp-$(date +%Y%m%d).duckdb
# Option 2: DuckDB export (online, but slower)duckdb /data/mxcp.duckdb <<EOFCOPY (SELECT * FROM my_table) TO '/backup/my_table.parquet';EOF
# Option 3: Scheduled backup script#!/bin/bashBACKUP_DIR=/backup/$(date +%Y%m%d)mkdir -p $BACKUP_DIR
# Trigger checkpoint for consistencycurl --unix-socket /run/mxcp/mxcp.sock -X POST http://localhost/admin/checkpoint
# Copy databasecp /data/mxcp.duckdb $BACKUP_DIR/
# Compressgzip $BACKUP_DIR/mxcp.duckdbAudit Log Backup
Section titled “Audit Log Backup”# Archive and rotatetar -czf /backup/audit-$(date +%Y%m%d).tar.gz /var/log/mxcp/find /var/log/mxcp -name "*.jsonl" -mtime +30 -delete
# Sync to object storageaws s3 sync /var/log/mxcp/ s3://backups/mxcp/audit/
# Use mxcp log-cleanup for managed rotationmxcp log-cleanup --retention-days 90Backup Schedule Recommendations
Section titled “Backup Schedule Recommendations”| Data | Frequency | Retention |
|---|---|---|
| DuckDB database | Daily | 30 days |
| Audit logs | Daily archive | 90 days local, 1 year cloud |
| Configuration | On change | Versioned in git |
Recovery Procedure
Section titled “Recovery Procedure”# Stop servicesudo systemctl stop mxcp
# Restore databasecp /backup/mxcp-20240115.duckdb /data/mxcp.duckdbchown mxcp:mxcp /data/mxcp.duckdb
# Start servicesudo systemctl start mxcp
# Verify healthcurl --unix-socket /run/mxcp/mxcp.sock http://localhost/healthSecurity Hardening
Section titled “Security Hardening”File Permissions
Section titled “File Permissions”# Database - readable/writable by mxcp user onlychmod 640 /data/mxcp.duckdbchown mxcp:mxcp /data/mxcp.duckdb
# Audit logschmod 640 /var/log/mxcp/*.jsonlchown mxcp:mxcp /var/log/mxcp/*.jsonl
# User configuration (contains secrets)chmod 600 ~/.mxcp/config.yml
# Admin socketchmod 660 /run/mxcp/mxcp.sockchown mxcp:mxcp /run/mxcp/mxcp.sockNetwork Restrictions
Section titled “Network Restrictions”# Allow only internal networkiptables -A INPUT -p tcp --dport 8000 -s 10.0.0.0/8 -j ACCEPTiptables -A INPUT -p tcp --dport 8000 -j DROP
# Or use firewalldfirewall-cmd --add-rich-rule='rule family="ipv4" source address="10.0.0.0/8" port port="8000" protocol="tcp" accept'Container Security
Section titled “Container Security”# Kubernetes SecurityContextsecurityContext: runAsNonRoot: true runAsUser: 1000 readOnlyRootFilesystem: true allowPrivilegeEscalation: false capabilities: drop: - ALLSecurity Scanning
Section titled “Security Scanning”Scan container images for vulnerabilities:
# Using Trivytrivy image your-registry/mxcp:latest
# Using Docker Scoutdocker scout cves your-registry/mxcp:latestEnvironment Variables Reference
Section titled “Environment Variables Reference”Key environment variables for deployment:
| Variable | Description | Default |
|---|---|---|
MXCP_PROFILE | Active profile | default |
MXCP_CONFIG | User config path | ~/.mxcp/config.yml |
MXCP_DUCKDB_PATH | Database path override | from config |
MXCP_READONLY | Force read-only mode | false |
MXCP_ADMIN_ENABLED | Enable admin socket | false |
MXCP_ADMIN_SOCKET | Admin socket path | /run/mxcp/mxcp.sock |
MXCP_DEBUG | Debug logging | false |
MXCP_AUDIT_ENABLED | Override audit setting | from config |
See Configuration for complete list.
Troubleshooting
Section titled “Troubleshooting”Service Won’t Start
Section titled “Service Won’t Start”# Check logsjournalctl -u mxcp -n 50
# Validate configurationmxcp validate
# Check file permissionsls -la /data /var/log/mxcp /opt/mxcp
# Test manuallysudo -u mxcp mxcp serve --port 8000Container Won’t Start
Section titled “Container Won’t Start”# Check logsdocker logs mxcp
# Common issues:# - Missing config files# - Invalid YAML syntax# - Missing environment variables# - Permission issues
# Debug modedocker run -it --rm \ -v $(pwd):/app \ mxcp:latest \ mxcp validate --debugAuthentication Failures
Section titled “Authentication Failures”# Verify OAuth configmxcp validate
# Check environment variablesdocker exec mxcp env | grep CLIENT
# Verify redirect URIs match exactly in OAuth provider settingsDatabase Locked
Section titled “Database Locked”DuckDB only supports a single writer. If you see “database is locked” errors:
# Check for stale connectionslsof | grep production.duckdb
# Make sure you're not running multiple instances# pointing to the same DuckDB filepgrep -f mxcpHigh Memory Usage
Section titled “High Memory Usage”- Check DuckDB query patterns with
EXPLAIN ANALYZE - Implement query result limits
- Monitor via admin socket
/statusendpoint - Consider read-only mode with external aggregation
Connection Refused
Section titled “Connection Refused”# Verify service is runningsystemctl status mxcp
# Check port bindingss -tlnp | grep 8000
# Test locally (admin socket must be enabled)curl --unix-socket /run/mxcp/mxcp.sock http://localhost/health
# Check firewalliptables -L -n | grep 8000Performance Issues
Section titled “Performance Issues”# Monitor resource usagedocker stats mxcp
# Check slow queries in audit logsmxcp log --since 1h | jq 'select(.duration_ms > 1000)'
# Analyze patternsmxcp log --export-duckdb perf.dbduckdb perf.db "SELECT name, AVG(duration_ms) FROM logs GROUP BY name ORDER BY 2 DESC;"Hot Reload Fails
Section titled “Hot Reload Fails”# Check reload logsjournalctl -u mxcp | grep -i reload
# Verify secrets are accessiblemxcp validate
# Test vault/1password connectivityvault kv get secret/myappop read "op://Private/item/field"Debug Mode
Section titled “Debug Mode”# Enable debug loggingmxcp serve --debug
# Or via environmentexport MXCP_DEBUG=truemxcp serveNext Steps
Section titled “Next Steps”- Monitoring - Set up observability
- Admin Socket - Health checks and management API
- Auditing - Configure audit logging
- Configuration - Complete configuration reference