mcp-vroid
mcp-vroid
一个 驱动 VRoid Studio GUI 的 MCP 服务器。它为任何 MCP 客户端(Claude Code,或任何支持该协议的其他工具)提供一组工具:启动应用、查看应用、在画面中查找控件并点击和输入、设置参数,以及导出 .vrm —— 运行在 Arch + Hyprland (Wayland) 上,VRoid Studio 通过 Steam/Proton 运行。
VRoid Studio 没有脚本 API,所以只能用现在唯一可行的方式:对窗口截图,用 OCR 和颜色匹配定位目标,并注入真实的指针和键盘事件。
grim ──► PNG ──► tesseract / cv2 ──► (x, y) ──► virtual pointer / XTEST
▲ │
└──────────────────── screenshot again ◄───────────────┘服务器底层的引擎来自 arrakis 项目中的 tools/vroid-driver spike,这里以 mcp_vroid.driver 的名义随包带进来 —— 代码相同,只是重新打包,让 MCP 客户端能够安装并启动它。
环境要求
组件 | 用途 |
Hyprland(>= 0.55,Lua dispatch API) | 窗口发现、聚焦、工作区 |
VRoid Studio(通过 Steam/Proton,appid | 被驱动的应用 |
| 截屏 |
| OCR |
| 构建指针辅助工具 |
Xwayland( | 键盘和滚轮讲通过 X11 XTEST 注入 |
Python 3.11+、 | 服务器本体 |
Python 依赖(由 uv sync 安装):mcp、pillow、numpy、opencv-python-headless、pytesseract、python-xlib。
Related MCP server: Persona MCP Server
安装
git clone https://github.com/nhodges/mcp-vroid
cd mcp-vroid
uv sync # virtualenv + dependencies
bash native/build.sh # builds native/vpointer <-- REQUIRED, not optionalnative/build.sh 编译出一个约 150 行的 C 客户端,用于 zwlr_virtual_pointer_unstable_v1(协议 XML 已随附在 native/protocols/ 下)。没有它,所有指针工具都会报 native/vpointer missing。vroid_status 会报告它是否存在。
为什么C 用一个C helper:ydotool 没有安装在参考机器上,且 /dev/uinput 是 0600 root:root,所以 evdev 注入需要 sudo 或 udev 规则。Wayland 虚拟指针协议不需要这两者,它移动的是合成器真实指针,并且能在任何窗口下工作。
向某个客户端注册
Claude Code:
claude mcp add vroid -- uv run --directory /path/to/mcp-vroid mcp-vroid通用 mcpServersJSON:
G4
通用 mcpServers JSON:
{
"mcpServers": {
"vroid": {
"command": "uv",
"args": ["run", "--directory", "/path/to/mcp-vroid", "mcp-vroid"]
}
}
}客户端通常会在一个净化过的环境中启动服务器。这台服务器会在启动时从运行时目录恢复 XDG_RUNTIME_DIR、WAYLAND_DISPLAY、HYPRLAND_INSTANCE_SIGNATURE 与 DISPLAY(src/mcp_vroid/session_env.py),所以 hyprctl/grim/XTEST 仍然能用;vroid_status 会显示它补了哪些。环境里已有的变量优先。
可选环境变量:
变量 | 默认值 | 含义 |
|
| 写入截图的位置 |
|
| 导出/保存的默认目录 |
|
| 指针辅助程序路径 |
|
| 发送给客户端的图片(单边最大长度,0=不缩放) |
工具
生命周期
tool | what it does |
| 需要时通过 Steam 启动 VRoid,把它停到 Hyprland workspace 9 上,记住你所在的工作区,再聚焦并全屏它。 |
| 窗口是否存在/聚焦/标题/几何、当前工作区、截图目录,以及 |
| 切回用户原来所在的工作区。VRoid(设在 ws 9)继续运行。 |
查看
tool | what it does | |
| 捕获窗口(或整个输出,对 Wine 的保存窗口按作用),保存到 captures 目录,并作为 MCP 图像内容返回,容纳客户端模型查看。报告原生图像尺寸以及传输时应用的降采样 factor。 | |
| 新截图 + tesseract;返回匹配单词的框与中心点,单位为图像 px。请传 | |
`vroid_find_button(color='primary' | 'disabled', label?, region?)` | 根据颜色找到 VRoid 的:由 solid 单色 |
|
|
执行(原始输入)
tool | what it does |
| 把指针分几步滑过去(其次能触发 hover 状态),再点击。 |
| 按下 → 24 步滑动 → 松开。右键拖动旋转相机,中键拖动平移。 |
| 滚轮( X11 buttons 4/5,6/7 为横向)。先把指针放在要滚的那块面板上。 |
| 通过 XTEST 向聚焦的控件键入内容。 |
| 如 |
执行(流程)
tool | what it does |
| 起始屏 → Create New → 基体 → 编辑器。 |
| Face / Hairstyle / Body / Outfit / Accessories / Look。 |
| 将 Parameters 面板滚动到对应行,然后在参数框输入精确值。 |
| 同上,针对 |
| 完整的 Export-as-VRM 流程,包括 VRM Settings 元数据模态框和 Wine 保存对话框。 |
| 带名字的用 Ctrl+Shift+S 存到显式 |
每个 acting 工具都会先在那之前聚焦 VRoid,若当前聚焦窗口不是 VRoid Studio 时拒绝被执行。
如何使用
大多数是:截图 → 查看 → 定位 → 点击/输入 → 再截图。
vroid_launch()vroid_screenshot(),并等待图片vroid_find_text("Export")(或vroid_find_button())获取坐标vroid_click(x, y)—— 始终从新的截图里获取坐标vroid_screenshot()确认实际发生
从最初的 spike 得来的重要规则:
读整个画面,而不是局部裁剪。 一个“Close Hairstyle Editor”的确认型弹窗正戳在屏幕中央,却导致六次点击失败,因为当时只对顶部 60 px 做了 OCR 检查。
不要通过 3D 视图判断变化。 VRoid 每帧都会做抖动(dithering),因此即使无事发生,全窗口 diff 也是 0.98 左右。要看一段 UI 条。
优先选择数值框,而不是拖敲滑块。
vroid_set_slider会输入精确值,拖拽留给我们没有数值框的控件。主导按钮是按颜色而不是文字查找。 如果你预期是蓝色胶囊却看到灰色胶囊,那是应用在告诉你某必填字段为空。
一个完整 2560×1440 帧先用 OCR 大约需要 10 秒。合并起来传
region。
坐标空间
实行有三个空间,参数各不相同:
空间 | 参考机型上的尺寸 | 由谁使用 |
Hyprland layout(逻辑层) | 2048 × 1152 |
|
截图的 image pixels | 2560 × 1440 | tesseract、cv2、你见到的所有内容 |
X11 像素(Xwayland) | 2560 × 1440 | XTEST |
工具默认接收并返回 image px(space="image"),并在内部自动换算坐标,所以你可以把 vroid_find_text 直接输出给 vroid_click。如果 MCP_VROID_MAX_IMAGE_PX 降采样了你看到的图片,请将你读到的坐标乘以给出的 downscale 因子的倒数——或者直接调用 vroid_find_text,它始终返回原生 px。
UI 地图(VRoid Studio 2.14.0,英文版)
坐标都是2560×1440 全屏窗口截图的 image px。把它们当作提示即可,工具会优先用 OCR 定位。
开始屏幕 — Create New + 卡片位于约 (118, 218),说明文字位于 (118, 328);右上角 New / Open 位于 (2439, 99) / (2495, 100);下方为 Sample Models 网格。点击 Create New 会打开一个模态框,文字为 "Select a base to start with",其中 Fem (1199, 862) 与 Masc (1359, 862) 是说明标签——应点击说明文字上方约 100 像素处的缩略图。
编辑器 — 标签栏位于 y ≈ 23:Face 97 · Hairstyle 198 · Body 302 ·
Outfit 392 · Accessories 509 · Look 622。汉堡菜单 ☰ 位于 (29, 23) →
Save (Ctrl+S)、Save As… (Ctrl+Shift+S)、导入/批量导出、撤销/重做、返回
模型选择界面——Escape 不会关闭此菜单,需点击其他位置。右上角工具栏:相机 (2415, 23),分享/导出 (2464, 23),竖向菜单 ⋮
(2512, 23)。左侧图标条(x ≈ 24,第一个图标 y ≈ 77,之后每个间隔约 48 像素)=
当前标签页的子分类。左侧面板 = 预设网格,Presets/Custom 位于 y ≈ 120。右侧面板 = Customize,然后是 Parameters。
右侧面板控件
控件 | 驱动方式 |
滑块 | 使用 x ≈ 2505 处的数字输入框(对应 |
颜色 | 使用 x ≈ 2450 处的 |
复选框 / 单选按钮 | 直接点击小方块/圆圈 |
折叠面板 (accordion) | 点击标题(例如 |
下拉框 | 仅在原生 Wine 对话框中出现;先点击,再用方向键操作 |
Body 参数从 Model's Height : 161.2 cm 开始,然后是 Fem Height、
Masc Height、Body Size、Head Size、Head Width、Head Tip (Y)、
Neck Length/Thickness/Width、Soften Collarbone,……Face 参数包括:
Eye 大小 X/Y,Eye Position (X/Y)、Rotate Eye Socket、Inner/Outer Eye Slant、Iris Size X/Y、Gaze (Y),……(共约 40行;工具会为你自动滚动。)
发型编辑 — Hairstyle 标签页 → 左侧图标栏的发型图标 → Custom 子标签页 →
+ Create New → 右侧出现 Edit Hairstyle。其中有:Add Freehand Hair Guides / Add Procedural Hair Guides、Hair Groups 列表,以及位于上方的
(330 / 365 / 398 / 432, 83) 的工具面板,撤销/重做在 (76, 23) / (133, 23)。退出前会提示:点击 ✕(23, 23)会弹出 Close Hairstyle Editor
对话框,其中有 Save as new item / Overwrite / Close without saving 三个选项。
导出为 VRM — 点击分享图标 (2462, 23) → 选择 Export as VRM → 进入全屏导出页面,可见蓝色 Export 胶囊按钮(约 (2412, 197)),然后再打开VRM Settings** 模态框(居中、可滚动,约 x 1000–1560 范围):其中包含 Export Format 的单选项 VRM 0.0/VRM 0.0,Avatar Name 字段为必填项,Version,以及 Creators 必填,版权/联系方式/参考资料,以及使用方式勾选框;Export 胶囊按钮在必填项填好前都会是灰色不可点击状态。接下来是 Wine 保存对话框(独立窗口,标题为 Export):其 File name: 输入框会自动获得焦点且文本已全选,所以直接输入 Windows 路径并回车触发默认按钮即可。Proton 前缀会把 Z:\ 映射为 /,因此 /home/nuri/x 对应 Z:\home\nuri\x。不要把 OCR 识别到的 Save 当作唯一线索:Save in: 标签也会匹配同一个关键词。
脆弱之处
整个定位都完全依赖 OCR。 字号较小、字距较大或浅底深字的标签容易被拆开或漏识别(例如
Export→E+xport)。图标完全无文字——这些 anchor 是按窗口尺寸硬编码的位置比例,pixiv 重新调整 UI 后就可能移动。固定锚点是按 2560×1440 分辨率、125% 缩放标定的。 如果换了别的显示器,可能需要重新量一次。
模态框可能出现在你搜索区域之外,并会悄悄吞掉点击。
时序问题。 选定基座后约 5 秒 3D 视口才出现;导出需要 5–30 秒(模型越重越久)。
Wine 对话框是一个独立的窗口,有完整的填充和几何设置,请对
vroid_screenshot(whole_screen=true)下手。语言。 这些前提都假设 UI 是英文。如果 VRoid 显示为日文,向上角骨、通过
⋮→ Settings → Language 改成英文。闲置屏保 可能在运行中随时抢占会话。保护逻辑拒绝在屏保窗口呼吸输入,并且在动手前只会关闭那一个窗口(只关那一个)。
安全注意
这个服务端会向真实桌面会话注入真实鼠标/键盘事件,并截取整个桌面的截图。 这就是它的核心目标,同时也正是风险所在:
截图可能包含屏幕上的任意可见内容——
whole_screen=true会全屏捕获,而且截图会明文(不加密)写到磁盘。按键会发往当前有焦点的窗口。驱动会跳过 VRoid Studio 以外的任何窗口,但即使被攻破或依赖提示不善,仍然可能点到 VRoid 内部任何位置。
vroid_launch(restart=true)会杀掉 VRoid Studio,未保存的工作会丢失。此处没有任何沙箱,也没有确认确认步骤。
请在有人的陪同下运行,在该会话中一直监视,不要让无人看管的 agent 长时间驱动它。完成后调用 vroid_release() 把桌面交还给你。
开发
uv run python scripts/smoke_test.py # start the server, list tools, call vroid_status
uv run python scripts/smoke_test.py --screenshot # + one passive capture if VRoid is open
uv run vroid-driver shot # the original driver CLI, still herevroid-driver(mcp_vroid.driver.cli)是原型阶段的命令行界面——其中包含 launch、shot、find、click、tab、slider、export、cam、apply-params 等命令,非常适合在没有 MCP 客户端参与的情况下做调试。
致谢与许可证
驱动代码(src/mcp_vroid/driver/、native/)起初是来自我自己的 arrakis 项目,后来打成 tools/vroid-driver 的独立 spike,在这里与 MCP server 包装后一并提供。
MIT —— 见 LICENSE。
Available Tools
18 toolsvroid_clickA
Click a point in the VRoid window with the real compositor cursor.
Refuses unless VRoid Studio is the focused window; it focuses the window itself first (workspace 9, fullscreen) and raises rather than clicking into somebody else's app.
The pointer glides to the target in a few steps so hover states fire, then clicks and settles ~0.35 s. Coordinates must come from a CURRENT capture - take a fresh vroid_screenshot or vroid_find_text right before clicking, because panels reflow and modals move.
Inputs: x (required), y (required), space, button, +1 more. Returns: object
vroid_current_screenA
Identify which VRoid screen is on top: start, editor, export_vrm, hair_editor, or unknown.
Cheap-ish (OCRs only the top strip, ~2 s) and worth calling whenever a flow tool fails - most failures are "you are not on the screen this tool expects". 'unknown' usually means a modal is up; screenshot the whole window and look.
Inputs: no named parameters. Returns: object
vroid_dragA
Press, glide and release - slider handles, the 3D camera, hair guides.
For Parameters sliders prefer vroid_set_slider, which types an exact value into the row's numeric box; dragging is only for controls that have no numeric box. The glide is 24 interpolated steps, which is what the app needs to register a drag rather than a click.
Inputs: x1 (required), x2 (required), y1 (required), y2 (required), +2 more. Returns: object
vroid_export_vrmA
Walk the entire Export-as-VRM flow and write a .vrm file.
Editor toolbar share icon -> 'Export as VRM' -> the blue Export pill -> the VRM Settings modal (fills Avatar Name and Creators, picks the export format, scrolls to the bottom and clicks Export) -> Wine's save dialog (types a Z:\ path and presses Return) -> waits for the file size to stop growing.
Must be started from the EDITOR screen with a model loaded. Takes 30 s to a few minutes depending on the model. Returns the written path and its size; raises with the path of a diagnostic screenshot if any step fails - read that screenshot before retrying, since a half-finished flow usually leaves a modal open that the next attempt will trip over.
Inputs: path (required), creator (required), avatar_name (required), timeout, +1 more. Returns: object
vroid_find_buttonA
Find VRoid's primary action buttons by their colour, not their text.
VRoid's confirm buttons ('Export', 'OK', 'Create') are solid #0096FA pills whose white labels tesseract regularly loses, so this matches the button chrome. Blobs come back biggest-first, in image px, ready for vroid_click.
A grey pill (color='disabled') where you expected a blue one means the
action is disabled - on the VRM Settings modal that means Avatar Name or
Creators is still empty.
Inputs: color, label, limit, region. Returns: object
vroid_find_textA
OCR the current VRoid window and return where query appears.
Takes its own fresh screenshot, so coordinates are current. Results are image px, ordered by OCR confidence, ready to pass straight to vroid_click (which defaults to space='image').
Known OCR weaknesses in this UI: small, letter-spaced or light-on-dark labels get split or dropped ('Export' -> 'E' + 'xport'), and white text on VRoid's blue primary buttons often disappears entirely - use vroid_find_button for those. Icons (toolbar, left rail) have no text at all; the README's UI map has their fractional positions.
If nothing is found, that is information: the screen may not be the one you think it is, or a modal is covering it. Take a screenshot and look.
Inputs: query (required), exact, limit, region. Returns: object
vroid_keyA
Press a key combination in the focused VRoid widget.
Useful ones: Return confirms a value box or a Wine dialog's default button; ctrl+s saves the project; ctrl+shift+s is Save As; ctrl+z/ctrl+y undo/redo in the editor.
Note Escape does NOT close VRoid's hamburger menu - click elsewhere to dismiss it.
Inputs: combo (required), times. Returns: object
vroid_launchA
Start VRoid Studio (Steam appid 1486350, Proton) and take control of it.
Idempotent: if the window already exists it is reused, not relaunched. Then the window is parked on Hyprland workspace 9, the workspace the user was on is remembered (vroid_release puts them back), and the window is focused and fullscreened so its geometry - and therefore every coordinate you will read off a screenshot - is stable.
Cold start over Proton takes 30-90 s; the call blocks until the window is up. It does NOT wait for the start screen to finish drawing, so take a vroid_screenshot and look before clicking anything.
Inputs: restart, timeout. Returns: object
vroid_new_characterA
From the start screen: Create New -> pick a base -> land in the editor.
Locates the 'Create New' tile by text (so it survives the Recently Edited grid growing), clicks the card above its caption, picks the base thumbnail, then waits up to a minute for the editor - the 3D viewport takes several seconds to appear after a base is chosen.
Inputs: base. Returns: object
vroid_open_tabA
Switch the editor to a top-level tab, located by OCR of the tab strip.
Only works on the editor screen (not the start screen, the export screen or the hair editor). Waits ~2 s for the panels to redraw and returns the path of a verification screenshot - take a vroid_screenshot if you want to see the result.
Inputs: name (required). Returns: object
vroid_releaseA
Hand the desktop back: switch to the workspace the user was on before.
Leaves VRoid running on workspace 9. Call this when you are done with a session, or before handing control back to the human.
Inputs: no named parameters. Returns: object
vroid_save_projectA
Save the .vroid project - plain Save, or Save As to an explicit path.
With name: presses Ctrl+Shift+S and drives Wine's save dialog the same
way the VRM export does, then waits for the file. Without name: opens
the hamburger menu and clicks Save, which overwrites the project's
existing file and opens the Wine dialog only if the project has never
been saved (in that case call this again WITH a name).
Worth doing before any risky experiment: nothing else in this server persists your work, and vroid_launch(restart=true) discards it.
Inputs: name, timeout. Returns: object
vroid_screenshotA
Screenshot VRoid and return the image, plus the path it was saved to.
LOOK at the returned image before you decide anything - this is the only way to see the app. Every capture is also written to the captures dir so it can be re-read later.
Coordinate space: the reported image_size is the native capture size
(2560x1440 on the reference machine) and that is the space every other
tool means by space="image". The transported image may be downscaled
(downscale in the text block says by how much); if you read a coordinate
off the picture by eye, divide it by that factor before clicking. Better:
get coordinates from vroid_find_text / vroid_find_button, which always
report native image px.
Gotchas carried over from the driver: capture the WHOLE window, not a crop, when checking "did that work" - modals appear in the middle of the screen and a top-strip-only check will miss them. And do not judge change by the 3D viewport, which dithers every frame; watch a UI strip instead.
Inputs: tag, region, whole_screen, full_resolution.
vroid_scrollA
Wheel-scroll a panel or zoom the 3D viewport.
Sent as X11 button 4/5 (6/7 horizontally): VRoid is an XWayland client and ignores Wayland virtual-pointer axis events, so this is the only wheel that works on it.
Long Parameters lists need this - a label that vroid_find_text cannot see is usually just below the fold. vroid_set_slider scrolls to its own row automatically, so you rarely need to do it by hand.
Inputs: x, y, dx, dy, +1 more. Returns: object
vroid_set_colorA
Set a colour swatch by typing a hex code into its #RRGGBB box.
Scrolls the right-hand panel to the labelled row, clicks the hex field just below the label, replaces its contents and presses Return. Same caveat as sliders: the row must belong to the currently open tab and sub-category (left icon rail).
Inputs: hex (required), label (required). Returns: object
vroid_set_sliderA
Set a Parameters slider exactly, by typing into its numeric box.
Scrolls the right-hand panel from the top until the labelled row is visible (so it works for parameters below the fold), clicks the numeric box at the end of that row, clears it, types the value and presses Return.
This is far more reliable than dragging the handle - use vroid_drag only for controls with no numeric box. Open the right tab first (vroid_open_tab): each tab has its own parameter list.
Inputs: label (required), value (required). Returns: object
vroid_statusA
Report whether VRoid Studio is running, focused, and where it sits.
Cheap and side-effect free (no OCR, no input) - use it before anything
else, and after anything that might have lost focus. focused false means
every acting tool will refuse until vroid_launch (or any acting tool's own
focus step) takes the window back.
Also reports whether the external helpers this server needs are present: the vpointer binary (built by native/build.sh), grim, tesseract, hyprctl.
Inputs: no named parameters. Returns: object
vroid_typeA
Type into whatever widget currently has keyboard focus.
Click the field first (vroid_click) - this tool has no idea where the caret is. Keystrokes go through X11 XTEST because the Wayland virtual keyboard is mis-read by this Proton client (a whole string arrives as a single character).
Always screenshot afterwards to confirm the text landed in the field you meant: VRoid's forms have several boxes with near-identical captions, and typing into the wrong one leaves the primary button greyed out with no other symptom.
Inputs: text (required), clear_first. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
Each tool addresses a distinct capability: launching, screen identification, OCR, clicking, typing, saving, exporting, etc. Even the 'seeing' tools (screenshot, find_text, find_button) have clearly separated purposes: one captures, one finds text, one finds buttons. The interaction primitives (click, drag, scroll, type, key) are mutually exclusive and well-defined. No two tools could be confused for the same action.
All tools share the 'vroid_' prefix and mostly follow a verb_noun pattern (open_tab, export_vrm, set_slider), but a few are single verbs or nouns (status, release, screenshot, click, type). The naming is predictable and readable, with only minor deviations like 'status' and 'release' being not strictly verb_noun. Overall consistent enough for an agent to infer actions.
18 tools is on the higher side but justified for a GUI automation server that needs primitives for every interaction type plus higher-level workflows like export and save. The count feels well-scoped for the domain—each tool earns its place since there's no redundant functionality. Slightly heavy but still reasonable.
The surface covers the full lifecycle: launch, status, screen detection, navigation (open_tab, scroll), interaction (click, drag, type, key, sliders, colors), inspection (screenshot, OCR), persistence (save_project), export (export_vrm), and creation (new_character). No obvious gaps—even edge cases like disabled buttons and modal detection are addressed. The server appears fully equipped for its stated purpose of automating VRoid Studio.
Related MCP Connectors
Build textured 3D models from studio uploads or written descriptions over an OAuth MCP connection.
1Remote desktop MCP: let AI see, click, type and run terminal commands on your own Windows or Mac.
Build editable 3D scenes, direct characters and cameras, and export AI video references with MCP.
- VULKDeprecatedio.github.devjoaocastro
Generate, edit, and deploy immersive 3D/WebGL web projects from any MCP assistant.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to show, animate, and control a VRM character on the desktop, including posing and motion installation via MCP tools.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to control a desktop virtual character (VRM) by playing animations, showing/hiding the character, and checking runtime status through the MCP protocol.2MIT
- AlicenseNot gradedqualityCmaintenanceEnables controlling VRoid Studio through desktop GUI automation, letting an MCP client launch the app, capture its window, locate controls via OCR, edit character parameters, and run save/export flows on macOS and Linux/Hyprland.MIT
- AlicenseNot gradedqualityCmaintenanceA local MCP server that drives one disposable copy of VRoid Studio through the application's own managed API, exposing 86 tools for character parameters, textures, bounded makeup editing, hair authoring, Dress-up outfit assembly, and VRM export without mouse automation, OCR, or screen scraping. It also verifies installations into an isolated lab directory and guards the copy against writes outside that lab.11MIT