Enables autonomous debugging of Commodore 64 programs through the VICE emulator, providing semantic interpretation of 6502 assembly code, memory operations, breakpoint management, VIC-II graphics state analysis, sprite debugging, and PETSCII screen text decoding.
vice-mcp
A Model Context Protocol (MCP) server for autonomous C64 debugging via the VICE emulator.
What is this?
vice-mcp bridges AI agents to the VICE Commodore 64 emulator, enabling autonomous debugging of 6502 assembly programs. Unlike raw protocol wrappers, it provides a semantic layer that interprets C64-specific data structures and returns meaningful, actionable information.
Why this exists:
AI agents need more than hex dumps—they need interpreted data with context
Debugging C64 code requires understanding VIC-II banks, PETSCII encoding, sprite pointers, and memory layouts
Every response includes hints suggesting next steps and related tools
Key differentiators:
Semantic output:
readScreenreturns text, not screen codes.readVicStateexplains graphics modes, not register bits.Actionable hints: Every response suggests what to do next
Cross-references: Tools point to related tools for common workflows
Agent-friendly errors: Clear error codes and recovery suggestions
Prerequisites
Node.js 18 or later
VICE emulator with binary monitor enabled
Starting VICE with Binary Monitor
The binary monitor listens on port 6502 by default.
Installation
From npm (when published)
From GitHub
Local Development
Claude Code Installation
The quickest way to get started with Claude Code:
1. Start VICE with binary monitor:
2. Add the MCP server:
3. Restart Claude Code to load the new MCP server.
That's it! You can now ask Claude Code to debug your C64 programs.
Manual Configuration
Alternatively, add to ~/.claude/claude_desktop_config.json:
Configuration
Add to your MCP client configuration (e.g., Claude Desktop, Cursor, or custom agent):
Or for local development:
Tool Reference
Connection & Status
Tool | Description |
| Connect to VICE (default: 127.0.0.1:6502) |
| Disconnect from VICE |
| Get connection state and emulation status |
Memory Operations
Tool | Description |
| Read raw bytes with hex dump and ASCII |
| Write bytes to memory |
CPU & Execution
Tool | Description |
| Get A, X, Y, SP, PC, and flags (interpreted) |
| Single-step execution (with step-over option) |
| Resume execution |
| Soft or hard reset |
| Run until specific address (temporary breakpoint) |
| Disassemble 6502 code with KERNAL labels |
Breakpoints & Watchpoints
Tool | Description |
| Set execution breakpoint |
| Remove breakpoint or watchpoint |
| List all breakpoints |
| Enable/disable breakpoint |
| Set memory read/write watchpoint |
| List all watchpoints |
Semantic Layer (Interpreted C64 Data)
Tool | Description |
| Get screen as text (PETSCII decoded) with summary mode |
| Get color RAM with color names and usage stats |
| Full VIC-II state: graphics mode, colors, banks, sprites |
| All 8 sprites: position, visibility, colors, pointers |
Visual Feedback
Tool | Description |
| Capture display buffer with palette |
| ASCII art rendering of display |
State Management
Tool | Description |
| Save complete machine state to file |
| Load machine state from file |
| Load and optionally run PRG/D64/T64 files |
Example Usage
Basic Debugging Session
Debugging Sprite Issues
Memory Watchpoint Workflow
State Checkpoint Pattern
Response Format
All responses include:
Structured data with
valueandhexrepresentations_metawith connection statehintwith contextual next steps
Example getRegisters response:
Architecture Overview
Key Files
File | Purpose |
| MCP server, tool definitions, semantic layer |
| VICE binary monitor client |
| Protocol constants and types |
| C64 utilities (PETSCII, colors, VIC banks) |
| 6502 disassembler with all addressing modes |
Design Principles
Semantic over raw: Return interpreted data, not just bytes
Hints everywhere: Every response suggests next actions
Cross-references: Tools reference related tools
Fail informatively: Errors explain what went wrong and how to fix it
Agent-first: Designed for autonomous operation, not human CLI use
Protocol Reference
vice-mcp implements the VICE Binary Monitor Protocol. Key commands used:
Code | Command | Purpose |
0x01 | MemoryGet | Read memory |
0x02 | MemorySet | Write memory |
0x12 | CheckpointSet | Create breakpoint/watchpoint |
0x13 | CheckpointDelete | Remove checkpoint |
0x15 | CheckpointToggle | Enable/disable checkpoint |
0x31 | RegistersGet | Read CPU registers |
0x41 | Dump | Save snapshot |
0x42 | Undump | Load snapshot |
0x81 | Continue | Resume execution |
0x82 | Step | Single-step |
0x84 | DisplayGet | Capture screen |
0x91 | PaletteGet | Get color palette |
0xdd | AutoStart | Load and run program |
License
MIT