GameBoy连接器
一种模型上下文协议服务器,使大型语言模型能够与GameBoy模拟器交互,提供控制GameBoy、加载ROM以及检索屏幕帧的工具。
可用工具 (13 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
press_up 1 个参数
Press the UP button on the GameBoy
该工具无需必填参数,直接调用即可
press_down 1 个参数
Press the DOWN button on the GameBoy
该工具无需必填参数,直接调用即可
press_left 1 个参数
Press the LEFT button on the GameBoy
该工具无需必填参数,直接调用即可
press_right 1 个参数
Press the RIGHT button on the GameBoy
该工具无需必填参数,直接调用即可
press_a 1 个参数
Press the A button on the GameBoy
该工具无需必填参数,直接调用即可
press_b 1 个参数
Press the B button on the GameBoy
该工具无需必填参数,直接调用即可
press_start 1 个参数
Press the START button on the GameBoy
该工具无需必填参数,直接调用即可
press_select 1 个参数
Press the SELECT button on the GameBoy
该工具无需必填参数,直接调用即可
wait_frames 1 个参数
Wait for a specified number of frames
该工具无需必填参数,直接调用即可
load_rom 1 个参数 需填 1 项
Load a GameBoy ROM file
必填参数:romPath
get_screen
Get the current GameBoy screen (advances one frame)
该工具无需必填参数,直接调用即可
is_rom_loaded
Check if a ROM is currently loaded in the emulator
该工具无需必填参数,直接调用即可
list_roms
List all available GameBoy ROM files
该工具无需必填参数,直接调用即可
服务介绍
MCP GameBoy 服务器
概述
这是一个用于 serverboy 的模型上下文协议 (MCP) 服务器,允许大型语言模型 (LLMs) 与 GameBoy 模拟器进行交互。
您的 LLM 可以...
- 加载 ROM
- 按键
- 查看 GameBoy 屏幕
- 跳过帧
您可以...
- 使用 @modelcontextprotocol/inspector 控制 GameBoy 模拟器
- 通过 http://localhost:3001/emulator 网页界面控制 GameBoy 模拟器(并上传 ROM)
- 在您喜欢的 MCP 客户端中安装 GameBoy 模拟器
功能
- 支持 stdio 和 SSE 传输
- 提供 GameBoy 控制工具(上、下、左、右、A、B、开始、选择)
- 提供加载不同 ROM 的工具
- 提供获取当前屏幕的工具
- 所有工具返回包含最新屏幕帧的 ImageContent
安装
通过 Smithery 安装
要通过 Smithery 自动为 Claude Desktop 安装 GameBoy 模拟器服务器:
bash
npx -y @smithery/cli install @mario-andreschak/mcp-gameboy --client claude
在 FLUJO 中安装
- 点击添加服务器
- 将 GitHub URL 复制并粘贴到 FLUJO
- 点击解析、克隆、安装、构建和保存。
手动安装
bash
克隆仓库
git clone https://github.com/yourusername/mcp-gameboy.git
cd mcp-gameboy
安装依赖
npm install
构建项目
npm run build
通过配置文件安装
!! 注意 : 许多 MCP 客户端需要在 .env 变量中指定 ROM 路径作为 绝对路径
要通过配置文件将此 MCP 服务器与 Cline 或其他 MCP 客户端集成:
-
打开您的 Cline 设置:
- 在 VS Code 中,转到文件 -> 首选项 -> 设置
- 搜索 "Cline MCP 设置"
- 点击 "在 settings.json 中编辑"
-
将服务器配置添加到
mcpServers对象中:
json
{
"mcpServers": {
"mcp-gameboy": {
"command": "node",
"args": [
"/path/to/mcp-gameboy/dist/index.js"
],
"disabled": false,
"autoApprove": []
}
}
} -
将
/path/to/mcp-gameboy/dist/index.js替换为您项目目录中index.js文件的实际路径。在 Windows 上使用正斜杠 (/) 或双反斜杠 (\) 作为路径分隔符。 -
保存设置文件。Cline 应该会自动连接到服务器。
使用
环境变量
!! 注意 : 许多 MCP 客户端需要在 .env 变量中指定 ROM 路径作为 绝对路径
在根目录创建一个 .env 文件,并添加以下变量:
服务器配置
PORT=3001
stdio 模式下的 ROM 路径
ROM_PATH=./roms/dangan.gb
以 stdio 模式运行
在 stdio 模式下,服务器使用 ROM_PATH 环境变量中指定的 ROM 路径。它将打开一个浏览器窗口来显示 GameBoy 屏幕。
bash
npm run start
以 SSE 模式运行
在 SSE 模式下,服务器启动一个 Express 服务器,提供一个网页用于选择 ROM。
bash
npm run start-sse
然后在浏览器中打开 http://localhost:3001 选择 ROM。
工具
服务器提供了以下工具:
press_up: 按下 GameBoy 上的方向键press_down: 按下 GameBoy 下的方向键-press_left: 按下 GameBoy 上的 LEFT 按钮press_right: 按下 GameBoy 上的 RIGHT 按钮press_a: 按下 GameBoy 上的 A 按钮press_b: 按下 GameBoy 上的 B 按钮press_start: 按下 GameBoy 上的 START 按钮press_select: 按下 GameBoy 上的 SELECT 按钮load_rom: 加载一个 GameBoy ROM 文件get_screen: 获取当前 GameBoy 屏幕
所有工具都返回带有最新屏幕帧的 ImageContent。
实现细节
该服务器使用 Model Context Protocol (MCP) TypeScript SDK 构建。它使用了:
- 从
@modelcontextprotocol/sdk/server/mcp.js导入的McpServer用于服务器实现 - 从
@modelcontextprotocol/sdk/server/stdio.js导入的StdioServerTransport用于 stdio 传输 - 从
@modelcontextprotocol/sdk/server/sse.js导入的SSEServerTransport用于 SSE 传输 serverboy用于 GameBoy 模拟express用于在 SSE 模式下的 Web 服务器canvas用于渲染 GameBoy 屏幕
许可证
MIT