Roblox Studio MCP
一个用于控制 Roblox Studio 的 MCP (Model Context Protocol) 服务。
安装
pip install roblox-studio-physical-operation-mcp
配置 MCP
Claude Desktop
编辑 %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"roblox-studio": {
"command": "python",
"args": ["-m", "roblox_studio_physical_operation_mcp"]
}
}
}
Droid
编辑 ~/.factory/mcp.json:
{
"mcpServers": {
"roblox-studio": {
"type": "stdio",
"command": "python",
"args": ["-m", "roblox_studio_physical_operation_mcp"]
}
}
}
注意:Windows Store 版 Python 可能需要使用完整路径:
"command": "C:\\Users\\<用户名>\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\\python.exe"
从源码安装
git clone https://github.com/white-dragon-tools/roblox-studio-physical-operation-mcp.git
cd roblox-studio-physical-operation-mcp
pip install -r requirements.txt
python -m roblox_studio_physical_operation_mcp
AI 使用指南
⚠️ 重要:获取 place_path 或 place_id
不知道 place_path 或 place_id 时,必须先调用 studio_list() 获取!
# 先获取当前运行的 Studio 实例
instances = studio_list()
# 返回示例:
# [{"pid": 12345, "type": "local", "place_path": "D:/game.rbxl"},
# {"pid": 67890, "type": "cloud", "place_id": 110155533210141}]
# 然后用返回的 place_path 或 place_id 操作
logs_get(place_path=instances[0]["place_path"])
推荐工作流程
调试已打开的 Studio
1. studio_list() # 获取运行中的 Studio 实例
2. studio_query(place_path) # 查询状态
3. modal_close(place_path) # 如果有模态弹窗,关闭它们
4. game_start(place_path) # 开始游戏
5. logs_get(place_path) # 获取日志
6. game_stop(place_path) # 停止游戏
打开新的 Studio
1. studio_open(place_path) # 打开 Studio(本地文件)
2. studio_query(place_path) # 查询状态
3. modal_close(place_path) # 如果有模态弹窗,关闭它们
4. studio_query(place_path) # 确认 ready=true
5. game_start(place_path) # 开始游戏
6. logs_get(place_path) # 获取日志
7. game_stop(place_path) # 停止游戏
8. studio_close(place_path) # 关闭 Studio
支持两种 Place 类型
所有工具都支持两种参数(二选一):
place_path- 本地 .rbxl 文件路径place_id- 云端 Roblox Place ID
# 本地文件
logs_get(place_path="D:/game.rbxl")
# 云端 Place(从网页打开的)
logs_get(place_id=110155533210141)
studio_query 返回值说明
{
"active": true, // Studio 是否运行中
"ready": true, // 是否就绪(无模态弹窗)
"pid": 12345, // 进程 ID
"hwnd": 67890, // 主窗口句柄
"has_modal": false, // 是否有模态弹窗
"modal_count": 0, // 模态弹窗数量
"modals": [] // 模态弹窗详情
}
重要: ready=true 时才能正常操作 Studio。
工具列表
系统工具
| 工具 | 说明 |
|---|---|
studio_help() |
获取使用指南 |
studio_list() |
列出所有运行中的 Studio 实例 |
studio_open(place_path) |
打开 Studio 并加载 .rbxl 文件 |
studio_close(place_path/place_id) |
关闭 Studio |
studio_status(place_path/place_id) |
获取基本状态 |
studio_query(place_path/place_id) |
综合查询状态(推荐) |
模态弹窗
| 工具 | 说明 |
|---|---|
modal_detect(place_path/place_id) |
检测模态弹窗 |
modal_close(place_path/place_id) |
关闭所有模态弹窗 |
游戏控制
| 工具 | 说明 |
|---|---|
game_start(place_path/place_id) |
开始游戏 (F5) |
game_stop(place_path/place_id) |
停止游戏 (Shift+F5) |
game_pause(place_path/place_id) |
暂停/恢复游戏 (F12) |
工具栏状态检测
| 工具 | 说明 |
|---|---|
toolbar_state(place_path/place_id) |
检测工具栏按钮状态和游戏状态 |
toolbar_state_debug(place_path/place_id) |
带调试信息的检测 |
返回示例:
{
"play": "enabled",
"pause": "disabled",
"stop": "disabled",
"game_state": "stopped"
}
game_state 可能的值:stopped, running, paused
日志
| 工具 | 说明 |
|---|---|
logs_get(place_path/place_id, after_line, before_line, timestamps) |
获取日志 |
logs_search(place_path/place_id, pattern, after_line, before_line, timestamps) |
搜索日志(正则) |
logs_clean(days) |
清理旧日志 |
logs_get 参数:
logs_get(
place_path: str = None, # 本地文件路径
place_id: int = None, # 云端 Place ID(二选一)
after_line: int = None, # 从哪一行之后开始读取
before_line: int = None, # 到哪一行之前结束
timestamps: bool = False # 是否附加时间戳 [HH:MM:SS]
)
logs_get 返回:
{
"logs": "[15:22:01] Hello world!\nThe MCP plugin is ready.",
"start_line": 100,
"last_line": 2330,
"remaining": 0,
"has_more": false
}
续读日志:
# 首次获取
result = logs_get(place_path="D:/game.rbxl")
# 续读新日志
result = logs_get(place_path="D:/game.rbxl", after_line=result["last_line"])
截图
| 工具 | 说明 |
|---|---|
screenshot(place_path/place_id) |
截取主窗口 |
screenshot_full(place_path/place_id) |
截取窗口(包含模态弹窗) |
注意事项
- 支持本地和云端 Place - 使用
place_path或place_id参数 - 启动后务必查询状态 - 调用
studio_query检查是否有模态弹窗 - 处理模态弹窗 -
ready=false时调用modal_close关闭弹窗 - 最小化窗口自动恢复 - 检测工具栏状态时会自动恢复最小化的窗口
- 自动清理 - 关闭本地文件的 Studio 后会自动清理 .lock 文件
- 日志过滤 -
logs_get自动过滤 Studio 内部日志,只返回用户脚本输出
技术说明
- 会话管理通过扫描进程命令行 + 日志文件自动匹配
- 日志索引缓存减少 IO 操作
- 游戏控制使用 SendInput API(需短暂切换窗口焦点)
- 截图使用 PrintWindow API(可捕获被遮挡窗口)
- 模态弹窗检测通过枚举同进程窗口实现
- 工具栏状态通过 OpenCV 模板匹配检测
- 支持多显示器环境
Metadata
Release files for roblox-studio-physical-operation-mcp 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| roblox_studio_physical_operation_mcp-0.2.1.tar.gz | 609.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| roblox_studio_physical_operation_mcp-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 644.9 kB
Release files / roblox_studio_physical_operation_mcp-0.2.1.tar.gz
| Download URL | roblox_studio_physical_operation_mcp-0.2.1.tar.gz |
|---|---|
| Size | 609.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e5fce319d83c957a12afe20ec00378201ec8d6736fbb7ba14656763b6d3869a
|
|
BLAKE2b-256 checksum How to use checksums |
bd28a26e79d78db156b78c752134efe236a9038e88414d6ba246e6049f51d5df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 6, 2026.
Transparency logRelease files / roblox_studio_physical_operation_mcp-0.2.1-py3-none-any.whl
| Download URL | roblox_studio_physical_operation_mcp-0.2.1-py3-none-any.whl |
|---|---|
| Size | 35.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20552ad052e1cbcf23c17eb70c4e1d497d12af47f44a8242c3dffd6785564e1a
|
|
BLAKE2b-256 checksum How to use checksums |
1106ee33f731c10413c3e913bb185766174f4d88af6c49f53ae1269656241537
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 6, 2026.
Transparency logSecurity for roblox-studio-physical-operation-mcp 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for roblox_studio_physical_operation_mcp-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.