forked from cardosofelipe/fast-next-template
Implements the Git Operations MCP server (Issue #58) providing: Core features: - GitPython wrapper for local repository operations (clone, commit, push, pull, diff, log) - Branch management (create, delete, list, checkout) - Workspace isolation per project with file-based locking - Gitea provider for remote PR operations MCP Tools (17 registered): - clone_repository, git_status, create_branch, list_branches - checkout, commit, push, pull, diff, log - create_pull_request, get_pull_request, list_pull_requests - merge_pull_request, get_workspace, lock_workspace, unlock_workspace Technical details: - FastMCP + FastAPI with JSON-RPC 2.0 protocol - pydantic-settings for configuration (env prefix: GIT_OPS_) - Comprehensive error hierarchy with structured codes - 131 tests passing with 67% coverage - Async operations via ThreadPoolExecutor Closes: #105, #106, #107, #108, #109 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
68 lines
1.6 KiB
Docker
68 lines
1.6 KiB
Docker
# Git Operations MCP Server Dockerfile
|
|
# Multi-stage build for smaller production image
|
|
|
|
FROM python:3.12-slim AS builder
|
|
|
|
# Install build dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install uv for fast package management
|
|
RUN pip install --no-cache-dir uv
|
|
|
|
# Create app directory
|
|
WORKDIR /app
|
|
|
|
# Copy dependency files
|
|
COPY pyproject.toml .
|
|
|
|
# Install dependencies with uv
|
|
RUN uv pip install --system --no-cache .
|
|
|
|
# Production stage
|
|
FROM python:3.12-slim
|
|
|
|
# Install runtime dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
git \
|
|
openssh-client \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create non-root user
|
|
RUN useradd --create-home --shell /bin/bash syndarix
|
|
|
|
# Create workspace directory
|
|
RUN mkdir -p /var/syndarix/workspaces && chown -R syndarix:syndarix /var/syndarix
|
|
|
|
# Create app directory
|
|
WORKDIR /app
|
|
|
|
# Copy installed packages from builder
|
|
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
|
|
COPY --from=builder /usr/local/bin /usr/local/bin
|
|
|
|
# Copy application code
|
|
COPY --chown=syndarix:syndarix . .
|
|
|
|
# Set Python path
|
|
ENV PYTHONPATH=/app
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# Configure git for the container
|
|
RUN git config --global --add safe.directory '*'
|
|
|
|
# Switch to non-root user
|
|
USER syndarix
|
|
|
|
# Expose port
|
|
EXPOSE 8003
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD python -c "import httpx; httpx.get('http://localhost:8003/health').raise_for_status()" || exit 1
|
|
|
|
# Run the server
|
|
CMD ["python", "server.py"]
|