c64bridge 0.9.3 → 1.0.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.
Files changed (48) hide show
  1. package/AGENTS.md +19 -3
  2. package/README.md +190 -148
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/c64Client.js +127 -5
  5. package/dist/config.js +12 -8
  6. package/dist/device.js +75 -45
  7. package/dist/mcp-server.js +11 -3
  8. package/dist/platform.js +13 -2
  9. package/dist/tools/audio.js +1 -1
  10. package/dist/tools/developer.js +6 -6
  11. package/dist/tools/graphics.js +4 -4
  12. package/dist/tools/input.js +129 -12
  13. package/dist/tools/machineControl.js +85 -6
  14. package/dist/tools/memory.js +1 -1
  15. package/dist/tools/meta/index.js +1 -1
  16. package/dist/tools/programRunners.js +5 -5
  17. package/dist/tools/rag.js +1 -1
  18. package/dist/tools/registry/batch.js +1 -1
  19. package/dist/tools/registry/config.js +5 -5
  20. package/dist/tools/registry/disk.js +2 -2
  21. package/dist/tools/registry/drive.js +2 -2
  22. package/dist/tools/registry/graphics.js +2 -2
  23. package/dist/tools/registry/memory.js +2 -2
  24. package/dist/tools/registry/platform.js +7 -5
  25. package/dist/tools/registry/program.js +5 -5
  26. package/dist/tools/registry/rag.js +1 -1
  27. package/dist/tools/registry/sound.js +4 -4
  28. package/dist/tools/registry/system.js +13 -3
  29. package/dist/tools/storage.js +1 -1
  30. package/doc/c64u/c64-openapi.yaml +1130 -774
  31. package/doc/u2/u2-openapi.yaml +1192 -0
  32. package/generated/c64/index.js +142 -9
  33. package/generated/openapi/c64u/index.js +1117 -0
  34. package/generated/openapi/u2/index.js +929 -0
  35. package/mcp/schemas/c64_graphics.schema.json +3 -3
  36. package/mcp/schemas/c64_input.schema.json +247 -6
  37. package/mcp/schemas/c64_memory.schema.json +3 -3
  38. package/mcp/schemas/c64_program.schema.json +3 -3
  39. package/mcp/schemas/c64_select_backend.schema.json +2 -0
  40. package/mcp/schemas/c64_system.schema.json +41 -1
  41. package/mcp/server.json +1 -1
  42. package/mcp/tools.json +382 -41
  43. package/mcp.json +14 -2
  44. package/package.json +4 -2
  45. package/scripts/mockC64Server.mjs +40 -0
  46. package/scripts/prepare-release.mjs +13 -2
  47. package/scripts/update-readme.ts +18 -30
  48. package/server.json +3 -3
package/mcp.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c64bridge",
3
- "version": "0.9.3",
3
+ "version": "1.0.0",
4
4
  "description": "Stdio-based Model Context Protocol (MCP) server that bridges Commodore 64 Ultimate hardware with AI agents.",
5
5
  "entry": "dist/index.js",
6
6
  "type": "stdio",
@@ -37,7 +37,7 @@
37
37
  "default": "~/.c64bridge.json"
38
38
  },
39
39
  "C64_MODE": {
40
- "description": "Select active backend (c64u for Ultimate hardware, vice for emulator)",
40
+ "description": "Select active backend (c64u/U64 hardware, u2/U2-family cartridge, or vice emulator)",
41
41
  "default": "c64u"
42
42
  },
43
43
  "C64U_HOST": {
@@ -52,6 +52,18 @@
52
52
  "description": "Override the C64 Ultimate network password sent as X-Password",
53
53
  "default": ""
54
54
  },
55
+ "U2_HOST": {
56
+ "description": "Override the U2/U2+/U2+L host name or IP address when C64_MODE=u2",
57
+ "default": ""
58
+ },
59
+ "U2_PORT": {
60
+ "description": "Override the U2-family REST port when C64_MODE=u2",
61
+ "default": ""
62
+ },
63
+ "U2_PASSWORD": {
64
+ "description": "Override the U2-family network password sent as X-Password when C64_MODE=u2",
65
+ "default": ""
66
+ },
55
67
  "C64BRIDGE_DIAGNOSTICS_DIR": {
56
68
  "description": "Override the directory where persistent MCP diagnostics files are written",
57
69
  "default": "~/.c64bridge/diagnostics"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c64bridge",
3
- "version": "0.9.3",
3
+ "version": "1.0.0",
4
4
  "mcpName": "io.github.chrisgleissner/c64bridge",
5
5
  "description": "C64 Bridge MCP server for Commodore 64 Ultimate hardware and VICE emulator control",
6
6
  "repository": {
@@ -38,7 +38,9 @@
38
38
  "check": "npm run build && npm test",
39
39
  "check:node-compat": "node scripts/check-node-compat.mjs",
40
40
  "build:rag": "node scripts/invoke-bun.mjs scripts/rag-rebuild.mjs",
41
- "api:generate": "npx --yes swagger-typescript-api@12.0.4 -p doc/c64u/c64-openapi.yaml -o generated/c64 -n index.ts --axios --single-http-client --module-name-first-tag",
41
+ "api:generate": "npm run api:generate:c64u && npm run api:generate:u2",
42
+ "api:generate:c64u": "npx --yes swagger-typescript-api@12.0.4 -p doc/c64u/c64-openapi.yaml -o generated/openapi/c64u -n index.ts --axios --single-http-client --module-name-index 0",
43
+ "api:generate:u2": "npx --yes swagger-typescript-api@12.0.4 -p doc/u2/u2-openapi.yaml -o generated/openapi/u2 -n index.ts --axios --single-http-client --module-name-index 0",
42
44
  "c64:tool": "bash scripts/c64-tool.sh",
43
45
  "rag:rebuild": "node scripts/invoke-bun.mjs scripts/rag-rebuild.mjs",
44
46
  "rag:fetch": "node scripts/fetch-external-sources.mjs",
@@ -112,6 +112,8 @@ function createInitialState() {
112
112
  lastConfigAction: null,
113
113
  menuToggleCount: 0,
114
114
  lastMenuTarget: null,
115
+ menuScreen: Buffer.from([0x41, 0x01, 0x42, 0x02]),
116
+ inputState: { keyboard: { inputs: [] }, joysticks: [{ port: 1, inputs: [] }, { port: 2, inputs: [] }] },
115
117
  streams: {
116
118
  video: { active: false, target: null, packetsSent: 0 },
117
119
  audio: { active: false, target: null, packetsSent: 0 },
@@ -331,6 +333,44 @@ export async function startMockC64Server(options = {}) {
331
333
  return;
332
334
  }
333
335
 
336
+ if (method === "GET" && url === "/v1/machine:menu_screen") {
337
+ res.setHeader("Content-Type", "application/octet-stream");
338
+ res.end(state.menuScreen);
339
+ return;
340
+ }
341
+
342
+ if (method === "GET" && url === "/v1/machine:input") {
343
+ sendJson(res, state.inputState);
344
+ return;
345
+ }
346
+
347
+ if (method === "POST" && url === "/v1/machine:input") {
348
+ const batch = await readJson(req);
349
+ for (const event of batch.events ?? []) {
350
+ if (event.kind === "release_all") {
351
+ state.inputState.keyboard.inputs = [];
352
+ state.inputState.joysticks.forEach((joystick) => { joystick.inputs = []; });
353
+ continue;
354
+ }
355
+ const target = event.kind === "keyboard"
356
+ ? state.inputState.keyboard
357
+ : state.inputState.joysticks.find((joystick) => joystick.port === event.port);
358
+ if (!target) continue;
359
+ const inputs = new Set(target.inputs);
360
+ for (const input of event.inputs ?? []) {
361
+ if (event.transition === "release") inputs.delete(input);
362
+ else if (event.transition === "press") inputs.add(input);
363
+ else if (event.transition === "tap") {
364
+ inputs.add(input);
365
+ inputs.delete(input);
366
+ }
367
+ }
368
+ target.inputs = [...inputs];
369
+ }
370
+ sendJson(res, state.inputState);
371
+ return;
372
+ }
373
+
334
374
  if (method === "GET" && url === "/v1/machine:debugreg") {
335
375
  sendJson(res, { value: state.debugreg ?? "00" });
336
376
  return;
@@ -26,8 +26,19 @@ const fileExists = async (relativePath) => {
26
26
  };
27
27
 
28
28
  const getRepositoryMetadata = (repository) => {
29
- const url = typeof repository === 'string' ? repository : repository?.url;
30
- if (!url) {
29
+ const rawUrl = typeof repository === 'string' ? repository : repository?.url;
30
+ if (!rawUrl) {
31
+ return undefined;
32
+ }
33
+
34
+ let url = rawUrl.trim();
35
+ if (url.startsWith('git+')) {
36
+ url = url.slice(4);
37
+ }
38
+ if (url.endsWith('.git')) {
39
+ url = url.slice(0, -4);
40
+ }
41
+ if (!/^https?:\/\//.test(url)) {
31
42
  return undefined;
32
43
  }
33
44
 
@@ -27,6 +27,7 @@ type ManifestEnvEntry = {
27
27
  type EnvCategory =
28
28
  | "Server Runtime"
29
29
  | "C64 Ultimate"
30
+ | "U2-family"
30
31
  | "VICE Runtime"
31
32
  | "VICE Audio Capture"
32
33
  | "SID Playback"
@@ -55,6 +56,9 @@ function classifyEnvVariable(name: string): EnvCategory {
55
56
  if (name.startsWith("C64U_")) {
56
57
  return "C64 Ultimate";
57
58
  }
59
+ if (name.startsWith("U2_")) {
60
+ return "U2-family";
61
+ }
58
62
  if (name.startsWith("VICE_") || name === "FORCE_XVFB" || name === "DISABLE_XVFB") {
59
63
  if (name === "VICE_MODE" || name === "VICE_LIMIT_CYCLES" || name === "VICE_RUN_TIMEOUT_MS") {
60
64
  return "VICE Audio Capture";
@@ -79,6 +83,9 @@ function resolveJsonConfigKey(name: string): string {
79
83
  C64U_HOST: "c64u.host",
80
84
  C64U_PORT: "c64u.port",
81
85
  C64U_PASSWORD: "c64u.networkPassword",
86
+ U2_HOST: "u2.host",
87
+ U2_PORT: "u2.port",
88
+ U2_PASSWORD: "u2.networkPassword",
82
89
  VICE_BINARY: "vice.exe",
83
90
  VICE_DIRECTORY: "vice.directory",
84
91
  VICE_HOST: "vice.host",
@@ -104,6 +111,7 @@ export function renderEnvironmentSection(envEntries: Readonly<Record<string, Man
104
111
  const orderedCategories: readonly EnvCategory[] = [
105
112
  "Server Runtime",
106
113
  "C64 Ultimate",
114
+ "U2-family",
107
115
  "VICE Runtime",
108
116
  "VICE Audio Capture",
109
117
  "SID Playback",
@@ -145,7 +153,6 @@ type GroupedOperation = {
145
153
  readonly required: readonly string[];
146
154
  readonly optional: readonly string[];
147
155
  readonly properties: Readonly<Record<string, JsonSchema | undefined>>;
148
- readonly notes: readonly string[];
149
156
  };
150
157
 
151
158
  type GroupedToolInfo = {
@@ -168,6 +175,11 @@ function toTableValue(values: readonly string[]): string {
168
175
  return values.join(", ");
169
176
  }
170
177
 
178
+ function withVerificationNote(description: string, properties: Readonly<Record<string, JsonSchema | undefined>>): string {
179
+ const supportsVerification = Object.keys(properties).some((name) => name.toLowerCase().startsWith("verify"));
180
+ return supportsVerification ? `${description} Supports verification.` : description;
181
+ }
182
+
171
183
  function formatInputName(name: string, schema?: JsonSchema): string {
172
184
  const defaultSuffix = schema && Object.prototype.hasOwnProperty.call(schema, "default")
173
185
  ? `=${JSON.stringify(schema.default)}`
@@ -229,21 +241,12 @@ function collectFromOperationMetadata(schema: JsonSchema): readonly GroupedOpera
229
241
  ? entry.optional.filter((name): name is string => typeof name === "string" && name !== "op")
230
242
  : Object.keys(properties).filter((name) => name !== "op" && !requiredProps.includes(name));
231
243
 
232
- const notes: string[] = [];
233
- const hasVerificationProperty = Object.keys(properties).some((name) =>
234
- name.toLowerCase().startsWith("verify"),
235
- );
236
- if (hasVerificationProperty) {
237
- notes.push("supports verify");
238
- }
239
-
240
244
  operations.push({
241
245
  op: opName,
242
- description: getString(entry.description, `Operation ${opName}`),
246
+ description: withVerificationNote(getString(entry.description, `Operation ${opName}`), properties),
243
247
  required: requiredProps,
244
248
  optional: optionalProps,
245
249
  properties,
246
- notes,
247
250
  });
248
251
  }
249
252
 
@@ -282,21 +285,12 @@ function collectFromVariantList(variants: readonly JsonSchema[]): readonly Group
282
285
  const description = getString(typedVariant.description, getString(opSchema?.description, `Operation ${opName}`));
283
286
  const requiredProps = ((typedVariant.required as readonly string[] | undefined) ?? []).filter((name) => name !== "op");
284
287
 
285
- const notes: string[] = [];
286
- const hasVerificationProperty = Object.keys(properties).some((name) =>
287
- name.toLowerCase().startsWith("verify"),
288
- );
289
- if (hasVerificationProperty) {
290
- notes.push("supports verify");
291
- }
292
-
293
288
  operations.push({
294
289
  op: opName,
295
- description,
290
+ description: withVerificationNote(description, properties),
296
291
  required: requiredProps,
297
292
  optional: Object.keys(properties).filter((name) => name !== "op" && !requiredProps.includes(name)),
298
293
  properties,
299
- notes,
300
294
  });
301
295
  }
302
296
 
@@ -321,18 +315,12 @@ function collectFromFlattenedSchema(schema: JsonSchema): readonly GroupedOperati
321
315
  }
322
316
 
323
317
  const descriptionMap = parseOperationDescriptions(getString(schema.description));
324
- const hasVerificationProperty = Object.keys(properties).some((name) =>
325
- name !== "op" && name.toLowerCase().startsWith("verify"),
326
- );
327
- const notes = hasVerificationProperty ? ["supports verify"] : [];
328
-
329
318
  return opNames.map((opName) => ({
330
319
  op: opName,
331
- description: descriptionMap.get(opName) ?? `Operation ${opName}`,
320
+ description: withVerificationNote(descriptionMap.get(opName) ?? `Operation ${opName}`, properties),
332
321
  required: [] as readonly string[],
333
322
  optional: Object.keys(properties).filter((name) => name !== "op"),
334
323
  properties,
335
- notes,
336
324
  }));
337
325
  }
338
326
 
@@ -391,13 +379,13 @@ export function renderToolsSection(modules: readonly ToolModuleDescriptor[] = de
391
379
  escapeCell(operation.description),
392
380
  escapeCell(formatInputs(operation.required, operation.properties)),
393
381
  escapeCell(formatInputs(operation.optional, operation.properties)),
394
- operation.notes.length ? escapeCell(operation.notes.join(", ")) : "—",
395
382
  effectivePlatforms.includes("c64u") ? "✅" : "",
383
+ effectivePlatforms.includes("u2") ? "✅" : "",
396
384
  effectivePlatforms.includes("vice") ? "✅" : "",
397
385
  ];
398
386
  });
399
387
 
400
- lines.push(renderTable(["Operation", "Description", "Required Inputs", "Optional Inputs", "Notes", "C64U", "VICE"], operationRows));
388
+ lines.push(renderTable(["Operation", "Description", "Required Inputs", "Optional Inputs", "C64U", "U2", "VICE"], operationRows));
401
389
  }
402
390
 
403
391
  lines.push("");
package/server.json CHANGED
@@ -4,16 +4,16 @@
4
4
  "title": "C64 Bridge",
5
5
  "description": "MCP server for Commodore 64 Ultimate hardware and VICE emulator control.",
6
6
  "repository": {
7
- "url": "git+https://github.com/chrisgleissner/c64bridge.git",
7
+ "url": "https://github.com/chrisgleissner/c64bridge",
8
8
  "source": "github"
9
9
  },
10
10
  "websiteUrl": "https://github.com/chrisgleissner/c64bridge",
11
- "version": "0.9.3",
11
+ "version": "1.0.0",
12
12
  "packages": [
13
13
  {
14
14
  "registryType": "npm",
15
15
  "identifier": "c64bridge",
16
- "version": "0.9.3",
16
+ "version": "1.0.0",
17
17
  "transport": {
18
18
  "type": "stdio"
19
19
  },