@gbs-toolkit/mcp-server
MCP server for structured GB Studio 4.x project editing, enabling read/patch scripts, scenes, actors, triggers, variables; build ROMs; and sprite generation.
README
@gbs-toolkit/mcp-server
MCP server for structured GB Studio 4.x project editing — read/patch scripts, scenes, actors, triggers, variables; build ROMs; sprite generation pipeline.
Designed to be driven by an LLM coding assistant (Claude Code, Cursor, etc.) so the model can mutate .gbsres resources safely instead of dropping bytes into JSON by hand.
Install
npm install -g @gbs-toolkit/mcp-server
Or invoke on demand via npx:
npx -y @gbs-toolkit/mcp-server
Run as an MCP server
The server speaks stdio MCP. Most users wire it up in their LLM client's .mcp.json:
{
"mcpServers": {
"gbs": {
"command": "npx",
"args": ["-y", "@gbs-toolkit/mcp-server"],
"env": {
"GBS_PROJECT_ROOT": "./gbsproj/demo"
}
}
}
}
Environment variables
| Variable | Required | Default | Notes |
|---|---|---|---|
GBS_PROJECT_ROOT |
yes | — | Directory containing <name>.gbsproj |
GBS_CLI_PATH |
no | probes common install locations | Absolute path to gb-studio-cli.js |
GBS_MGBA_RUNNER |
no | none | Path to a libmgba-linked runner binary used by run_emulator (build it from native/build.sh) |
GBS_ROM_OUT |
no | <root>/build |
Output directory for build_rom |
GBS_LOG_PATH |
no | <root>/build/compile.log |
Captured compile log |
GBS_SCREENSHOT_DIR |
no | <root>/build/screenshots |
Where run_emulator drops PNGs |
SPRITE_PROVIDER |
no | openai |
openai / gemini / replicate / fal |
OPENAI_API_KEY |
conditional | — | Required if SPRITE_PROVIDER=openai and generate_sprite is used |
GEMINI_API_KEY |
conditional | — | Required for gemini provider |
REPLICATE_API_TOKEN |
conditional | — | Required for replicate provider |
FAL_KEY |
conditional | — | Required for fal provider |
Tool inventory
| Tool | Kind |
|---|---|
list_scenes / read_scene / list_actors / read_script / read_compile_log |
read |
patch_script |
write (insert / replace / delete, applied in order) |
set_variable |
write (upserts a VARIABLE_SET_TO_VALUE event in the start scene's onInit) |
create_scene / create_actor / create_trigger / create_variable / create_custom_event / set_start_scene |
write |
delete_scene / delete_actor / delete_trigger / delete_custom_event / delete_variable |
write (cross-script reference scan; refuses unless force: true) |
generate_sprite |
write (text-to-image → 4-colour DMG quantise → emits (asset.png, asset.png.gbsres)) |
convert_image_to_sprite |
write (no AI; same pipeline applied to a user-supplied PNG/JPG) |
build_rom |
subprocess (spawns GB Studio CLI's make:rom) |
run_emulator |
subprocess (drives a libmgba-linked C runner) |
screenshot |
read image (returns base64 PNG as multimodal MCP content) |
What is NOT exposed
Creation/import of binary assets stays GUI-side: backgrounds, tilesets, emotes, avatars, fonts, music, sounds, plus actorPrefabs / triggerPrefabs / palettes / notes. The MCP layer can read and patch scripts that reference these resources by id, but cannot create their .png / .uge / .wav payloads. Sprites are the one exception (see generate_sprite / convert_image_to_sprite).
Built-in guardrails
The server enforces two checks that previously had to live in prompts:
-
Dialogue width audit —
patch_scriptvalidates everyEVENT_TEXT/EVENT_MENU/EVENT_CHOICE/EVENT_DIALOGUE/EVENT_MARQUEEstring against the GB Studio default-font line budget (18 columns;$var$placeholders reserve 5 chars to cover signed-16-bit values). Multi-boxtext: string[]form, CJK width (2 columns / char), and recursivechildrenbranches are all walked. A violation rejects the patch withDIALOGUE_WIDTH_EXCEEDEDand a per-line breakdown. PasswidthBudgetto override (e.g. for a custom narrow font) orforce: trueto bypass. -
Sprite quality check —
generate_spriteandconvert_image_to_spriteanalyse the post-quantisation RGBA buffer (opaque ratio, effective DMG colour count, edge density, single-shade dominance). Clearly degenerate outputs (near-empty frame, ≤1 effective shade) refuse to write the asset; borderline cases (2 shades, low edge density, >85% one shade) save with aquality.level: "warn"field in the response. Passforce: trueto skip the check.
Both checks return structured metadata so the LLM can self-correct rather than ploughing through.
Building the emulator runner
run_emulator requires a libmgba-linked C binary. Stock mGBA CLIs do not accept a startup --script flag, so we ship a small dedicated runner. From the cloned repo:
cd native
MGBA_SRC=/path/to/mgba MGBA_BUILD=/path/to/mgba/build ./build.sh
Then point the env var at the result: GBS_MGBA_RUNNER=/path/to/gbs-mgba-runner.
If you don't need run_emulator, ignore this — every other tool works without it.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。