PEEKaboo

127.0.0.1:7475 PEEKaboo's MCP server

The AI enthusiast

For people who'd rather ask than dig. Connect an AI agent to PEEKaboo, and it can read the running Amiga for itself: registers, memory, copper lists, blits and screenshots. Here Claude explains how Bartman's example works, then adds a feature and checks it on the emulated screen.

01What the agent can see

PEEKaboo serves its debugger as MCP tools. MCP is the open standard AI agents use to reach outside tools. There are more than 200 of them. They read the CPU, memory, the custom chips, the copper list, the blitter log and the screen. They set breakpoints and labels. They pause, step and run the machine.

So instead of guessing from source code, the agent can look at what the program actually did in the frame you're looking at, the same way you would with the Curious windows, only faster.

02Connect an agent

  1. Turn on the server

    In Emulator › Preferences › General, tick Enable MCP server, note the port (7475) and press Regenerate to make a token. Then restart PEEKaboo.

  2. Set up the bridge

    Agents talk to MCP servers through a small program. PEEKaboo's is in extras\mcp. It needs Python 3.10 to 3.13:

    cd extras\mcp
    python -m venv .venv
    .venv\Scripts\python -m pip install -r requirements.txt
  3. Tell your agent about it

    Claude Desktop: Copy Claude Desktop config in PEEKaboo's Preferences puts a ready-made entry on your clipboard. Paste it into claude_desktop_config.json, point command at the venv's Python, and restart Claude Desktop.

    Claude Code (in a terminal, from your project folder):

    claude mcp add peekaboo -e PEEKABOO_MCP_URL=http://127.0.0.1:7475 -e PEEKABOO_MCP_TOKEN=<token> -- <path>\extras\mcp\.venv\Scripts\python.exe <path>\extras\mcp\peekaboo_mcp_bridge.py

    Anything else (Codex, Gemini CLI, LM Studio and other MCP clients): add a local MCP server whose command is the venv's Python, with peekaboo_mcp_bridge.py as its argument and two environment variables, PEEKABOO_MCP_URL=http://127.0.0.1:7475 and PEEKABOO_MCP_TOKEN set to your token. The same three pieces go in every client's MCP settings. Only the file they go in differs.

Start PEEKaboo with something running before you ask about it. Here, that's Bartman's example from the Developer guide. A coding agent such as Claude Code or Codex suits this guide well: it can read and edit the project's source as well as talk to PEEKaboo.

03Ask how something works

With the example running, ask about the part you want to understand. Below is a conversation of that kind. The tool calls and every number in the answers come from a real session against the running example. The raw tool results are left out.

  • You

    Bartman's example is running in PEEKaboo. How does the row of bobs move, and why does the whole picture wobble sideways?

  • Claude

    • get_debug_resources
    • get_blitter_log
    • disassemble_copper COP1
    • disassemble_copper COP2
    • screenshot

    The bobs. Every frame the CPU starts 17 blits. The first clears the strip at the bottom of the picture: channel D only, minterm $F0, 320 pixels by 280 rows (56 lines × 5 bitplanes). Then come 16 bobs, each a cookie-cut using all four channels: A is the bob, B its mask, C the background, D the destination, minterm $CA.

    Each bob's x and y come from two sine tables, sinus32 and sinus40, read at frameCounter + i. Bob i is one step further along the wave than bob i−1, and the whole row moves one step per frame. The bottom four bits of x can't be reached by moving the blit address, so they go into the shift fields at the top of BLTCON0 and BLTCON1. You can see it in the log: $EFCA / $E000 is a shift of 14.

    The wobble. Copper list 1 sets up the screen and includes a MOVE to BPLCON1, the horizontal scroll register. The vertical-blank interrupt rewrites that value every frame from a third table, sinus15[frameCounter & 63], into both playfields' nibbles. When I looked it was $0011, a 1-pixel shift. Over 64 frames it sweeps 0 to 15 and back, and the picture sways.

    The grey bars. Copper list 1 ends by jumping to list 2. That's 15 WAITs on lines 65 to 79, each setting COLOR00 one shade lighter, ending on white: the band at the top of the picture.

  • You

    Why is the scroll value written into both nibbles?

  • Claude

    BPLCON1 has a separate 4-bit delay for each playfield: bits 0–3 for the odd bitplanes and bits 4–7 for the even ones. The picture uses all five planes as one playfield, so both halves must move together, or the odd and even planes would separate into a colour fringe. sin | (sin << 4) puts the same value in both.

Each answer came from the running machine. The blit count, the minterms, the shift values and the $0011 were read from PEEKaboo, not guessed from the source. Ask follow-ups the same way.

MCP Activity
PEEKaboo's MCP Activity window listing the calls with their time, tool, arguments, result and duration: disassemble_copper with source COP2, screenshot, get_debug_resources, get_blitter_log, disassemble_copper COP1 and COP2, and screenshot.
What Claude looked at, call by call, with each result. Nothing is hidden.

04Add a feature

A coding agent can change the source too, then use PEEKaboo to check the change does what you asked:

  • You

    Turn the grey bars at the top into a rainbow that scrolls.

  • Claude

    The bars are the 15 colour values in copper2. The copper reads its list from memory every frame, so the vertical-blank interrupt can rewrite those values and the change appears on the next frame, with no other drawing needed. Three changes to main.c:

    // 1. copper2 was const; the interrupt now rewrites it
    UWORD copper2[] __attribute__((section (".MEMF_CHIP"))) = {
    
    // 2. 16 colours around the colour wheel, as 12-bit OCS values ($0RGB)
    static const UWORD rainbow[16] = {
        0xf00, 0xf60, 0xfa0, 0xff0, 0xaf0, 0x0f0, 0x0f6, 0x0fa,
        0x0ff, 0x0af, 0x06f, 0x00f, 0x60f, 0xa0f, 0xf0f, 0xf06,
    };
    
    // 3. in interruptHandler(): one step along the table every other frame
    for(short line = 0; line < 15; line++)
        copper2[5 + line * 4] = rainbow[(line + (frameCounter >> 1)) & 15];

    Line n's colour is word 5 + n*4 of the list: two words for the first MOVE, then four (WAIT, WAIT, register, value) per line. I've built it with Bartman's compile task and sent it to PEEKaboo, as F5 does.

    • screenshot

    The bars scroll, but the whole background has turned mint green. That's my mistake. The last MOVE in the list sets COLOR00 for the rest of the screen, which is why the original ended on white, the picture's background. The fix is to cycle only the first 14 lines and leave the last one white:

    for(short line = 0; line < 14; line++)   // the last line stays $fff
    • screenshot
    • disassemble_copper COP2
    • screenshot

    Now it's right. Two screenshots a few frames apart show the band has moved. Copper list 2, read twice a second apart, starts $006F, $000F, $060F… and then $00FF, $00AF, $006F…: the rainbow, rewritten by the interrupt and shifted along. Both times the last line is $0FFF.

  • Before
    Bartman's example as shipped: a grey band at the top fading from black to white, then the abyss logo and the row of bobs.
    The grey bars, as shipped.
  • After
    The same screen with a rainbow band at the top instead of grey.
    The rainbow, scrolling.
  • Close up
    The rainbow band enlarged: red, orange, yellow, green, cyan, blue and violet lines one pixel tall each.
    One colour per line, 14 lines.

05Things to ask

  • "Profile one frame. Where does the time go, and what would make it faster?" For this example, it should notice the 32-bit divide helpers from the % in the bob loop.
  • "Label the interrupt handler and the bob loop in the disassembly." Claude can write labels and comments into PEEKaboo's annotations, and they stay with the program.
  • "Hide each bitplane in turn and tell me what each one draws."
  • With a game running: "Find the lives counter." That's the Pirate guide, done for you.
  • With a demo running: "How is this effect done?" The same questions work on code you don't have the source for.

Where next