c64-debug-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,287 @@
1
+ # C64 Debug MCP
2
+
3
+ [![npm version](https://badge.fury.io/js/c64-debug-mcp.svg)](https://www.npmjs.com/package/c64-debug-mcp)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that enables AI assistants like Claude to debug and interact with Commodore 64 programs running in the VICE emulator.
7
+
8
+ ## Features
9
+
10
+ - 🎮 **Full C64 Control**: Pause, resume, step, and reset the emulator
11
+ - 🔍 **Memory Operations**: Read, write, search, and compare memory
12
+ - 🐛 **Breakpoints**: Set execution breakpoints and watchpoints
13
+ - 📊 **Register Access**: Get and set CPU registers (A, X, Y, PC, SP, flags)
14
+ - 📸 **Display Capture**: Capture screen state and text content
15
+ - ⌨️ **Input Control**: Send keyboard and joystick input
16
+ - 📝 **Program Loading**: Load PRG files and manage execution
17
+
18
+ ## Requirements
19
+
20
+ - **Node.js**: >= 22.13.0
21
+ - **VICE Emulator**: Any recent version with binary monitor support
22
+ - Download from: https://vice-emu.sourceforge.io/
23
+ - Supports: x64sc (C64), x128 (C128), xvic (VIC-20), xpet (PET), and others
24
+
25
+ ## Installation
26
+
27
+ ### Option 1: No Installation (Recommended)
28
+
29
+ Use `npx` to automatically run the latest version without installing:
30
+
31
+ **No setup required!** Just configure Claude Desktop (see below).
32
+
33
+ ### Option 2: Global Installation
34
+
35
+ ```bash
36
+ npm install -g c64-debug-mcp
37
+ ```
38
+
39
+ ### Option 3: Local Installation
40
+
41
+ ```bash
42
+ npm install c64-debug-mcp
43
+ ```
44
+
45
+ ## Usage
46
+
47
+ ### With Claude Desktop
48
+
49
+ Add to your Claude Desktop configuration file:
50
+
51
+ **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
52
+ **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
53
+ **Linux**: `~/.config/Claude/claude_desktop_config.json`
54
+
55
+ #### Recommended: Using npx (no installation, always latest)
56
+
57
+ ```json
58
+ {
59
+ "mcpServers": {
60
+ "c64-debug": {
61
+ "command": "npx",
62
+ "args": ["-y", "c64-debug-mcp"]
63
+ }
64
+ }
65
+ }
66
+ ```
67
+
68
+ #### Alternative: Using global installation
69
+
70
+ ```json
71
+ {
72
+ "mcpServers": {
73
+ "c64-debug": {
74
+ "command": "c64-debug-mcp"
75
+ }
76
+ }
77
+ }
78
+ ```
79
+
80
+ ### With Other MCP Clients
81
+
82
+ ```bash
83
+ # STDIO mode (for Claude Desktop and similar clients)
84
+ c64-debug-mcp
85
+
86
+ # HTTP mode (for web-based clients)
87
+ c64-debug-mcp-http
88
+ ```
89
+
90
+ ### HTTP Server Configuration
91
+
92
+ The HTTP server can be configured via environment variables:
93
+
94
+ ```bash
95
+ C64_DEBUG_HTTP_HOST=127.0.0.1 # Default: 127.0.0.1
96
+ C64_DEBUG_HTTP_PORT=39080 # Default: 39080
97
+ C64_DEBUG_HTTP_PATH=/mcp # Default: /mcp
98
+ C64_DEBUG_HTTP_HEALTH_PATH=/healthz # Default: /healthz
99
+ ```
100
+
101
+ ## Quick Start
102
+
103
+ 1. **Start VICE emulator** with binary monitor enabled:
104
+ ```bash
105
+ x64sc -remotemonitor -remotemonitoraddress 127.0.0.1:6502
106
+ ```
107
+
108
+ 2. **Configure Claude Desktop** (add to config file):
109
+ ```json
110
+ {
111
+ "mcpServers": {
112
+ "c64-debug": {
113
+ "command": "npx",
114
+ "args": ["-y", "c64-debug-mcp"]
115
+ }
116
+ }
117
+ }
118
+ ```
119
+
120
+ 3. **Restart Claude Desktop**
121
+
122
+ 4. **Ask Claude to interact with C64**:
123
+ - "What's in memory at $D000?"
124
+ - "Set a breakpoint at $1000"
125
+ - "Load and run my program.prg"
126
+ - "Show me the screen content"
127
+
128
+ ## Available Tools
129
+
130
+ ### Execution Control
131
+ - `execute` - Pause, resume, step, step_over, step_out, or reset
132
+ - `wait_for_state` - Wait for running/stopped state
133
+ - `program_load` - Load PRG files with optional auto-start
134
+
135
+ ### Memory Operations
136
+ - `memory_read` - Read memory by address and length
137
+ - `memory_write` - Write bytes to memory
138
+ - `get_registers` - Get CPU register values
139
+ - `set_registers` - Set CPU register values
140
+
141
+ ### Breakpoints
142
+ - `breakpoint_set` - Create execution or watchpoint breakpoints
143
+ - `breakpoint_clear` - Remove a breakpoint
144
+ - `list_breakpoints` - List all breakpoints
145
+
146
+ ### Display & Input
147
+ - `capture_display` - Capture screen to PNG
148
+ - `get_display_state` - Get screen RAM, color RAM, and graphics mode
149
+ - `get_display_text` - Get text screen content
150
+ - `write_text` - Type text with PETSCII support
151
+ - `keyboard_input` - Send key presses/releases/taps
152
+ - `joystick_input` - Send joystick commands
153
+
154
+ ### State Monitoring
155
+ - `get_monitor_state` - Get execution state and stop reason
156
+ - `get_session_state` - Get detailed emulator session state
157
+
158
+ ## Example Workflows
159
+
160
+ ### Debugging a Program
161
+
162
+ ```
163
+ You: Load examples/hello.prg and set a breakpoint at $1000
164
+
165
+ Claude will:
166
+ 1. Load the program using program_load
167
+ 2. Set a breakpoint at $1000 using breakpoint_set
168
+ 3. Resume execution until breakpoint is hit
169
+ 4. Show you the register state when stopped
170
+ ```
171
+
172
+ ### Memory Analysis
173
+
174
+ ```
175
+ You: What's the BASIC program in memory?
176
+
177
+ Claude will:
178
+ 1. Read memory from $0801 (BASIC start)
179
+ 2. Parse the BASIC tokens
180
+ 3. Show you the program listing
181
+ ```
182
+
183
+ ### Screen Capture
184
+
185
+ ```
186
+ You: Show me what's on the screen
187
+
188
+ Claude will:
189
+ 1. Capture the display using capture_display
190
+ 2. Save a PNG image
191
+ 3. Describe what's visible
192
+ ```
193
+
194
+ ## Configuration
195
+
196
+ ### Environment Variables
197
+
198
+ - `C64_DEBUG_CONSOLE_LOGS` - Enable verbose logging (1, true, yes, on)
199
+ - `C64_DEBUG_SERVER_NODE` - Path to Node.js executable for smoke tests
200
+ - `C64_DEBUG_HTTP_*` - HTTP server configuration (see above)
201
+
202
+ ### VICE Connection
203
+
204
+ The MCP server connects to VICE on `localhost:6502` by default. Ensure VICE is started with:
205
+
206
+ ```bash
207
+ x64sc -remotemonitor -remotemonitoraddress 127.0.0.1:6502
208
+ ```
209
+
210
+ Or add to your `~/.vice/vicerc`:
211
+
212
+ ```
213
+ RemoteMonitor=1
214
+ RemoteMonitorAddress=127.0.0.1:6502
215
+ ```
216
+
217
+ ## Troubleshooting
218
+
219
+ ### "Cannot connect to VICE"
220
+ - Ensure VICE is running with `-remotemonitor` flag
221
+ - Check that port 6502 is not blocked by firewall
222
+ - Verify VICE is listening: `netstat -an | grep 6502`
223
+
224
+ ### "Command not found: c64-debug-mcp"
225
+ - Ensure global npm bin directory is in PATH: `npm config get prefix`
226
+ - Or use npx: `npx c64-debug-mcp`
227
+
228
+ ### Node version errors
229
+ - This package requires Node.js >= 22.13.0
230
+ - Check version: `node --version`
231
+ - Install latest: https://nodejs.org/
232
+
233
+ ## Development
234
+
235
+ ```bash
236
+ # Clone repository
237
+ git clone https://github.com/henols/c64-debug-mcp.git
238
+ cd c64-debug-mcp/packages/c64-debug-mcp
239
+
240
+ # Install dependencies
241
+ npm install
242
+
243
+ # Build
244
+ npm run build
245
+
246
+ # Run tests
247
+ npm run smoke:http
248
+
249
+ # Type check
250
+ npm run check
251
+ ```
252
+
253
+ ## Architecture
254
+
255
+ - **TypeScript** with strict type checking
256
+ - **Zod** for schema validation
257
+ - **Mastra MCP** framework for protocol implementation
258
+ - **VICE Binary Monitor Protocol** for emulator communication
259
+
260
+ ## Contributing
261
+
262
+ Contributions are welcome! Please:
263
+
264
+ 1. Fork the repository
265
+ 2. Create a feature branch
266
+ 3. Make your changes with tests
267
+ 4. Submit a pull request
268
+
269
+ ## License
270
+
271
+ MIT License - see [LICENSE](LICENSE) file for details
272
+
273
+ ## Resources
274
+
275
+ - [Model Context Protocol Specification](https://spec.modelcontextprotocol.io/)
276
+ - [VICE Emulator](https://vice-emu.sourceforge.io/)
277
+ - [VICE Binary Monitor Protocol](https://vice-emu.sourceforge.io/vice_13.html#SEC338)
278
+ - [Smithery MCP Registry](https://smithery.ai/)
279
+
280
+ ## Acknowledgments
281
+
282
+ Built with the [Model Context Protocol](https://modelcontextprotocol.io) by Anthropic.
283
+ Powered by [VICE](https://vice-emu.sourceforge.io/) - the Versatile Commodore Emulator.
284
+
285
+ ---
286
+
287
+ **Happy C64 debugging! 🎮**