FROM python:3.11-slim # Node.js is required by the MongoDB MCP server (npx @mongodb-js/mongodb-mcp-server) RUN apt-get update && apt-get install -y --no-install-recommends curl && \ curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ apt-get install -y --no-install-recommends nodejs && \ rm -rf /var/lib/apt/lists/* # Pre-install the MongoDB MCP server so npx doesn't download it on first request RUN npm install -g @mongodb-js/mongodb-mcp-server WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . # Hugging Face Spaces expects port 7860 ENV PORT=7860 CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port $PORT"]