dosbox-mcp

v0.2.4
io.github.dosbox-automation/dosbox-mcp Checked 4 days ago Published 24 days ago

Drive a DOS machine in dosbox-automation: keys, screen, recordings, Lua, memory.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

dosbox_status

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.

dosbox_shutdown

Shut down the emulator. Irreversible.

session_info

Connection details for the emulator's REST API: base URL, token location, and a curl example that reads the token from its file. Use this when the user asks how to call the API directly; for the work itself, use the MCP tools. The token value itself is never returned - it stays out of transcripts by design.

screen_text

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

screen_capture

Capture the current screen as a PNG image. Works in all video modes. mode raw (default): the video adapter's frame at its own size; rendered: the window's image after shader and scaling.

ParameterTypeDescription
modestringraw (default) or rendered

screen_info

Frame metadata: resolution, pixel format, palette status.

video_capture_start

Start ZMBV video recording (AVI with sound) into the engine's capture directory. mode raw (default): the video adapter's frames at their own size, no window needed. mode rendered: what the window shows, after shader and scaling. A start while one runs is an error.

ParameterTypeDescription
modestringraw (default) or rendered

video_capture_stop

Stop ZMBV video recording; reports the mode and why it ended.

video_capture_compression

Zlib levels (0-9) for raw and rendered video capture.

video_capture_compression_set

Set the zlib level (0-9) for raw and/or rendered video capture. Applies to the next start; refused while recording.

ParameterTypeDescription
rawinteger
renderedinteger

video_capture_status

Check whether a video capture is in progress.

audio_capture_start

Start WAV audio capture of the mixer output, into an auto-numbered file in the emulator's capture folder.

audio_capture_stop

Stop WAV audio capture.

audio_capture_status

Check whether an audio capture is in progress.

mixer_status

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

mixer_volume

Set the master mixer volume.

ParameterTypeDescription
left *numberLeft channel volume (0.0+)
right *numberRight channel volume (0.0+)

mixer_mute

Mute the master mixer output.

mixer_unmute

Unmute the master mixer output.

mixer_channel_volume

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

ParameterTypeDescription
channel *stringChannel name
left *numberLeft volume (0.0+)
right *numberRight volume (0.0+)

script_run

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.

ParameterTypeDescription
script *stringLua source code to execute.

script_status

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

script_stop

Stop a running Lua script.

input_type

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).

ParameterTypeDescription
text *stringText to type (max 4096 chars).
cpsnumberCharacters per second (default 30).

input_key

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

ParameterTypeDescription
key *stringKey name, e.g. KBD_enter, KBD_f1, KBD_esc.
pressedbooleanTrue for press, false for release.

input_sequence

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.

ParameterTypeDescription
events *arrayInput events, dispatched in order on one timeline.

mem_read

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

ParameterTypeDescription
length *integerNumber of bytes to read (max 65536).
offset *integerPhysical memory offset to read from.

mem_write

Write bytes to guest physical memory.

ParameterTypeDescription
data *stringBase64-encoded data to write.
offset *integerPhysical memory offset to write to.

dos_memory_map

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

freeze_set

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

ParameterTypeDescription
address *integerPhysical memory address to freeze.
value *integerValue to hold at the address.
widthintegerWidth in bytes: 1, 2, or 4 (default 1).

freeze_list

List all active memory freezes.

freeze_clear

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

ParameterTypeDescription
addressintegerAddress to unfreeze. Omit to clear all.

port_read

Read an x86 I/O port. Width is 1 (byte) or 2 (word). Use for VGA registers, sound cards, HGC control ports. The read goes through the device, as the CPU's would: reading port 60h takes a key from the keyboard buffer.

ParameterTypeDescription
port *integerI/O port address (0x0000..0xFFFF).
widthintegerWidth: 1 (byte) or 2 (word). Default 1.

port_write

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

ParameterTypeDescription
port *integerI/O port address (0x0000..0xFFFF).
value *integerValue to write.
widthintegerWidth: 1 (byte) or 2 (word). Default 1.

cpu_write_register

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.

ParameterTypeDescription
register *stringRegister name: eax, ebx, ecx, edx, esi, edi, esp, ebp, cs, ds, es, ss, fs, gs.
value *integerValue to write (0..0xFFFFFFFF for general, 0..0xFFFF for segment).

debug_status

Debugger state: paused, breakpoints, current instruction.

debug_pause

Pause emulation at the current instruction.

debug_continue

Resume emulation from the current pause point.

debug_step

Execute one instruction and pause again.

bridge_version

Bridge version and the protocol level it implements.

bridge_status

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

bridge_help

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

bridge_connect

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

bridge_disconnect

Detach from the instance; it keeps running.

bridge_start

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.

bridge_stop

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

bridge_logs

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

ParameterTypeDescription
nintegerNumber of lines from the end (default all buffered).

bridge_setup

Change safe bridge settings: headless, protocol pin. This tool cannot change the binary path, the capability mode, the token file or the port; a person sets those in the config file.

ParameterTypeDescription
headlessbooleanSpawn without a window.
protocolstringProtocol pin, "major.minor".

bridge_swagger

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