GitHub - cliffhall/mcp-c64: An MCP server for developing BASIC and Assembly Language programs for the Commodore 64 (original) (raw)

mcp-c64 logo

An MCP server for developing BASIC and Assembly Language programs for the Commodore 64

REQUIREMENTS

Install

Configure

Create .env file

Example .env file

ASSEMBLER=64tass TOKENIZER=/Users/zaphod/vice/bin/petcat EMULATOR=/Users/zaphod/vice/x64sc.app/Contents/MacOS/x64sc

ASM_PATH=./asm/hello BASIC_PATH=./basic/token

Example mcp.json file for Cursor

{ "mcpServers": { "mcp-c64": { "command": "npx", "args": ["-y", "mcp-c64"], "env": { "ASSEMBLER": "64tass", "TOKENIZER": "/Users/zaphod/vice/bin/petcat", "EMULATOR": "/Users/zaphod/vice/x64sc.app/Contents/MacOS/x64sc", "ASM_PATH": "/Users/zaphod/Projects/retro-game/asm/", "BASIC_PATH": "/Users/zaphod/Projects/retro-game/basic/" } } } }

Example mcp.json file for VSCode

{ "mcp": { "servers": { "mcp-c64": { "type": "stdio", "command": "npx", "args": [ "-y", "mcp-c64" ], "env": { "ASSEMBLER": "64tass", "TOKENIZER": "/Users/zaphod/vice/bin/petcat", "EMULATOR": "/Users/zaphod/vice/x64sc.app/Contents/MacOS/x64sc", "ASM_PATH": "/Users/zaphod/Projects/retro-game/asm/", "BASIC_PATH": "/Users/zaphod/Projects/retro-game/basic/" } } } } }

Example configuration for Github Copilot

{ "servers": { "mcp-c64": { "type": "stdio", "command": "npx", "args": ["-y", "mcp-c64"], "env": { "ASSEMBLER": "64tass", "TOKENIZER": "/Users/zaphod/vice/bin/petcat", "EMULATOR": "/Users/zaphod/vice/x64sc.app/Contents/MacOS/x64sc", "ASM_PATH": "/Users/zaphod/Projects/retro-game/asm/", "BASIC_PATH": "/Users/zaphod/Projects/retro-game/basic/" } } } }

The REPL

A minimal MCP Client which allows you to interact with the mcp-c64 server. It doesn't invoke LLMs but rather allows you to invoke the tools as an LLM would.

Running the REPL

MCP Interactive Client
=====================
Connected to mcp-c64 server via STDIO transport

Available commands:
  help                       - Show this help
  list-tools                 - List available tools
  call-tool <name> [args]    - Call a tool with optional JSON arguments
  quit                       - Exit the program

> 

The list-tools command

> list-tools

Available tools:
  - assemble_program: Assemble an assembly language program.
        Only the .asm source filename is required in file parameter, output .prg and .map files will be generated.
        Any additional args such as -a, -cbm-prg, etc. should be supplied in an array in the args parameter.
  - tokenize_program: Tokenize a BASIC program.
        Only the .bas source filename is required in file parameter, output .prg file will be generated.
        Any additional args such as -w2, etc. should be supplied in an array in the args parameter.
  - run_program: Run an assembled or tokenized program.
        The .prg filename is required in file parameter, and the program's path is required in path parameter.
        Any additional args such as -console, etc. should be supplied in an array in the args parameter.
        
>

The call-tool command

assemble_program tool

> call-tool assemble_program {"file":"hello_world.asm", "args": ["-a", "--cbm-prg"]}
Calling tool 'assemble_program' with args: { file: 'hello_world.asm', args: [ '-a', '--cbm-prg' ] }
Tool result:
{
  output: '64tass Turbo Assembler Macro V1.60.3243\n' +
    '64TASS comes with ABSOLUTELY NO WARRANTY; This is free software, and you\n' +
    'are welcome to redistribute it under certain conditions; See LICENSE!\n' +
    '\n' +
    'Assembling file:   asm/hello/hello_world.asm\n' +
    'Output file:       asm/hello/hello_world.prg\n' +
    'Passes:            2\n',
  error: '',
  status: 0
}

>

tokenize_program tool

> call-tool tokenize_program {"file":"token_test.bas", "args": ["-w2","-v"]}}
Calling tool 'tokenize_program' with args: { file: 'token_test.bas', args: [ '-w2', '-v' ] }
Tool result:
{
  output: '/Users/zaphod/Projects/retro-game\n',
  error: '\nLoad address 0801\nControl code set: enabled\n\n',
  status: 0
}

> 

run_program tool

> call-tool run_program {"file":"token_test.prg", "path":"/Users/zaphod/Projects/retro-game/basic/token", "args": ["-exitscreenshot","token_test.png"]}
Calling tool 'run_program' with args: {
  file: 'token_test.prg',
  path: '/Users/zaphod/Projects/retro-game/basic/token',
  args: [ '-exitscreenshot', 'token_test.png' ]
}
Tool result:
{ output: '', error: '', status: 0 }

>