claude-os/deployment/mcp-only/Dockerfile
Claude 0e5687b0f1
Add MCP-only deployment package for standalone knowledge base server
This commit adds a complete deployment solution for running Claude OS's
MCP (Model Context Protocol) server as a standalone service, separate
from the full coding environment. This allows other applications to
access the knowledge bases without requiring the CLI or coding tools.

Features:
- Docker-based deployment with Ollama integration
- Automated setup script with model pulling
- Read-only database mounting by default
- CORS and authentication configuration
- Complete API documentation and examples
- Python and JavaScript client examples

Also includes alternative Cloudflare Workers implementation:
- TypeScript starter template
- D1 and Vectorize integration examples
- Migration scripts and documentation
- Deployment comparison guide

Files added:
- deployment/mcp-only/Dockerfile
- deployment/mcp-only/docker-compose.yml
- deployment/mcp-only/requirements.txt
- deployment/mcp-only/setup.sh
- deployment/mcp-only/.env.example
- deployment/mcp-only/.dockerignore
- deployment/mcp-only/README.md
- deployment/mcp-only/DEPLOYMENT_COMPARISON.md
- deployment/mcp-only/examples/chat-integration.py
- deployment/mcp-only/examples/chat-integration.js
- deployment/mcp-only/cloudflare-workers/*

This addresses the need to expose MCP data to other applications
(knowledge base access, live chat) without deploying the full
Claude OS environment to production servers.
2025-11-05 17:46:00 +00:00

53 lines
1.3 KiB
Docker

FROM python:3.11-slim as builder
# Install system dependencies for building
RUN apt-get update && apt-get install -y \
gcc \
g++ \
make \
libmagic1 \
&& rm -rf /var/lib/apt/lists/*
# Create virtual environment
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Copy requirements and install Python dependencies
COPY requirements.txt /tmp/
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Final stage
FROM python:3.11-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
libmagic1 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy virtual environment from builder
COPY --from=builder /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Set working directory
WORKDIR /app
# Copy only necessary application files
COPY mcp_server/ /app/mcp_server/
COPY app/core/ /app/app/core/
COPY app/db/ /app/app/db/
COPY app/utils/ /app/app/utils/
COPY app/__init__.py /app/app/__init__.py
# Create data directory for database
RUN mkdir -p /app/data
# Expose MCP server port
EXPOSE 8051
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8051/health || exit 1
# Run MCP server
CMD ["python", "-m", "uvicorn", "mcp_server.server:app", "--host", "0.0.0.0", "--port", "8051"]