ps2mcp
Provides tools to run ELF/module programs on a PlayStation 2, read/write EE and IOP memory and registers, measure hardware timing, capture screenshots, control a virtual DualShock 2 controller, debug with breakpoints/watchpoints/registers, and stop/reset the console.
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., "@ps2mcp run hello.elf and show me what it printed and how it exited"
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.
ps2mcp
A PlayStation 2 that an AI agent can work with: ps2mcp is to an agent what ps2link is to a developer. It runs programs on a console and reports how they ended, reads and writes the hardware's memory and registers, times what the hardware does, and takes pictures of what's on the screen. It speaks the Model Context Protocol, so any MCP client can use it.
ps2link assumes a person: eyes on the television, output scrolling by, a finger on the reset button. An agent has none of those, so ps2mcp gives it what they stood for:
A developer has | An agent gets |
Eyes on the television |
|
Output scrolling by |
|
A feel for when it's hung | A bound on every wait, and |
A controller in their hands |
|
A program written for each question |
|
A notebook | A journal of every request to the hardware and its answer, with the console it came from |
It's meant for two kinds of work: developing software for the PS2, and finding out what the hardware does so that it can be written down.
Status
This is version 1.0.0. Everything below has run on a PlayStation 2, a SCPH-30001, over its network adapter, and on that one console only: another model, or another BIOS, may yet have something to say. The wire protocol is at version 1.0.
Programs. An ELF for the EE or a module for the IOP is loaded from the host and started, a small one printing in a quarter of a second. Its
host:files come from the host, and what it prints goes there, without what the console's own modules say of loading it.How a program ended. Its exit code, or the exception it died of with its registers. The console is ready for the next program 0.4 s after the last was asked for: 300 were run one after another.
Recovery.
stoptakes the EE back from a program that's spinning or asleep in 0.1 s.resetstarts the console's side afresh, IOP and all, in 6 s, wherever the loader is: a loader left waiting on the IOP between programs is brought back too.Memory. The EE's address space and the IOP's, the kernel's addresses and the hardware's registers included, in accesses of exactly the width asked for, while a program runs or none does. An access that faults is answered with FAULT.
Measuring.
measureruns a sequence of reads, writes, delays, waits and calls back to back on the EE, timed by its cycle counter at 61 cycles a step, or on the IOP, timed by its system clock. Interrupts are off if asked.The picture.
screenshotreads back what's being shown, or any rectangle of the GS's memory, as it was at one moment: 640 by 448 in 2.4 s.displaygives the GS's display registers, which can't be read from the GS: the loader follows each write to them.Debugging. A program is held at a
breakpoint, at its first instruction, where it would have crashed, wherever it is whenhaltis called, or at the instruction about to touch an address awatchpointis on, with everything of it kept: itsregistersread and changed, its memory too,stepfor an instruction at a time,resumeto send it on.The controller.
controllerputs a DualShock 2 in a port and presses its buttons: a program reading it through the console's padman or PS2SDK's finds it there, sticks and pressures too, whatever is really plugged in.Starting by itself. From a memory card, with no ps2link and no host:
ps2mcp.elfand anIPCONFIG.DATbeside it are all the console needs.New builds.
scripts/update-consoleputs one on a running console over the link in about five seconds.
What it can't do
A program that resets the IOP takes ps2mcp's module with it, as it takes ps2link: the console's reset button is needed after. Most games do, so they're out of reach. So is the button needed after a program that keeps interrupts off and never ends, one that writes over the loader at the top of memory (0x01a00000 and up), and an IOP that dies of an exception outside a caught access.
The debugger is the EE's. There's none for the IOP, and VU1's registers aren't given. A breakpoint or a crash inside a program's own interrupt handler can't be held, and hangs the console.
haltholds code below 16 MiB, when one of the program's threads next runs.The controller is found by a program that reads it through the IOP's sio2man, as the console's padman and PS2SDK's do. There's no multitap, and the later XSIO2MAN and XPADMAN haven't been tried.
Speed. Memory, sequences and pictures on the EE are answered at a vertical blank: 17 ms a request, half a megabyte a second for a block.
Starting from a USB drive hasn't been tried. From a memory card it works, the address read from the
IPCONFIG.DATbeside the program.An emulator can't be a target yet, and memory cards and discs aren't reached: see the plan.
Related MCP server: ce-mcp
Getting started
With no console
git clone https://github.com/ooPo/ps2mcp
cd ps2mcp
python3 -m venv .venv
.venv/bin/pip install -e '.[dev]'
.venv/bin/pytestThe mock target answers the protocol with no console behind it. To give it to an MCP client,
have the client start .venv/bin/ps2mcp --target mock. For Claude Code:
claude mcp add ps2mcp -- "$PWD/.venv/bin/ps2mcp" --target mock --root "$PWD"With a console
A PlayStation 2 with a network adapter, and some way of starting homebrew on it.
scripts/build-console # needs Dockerbuilds these into build/console; a release has
them already built, in one archive. The
first two are all the console needs:
File | |
| ps2mcp, with the network's modules inside it |
| The console's address, netmask and gateway, as one line of text: |
| Only for a folder of ps2mcp's own at the top of a memory card: with these beside the other two, the console's browser shows the folder as ps2mcp, with its icon, where it would say the data is corrupted |
Put the two together where the console's programs are kept (a folder on a memory card, a USB
drive) and start ps2mcp.elf as any other program is started there. The television shows the
picture above, with the address the console is listening on and where it had it from. An
IPCONFIG.DAT that ps2link already uses, in mc0:/SYS-CONF, is found too if there's none
beside the program, and it's the same format.
Then give the console to an MCP client:
claude mcp add ps2mcp -- "$PWD/.venv/bin/ps2mcp" --target 192.168.0.10 --root "$PWD/build/console/tests"and the agent can be asked to run hello_ee.elf, one of the test programs built into
build/console/tests.
A console that's running ps2link can be given ps2mcp over the network instead, with nothing
copied to it: scripts/start-from-ps2link <address> sends ps2mcp.elf to ps2link, which it
takes the place of, at the address the console already has. And `scripts/update-console
The build uses PS2SDK in the pinned ps2dev/ps2dev Docker image (scripts/ps2dev runs a
command in it).
The server's arguments
Argument | |
| A target's address, |
| The folder programs are run from and the target's |
| The journal's file: |
The tools
Tool | What it does |
| What the target is, what it can do, and what the program on it is doing |
| Values of 1, 2, 4, 8 or 16 bytes, each with one access of exactly that width: for hardware registers, in the EE's address space or the IOP's |
| A block of memory as a hex dump, or saved to a file |
| A sequence of reads, writes, delays, waits and readings of the cycle counter, run back to back on the target with no traffic to the host between them |
| Runs an ELF on the EE or a module on the IOP, and waits for it to end or to print a given text: exited, crashed (with the exception), loaded, or still running |
| What's been printed since last asked |
| Ends the program; puts the target back as it starts |
| Holds a program at an instruction, or wherever it is; sends it on; steps it an instruction at a time |
| Holds a program when it loads from or stores to an address, or only when it's a given value: what touches a variable, or a hardware register |
| A held program's registers, read and changed: the general ones, the FPU's, COP0's, VU0's |
| Presses buttons and moves sticks on a controller the program finds in a port, whatever is plugged in |
| The picture being shown, or a rectangle of the GS's memory |
| The GS's display registers as the program has written them |
A target says which of these it can do. A console can't save its state, and an emulator can; the
mock can't call code. status lists them.
On the console
ps2mcp.elf, the loader, restarts the IOP, loads the network's modules and ps2mcp.irx from
inside itself, and then stays, high in memory, to load the programs it's given and to take the
EE back when one ends, crashes or is stopped. ps2mcp.irx, the module resident on the IOP,
answers the protocol over TCP and serves the IOP's side itself. The comments at the top of
console/ee/loader.c and console/iop/ps2mcp.c say how each part works.
The console's address is the loader's arguments, or IPCONFIG.DAT's, looked for beside the
loader and then in mc0:/SYS-CONF, where ps2link keeps its own.
The loader can be tried in an emulator before a console. One found a write through a null
pointer that a PS2 showed only as an exception on its screen. build/console/tests/preview.elf
is the loader's screen alone, for looking at in one.
How it's put together
MCP client <--MCP, stdio--> ps2mcp (Python, on the host) <--the wire protocol, TCP--> a target
(an agent) tools, files, journal console, emulator or mockAnything that answers the wire protocol is a target, so the host has one way of talking to all of them:
A console, running the loader and the module in
console/.An emulator with the protocol built in as a debug server, or running the console's side as a guest. Not yet written.
The mock (
src/ps2mcp/mock.py), for building the host's side and trying clients.
File | What it is |
| The protocol's numbers and framing |
| The host's end of a link: requests, events, the journal |
| The target's |
|
|
| The MCP server and its tools |
| The mock target |
| The protocol's numbers, for C |
| The module resident on the IOP |
| The loader, and what of it stays with a running program |
| What the loader shows on the television |
| Replaces a running ps2mcp with a new build |
| Small programs that exit, crash, hang, read a file, write to the display, read the controller, use the FPU and VU0, touch hardware registers and wait to be debugged, to try the tools with |
| Build the console's side in the pinned toolchain image |
| Starts ps2mcp on a console running ps2link |
| Puts a new build on a console already running ps2mcp |
| What the console's browser shows for ps2mcp's folder on a memory card |
| Draws the icon, for this page, for the television and for a memory card |
| Gathers what a console needs into one archive |
The plan
In 1.0, and in the changelog:
The protocol and the host's side, against a mock.
The console's side: a loader and a module resident on the IOP with the network, programs run with their outcomes and crashes reported,
host:files and console output as programs written for ps2link expect them.A resident on the EE: memory and registers reached while a program runs, sequences, code called, the picture read back from the GS.
A debugger: breakpoints, steps, registers, a running program halted, a watch on an address or a value, and a crash held to be looked at.
The controller pressed from the host.
Not in 1.0:
An emulator as a target, so the tools work end to end on PS2 code with no hardware, and what a console does can be set beside what an emulator does. It wants designing with an emulator's authors, not adding on.
Memory cards and discs behind a switch that's off by default, and hardware notes served beside the tools.
More consoles. Reports of other models are welcome:
statussays what a console is.
Licence
Available Tools
19 toolsbreakpointA
Sets a breakpoint at an instruction of the EE's program, or removes one. A program
that reaches it is held there, before the instruction is done: run and resume return
with the state "held". Breakpoints are kept from one run to the next, and can be set
before the program is run or while it runs. Returns all that are set.
While a program is held its breakpoints are out of its memory, which reads as the program's own. One in a branch's delay slot is reported at the branch.
Inputs: address (required), remove. Returns: object
controllerA
Presses buttons on a controller of the target's own making, a DualShock 2 in port
1 or 2, which the program finds there whatever is really plugged in. buttons are those
held down, all the others up: select, start, up, right, down, left, triangle, circle,
cross, square, l1, l2, l3, r1, r2, r3. The sticks are x and y from -1 to 1, right and
down positive, and are centred if not given.
With seconds the buttons are held that long and then let go, the call returning after:
a press. Without, they stay as set until the next call; an empty call lets everything
go. A program usually wants a button down for a few frames to notice it: 0.1 is a
press. unplug takes the controller out, and the port is as it really is again.
polls counts the times the port was asked what's pressed: one that isn't growing
means no program is reading it. A console reaches a program that reads the controller
through the IOP's sio2man, as the console's own padman and PS2SDK's do.
Inputs: port, unplug, buttons, seconds, +2 more. Returns: object
displayA
What a console's program has written to the GS's display registers, which can't be
read from the GS itself: PMODE, SMODE2, DISPFB1 and 2, DISPLAY1 and 2, BGCOLOR and their
neighbours, each as it was last written, with writes, how many there have been since
the program started. DISPFB and DISPLAY are taken apart too, as circuits: where the
frame buffer is and what of it is shown. Only writes since the program started are
known; the kernel's own, made when it sets the video mode, are among them.
Inputs: no named parameters. Returns: object
dump_memoryA
Reads a block of plain memory as bytes. Returns a hex dump of up to 4096 bytes; with
save_to, a file name under the server's root, any length is written there as raw bytes
instead and only a summary is returned. Not for hardware registers: use read_memory.
Inputs: address (required), space, length, save_to. Returns: result
haltA
Holds the program that's running, wherever it is, as a breakpoint there would: the
state is "held", and registers, step and resume follow. A console holds it at the
next instruction one of its threads does. A program whose threads are all waiting (for
a semaphore, the next frame) is still "running" when this returns, and is held when one
next runs; one that's waiting for good is ended with stop.
Inputs: no named parameters. Returns: object
measureA
Runs a sequence of steps on the target back to back, with no traffic to the host between them, and returns each step's result in order. Use it when the order and timing of register accesses matter, as when finding out what the hardware does.
Steps (addresses and values as numbers or "0x..." text; width 1, 2, 4, 8 or 16, default 4; any step that gives a result may carry a "label"): {"op": "read", "address": A, "width": W} the value read {"op": "write", "address": A, "width": W, "value": V} {"op": "delay", "cycles": N} waits at least N CPU cycles {"op": "time"} the CPU's cycle counter, 32 bits {"op": "wait", "address": A, "width": W, "mask": M, "value": V, "timeout": N} reads until (value read & M) == V; the cycles waited, or the sequence ends in TIMEOUT {"op": "repeat", "count": N, "steps": [...]} up to three deep {"op": "call", "address": A} calls code at A; what it returned
processor is "ee" or "iop": which runs the steps, and in whose address space. On the
IOP widths go up to 4, and the clock that time, delay and a wait's timeout count in
is a console's 36.864 MHz system clock, which is the IOP's own.
interrupts_off runs it with interrupts disabled. note says what the measurement is
for, and is kept with it in the journal. If a step fails, the results up to it are still
returned, with failed saying why.
Inputs: steps (required), note, processor, interrupts_off. Returns: object
outputA
What the target has printed to its console since output or run last returned, and
what the program is doing now.
Inputs: no named parameters. Returns: object
read_memoryA
Reads count values of width bytes (1, 2, 4, 8 or 16) starting at address, each
with one access of exactly that width, in ascending order. This is the way to read a
hardware register, where the width of the access matters. space is "ee" or "iop".
For a block of plain memory use dump_memory.
Inputs: address (required), count, space, width. Returns: object
registersA
A held program's registers. group chooses which:
"general", the default: the 32 general ones, pc, hi and lo, and the exception's status, cause and bad_address. The general registers are given as their low 64 bits, or as all 128 with
wide."fpu": f0 to f31, each as its bits and the single-precision number they are; the accumulator, acc; fcr31, the control and status register; and fcr0.
"cop0": the system control registers by name. status, cause, epc and badvaddr are the held program's; the rest are as they are now, count running on.
"other": hi1 and lo1, the halves of HI and LO the R5900 added, and sa, the shift amount.
"vu0": VU0's, which the EE has as its second coprocessor: vf0 to vf31, each as its four numbers x, y, z and w and as their bits, w's highest; vi0 to vi15; and its control registers. They're read as they are: changing, if VU0 is running a program of its own, which vpu_stat's lowest bit says.
Inputs: wide, group. Returns: object
resetA
Resets the target to the state it starts in, and connects to it again. Use it to recover a target that's stuck, or to start a measurement from a known state.
Inputs: no named parameters. Returns: result
resumeA
Sends a held program on from where it is, and waits as run does: for it to end, to
be held again, to print until, or for the timeout. Returns what run returns, with
what the program printed since.
Inputs: until, timeout. Returns: object
runA
Runs a program under the server's root, served to the target as host:: an ELF on
the EE, or, if its name ends in .irx, a module on the IOP. Waits up to timeout seconds
for it to end, or returns as soon as it has printed the text until, if that's given.
Returns its state and everything it printed as output. For an ELF the state is
"exited" with an exit_code, "crashed" with the exception (what, where and the
registers), or "running" if it hasn't ended, in which case output and stop carry on
from there. Not every target can tell that a program has ended: one that can't leaves it
"running", and until is the way to know it's done. For a module the state is "loaded",
with its number and what its start returned.
On a target with the debug capability an ELF can be held instead of lost. hold is
"exception", for a program that's kept where it would have crashed, or "entry", for one
kept at its first instruction too; any breakpoint set does the first by itself. The
state is then "held", with held saying why and where, and the program waits, whole,
for registers, read_memory, step and resume, or for stop to end it.
Inputs: path (required), hold, until, timeout, +1 more. Returns: object
screenshotA
A picture from the target, as an image. With no arguments, what's being shown.
An emulator or the mock knows what that is. A console can't ask the GS (its display
registers are write-only), so it watches what the program writes to them, and reads back
the frame buffer they describe: see display. A program that has written none of them
gets the 640 by 448 at the start of the GS's memory.
Any argument given makes it a rectangle of the GS's memory instead, the others taking
these defaults: base 0, the buffer's address in the GS's units of 64 words (a frame
buffer's FBP times 32, or a texture's TBP as it is); buffer_width 640, in pixels, a
multiple of 64; format ct32, or ct24, ct16, ct16s, z32, z24, z16, z16s; x and y 0;
width 640 and height 448. That's for textures, the buffer not being shown, the depth
buffer. The most at once is 1.3 MB of pixels: 640 by 512 at ct32. All of the GS's memory
is 1024 by 1024 at ct32 from base 0, in pieces.
The picture is of one moment, read with the console's interrupts off: a program drawing at that moment may show a frame half drawn.
Inputs: x, y, base, width, +3 more.
set_registerA
Gives a register of a held program a value: a general register by its name (v0, a0, sp, ra...), pc, hi, lo or status; f0 to f31 or acc of the FPU, fcr31; hi1, lo1 or sa. Setting pc is how a program is sent on from somewhere else, past a break instruction of its own, say. A general register takes up to 128 bits; a negative value is sign-extended. An FPU register takes a number with a point in it, 1.5 or "1.5", as that number in single precision, and anything else as its bits. VU0's vf1 to vf31 take four numbers, x, y, z and w, as "1.0, 2.0, 3.0, 4.0", or 128 bits; vi1 to vi15 take 16 bits.
Inputs: value (required), register (required). Returns: result
statusA
What the target is (a console, an emulator or the mock, with its identity), what it can do, and what the program on it is doing. Connects if the link is down. Call this first.
Inputs: no named parameters. Returns: object
stepA
Steps a held program by count instructions, and says where that leaves it. A branch
and the instruction in its delay slot are one step. A call is stepped into; a syscall is
stepped over, and one that waits leaves the program "running" until it returns.
Inputs: count. Returns: object
stopB
Stops the program that's running, or held, and returns the target to idle.
Inputs: no named parameters. Returns: result
watchpointA
Sets the watch: the EE's program is held when it stores to an address (access
"write"), loads from it ("read"), or either ("any"). run and resume then return with
the state "held", and held says what was caught. It's for finding what touches a
variable or a hardware register. There is one watch, kept until it's removed or set
elsewhere; remove takes it away.
length is how many bytes from address are watched, a power of two, and the address
is rounded down to a multiple of it. The program is held at the instruction that's about
to make the access, with the access not yet made: a store's value is in the register
it's stored from, and step does it.
With value only an access of that value is caught: the 32 bits stored or loaded, or
those of them set in value_mask. A store of the value is held before it's made, as
any store is. A load can only be known by what it loaded: the program is held a few
instructions after it, with the load made.
On a console it catches the program's own accesses, in its threads: not the kernel's,
not an interrupt handler's, and not the GS's display registers at 0x12000000 to
0x12000fff, whose writes display gives instead.
Inputs: value, access, length, remove, +2 more. Returns: object
write_memoryA
Writes values of width bytes (1, 2, 4, 8 or 16) starting at address, each with one
access of exactly that width, in ascending order: the way to write a hardware register.
space is "ee" or "iop".
Inputs: values (required), address (required), space, width. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Tools mostly target distinct operations, and descriptions explicitly separate easily confused pairs such as read_memory vs dump_memory and run vs resume. Minor overlap remains around execution control (halt/stop) and memory/register access, but boundaries are workable.
All names are lower_snake_case with no casing or style collisions. The set mixes verb names (resume, step, read_memory) with resource nouns (registers, display, controller), so it is readable but not a strict verb_noun convention.
Nineteen tools is somewhat heavy but justified for a full PS2 debug/emulation surface: execution control, memory, registers, break/watch, measurement, display, screenshot, and input are distinct responsibilities. It is above the typical 3-15 range but not bloated.
The surface covers the core lifecycle: status, run/resume/step/halt/stop/reset, breakpoints/watchpoints, register and memory access, screenshots, display state, and controller input. Minor gaps such as disassembly, memory search, or save-state management are workarounds rather than fatal omissions.
Maintenance
Related MCP Connectors
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Agent Replay Debugger MCP — record every agent step + deterministic replay. Step-debugger for
Email inboxes, webhook URLs, mock APIs and 170+ tools for coding agents over one MCP connection.
Live browser debugging for AI assistants — DOM, console, network via MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with GDB for debugging via the MCP protocol. Supports setting breakpoints, stepping through code, inspecting memory and registers, and more.86MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI to directly control Cheat Engine for process attachment, memory scanning, reading/writing, address list management, speed hack, Lua/Auto Assembler execution, and CT file management via the MCP protocol.6MIT
- AlicenseNot gradedqualityDmaintenanceEnables debugging of PlayStation games through DuckStation by providing MCP tools for execution control, register access, memory inspection, breakpoints, process management, and log analysis.MIT
- AlicenseAqualityBmaintenanceEnables AI agents to debug and control the PPSSPP PSP emulator, providing tools for memory access, disassembly, breakpoints, CPU control, input automation, screenshots, and diagnostic scripting.372MIT