New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

c64bridge

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

c64bridge

Local MCP server for controlling a Commodore 64 via Ultimate 64 REST API

Source
npmnpm
Version
0.7.4
Version published
Weekly downloads
46
-58.18%
Maintainers
1
Weekly downloads
 
Created
Source

Logo

C64 Bridge

Your AI Command Bridge for the Commodore 64.

npm Build codecov License: GPL v2 Platform

Overview

C64 Bridge is a Model Context Protocol (MCP) server that drives a real Commodore 64 Ultimate or Ultimate 64 over their REST APIs.

It is based on the official TypeScript @modelcontextprotocol/sdk and supports both stdio (for local AI integration) and HTTP (for remote access by other applications).

Features

  • Program runners for BASIC, 6510 assembly, and PRG/CRT
  • Full memory access — read/write operations and text monitoring
  • System integration covering drives, files, and printers
  • SID audio tools for composition, playback, and analysis
  • Built-in knowledge base for smarter AI prompting using local examples and docs
  • Multiple backends: hardware C64 Ultimate (primary) and experimental VICE runner

Quick Start

  • Install Node.js 24+ and npm
  • Linux (Ubuntu/Debian)

    • Recommended:

      sudo apt update
      sudo apt install -y curl ca-certificates
      curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
      sudo apt install -y nodejs
      
    • Fallback (may be older): sudo apt install -y nodejs npm

  • macOS

    brew install node@24
    brew link --overwrite node@24
    
  • Windows

    # winget
    winget install OpenJS.NodeJS.LTS
    # or Chocolatey
    choco install nodejs-lts -y
    

Verify: node --version → v24.x

  • Run the server (choose one)
  • npx (zero setup)

    npx -y c64bridge@latest
    
  • npm (project‑local)

    mkdir -p ~/c64bridge && cd ~/c64bridge
    npm init -y
    npm install c64bridge
    node ./node_modules/c64bridge/dist/index.js
    
  • From source (contributing/testing)

    git clone https://github.com/chrisgleissner/c64bridge.git
    cd c64bridge
    npm install
    npm start
    

On start, the server probes your target (REST + zero‑page read) and prints diagnostics before announcing that it is running on stdio.

Configuration

The server reads configuration in this order:

  • C64BRIDGE_CONFIG environment variable containing the path of the config file
  • .c64bridge.json in the project root
  • ~/.c64bridge.json in your home directory

C64 Ultimate

Use this for a C64 Ultimate:

{
  "c64u": {
    "host": "c64u",
    "port": 80,
    "networkPassword": "secret"
  }
}
  • If no file is found, it defaults to c64u:80 and no network password.
  • A networkPassword is only required if you specified one in the C64 Ultimate menu under Network Settings.

VICE

Use this for VICE:

{
  "vice": {
    "exe": "/usr/bin/x64sc"
  }
}

VS Code MCP Setup

If this repository is checked out locally, simply open the prepared .vscode/mcp.json. Otherwise, put the following text in your .vscode/mcp.json:

{
  "servers": {
    "c64bridge": {
      "command": "npx",
      "args": [
        "-y",
        "c64bridge@latest"
      ]
    }
  }
}

Then click the "Start" icon that appears above the c64bridge server entry.

Your C64 Bridge MCP server should now be running:

VS Code Started MCP server

For more details, see the official VS Code MCP Server documentation.

Enable The C64 Agent

After the MCP server is running, switch to the C64 agent in VS Code.

This agent is useful because it is preconfigured for Commodore 64 tasks. It steers Copilot toward c64bridge workflows for BASIC, 6502 assembly, SID audio, VIC-II graphics, memory inspection, disk operations, printing, streaming, and device control.

VS Code C64 agent

Optional Overrides

You can add env entries in .vscode/mcp.json to select a config file or force a backend:

{
  "servers": {
    "c64bridge": {
      "command": "npx",
      "args": [
        "-y",
        "c64bridge@latest"
      ],
      "env": {
        "C64BRIDGE_CONFIG": "/home/you/.c64bridge.json",
        "C64_MODE": "c64u",
        "LOG_LEVEL": "debug",
      }
    }
  }
}
  • C64BRIDGE_CONFIG points to a specific config file.
  • C64_MODE forces c64u or vice.
  • LOG_LEVEL=debug enables verbose logging.

Example

Compose a children’s song with ChatGPT + VS Code:

duck song

Then render PETSCII art for it:

duck petscii

HTTP Invocation

  • Preferred transport is stdio. The HTTP bridge is disabled by default; enable it only for manual testing
  • These curl commands are illustrative to show what happens under the hood when tools run.
# Upload and run BASIC
curl -s -X POST -H 'Content-Type: application/json' \
  -d '{"op":"upload_run_basic","program":"10 PRINT \"HELLO\"\n20 GOTO 10"}' \
  http://localhost:8000/tools/c64_program | jq

# Read current screen (PETSCII→ASCII)
curl -s -X POST -H 'Content-Type: application/json' \
  -d '{"op":"read_screen"}' \
  http://localhost:8000/tools/c64_memory | jq

# Reset the machine
curl -s -X POST -H 'Content-Type: application/json' \
  -d '{"op":"reset"}' \
  http://localhost:8000/tools/c64_system

Build & Test

  • npm install (or bun install) — install deps
  • npm start — dev server (ts-node)
  • npm run build — type‑check and build
  • npm test — integration tests (mock)
  • npm test -- --real — target real hardware (reuses your config)
  • npm run coverage — coverage via Bun harness (minimum 90%)

Documentation

MCP API Reference

This MCP server exposes 12 tools, 25 resources, and 7 prompts for controlling your Commodore 64.

Tools

c64_config

Grouped entry point for configuration reads/writes, diagnostics, and snapshots.

OperationDescriptionRequired InputsNotes
batch_updateApply multiple configuration updates in a single request.
diffCompare the current configuration with a snapshot.path
getRead a configuration category or specific item.category
infoRetrieve Ultimate hardware information and status.
listList configuration categories reported by the firmware.
load_flashLoad configuration from flash storage.
read_debugregRead the Ultimate debug register ($D7FF).
reset_defaultsReset firmware configuration to factory defaults.
restoreRestore configuration from a snapshot file.path
save_flashPersist the current configuration to flash storage.
setWrite a configuration value in the selected category.category, item, value
shuffleDiscover PRG/CRT files and run each with optional screen capture.
snapshotSnapshot configuration to disk for later restore or diff.path
versionFetch firmware version details.
write_debugregWrite a hex value to the Ultimate debug register ($D7FF).value

c64_disk

Grouped entry point for disk mounts, listings, image creation, and program discovery.

OperationDescriptionRequired InputsNotes
create_imageCreate a blank disk image of the specified format.format, path
file_infoInspect metadata for a file on the Ultimate filesystem.path
find_and_runSearch for a PRG/CRT by name substring and run the first match.nameContains
list_drivesList Ultimate drive slots and their mounted images.
mountMount a disk image with optional verification and retries.drive, imagesupports verify
unmountRemove the mounted image from an Ultimate drive slot.drive

c64_drive

Grouped entry point for drive power, mode, reset, and ROM operations.

OperationDescriptionRequired InputsNotes
load_romTemporarily load a custom ROM into an Ultimate drive slot.drive, path
power_offPower off a specific Ultimate drive slot.drive
power_onPower on a specific Ultimate drive slot.drive
resetIssue an IEC reset for the selected drive slot.drive
set_modeSet the emulation mode for a drive slot (1541/1571/1581).drive, mode

c64_extract

Grouped entry point for sprite/charset extraction, memory dumps, filesystem stats, and firmware health checks.

OperationDescriptionRequired InputsNotes
charsetLocate and extract 2KB character sets from RAM.
firmware_healthRun firmware readiness checks and report status metrics.
fs_statsWalk the filesystem and aggregate counts/bytes by extension.
memory_dumpDump a RAM range to hex or binary files with manifest metadata.address, length, outputPath
spritesScan RAM for sprites and optionally export .spr files.address, length

c64_graphics

Grouped entry point for PETSCII art, sprite previews, and future bitmap generation.

OperationDescriptionRequired InputsNotes
create_petsciiGenerate PETSCII art from prompts, text, or explicit bitmap data.
generate_bitmapReserved high-resolution bitmap generator (coming soon).
generate_spriteBuild and run a sprite PRG from raw 63-byte sprite data.sprite
render_petsciiRender PETSCII text with optional border/background colours.text

c64_memory

Grouped entry point for memory I/O, screen reads, and screen polling.

OperationDescriptionRequired InputsNotes
readRead a range of bytes and return a hex dump with address metadata.address
read_screenReturn the current 40x25 text screen converted to ASCII.
wait_for_textPoll the screen until a substring or regex appears, or timeout elapses.pattern
writeWrite a hexadecimal byte sequence into RAM.address, bytessupports verify

c64_printer

Grouped entry point for Commodore and Epson printing helpers.

OperationDescriptionRequired InputsNotes
define_charsDefine custom printer characters (Commodore DLL mode).firstChar, chars
print_bitmapPrint a bitmap row via Commodore (BIM) or Epson ESC/P workflows.printer, columns
print_textGenerate BASIC that prints text to device 4.text

c64_program

Grouped entry point for program upload, execution, and batch workflows.

OperationDescriptionRequired InputsNotes
batch_runRun multiple PRG/CRT programs with post-run assertions.programs
bundle_runCapture screen, memory, and debug registers into an artifact bundle.runId, outputPath
load_prgLoad a PRG from Ultimate storage without executing it.path
run_crtMount and run a CRT cartridge image.path
run_prgLoad and execute a PRG located on the Ultimate filesystem.path
upload_run_asmAssemble 6502/6510 source, upload the PRG, and execute it.programsupports verify
upload_run_basicUpload Commodore BASIC v2 source and execute it immediately.programsupports verify

c64_rag

Grouped entry point for BASIC and assembly RAG lookups.

OperationDescriptionRequired InputsNotes
asmRetrieve 6502/6510 assembly references from the local knowledge base.q
basicRetrieve BASIC references and snippets from the local knowledge base.q

c64_sound

Grouped entry point for SID control, playback, composition, and analysis workflows.

OperationDescriptionRequired InputsNotes
analyzeAutomatically analyze SID playback when verification is requested.request
compile_playCompile SIDWAVE or CPG source and optionally play it immediately.
generateGenerate a lightweight SID arpeggio playback sequence.
note_offRelease a SID voice by clearing its gate bit.voice
note_onTrigger a SID voice with configurable waveform, ADSR, and pitch.
pipelineCompile a SIDWAVE score, play it, and analyze the recording.supports verify
play_mod_filePlay a MOD tracker module via the Ultimate SID player.path
play_sid_filePlay a SID file stored on the Ultimate filesystem.path
record_analyzeRecord audio for a fixed duration and return SID analysis metrics.durationSeconds
resetSoft or hard reset of SID registers to clear glitches.
set_volumeSet the SID master volume register at $D418 (0-15).volume
silence_allSilence all SID voices with optional audio verification.supports verify

c64_stream

Grouped entry point for starting and stopping Ultimate streaming sessions.

OperationDescriptionRequired InputsNotes
startStart an Ultimate streaming session toward a host:port target.stream, target
stopStop an active Ultimate streaming session.stream

c64_system

Grouped entry point for power, reset, menu, and background task control.

OperationDescriptionRequired InputsNotes
list_tasksList known background tasks with status metadata.
menuToggle the Ultimate menu button for navigation.
pausePause the machine using DMA halt until resumed.
poweroffRequest a controlled shutdown via the Ultimate firmware.
rebootTrigger a firmware reboot to recover from faults.
resetIssue a soft reset without cutting power.
resumeResume CPU execution after a DMA pause.
start_taskStart a named background task that runs on an interval.name, operation
stop_all_tasksStop every running background task and persist state.
stop_taskStop a specific background task and clear its timer.name

Resources

NameSummary
c64://docs/indexExplains how to approach each knowledge bundle and when to consult it.
c64://context/bootstrapStep-by-step rules for safe automation, verification, and rollback on the C64.
c64://specs/basicToken definitions, syntax rules, and device I/O guidance for BASIC v2.
c64://docs/basic/pitfallsQuickref covering quotation handling, line length, tokenization, variable names, and other BASIC traps.
c64://specs/assemblyOfficial opcode matrix, addressing modes, and zero-page strategy for the 6510 CPU.
c64://specs/sidRegister map, waveform behaviour, and ADSR envelopes for expressive SID playback.
c64://specs/sidwaveDefines the SIDWAVE interchange format used by the SID composer workflow.
c64://docs/sid/file-structureExplains PSID/RSID headers, metadata blocks, and compatibility notes for imported music.
c64://docs/sid/best-practicesCaptures proven waveforms, ADSR presets, phrasing, and verification workflow for pleasant SID music.
c64://specs/vicCovers raster timing, sprite control, colour RAM, and bitmap modes on the VIC-II.
c64://specs/charsetCharacter code table mapping PETSCII codes to screen codes, glyphs, and keyboard input.
c64://docs/petscii-styleDocuments colour palette, readability presets, dithering patterns, and best practices for creating artistic and readable PETSCII displays.
c64://docs/sprite-charset-workflowsDocuments sprite and charset workflows, memory layout, VIC-II configuration, common pitfalls, and proven techniques for hardware-accelerated graphics.
c64://specs/memory-mapPage-by-page breakdown of the 64 KB address space with hardware, ROM, and RAM regions.
c64://specs/memory-lowDocuments zero-page variables, BASIC pointers, and KERNAL workspace addresses.
c64://specs/memory-kernalLists KERNAL ROM vectors and service routines for OS-level functionality.
c64://specs/ioCovers VIC-II, SID, CIA, and system control registers with address ranges and usage notes.
c64://specs/ciaDetails CIA 1/2 registers, timers, interrupts, and keyboard matrix layout.
c64://specs/printerCovers device setup, control codes, and Ultimate 64 integration for printers.
c64://docs/printer/guideQuick-look workflow covering setup, troubleshooting, and sample jobs for both printer families.
c64://docs/printer/commodore-textCharacter sets, control codes, and formatting for Commodore MPS text output.
c64://docs/printer/commodore-bitmapDetails bitmap modes, graphics commands, and data layout for MPS bitmap printing.
c64://docs/printer/epson-textLists ESC/P control codes and formatting advice for Epson FX text output.
c64://docs/printer/epson-bitmapExplains bit-image modes, density options, and data packing for Epson bitmap jobs.
c64://docs/printer/promptsReusable prompt templates that drive complex printer jobs through the MCP server.

Prompts

NameDescription
assembly-programAuthor 6502/6510 assembly routines with precise hardware guidance.
basic-programPlan, implement, and verify Commodore BASIC v2 programs safely.
drive-managerMount, create, or power drives while preserving running workloads.
graphics-demoCreate VIC-II graphics demos with safe setup and validation steps.
memory-debugInspect or patch memory ranges with reversible steps and logging.
printer-jobSend formatted output to Commodore or Epson printers with safe teardown steps.
sid-musicCompose SID music with expressive phrasing and iterative audio verification.

Keywords

mcp

FAQs

Package last updated on 07 Mar 2026

Related posts