Pure-Python client harness and MCP server exposing the Commander X16 emulator's stdio debugger to MCP-speaking clients
Project description
x16-emulator-MCP
x16-emulator-MCP is a Python Model Context Protocol (MCP) server that lets an AI application boot, drive, and interrogate a real Commander X16 emulator through its headless -debugstdio debugger. The agent works the way a person would at a debugger: set breakpoints and memory watchpoints, run, read registers, memory, and VRAM, evaluate conditions, and look at the screen.
Ask an AI agent something like:
A routine is clobbering zero-page
$70and I don't know which one. Put a write watchpoint on it, run, and tell me what writes there.
A moment later the answer comes back in the tool-result pane: $0070 written as $aa by the instruction at $0502. Catching the program counter behind a stray write is the loop the project is built for.
x16-emulator-MCP drives a fork of the Commander X16 emulator that carries the headless debugger protocol it speaks. Install and configure the emulator before using the server; the installation guide walks through it.
What the AI agent can do with it
The server exposes the debugger as a set of typed tools; the tool reference documents each with a worked example.
-
Boot a headless X16 session against a ROM, optionally loading a PRG at the BASIC prompt, and keep several independent sessions open at once, each addressed by a session id.
-
Set execution breakpoints and read or write memory watchpoints, including conditional ones, then run to the next hit. Each watchpoint hit names the program counter behind the access, which is what makes corruption hunting work.
-
Read and write CPU registers, system memory, and VRAM, and disassemble instructions.
-
Inspect the call stack, the zero-page registers, and the machine's banking and status state.
-
Capture the screen as a PNG.
-
Reach the raw debugger directly through a passthrough tool when no typed tool covers a command, and tear every session down cleanly on disconnect.
Use it as a Python library
x16dbg is a pure-standard-library package for use in regular Python modules, scripts and can run unattended in a test suite or a CI pipeline and is the foundation of the x16mcp MCP server.
Programmatically arm a watchpoint, run a routine, and assert on where it stopped:
from x16dbg import Client, discoverEmulator, discoverRom
def testStoreHitsZeroPage():
with Client.launch(discoverEmulator(), discoverRom()) as x16:
x16.brk() # halt the running machine
x16.writeMemory(0x00, 0x0500, [0xA9, 0xAA, 0x85, 0x70]) # LDA #$aa ; STA $70
x16.setRegister("pc", 0x0500)
x16.setWatchpoint("w", 0x00, 0x70) # stop on any write to $70
hit = x16.runUntil()
assert hit.pc == 0x0502
The Python API documents every method, and getting started walks a first session end to end.
Licence
MIT. See LICENSE.
Acknowledgements
Thanks to the Commander X16 community and the authors of X16Community/x16-emulator.
Fork Notice
x16-emulator-MCP depends on a fork of x16-emulator that implements a headless -debugstdio debugger protocol.
The emulator and ROM are not distrubted as part of this repository or its release artefacts. The ROM is licensed separately and you need to install both seperately. See the Installation Guide for more details.
Disclaimer
x16-emulator-MCP is a separate project from the Commander X16 emulator and is not affiliated with, sponsored, or endorsed by the X16Community project.
For the canonical emulator source and documentation, see X16Community/x16-emulator.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file x16_emulator_mcp-0.1.1.tar.gz.
File metadata
- Download URL: x16_emulator_mcp-0.1.1.tar.gz
- Upload date:
- Size: 45.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
399b93fcf76975bcfe2ab574aeea4382cc7d29917d7b8c9c4ec2f125c1d63fd6
|
|
| MD5 |
cf7aae4ac78f7224298a1ece6e419181
|
|
| BLAKE2b-256 |
8896e55d47fa50df793f18eff860740efe7c52c25901d27bbbd53d9402f81743
|
Provenance
The following attestation bundles were made for x16_emulator_mcp-0.1.1.tar.gz:
Publisher:
publish.yml on acscpt/x16-emulator-MCP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
x16_emulator_mcp-0.1.1.tar.gz -
Subject digest:
399b93fcf76975bcfe2ab574aeea4382cc7d29917d7b8c9c4ec2f125c1d63fd6 - Sigstore transparency entry: 1758349865
- Sigstore integration time:
-
Permalink:
acscpt/x16-emulator-MCP@5099a468c63b692d08986c110f2680d61cc37596 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/acscpt
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5099a468c63b692d08986c110f2680d61cc37596 -
Trigger Event:
push
-
Statement type:
File details
Details for the file x16_emulator_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: x16_emulator_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 38.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca27aee41f3b5e8fa9c445fe5acbf6bd5f9da81c661fab877b332944c130c512
|
|
| MD5 |
3507f66815d565b36039daba85b3ac4f
|
|
| BLAKE2b-256 |
b0bfd529e925ed742e5569c7d23145b714977a555a4cafe13b5cf2b7c84581d5
|
Provenance
The following attestation bundles were made for x16_emulator_mcp-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on acscpt/x16-emulator-MCP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
x16_emulator_mcp-0.1.1-py3-none-any.whl -
Subject digest:
ca27aee41f3b5e8fa9c445fe5acbf6bd5f9da81c661fab877b332944c130c512 - Sigstore transparency entry: 1758349887
- Sigstore integration time:
-
Permalink:
acscpt/x16-emulator-MCP@5099a468c63b692d08986c110f2680d61cc37596 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/acscpt
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5099a468c63b692d08986c110f2680d61cc37596 -
Trigger Event:
push
-
Statement type: