G

GameBoy连接器

一种模型上下文协议服务器,使大型语言模型能够与GameBoy模拟器交互,提供控制GameBoy、加载ROM以及检索屏幕帧的工具。

games-and-gamificationagent-orchestration

303 查看 · 2026-07-07 更新

简介

一种模型上下文协议服务器,使大型语言模型能够与GameBoy模拟器交互,提供控制GameBoy、加载ROM以及检索屏幕帧的工具。

简介

一种模型上下文协议服务器,使大型语言模型能够与GameBoy模拟器交互,提供控制GameBoy、加载ROM以及检索屏幕帧的工具。

MCP GameBoy 服务器

smithery 徽章

GameBoy 服务器 MCP 服务器

概述

这是一个用于 serverboy 的模型上下文协议 (MCP) 服务器,允许大型语言模型 (LLMs) 与 GameBoy 模拟器进行交互。 您的 LLM 可以...

  • 加载 ROM
  • 按键
  • 查看 GameBoy 屏幕
  • 跳过帧

您可以...

  • 使用 @modelcontextprotocol/inspector 控制 GameBoy 模拟器
  • 通过 http://localhost:3001/emulator 网页界面控制 GameBoy 模拟器(并上传 ROM)
  • 在您喜欢的 MCP 客户端中安装 GameBoy 模拟器

截图 2025-04-25 183528

截图 2025-04-25 081510

图片

功能

  • 支持 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 中安装

  1. 点击添加服务器
  2. 将 GitHub URL 复制并粘贴到 FLUJO
  3. 点击解析、克隆、安装、构建和保存。

手动安装

bash

克隆仓库

git clone https://github.com/yourusername/mcp-gameboy.git cd mcp-gameboy

安装依赖

npm install

构建项目

npm run build

通过配置文件安装

!! 注意 : 许多 MCP 客户端需要在 .env 变量中指定 ROM 路径作为 绝对路径

要通过配置文件将此 MCP 服务器与 Cline 或其他 MCP 客户端集成:

  1. 打开您的 Cline 设置:

    • 在 VS Code 中,转到文件 -> 首选项 -> 设置
    • 搜索 "Cline MCP 设置"
    • 点击 "在 settings.json 中编辑"
  2. 将服务器配置添加到 mcpServers 对象中: json { "mcpServers": { "mcp-gameboy": { "command": "node", "args": [ "/path/to/mcp-gameboy/dist/index.js" ], "disabled": false, "autoApprove": [] } } }

  3. /path/to/mcp-gameboy/dist/index.js 替换为您项目目录中 index.js 文件的实际路径。在 Windows 上使用正斜杠 (/) 或双反斜杠 (\) 作为路径分隔符。

  4. 保存设置文件。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

工具列表

  • press_up: Press the UP button on the GameBoy

  • press_down: Press the DOWN button on the GameBoy

  • press_left: Press the LEFT button on the GameBoy

  • press_right: Press the RIGHT button on the GameBoy

  • press_a: Press the A button on the GameBoy

  • press_b: Press the B button on the GameBoy

  • press_start: Press the START button on the GameBoy

  • press_select: Press the SELECT button on the GameBoy

  • wait_frames: Wait for a specified number of frames

  • load_rom: Load a GameBoy ROM file

  • 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

服务配置

[{'mcpServers': {'mcp-gameboy': {'args': ['/path/to/mcp-gameboy/dist/index.js'], 'autoApprove': [], 'command': 'node', 'disabled': False}}}]

来源