mcp-c64

mcp-c64

An MCP server for developing BASIC and Assembly Language programs for the Commodore 64, providing tools to assemble, tokenize, and run programs in the VICE emulator.

Category
访问服务器

README

mcp-c64

mcp-c64 logo

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

  • Optimal C64 development stack
  • REPL - A minimal command line client for interacting directly with the MCP server.
  • MCP Server working with the ability to:
    • Assemble 6502 assembly language programs to .prg format
    • Tokenize BASIC programs to .prg format
    • Launch and run .prg format programs in the emulator

REQUIREMENTS

Install

  • Node + npm - Javascript runtime environment

    • <a href="https://nodejs.org/en/download" target="_blank">Install</a> the latest stable Node release (comes with npm).
  • VICE - The Versatile Commodore Emulator

  • 64Tass - The 6502 assembler for C64

Configure

Create .env file

  • Create file .env in the root of your project.
    • If you have downloaded the project source, you can copy .env-example
  • Add / modify vars
    • ASSEMBLER - pointing to the 64tass assembler executable (full path if not in PATH)
    • TOKENIZER - pointing to the petcat tokenizer executable (full path if not in PATH)
    • EMULATOR - pointing to the x64sc emulator executable (full path if not in PATH)
    • ASM_PATH - pointing to your assembly source folder
    • BASIC_PATH- pointing to your basic source folder

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

  • Invoke with npm run repl
  • You will see a menu of available commands.
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

  • Lists the available tools in the MCP server.
  • These are the tools that the LLM could call, and the descriptions it would see
> 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

  • Allows you to call a tool on the MCP server just as the LLM would
  • You pass the tool name and its arguments as a JSON string

assemble_program tool

  • Uses 64tass to assemble a 6502 assembly language program
  • To target the Commodore 64 using Unicode or standard ASCII input, include the -a and -cbm-prg arguments
  • Refer to the 64tass command line options reference for more info on configuring the assembler behaviors
> 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

  • Uses the petcat command included with the VICE emulator
  • To tokenize a Unicode or standard ASCII file for the Commodore 64, include the -w2 argument
  • See the petcat command line options reference for more info on configuring the tokenizer input and output behavior
  • See the C64-Wiki for PETSCII control characters that can be used in BASIC strings for such things as cursor movement and character color
> 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

  • Uses the x64sc executable included with the VICE emulator package
  • To take a screenshot on exit, include the -exitscreenshot argument followed by a file name argument
  • See the x64sc command line options reference for more info on configuring the emulator behavior
> 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 }

> 

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选