Skip to main content
Glama

dosbox-mcp

MCP server for dosbox-automation: drive a DOS machine from an AI agent.

dosbox-automation is a DOS emulator with a built-in REST API for automation. It began as a fork of dosbox-staging and has been developed independently since version 0.85.0. This bridge connects any MCP-capable agent (Claude Code, Claude Desktop, or anything that speaks the Model Context Protocol) to a running emulator. The agent can type into DOS programs, read the screen, capture frames and video, run sandboxed Lua scripts, and inspect memory.

Getting started

You need the emulator, this bridge, and an MCP client such as Claude Code or Claude Desktop. The bridge runs on Python 3.11 or newer.

1. Get dosbox-automation

Download from the releases page or build from source. Linux and Windows builds are on the releases page; on macOS you build from source. The manual has the platform-specific setup.

2. Enable the API

Open the primary config file. It lives at ~/.config/dosbox-automation/dosbox-automation.conf on Linux, %LOCALAPPDATA%\dosbox-automation\ on Windows and ~/Library/Preferences/dosbox-automation/ on macOS. In its [webserver] section (add the section if the file has none), set:

[webserver]
webserver_enabled = true
webserver_token_file = true
mount_allowed_bases = /home/you/dos

The last line names the folder your DOS programs live in. The emulator refuses to mount anything outside the folders listed there, so without it the agent can type MOUNT all day and get nothing. On Windows write the path as C:\Users\you\dos.

Start dosbox-automation. The DOS prompt appears in its window. To check the API is up, open http://localhost:8386/ in a browser: the API's documentation page answers.

3. Install the bridge

Pick one:

pipx install dosbox-mcp
uvx dosbox-mcp

pip install dosbox-mcp inside a virtual environment works too, but then the dosbox-mcp command lives in that environment's bin folder, and step 4 needs its full path.

You never start the bridge by hand. Your MCP client launches it when a conversation begins and stops it afterwards. Run in a terminal, it waits silently for a client that never comes.

4. Register with your MCP client

Claude Code, available in every project directory:

claude mcp add --scope user dosbox -- dosbox-mcp

With uvx instead of an install:

claude mcp add --scope user dosbox -- uvx dosbox-mcp

Claude Desktop: open Settings, then Developer, then Edit Config, and add the server to claude_desktop_config.json:

{
  "mcpServers": {
    "dosbox": { "command": "/home/you/.local/bin/dosbox-mcp" }
  }
}

Use the full path (which dosbox-mcp, or where dosbox-mcp on Windows): a desktop app does not see your shell's PATH. For uvx, use "command": "uvx", "args": ["dosbox-mcp"]. Restart Claude Desktop afterwards; it reads the file only at start.

The bridge reads the emulator's API token from ~/.config/dosbox-automation/webserver/api_token. On Windows and macOS the emulator writes the token under its own config folder from step 2, in a webserver subfolder; point the bridge at that file with the DOSBOX_TOKEN_FILE environment variable or the token_file setting (see Configuration).

5. Hello world

Start a new conversation with your agent and ask it something like:

Type DIR in the DOS prompt and tell me what files you see.

The agent calls the bridge tools to type the command, reads the screen text, and reports back what DOS printed. From here you can mount the folders you listed in step 2, run and install programs, capture screenshots, search memory for values, or write Lua scripts that automate entire workflows. The bridge_status tool confirms the connection if you want to check first.

Related MCP server: windows98-mcp

Configuration

Optional. Write a commented config file to tune the port, spawn an emulator on demand, or limit what an agent may do:

dosbox-mcp setup --init

The comments in the generated file explain each setting. Environment variables DOSBOX_API_URL, DOSBOX_API_TOKEN and DOSBOX_TOKEN_FILE override it. The bridge talks to loopback addresses only; it will not reach out to a remote machine.

What the agent gets

Tools for session control, screen text and captures, video recording, Lua scripting, keyboard and mouse input, and memory access. You choose how much reach an agent has, from read-only observation to full control.

An open protocol

The contract between this bridge and the emulator is written down in PROTOCOL.md and versioned independently. dosbox-automation is the reference implementation; any DOSBox variant that speaks the protocol works with this bridge.

In the box

Like the games it drives, this one ships with its paper. The feelies/ folder holds the manual, a reference card for every tool, an install sheet, and a tech-support page.

Requirements

  • Python 3.11 or newer

  • A running dosbox-automation (0.84-da2 or newer) on the same machine

License

GPL-2.0-or-later: the license text is in LICENSE, which parts carry which license in NOTICE. The protocol specification (PROTOCOL.md) is licensed CC-BY-SA-4.0.


This project is developed with tooled assistance, but tested, reviewed and signed off by a human developer.

Available Tools

47 tools
audio_capture_startB

Start WAV audio capture of the mixer output.

Inputs: path.

audio_capture_statusB
Read-only

Check whether an audio capture is in progress.

Inputs: no named parameters.

audio_capture_stopA

Stop WAV audio capture.

Inputs: no named parameters.

bridge_connectA

Explicitly attach to the running dosbox instance: reads the token, probes the API, negotiates the protocol version. Reports a precise reason when it cannot.

Inputs: no named parameters.

bridge_disconnectA

Detach from the instance; it keeps running.

Inputs: no named parameters.

bridge_helpA
Read-only

One-call orientation: version, connection state, and every available tool with a one-line description.

Inputs: no named parameters.

bridge_logsA
Read-only

Tail of the spawned instance's output (untrusted machine output). Only covers an instance this bridge started.

Inputs: n.

bridge_setupA

Change safe bridge settings: port, headless, protocol pin. The binary path and the capability mode are human-edited only and are rejected here by design.

Inputs: port, headless, protocol.

bridge_startA

Spawn the dosbox binary named in the human-edited config file (with an isolated config dir) and attach to it. Refuses while an instance is already managed.

Inputs: no named parameters.

bridge_statusA
Read-only

Bridge and connection state: engine version, effective protocol, enabled features, capability mode, managed instance, token presence (never the value).

Inputs: no named parameters.

bridge_stopA

Stop the instance this bridge spawned. Never stops an instance it merely attached to.

Inputs: no named parameters.

bridge_swaggerB
Read-only

Digest of the instance's OpenAPI surface: route counts per group and routes unknown to the negotiated protocol.

Inputs: no named parameters.

bridge_versionB
Read-only

Bridge version and the protocol level it implements.

Inputs: no named parameters.

cpu_write_registerA

Write a CPU register. General registers (eax..ebp) accept 32-bit values. Segment registers (cs,ds,es,ss,fs,gs) accept 16-bit values and update the cached physical base.

Inputs: value (required), register (required).

debug_continueA

Resume emulation from the current pause point.

Inputs: no named parameters.

debug_pauseB

Pause emulation at the current instruction.

Inputs: no named parameters.

debug_statusB
Read-only

Debugger state: paused, breakpoints, current instruction.

Inputs: no named parameters.

debug_stepA

Execute one instruction and pause again.

Inputs: no named parameters.

dosbox_shutdownA

Shut down the emulator. Irreversible.

Inputs: no named parameters.

dosbox_statusA
Read-only

Machine state: what program is running, mount status, version. One call answers 'what is the machine doing right now'. While a mount waits on an archive, status.archive says what the archive helper does (activity identifying or materializing, archive, bytes_done, bytes_total); the field is absent otherwise.

Inputs: no named parameters.

dos_memory_mapA
Read-only

Walk the DOS MCB chain and report which PSP owns which memory block. Shows the full conventional memory layout.

Inputs: no named parameters.

freeze_clearA

Remove a freeze. Pass an address to remove one, or omit to clear all freezes.

Inputs: address.

freeze_listA
Read-only

List all active memory freezes.

Inputs: no named parameters.

freeze_setA

Lock a memory address to a value. The value is rewritten every frame, trainer-style. Width is 1/2/4 bytes, little-endian.

Inputs: value (required), address (required), width.

input_keyA

Press or release a single key by its KBD_* name. Use for special keys (F1-F12, arrows, Escape, etc) that input_type cannot produce.

Inputs: key (required), pressed.

input_sequenceA

Inject a timed sequence of key, mouse, and wheel events. For complex input patterns or recorded replays. Mouse movement is RELATIVE (x_rel/y_rel deltas from the current cursor position); there is no absolute positioning. To reach a known position, sweep past a screen corner first (e.g. x_rel:-4000, y_rel:-4000 pins the cursor top-left), then move by the target offset. A click is a mouse_button press event followed by a release event. Unknown fields are rejected with an error naming the allowed ones.

Inputs: events (required).

input_typeA

Type a string on the DOS keyboard. Characters are injected with pacing so the 8-slot i8042 buffer never overflows. Supports printable ASCII and common symbols (US layout).

Inputs: text (required), cps.

mem_readA
Read-only

Read bytes from guest physical memory. Returns base64 data and current CPU register state.

Inputs: length (required), offset (required).

mem_writeC

Write bytes to guest physical memory.

Inputs: data (required), offset (required).

mixer_channel_volumeB

Set a mixer channel's user volume by name (SB, GUS, CDAUDIO, SPKR, etc.).

Inputs: left (required), right (required), channel (required).

mixer_muteA

Mute the master mixer output.

Inputs: no named parameters.

mixer_statusA
Read-only

Get mixer state: master volume, mute, all channels with volumes and sample rates.

Inputs: no named parameters.

mixer_unmuteA

Unmute the master mixer output.

Inputs: no named parameters.

mixer_volumeC

Set the master mixer volume.

Inputs: left (required), right (required).

port_readA
Read-only

Read an x86 I/O port. Width is 1 (byte) or 2 (word). Use for VGA registers, sound cards, HGC control ports.

Inputs: port (required), width.

port_writeB

Write to an x86 I/O port. Width is 1 (byte) or 2 (word). For Mode X unchaining, Hercules graphics, hardware config.

Inputs: port (required), value (required), width.

screen_captureA
Read-only

Capture the current screen as a PNG image. Works in all video modes.

Inputs: no named parameters.

screen_infoB
Read-only

Frame metadata: resolution, pixel format, palette status.

Inputs: no named parameters.

screen_textA
Read-only

Read the DOS text-mode screen buffer as a string. Works only in text modes (CGA/EGA/VGA/Hercules text).

Inputs: no named parameters.

script_runA

Load and start a Lua script. The script runs sandboxed on the emulation thread. Any DOS automation capability without a dedicated tool is reachable through a Lua script.

Inputs: script (required).

script_statusA
Read-only

Check the running script's state and read its output table. Scripts communicate results through dosbox.output['key'] = value.

Inputs: no named parameters.

script_stopB

Stop a running Lua script.

Inputs: no named parameters.

session_infoA
Read-only

Connection details for driving the REST API directly: base URL, token location, and a curl example that reads the token from its file. Use this when you need an endpoint the MCP tools don't wrap, such as saving a video frame to a file. The token value itself is never returned - it stays out of transcripts by design.

Inputs: no named parameters.

video_capture_startA

Start ZMBV video recording of the emulator screen.

Inputs: no named parameters.

video_capture_statusA
Read-only

Check whether a video capture is in progress.

Inputs: no named parameters.

video_capture_stopB

Stop ZMBV video recording.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 47 tools

    Disambiguation4/5

    Most tools are cleanly separated by resource prefix (video_, audio_, mixer_, mem_, port_, debug_, bridge_, script_, input_), so an agent can usually pick the right one. Some state-reporting tools overlap conceptually—bridge_status, dosbox_status, debug_status, bridge_version, session_info—but their descriptions clearly distinguish connection, machine, debugger, protocol, and REST details.

    Naming Consistency4/5

    Names are overwhelmingly predictable snake_case with a group prefix and action suffix, e.g. mem_read, port_write, freeze_list, bridge_connect. Minor deviations like cpu_write_register and dosbox_status/session_info/bridge_help are still readable and do not create confusion.

    Tool Count2/5

    47 tools is very heavy for an MCP surface, even for full emulator control. Many start/stop/status triplets and bridge-management tools could be consolidated without losing capability, making the set feel oversized rather than lean.

    Completeness4/5

    Coverage is broad: capture, input, memory, ports, CPU registers, debugger, mixer, and bridge lifecycle are all represented. Direct mount/save-state/config operations are not wrapped, but script_run explicitly provides an escape hatch to any Lua-reachable DOSBox capability, leaving only minor gaps.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI to observe and control the DOS game Master of Orion 2 by reading emulator memory and simulating mouse/keyboard input.
      2
      MIT
    • F
      license
      A
      quality
      C
      maintenance
      Enables an MCP client to observe and control a text-mode DOS system via a Python bridge, supporting keyboard input and screen capture.
      8
      -
    • F
      license
      Not graded
      quality
      C
      maintenance
      This MCP server enables AI agents to inspect and control the native DOSBox-X debugger through bounded MCP tools, including breakpoint management, execution control, register/memory inspection, and disassembly for DOS program debugging and reverse engineering.
      1
      -