Skip to main content

Overview

Self-host the CodeAlive MCP server for complete control over your deployment. The MCP server can be deployed using Docker or from source code.

Prerequisites

  • CodeAlive API key from app.codealive.ai
  • Docker (for container deployment) or Python 3.11+ (for source deployment)

Docker Deployment

The easiest way to self-host CodeAlive MCP:
# Pull the latest image
docker pull ghcr.io/codealive-ai/codealive-mcp:main

# Run the container
docker run -d \
  -p 8000:8000 \
  -e CODEALIVE_API_KEY=YOUR_API_KEY \
  --name codealive-mcp \
  --restart unless-stopped \
  ghcr.io/codealive-ai/codealive-mcp:main

Docker Compose

Create docker-compose.yml:
version: '3.8'

services:
  codealive-mcp:
    image: ghcr.io/codealive-ai/codealive-mcp:main
    container_name: codealive-mcp
    ports:
      - "8000:8000"
    environment:
      - CODEALIVE_API_KEY=${CODEALIVE_API_KEY}
    restart: unless-stopped
Run with:
export CODEALIVE_API_KEY="your_api_key"
docker-compose up -d

Source Code Deployment

Deploy from the GitHub repository:
# Clone the repository
git clone https://github.com/CodeAlive-AI/codealive-mcp.git
cd codealive-mcp

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Set environment variable
export CODEALIVE_API_KEY="your_api_key"

# Run the server
python -m codealive_mcp.server

Custom Port

To run on a different port:
python -m codealive_mcp.server --port 8080

Connecting to Self-Hosted Instance

Once your server is running, configure your AI assistant to use the local URL:

For Docker

{
  "mcpServers": {
    "codealive": {
      "type": "http",
      "url": "http://localhost:8000/api"
    }
  }
}

For Custom Port

{
  "mcpServers": {
    "codealive": {
      "type": "http",
      "url": "http://localhost:8080"
    }
  }
}

For Self-Hosted CodeAlive Backend

If you’re running a self-hosted CodeAlive instance (not just the MCP server), configure the base URL:

Docker

docker run -d \
  -p 8000:8000 \
  -e CODEALIVE_API_KEY=YOUR_API_KEY \
  -e CODEALIVE_BASE_URL=https://your-codealive-instance.com/api \
  --name codealive-mcp \
  ghcr.io/codealive-ai/codealive-mcp:main

Source Code

Set additional environment variable:
export CODEALIVE_BASE_URL="https://your-codealive-instance.com/api"
python -m codealive_mcp.server

Basic Troubleshooting

Check:
  • API key is correctly set
  • Port 8000 is not already in use
  • Docker daemon is running
View logs:
docker logs codealive-mcp
Check:
  • Server is running: docker ps or check Python process
  • Correct URL in your AI assistant configuration
  • Firewall allows connections to the port
Check:
  • API key is valid and active
  • Environment variable is set correctly
  • For self-hosted backend, verify base URL is correct

Security Notes

  • Never expose the MCP server directly to the internet
  • Keep your API keys secure
  • Use HTTPS in production environments
  • Consider using a reverse proxy for additional security