52 lines
1.8 KiB
Docker
52 lines
1.8 KiB
Docker
# cursor-agent-api-proxy — OpenAI-compatible API in front of cursor-agent CLI (ACP).
|
|||
|
|
#
|
||
|
|
# Every request uses cursor-agent ACP (`agent acp`):
|
||
|
|
# - session/new with in-process MCP server for client tools[]
|
||
|
|
# - session/prompt with text + image ContentBlocks
|
||
|
|
# - session/request_permission denies built-in tools, allows MCP client tools
|
||
|
|
# - Tool invocations park until HTTP client returns role:"tool"
|
||
|
|
#
|
||
|
|
# Requires CURSOR_API_KEY (Cursor subscription) at runtime.
|
||
|
|
|
||
|
|
FROM ubuntu:noble
|
||
|
|
|
||
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
||
|
|
RUN apt-get update && \
|
||
|
|
apt-get install -y --no-install-recommends \
|
||
|
|
bash \
|
||
|
|
ca-certificates \
|
||
|
|
curl \
|
||
|
|
tzdata \
|
||
|
|
&& rm -rf /var/lib/apt/lists/*
|
||
|
|
|
||
|
|
# Node 20 (LTS) — proxy and stdio MCP bridge both run on Node.
|
||
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
||
|
|
apt-get install -y --no-install-recommends nodejs && \
|
||
|
|
rm -rf /var/lib/apt/lists/*
|
||
|
|
|
||
|
|
# cursor-agent CLI (subscription-backed).
|
||
|
|
RUN curl -fsS https://cursor.com/install | bash && \
|
||
|
|
CURSOR_VERSION_DIR="$(echo /root/.local/share/cursor-agent/versions/*)" && \
|
||
|
|
cp -r "${CURSOR_VERSION_DIR}" /opt/cursor-agent && \
|
||
|
|
ln -sf /opt/cursor-agent/cursor-agent /usr/local/bin/cursor-agent && \
|
||
|
|
ln -sf /opt/cursor-agent/cursor-agent /usr/local/bin/agent.real
|
||
|
|
|
||
|
|
# Application code.
|
||
|
|
COPY src/ /app/src/
|
||
|
|
COPY scripts/ /app/scripts/
|
||
|
|
COPY cursor-bootstrap/ /opt/cursor-bootstrap/
|
||
|
|
COPY entrypoint.sh /app/entrypoint.sh
|
||
|
|
|
||
|
|
RUN mkdir -p /workspace /home/nobody/.cursor && \
|
||
|
|
chmod +x /app/scripts/*.sh /app/entrypoint.sh && \
|
||
|
|
chown -R nobody:nogroup /opt/cursor-agent /opt/cursor-bootstrap /app /workspace /home/nobody
|
||
|
|
|
||
|
|
WORKDIR /workspace
|
||
|
|
ENV PORT=4646
|
||
|
|
ENV HOME=/home/nobody
|
||
|
|
ENV NODE_ENV=production
|
||
|
|
USER nobody
|
||
|
|
|
||
|
|
EXPOSE 4646
|
||
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|