c64bridge 0.9.1 → 0.9.2

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 CHANGED
@@ -14,6 +14,7 @@ Your AI Command Bridge for the Commodore 64.
14
14
  [![Install in VS Code Insiders](https://img.shields.io/badge/Install_in-VS_Code_Insiders-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=io.github.chrisgleissner%2Fc64bridge&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22c64bridge%22%5D%2C%22env%22%3A%7B%22C64_MODE%22%3A%22c64u%22%2C%22C64U_HOST%22%3A%22c64u%22%2C%22VICE_BINARY%22%3A%22%2Fusr%2Flocal%2Fbin%2Fx64sc%22%2C%22VICE_DIRECTORY%22%3A%22%2Fusr%2Flocal%2Fshare%2Fvice%22%2C%22VICE_VISIBLE%22%3A%22true%22%2C%22VICE_WARP%22%3A%22false%22%7D%7D&quality=insiders)
15
15
  [![Install in Visual Studio](https://img.shields.io/badge/Install_in-Visual_Studio-C16FDE?style=flat-square&logo=visualstudio&logoColor=white)](https://vs-open.link/mcp-install?%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22c64bridge%22%5D%2C%22env%22%3A%7B%22C64_MODE%22%3A%22c64u%22%2C%22C64U_HOST%22%3A%22c64u%22%2C%22VICE_BINARY%22%3A%22%2Fusr%2Flocal%2Fbin%2Fx64sc%22%2C%22VICE_DIRECTORY%22%3A%22%2Fusr%2Flocal%2Fshare%2Fvice%22%2C%22VICE_VISIBLE%22%3A%22true%22%2C%22VICE_WARP%22%3A%22false%22%7D%7D)
16
16
  [![Install in Cursor](https://img.shields.io/badge/Install_in-Cursor-000000?style=flat-square&logoColor=white)](https://cursor.com/en/install-mcp?name=io.github.chrisgleissner%2Fc64bridge&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImM2NGJyaWRnZSJdLCJlbnYiOnsiQzY0X01PREUiOiJjNjR1IiwiQzY0VV9IT1NUIjoiYzY0dSIsIlZJQ0VfQklOQVJZIjoiL3Vzci9sb2NhbC9iaW4veDY0c2MiLCJWSUNFX0RJUkVDVE9SWSI6Ii91c3IvbG9jYWwvc2hhcmUvdmljZSIsIlZJQ0VfVklTSUJMRSI6InRydWUiLCJWSUNFX1dBUlAiOiJmYWxzZSJ9fQ==)
17
+ [![Use with Claude Code](https://img.shields.io/badge/Use_with-Claude_Code-D97757?style=flat-square&logo=anthropic&logoColor=white)](#claude-code)
17
18
 
18
19
  C64 Bridge is an MCP server for controlling and working with a Commodore 64 from an AI client.
19
20
 
@@ -52,6 +53,7 @@ C64 Bridge is listed in the [Official MCP Registry](https://registry.modelcontex
52
53
  - [SID Playback](#sid-playback)
53
54
  - [RAG](#rag)
54
55
  - [Testing](#testing)
56
+ - [Claude Code](#claude-code)
55
57
  - [Example Workflow](#example-workflow)
56
58
  - [HTTP Invocation](#http-invocation)
57
59
  - [Build and Test](#build-and-test)
@@ -59,12 +61,14 @@ C64 Bridge is listed in the [Official MCP Registry](https://registry.modelcontex
59
61
  - [Static MCP Interface](#static-mcp-interface)
60
62
  - [MCP API Reference](#mcp-api-reference)
61
63
  - [Tools](#tools)
64
+ - [c64\_batch](#c64_batch)
62
65
  - [c64\_config](#c64_config)
63
66
  - [c64\_debug](#c64_debug)
64
67
  - [c64\_disk](#c64_disk)
65
68
  - [c64\_drive](#c64_drive)
66
69
  - [c64\_extract](#c64_extract)
67
70
  - [c64\_graphics](#c64_graphics)
71
+ - [c64\_input](#c64_input)
68
72
  - [c64\_memory](#c64_memory)
69
73
  - [c64\_printer](#c64_printer)
70
74
  - [c64\_program](#c64_program)
@@ -191,9 +195,14 @@ The detailed lookup order, merge rules, backend examples, and override model are
191
195
 
192
196
  ### 4. Connect from an MCP Client
193
197
 
194
- If you use VS Code, follow the [VS Code MCP Setup](#vs-code-mcp-setup) section below.
198
+ C64 Bridge ships a single canonical `stdio` entry point that every MCP client uses:
195
199
 
196
- If you use another MCP client, point it at the `stdio` server entry point and pass any required environment variables exactly as documented in this README and in [mcp.json](./mcp.json).
200
+ - **VS Code (GitHub Copilot)** — see [VS Code MCP Setup](#vs-code-mcp-setup).
201
+ - **Claude Code (CLI and VS Code plugin)** — see [Claude Code](#claude-code).
202
+ - **Cursor, Visual Studio, VS Code Insiders** — use the install badges at the top of this README.
203
+ - **Any other MCP client** — point it at the same `stdio` server, with the environment variables documented in [Runtime Environment Variable Reference](#runtime-environment-variable-reference) and the registry manifest in [mcp.json](./mcp.json).
204
+
205
+ The startup command is the same across clients: `npx -y c64bridge@latest` for the published package, or `node scripts/start.mjs` from a local checkout. Backend selection (`c64u` vs `vice`) and credentials live in the shared [Configuration](#configuration) files and environment variables — clients only need to know the command.
197
206
 
198
207
  ## Configuration
199
208
 
@@ -265,6 +274,9 @@ Prompt illustration (issued via Copilot in VS Code, using GPT 5.4 Medium):
265
274
 
266
275
  ```text
267
276
  c64u: write a small BASIC program that clears the screen and prints HELLO C64U
277
+ ```
278
+
279
+ ```text
268
280
  vice: write a small BASIC program that clears the screen and prints HELLO VICE
269
281
  ```
270
282
 
@@ -277,6 +289,8 @@ The screenshots below were captured from actual backend bitmap responses after t
277
289
 
278
290
  ## VS Code MCP Setup
279
291
 
292
+ This section covers the GitHub Copilot integration that ships with VS Code. For the Claude Code VS Code plugin, see [Claude Code](#claude-code) — it reads `.mcp.json`, not `.vscode/mcp.json`.
293
+
280
294
  If this repository is checked out locally, open the prepared [.vscode/mcp.json](./.vscode/mcp.json).
281
295
 
282
296
  Otherwise, put the following into your own `.vscode/mcp.json`:
@@ -483,6 +497,24 @@ Every runtime environment variable documented in `mcp.json` can be set in your M
483
497
 
484
498
  <!-- AUTO-GENERATED:ENV-VARS-END -->
485
499
 
500
+ ## Claude Code
501
+
502
+ [Claude Code](https://docs.claude.com/en/docs/claude-code/mcp) is supported as a first-class MCP client. It uses the same canonical start command and the same backend [Configuration](#configuration) files and environment variables as every other client — only the discovery file differs.
503
+
504
+ **Claude Code CLI** — register the published server in one command:
505
+
506
+ ```bash
507
+ claude mcp add c64bridge -- npx -y c64bridge@latest
508
+ ```
509
+
510
+ Use `--scope user` to make it available across all your projects, or `--scope project` to write a `.mcp.json` next to the current repo. Backend selection (`c64u` vs `vice`), host, port, and password come from the same files documented in [Configuration](#configuration); per-shell overrides come from the variables in [Runtime Environment Variable Reference](#runtime-environment-variable-reference).
511
+
512
+ **Project-scoped discovery** — this repository ships a checked-in [.mcp.json](./.mcp.json) that points Claude Code at the local source via `node scripts/start.mjs`. When you open the repo with `claude` (CLI or VS Code plugin), Claude Code prompts to enable the project-scoped server on first run. Approve it once and the `c64_*` tools become discoverable in that workspace.
513
+
514
+ **Claude Code VS Code plugin** — the plugin reads the same `.mcp.json` and the same user-scope `claude mcp add` registrations as the CLI. No extra setup is required beyond installing the plugin and approving the project server prompt. The existing [.vscode/mcp.json](./.vscode/mcp.json) is read by GitHub Copilot, not by Claude Code; the two files coexist without conflict because they target different clients with different config schemas.
515
+
516
+ **Verify it works** — after registration, run `claude mcp list` (CLI) or open the MCP panel (plugin) and look for `c64bridge`. Then ask Claude Code something like *“use vice: write a small BASIC program that clears the screen and prints HELLO CLAUDE”* — it should call `c64_select_backend` and `c64_program` directly. If tools do not appear, confirm Node 24+ is on `PATH`, that the server was approved at the requested scope, and that the backend is reachable per the [Configuration](#configuration) section.
517
+
486
518
  ## Example Workflow
487
519
 
488
520
  Compose a children’s song with ChatGPT and VS Code:
@@ -506,4 +506,4 @@ Screen-code conversion
506
506
 
507
507
  - If input is ASCII uppercase 'A'..'Z', convert: screen = PETSCII - $40 (e.g. $41→$01). Implement in a small loop if needed.
508
508
 
509
- This file is intentionally minimal: use `basicConverter` / `assemblyConverter` in `src/` for tokenization/PRG building and `data/graphics/character-set.csv` for exact screen-code mappings.
509
+ This file is intentionally minimal: use `src/tools/basicTokenizer.ts` / `src/tools/assembler.ts` for tokenization/PRG building and `data/graphics/character-set.csv` for exact screen-code mappings.
@@ -17,12 +17,12 @@ Do not assume the current backend is correct without checking
17
17
 
18
18
  ## Fast Paths
19
19
 
20
- - Grouped MCP tools are never called bare. For tools such as `c64_program`, `c64_memory`, `c64_graphics`, `c64_sound`, and `c64_system`, always send an object with `op` first.
21
- - Wrong: `c64_program {}`. Correct: `c64_program { op: "cross_platform_greeting" }`.
20
+ - Grouped MCP tools are never called bare. For tools such as `c64_program`, `c64_memory`, `c64_graphics`, `c64_sound`, and `c64_system`, call the tool with flat arguments that include `op`.
21
+ - Wrong: `c64_program {}` or `{ "c64_program": { "op": "cross_platform_greeting" } }`. Correct: call tool `c64_program` with `{ "op": "cross_platform_greeting" }`.
22
22
  - For simple visible confirmation on `vice`, `c64u`, or both, prefer `c64_program` with `op: "cross_platform_greeting"`.
23
23
  - For trivial hello-world and smoke-test requests, route to `.github/skills/hello-world/SKILL.md` and let that skill use the shortest greeting workflow.
24
24
  - That workflow switches backends internally, writes a platform-customized BASIC greeting, captures screenshots, and verifies the rendered text without extra tool composition.
25
- - Use manual `c64_select_backend` plus `upload_run_basic` only when the user needs custom program logic beyond a quick greeting or text demo.
25
+ - Use manual `c64_select_backend` with `op: "select"` plus `c64_program` with `op: "upload_run_basic"` only when the user needs custom program logic beyond a quick greeting or text demo.
26
26
  - On local machines with a graphical session, assume VICE should be visible by default. Only expect Xvfb or other headless fallback in CI or when no framebuffer/display session exists.
27
27
  - For manual visible VICE BASIC runs, avoid immediate `read_screen` or `wait_for_text` calls, because Binary Monitor traffic traps execution while servicing requests.
28
28
 
@@ -27,6 +27,8 @@ Use these routing shortcuts when the user wants a quick visible or audible resul
27
27
 
28
28
  Example:
29
29
 
30
+ Call tool `c64_sound` with:
31
+
30
32
  ```json
31
33
  {
32
34
  "op": "play_preset",
@@ -41,4 +43,4 @@ Example:
41
43
  ## Verification Order
42
44
 
43
45
  1. Trust the verification defined by the selected skill first.
44
- 2. Use captured artifacts or follow-up inspection only when the selected skill indicates that extra verification is needed.
46
+ 2. Use captured artifacts or follow-up inspection only when the selected skill indicates that extra verification is needed.
@@ -63,7 +63,7 @@ Conversion: Screen code ≠ PETSCII code. Use charset reference (c64://graphics/
63
63
 
64
64
  - BASIC/printing: Use PETSCII codes with CHR$() or PRINT
65
65
  - Direct screen memory: Use screen codes with POKE to $0400+offset
66
- - Tools: `c64_graphics` (`render_petscii_art`) returns both `petsciiCodes` array and screen memory data
66
+ - Tools: `c64_graphics` with `op: "render_petscii_art"` returns both `petsciiCodes` array and screen memory data
67
67
 
68
68
  ## Essential PETSCII Symbols
69
69
 
@@ -246,13 +246,14 @@ Custom charsets have minimal performance impact:
246
246
  ### Using render_sprite
247
247
 
248
248
  ```javascript
249
- {
250
- spriteData: "base64-encoded-63-bytes",
249
+ await callTool("c64_graphics", {
250
+ op: "render_sprite",
251
+ sprite: "base64-encoded-63-bytes",
251
252
  x: 160, // Center horizontally
252
253
  y: 100, // Center vertically
253
- colour: 1, // White
254
+ color: 1, // White
254
255
  multicolour: false
255
- }
256
+ })
256
257
  ```
257
258
 
258
259
  The tool:
@@ -270,26 +271,26 @@ When working with sprites and charsets:
270
271
  1. Use memory ranges documented in c64://memory/map
271
272
  2. Avoid BASIC program area ($0801-$9FFF) unless controlling it
272
273
  3. Preserve zero page ($0000-$00FF) and stack ($0100-$01FF)
273
- 4. Use the `c64_memory` operations `read` and `write` for safe access
274
+ 4. Use `c64_memory` with `op: "read"` and `op: "write"` for safe access
274
275
 
275
276
  ## Example Workflows
276
277
 
277
278
  ### Simple Sprite Display
278
279
 
279
280
  1. Prepare 24×21 sprite bitmap
280
- 2. Call `render_sprite` with sprite data
281
+ 2. Call `c64_graphics` with `op: "render_sprite"` and sprite data
281
282
  3. Tool writes sprite data and patches VIC-II state automatically
282
- 4. Use `read_screen` to verify appearance
283
- 5. Optionally call `c64_memory` `write` to adjust position/colour
283
+ 4. Use `c64_memory` with `op: "read_screen"` to verify appearance
284
+ 5. Optionally call `c64_memory` with `op: "write"` to adjust position/colour
284
285
 
285
286
  ### Custom Charset Installation
286
287
 
287
288
  1. Design character set (full or partial)
288
289
  2. Encode to 8-byte-per-char format
289
- 3. Use `c64_memory` `write` to copy the charset to $2000
290
+ 3. Use `c64_memory` with `op: "write"` to copy the charset to $2000
290
291
  4. POKE $D018 to point VIC-II at new charset
291
- 5. Use `upload_run_basic` to test character display
292
- 6. Verify with `read_screen`
292
+ 5. Use `c64_program` with `op: "upload_run_basic"` to test character display
293
+ 6. Verify with `c64_memory` and `op: "read_screen"`
293
294
 
294
295
  ### Animated Sprite Sequence
295
296
 
@@ -297,13 +298,13 @@ When working with sprites and charsets:
297
298
  2. Upload all frames to consecutive memory locations
298
299
  3. Generate BASIC program that cycles sprite pointer
299
300
  4. Use raster timing for smooth animation
300
- 5. Verify frame timing with `c64_memory` `read` checks
301
+ 5. Verify frame timing with `c64_memory` and `op: "read"` checks
301
302
 
302
303
  ## Best Practices Summary
303
304
 
304
305
  1. **Plan Memory Layout**: Map out sprite and charset locations before coding
305
306
  2. **Test Incrementally**: Display one sprite/char before adding more
306
- 3. **Use Tools**: Leverage `render_sprite` and memory tools
307
+ 3. **Use Tools**: Leverage `c64_graphics` with `op: "render_sprite"` and `c64_memory` operations
307
308
  4. **Document State**: Note which sprites/chars are active
308
309
  5. **Handle Errors**: Check return values and screen output
309
310
  6. **Optimize Last**: Get it working, then optimize if needed
@@ -5,12 +5,12 @@ This guide summarizes the High Voltage SID Collection (HVSC) "PSID file format"
5
5
  - A header containing metadata and playback parameters
6
6
  - The actual 6502 machine code and data that the player runs on the C64
7
7
 
8
- You can play a SID file on a connected device using the REST API via the MCP tool `sidplay_file`.
8
+ You can play a SID file on a connected device with the MCP tool `c64_sound` and `op: "play_sid_file"`.
9
9
 
10
- ## Quick start: play a SID via REST/MCP
10
+ ## Quick start: play a SID via MCP
11
11
 
12
- - Endpoint: `POST /tools/sidplay_file`
13
- - Body: `{ "path": "/flash/music/Example.sid", "songnr": 1 }` (optional `songnr`)
12
+ - Tool: `c64_sound`
13
+ - Arguments: `{ "op": "play_sid_file", "path": "/flash/music/Example.sid", "songnr": 1 }` (optional `songnr`)
14
14
 
15
15
  Refer to `doc/c64u/c64-rest-api.md` for the underlying device endpoint and options.
16
16
 
@@ -85,7 +85,7 @@ SID files do not embed duration. HVSC ships a `Songlengths.md5` database mapping
85
85
 
86
86
  ## Related API and tools
87
87
 
88
- - Play from device filesystem: `sidplay_file` (see generated `mcp-manifest.json` and `src/index.ts`)
88
+ - Play from device filesystem: `c64_sound` with `op: "play_sid_file"` (see generated `mcp/tools.json` and `mcp/schemas/c64_sound.schema.json`)
89
89
  - Low-level SID register programming: see `data/sound/sid-spec.md`
90
90
 
91
91
  References for further reading: HVSC PSID v2NG file format (spec), community resources, and project notes from implementations like SIDman.
@@ -126,18 +126,18 @@ This solution was developed through:
126
126
 
127
127
  ```bash
128
128
  curl -X POST -H 'Content-Type: application/json' \
129
- -d '{"program": "... BASIC program ..."}' \
130
- http://localhost:8000/tools/upload_run_basic
129
+ -d '{"op": "upload_run_basic", "program": "... BASIC program ..."}' \
130
+ http://localhost:8000/tools/c64_program
131
131
  ```
132
132
 
133
133
  ### Future Audio Analysis
134
134
 
135
- The working scale can now be used with the `analyze_audio` tool:
135
+ The working scale can now be used with `c64_sound` and `op: "analyze"`:
136
136
 
137
137
  ```bash
138
138
  curl -X POST -H 'Content-Type: application/json' \
139
- -d '{"request": "verify the scale sounds correct"}' \
140
- http://localhost:8000/tools/analyze_audio
139
+ -d '{"op": "analyze", "request": "verify the scale sounds correct"}' \
140
+ http://localhost:8000/tools/c64_sound
141
141
  ```
142
142
 
143
143
  ## Musical Expression Example: "Alle meine Entchen"
@@ -15,7 +15,7 @@ Recommended C64 Bridge entry points:
15
15
  | Debug registers and checkpoints | `c64_debug` | `get_registers`, `set_registers`, `create_checkpoint`, `list_checkpoints`, `step`, `step_return` |
16
16
  | Send keyboard or joystick input | `c64_input` | `write_text`, `key`, `joystick` |
17
17
  | Capture emulator display | `c64_graphics` | `capture_frame` |
18
- | Reset or resume execution | `c64_system` | `reset`, `resume` |
18
+ | Reset or continue execution | `c64_system`, `c64_debug` | `reset`, `continue_execution` |
19
19
  | Read or write VICE resources | `c64_vice` | `resource_get`, `resource_set` |
20
20
 
21
21
  ---
@@ -633,7 +633,7 @@ C64 Bridge mapping:
633
633
 
634
634
  | MCP tool | Operation |
635
635
  | ------------ | --------- |
636
- | `c64_system` | `resume` |
636
+ | `c64_debug` | `continue_execution` |
637
637
 
638
638
  ---
639
639
 
@@ -797,7 +797,7 @@ Usually emitted with `request_id = 0xffffffff`.
797
797
  | Palette Get | `0x91` | `0x91` | internal display support |
798
798
  | Joyport Set | `0xa2` | `0xa2` | `c64_input.joystick` |
799
799
  | Userport Set | `0xb2` | `0xb2` | internal or unmapped |
800
- | Exit | `0xaa` | `0xaa` | `c64_system.resume` |
800
+ | Exit | `0xaa` | `0xaa` | `c64_debug.continue_execution` |
801
801
  | Quit | `0xbb` | `0xbb` | managed VICE lifecycle |
802
802
  | Reset | `0xcc` | `0xcc` | `c64_system.reset`, `c64_system.reboot`, `c64_drive.reset` |
803
803
  | Autostart / Autoload | `0xdd` | `0xdd` | `c64_program.run_prg`, `c64_program.upload_run_basic`, `c64_program.upload_run_asm` |
@@ -827,17 +827,16 @@ Examples:
827
827
  | Read PC and A | `c64_debug` with `op = get_registers` |
828
828
  | Step one instruction | `c64_debug` with `op = step` |
829
829
  | Step until return | `c64_debug` with `op = step_return` |
830
- | Continue execution | `c64_system` with `op = resume` |
830
+ | Continue execution | `c64_debug` with `op = continue_execution` |
831
831
  | Reset VICE | `c64_system` with `op = reset` |
832
832
  | Change a VICE setting | `c64_vice` with `op = resource_set` |
833
833
 
834
834
  ## Backend Selection
835
835
 
836
- If both C64 Ultimate and VICE are configured, use `c64_select_backend` before making VICE-specific requests.
836
+ If both C64 Ultimate and VICE are configured, call `c64_select_backend` with these arguments before making VICE-specific requests:
837
837
 
838
838
  ```json
839
839
  {
840
- "tool": "c64_select_backend",
841
840
  "op": "select",
842
841
  "backend": "vice"
843
842
  }