mcdosbox-x/Makefile
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

110 lines
2.7 KiB
Makefile

# DOSBox-X MCP Makefile
# Convenient commands for development
.PHONY: all build up down logs shell test lint format clean help
# Default target
all: help
# Build the Docker image
build:
docker compose build
# Start DOSBox-X container
up:
@echo "Starting DOSBox-X..."
@echo "Note: Run 'xhost +local:docker' first for X11 display"
docker compose up -d
@echo "DOSBox-X started. GDB port: 1234"
@echo "Connect with: claude mcp add dosbox-mcp"
# Start headless (no GUI)
up-headless:
docker compose --profile headless up -d dosbox-headless
@echo "DOSBox-X headless started. GDB port: 1235"
# Stop container
down:
docker compose down
# View logs
logs:
docker compose logs -f
# Shell into container
shell:
docker compose exec dosbox /bin/bash
# Run tests
test:
uv run pytest tests/ -v
# Run specific test
test-%:
uv run pytest tests/ -v -k "$*"
# Lint code
lint:
uv run ruff check src/
# Format code
format:
uv run ruff format src/ tests/
# Clean up
clean:
docker compose down -v --rmi local
rm -rf __pycache__ .pytest_cache .ruff_cache
find . -type d -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true
# Install dependencies (development)
install:
uv sync --dev
# Register MCP server with Claude Code
register:
claude mcp add dosbox-mcp -- uv run --directory $(shell pwd) dosbox-mcp
# Unregister MCP server
unregister:
claude mcp remove dosbox-mcp
# Create DOS directory structure
init:
mkdir -p dos config
@echo "Created dos/ and config/ directories"
@echo "Place DOS binaries in dos/ directory"
# Quick test - launch and attach
quicktest: up
@sleep 3
@echo "Testing GDB connection..."
@nc -zv localhost 1234 && echo "GDB stub is listening!" || echo "GDB stub not responding"
# Help
help:
@echo "DOSBox-X MCP Server"
@echo ""
@echo "Docker commands:"
@echo " make build Build Docker image"
@echo " make up Start DOSBox-X (GUI mode)"
@echo " make up-headless Start DOSBox-X (headless mode)"
@echo " make down Stop container"
@echo " make logs View container logs"
@echo " make shell Shell into container"
@echo ""
@echo "Development commands:"
@echo " make install Install dependencies"
@echo " make test Run tests"
@echo " make lint Lint code"
@echo " make format Format code"
@echo " make clean Clean up"
@echo ""
@echo "MCP commands:"
@echo " make register Register with Claude Code"
@echo " make unregister Unregister from Claude Code"
@echo ""
@echo "Setup:"
@echo " make init Create DOS directory structure"
@echo " make quicktest Test GDB connection"