Remove Rust project; repo is now Python-only MCP server at root

This commit is contained in:
2026-06-13 06:11:21 +00:00
parent 873976c05a
commit 438eebc73d
67 changed files with 53 additions and 24721 deletions
+53 -78
View File
@@ -1,95 +1,70 @@
# Unified Dockerfile for docx-mcp
# Features:
# - HTTP mode (HTML interface) + stdio mode
# - LibreOffice for high-fidelity PDF conversion
# - Templates directory support
# - Sandboxed, non-root, read-only filesystem where possible
# Dockerfile for py-docx-mcp (Python MCP server) - OpenWebUI: MCP (Streamable HTTP)
# Usage:
# docker build -t py-docx-mcp .
# docker run --rm -p 3000:3000 py-docx-mcp
#
# In OpenWebUI:
# - Type: MCP (Streamable HTTP)
# - URL: http://<host>:3000
# - Auth: Bearer (if DOCX_MCP_API_KEY is set)
#
# Environment:
# DOCX_MCP_API_KEY - API key (Bearer or X-API-Key). Optional but recommended.
# DOCX_MCP_HTTP_HOST - Bind host (default: 0.0.0.0)
# DOCX_MCP_HTTP_PORT - Bind port (default: 3000)
# DOCX_MCP_TEMPLATES_DIR - Templates directory (default: /templates)
# DOCX_MCP_MAX_SIZE - Max document size in bytes (default: 104857600)
# DOCX_MCP_MAX_DOCS - Max open documents (default: 30)
# DOCX_MCP_SANDBOX - Enable sandbox mode (default: true)
# DOCX_MCP_ALLOW_EXTERNAL_TOOLS - Allow external tools (default: false)
# DOCX_MCP_ALLOW_NETWORK - Allow network access (default: false)
# ============================================================
# Build Stage
# ============================================================
FROM rust:1.90-slim AS builder
FROM python:3.12-slim AS base
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config \
libssl-dev \
libfontconfig1-dev \
libfreetype6-dev \
libjpeg-dev \
libpng-dev \
build-essential \
&& rm -rf /var/lib/apt/lists/*
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=1
WORKDIR /app
# Copy manifests and source
COPY Cargo.toml Cargo.lock build.rs ./
COPY src/ ./src/
COPY benches/ ./benches/
COPY assets/ ./assets/
# Build with all key features enabled:
# - runtime-server: stdio MCP transport
# - http-server: HTTP + HTML interface
# - advanced-docx: advanced document operations
# - build-bin: enables building the docx-mcp binary
RUN cargo build --release --features "runtime-server http-server advanced-docx build-bin"
# ============================================================
# Runtime Stage
# ============================================================
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies (including LibreOffice for better PDF conversion)
# System deps (for python-docx, Pillow, and optional external converters)
RUN apt-get update && apt-get install -y --no-install-recommends \
libssl3 \
libfontconfig1 \
libfreetype6 \
libjpeg62-turbo \
libpng16-16 \
ca-certificates \
build-essential \
libjpeg62-turbo-dev \
libpng-dev \
libfreetype6-dev \
libfontconfig1-dev \
libreoffice \
poppler-utils \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN groupadd -r docxmcp && useradd -r -g docxmcp -s /bin/bash -d /app docxmcp
# Install Python dependencies
COPY pyproject.toml ./
RUN pip install --upgrade pip && pip install .
WORKDIR /app
RUN chown -R docxmcp:docxmcp /app
# Copy source
COPY src/py_docx ./src/py_docx
# Copy binary from builder
COPY --from=builder /app/target/release/docx-mcp /usr/local/bin/docx-mcp
RUN chmod +x /usr/local/bin/docx-mcp
# Create runtime dirs
RUN mkdir -p /templates /out /tmp/py-docx-mcp
# Create working directories
RUN mkdir -p /tmp/docx-mcp /templates /out && \
chown -R docxmcp:docxmcp /tmp/docx-mcp /templates /out
# Environment
ENV DOCX_MCP_HTTP_HOST=0.0.0.0 \
DOCX_MCP_HTTP_PORT=3000 \
DOCX_MCP_TEMPLATES_DIR=/templates \
DOCX_MCP_MAX_SIZE=104857600 \
DOCX_MCP_MAX_DOCS=30 \
DOCX_MCP_SANDBOX=true \
DOCX_MCP_ALLOW_EXTERNAL_TOOLS=true \
DOCX_MCP_ALLOW_NETWORK=false
# Switch to non-root user
USER docxmcp
# Expose HTTP port (used when running in HTTP mode)
# Expose HTTP port (Streamable HTTP for OpenWebUI)
EXPOSE 3000
# Health check (checks binary is present and executable)
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD /usr/local/bin/docx-mcp --version
# Health check (ensure module is importable)
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD python -c "import py_docx.server; print('ok')" || exit 1
# Default environment:
# - HTTP disabled by default (use stdio mode).
# - Enable via DOCX_MCP_HTTP=true or --http-mode.
ENV RUST_LOG=info
ENV DOCX_MCP_TEMP=/tmp/docx-mcp
ENV DOCX_MCP_HTTP=false
ENV DOCX_MCP_HTTP_ADDRESS=0.0.0.0:3000
ENV DOCX_MCP_TEMPLATES_DIR=/templates
ENV DOCX_MCP_MAX_SIZE=104857600
ENV DOCX_MCP_MAX_DOCS=30
ENTRYPOINT ["/usr/local/bin/docx-mcp"]
# Default: stdio mode (for MCP clients).
# To run in HTTP mode, override CMD or set DOCX_MCP_HTTP=true.
CMD []
# Default: Streamable HTTP for OpenWebUI MCP
ENTRYPOINT ["python", "-m", "py_docx.server"]