# Docker image for MrMartiniMo/docmost-mcp (TypeScript STDIO MCP server)
# Not published to npm, so we clone + build from source.
# Includes patches for list_pages pagination and search response handling.
FROM node:20-slim

WORKDIR /mcp

RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*

RUN git clone --depth 1 https://github.com/MrMartiniMo/docmost-mcp.git . \
    && npm install \
    && rm -rf .git

# Apply our fixes before building
COPY deploy/docmost-mcp-fixes.patch /tmp/fixes.patch
RUN git init && git add -A && git apply /tmp/fixes.patch && rm -rf .git /tmp/fixes.patch

RUN npm run build

ENTRYPOINT ["node", "build/index.js"]
