dosbox-mcp
Drive and inspect a running dosbox-automation DOS emulator from an MCP client, from screen/input automation to memory, I/O, debugging, and bridge lifecycle management.
Machine/session control: check DOSBox status, shut down the emulator, inspect session/API details, connect/disconnect, start/stop a managed emulator, tail logs, view version/help/protocol/Swagger info, and adjust safe bridge settings.
Screen and media: read the text-mode screen buffer, capture PNG screenshots, get frame metadata, start/stop/check ZMBV video recording, start/stop/check WAV audio capture, and inspect or set mixer volumes and mute state.
Input automation: type strings, press/release individual KBD_* keys, and inject timed keyboard, relative mouse movement, mouse button, and wheel event sequences.
Scripting: run sandboxed Lua scripts on the emulation thread, check script state/output, and stop scripts; scripts can reach DOS automation capabilities without dedicated tools.
Memory and hardware: read/write/search guest physical memory, map DOS MCB memory, freeze/unfreeze values, read/write x86 I/O ports, and write CPU registers.
Debugging: pause/continue/step emulation and inspect debugger state, breakpoints, and current instruction.
Direct API access: get REST API connection info and a curl example for endpoints not wrapped by MCP tools; the token value itself is never exposed.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@dosbox-mcp list files in the current DOS directory"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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/dosThe 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-mcpuvx dosbox-mcppip 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-mcpWith uvx instead of an install:
claude mcp add --scope user dosbox -- uvx dosbox-mcpClaude 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 --initThe 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 toolsaudio_capture_startB
Start WAV audio capture of the mixer output.
Inputs: path.
audio_capture_statusBRead-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_helpARead-only
One-call orientation: version, connection state, and every available tool with a one-line description.
Inputs: no named parameters.
bridge_logsARead-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_statusARead-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_swaggerBRead-only
Digest of the instance's OpenAPI surface: route counts per group and routes unknown to the negotiated protocol.
Inputs: no named parameters.
bridge_versionBRead-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_statusBRead-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_statusARead-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_mapARead-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_listARead-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_readARead-only
Read bytes from guest physical memory. Returns base64 data and current CPU register state.
Inputs: length (required), offset (required).
mem_searchARead-only
Scan a range of guest memory for a value. Returns matching physical addresses. Width is 1 (byte), 2 (word), or 4 (dword), little-endian.
Inputs: end (required), start (required), value (required), width.
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_statusARead-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_readARead-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_captureARead-only
Capture the current screen as a PNG image. Works in all video modes.
Inputs: no named parameters.
screen_infoBRead-only
Frame metadata: resolution, pixel format, palette status.
Inputs: no named parameters.
screen_textARead-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_statusARead-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_infoARead-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_statusARead-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
Scored across 47 tools
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.
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.
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.
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
Related MCP Connectors
Make games with AI: one MCP server that connects your agent to Unity, Unreal and Godot editors.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
214 tools for AI agents over one MCP endpoint: image, video, audio, 3D, data, storage, mail, GPUs.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI to observe and control the DOS game Master of Orion 2 by reading emulator memory and simulating mouse/keyboard input.2MIT
- AlicenseBqualityCmaintenanceControls a real Windows 98 VM through 47 MCP tools, enabling screenshots, mouse/keyboard input, command execution, and file transfers.8529 npm3MIT
- FlicenseAqualityCmaintenanceEnables an MCP client to observe and control a text-mode DOS system via a Python bridge, supporting keyboard input and screen capture.8-
- FlicenseNot gradedqualityCmaintenanceThis 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-