2026-09-21 10:31:36 +03:00
|
|
|
# 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/*
|
|
|
|
|
|
2026-10-23 10:11:39 +00:00
|
|
|
# Build stage for the agent layer. The cursor-agent CLI is pinned at build
|
|
|
|
|
# time from the local cache (populated by `agent update` on the build host;
|
|
|
|
|
# CI downloads it once per runner via the same cache path). Keeps
|
|
|
|
|
# permission/sandbox enforcement current without runtime downloads.
|
|
|
|
|
FROM ubuntu:noble AS agent-stage
|
|
|
|
|
ARG CURSOR_AGENT_VERSION=2026.10.22-27dcf5f
|
|
|
|
|
COPY agent-cache/${CURSOR_AGENT_VERSION} /opt/cursor-agent
|
|
|
|
|
|
|
|
|
|
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 from the pinned build stage.
|
|
|
|
|
COPY --from=agent-stage /opt/cursor-agent /opt/cursor-agent
|
|
|
|
|
RUN ln -sf /opt/cursor-agent/cursor-agent /usr/local/bin/cursor-agent && \
|
2026-09-21 10:31:36 +03:00
|
|
|
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
|
|
|
|
|
|
2026-10-23 10:11:39 +00:00
|
|
|
# Dedicated HOME for the sandboxed agent child processes. The proxy runs
|
|
|
|
|
# non-root (uid 65534/nobody) and cannot setuid children, so the child
|
|
|
|
|
# inherits the pod uid; the separation here is about STATE isolation (the
|
|
|
|
|
# child's runtime files never touch the PVC-backed proxy HOME).
|
|
|
|
|
RUN mkdir -p /workspace /home/agent-home /home/nobody/.cursor && \
|
2026-09-21 10:31:36 +03:00
|
|
|
chmod +x /app/scripts/*.sh /app/entrypoint.sh && \
|
2026-10-23 10:11:39 +00:00
|
|
|
chown -R 65534:65534 /home/agent-home && \
|
|
|
|
|
chown -R 65534:65534 /opt/cursor-agent /opt/cursor-bootstrap /app /workspace /home/nobody
|
2026-09-21 10:31:36 +03:00
|
|
|
|
|
|
|
|
WORKDIR /workspace
|
|
|
|
|
ENV PORT=4646
|
2026-10-23 10:11:39 +00:00
|
|
|
ENV EDGE_PORT=4647
|
2026-09-21 10:31:36 +03:00
|
|
|
ENV HOME=/home/nobody
|
2026-10-23 10:11:39 +00:00
|
|
|
ENV CURSOR_AGENT_HOME=/home/agent-home
|
2026-09-21 10:31:36 +03:00
|
|
|
ENV NODE_ENV=production
|
|
|
|
|
USER nobody
|
|
|
|
|
|
2026-10-23 10:11:39 +00:00
|
|
|
EXPOSE 4646 4647
|
2026-09-21 10:31:36 +03:00
|
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|