mcdosbox-x/Dockerfile
Ryan Malloy 170eba0843 Initial implementation of DOSBox-X MCP Server
MCP server for AI-assisted debugging of DOS binaries via GDB protocol.

Features:
- GDB remote protocol client for DOSBox-X debugging
- 16 debugging tools: launch, attach, breakpoint management,
  registers, memory read/write, disassemble, step, continue, etc.
- Docker container with DOSBox-X for consistent environment
- Support for DOS segment:offset addressing
- Comprehensive test suite (49 tests)

Primary use case: Reverse engineering the unpublished Bezier algorithm
in RIPTERM.EXE for the RIPscrip graphics protocol project.
2026-01-27 13:07:51 -07:00

121 lines
2.7 KiB
Docker

# DOSBox-X with GDB stub support
# Multi-stage build for minimal final image
# =============================================================================
# Stage 1: Build DOSBox-X with GDB support
# =============================================================================
FROM debian:bookworm-slim AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
build-essential \
automake \
autoconf \
libtool \
pkg-config \
libsdl2-dev \
libsdl2-net-dev \
libsdl2-image-dev \
libpng-dev \
libpcap-dev \
libslirp-dev \
libfluidsynth-dev \
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libswscale-dev \
nasm \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Clone DOSBox-X (main repo - check for GDB support)
# Note: If hezi/dosbox-x-gdb is stale, main DOSBox-X may have debugger support
WORKDIR /build
RUN git clone --depth 1 https://github.com/joncampbell123/dosbox-x.git
WORKDIR /build/dosbox-x
# Configure and build
# DOSBox-X has built-in debugger that can be enabled
RUN ./autogen.sh && \
./configure \
--prefix=/opt/dosbox-x \
--enable-debug \
--enable-sdl2 \
--disable-printer \
&& make -j$(nproc) \
&& make install
# =============================================================================
# Stage 2: Runtime image
# =============================================================================
FROM debian:bookworm-slim
# Install runtime dependencies only
RUN apt-get update && apt-get install -y --no-install-recommends \
libsdl2-2.0-0 \
libsdl2-net-2.0-0 \
libsdl2-image-2.0-0 \
libpng16-16 \
libpcap0.8 \
libslirp0 \
libfluidsynth3 \
libavcodec59 \
libavformat59 \
libavutil57 \
libswscale6 \
&& rm -rf /var/lib/apt/lists/*
# Copy DOSBox-X from builder
COPY --from=builder /opt/dosbox-x /opt/dosbox-x
# Create symlink in PATH
RUN ln -s /opt/dosbox-x/bin/dosbox-x /usr/local/bin/dosbox-x
# Create directories for config and DOS files
RUN mkdir -p /config /dos
# Default configuration with GDB stub enabled
RUN cat > /config/dosbox.conf << 'EOF'
[sdl]
fullscreen=false
windowresolution=800x600
output=opengl
[cpu]
core=auto
cputype=auto
cycles=auto
[dosbox]
memsize=16
[debugger]
# Enable GDB server stub
gdbserver=true
gdbport=1234
[serial]
serial1=disabled
serial2=disabled
[autoexec]
# Mount /dos as C:
MOUNT C /dos
C:
EOF
# Expose GDB port
EXPOSE 1234
# Set working directory
WORKDIR /dos
# Environment for X11 forwarding
ENV DISPLAY=:0
# Entry point
ENTRYPOINT ["dosbox-x", "-conf", "/config/dosbox.conf"]
CMD []