
Roblox Mcp
- 50 installs
- 11 repo stars
- Updated August 3, 2026
- nonlooped/roblox-suite
Connect an AI coding tool to Roblox Studio via the Studio MCP server to read and write scripts, explore the data model, execute Luau, run playtests, and capture the viewport.
About
Documents the Roblox Studio MCP server that connects AI agents directly to Studio to read/write scripts, explore the data model, execute Luau, run playtests, capture the viewport, and control Studio. A developer uses it when wiring Cursor, VS Code, Claude, or Codex into Roblox Studio.
- Quick-connect vs JSON/CLI configuration for Cursor, VS Code, Claude, Codex
- Combines MCP with Script Sync for a file-based workflow
Roblox Mcp by the numbers
- 50 all-time installs (skills.sh)
- +14 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #7,298 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/nonlooped/roblox-suite --skill roblox-mcpAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 50 |
|---|---|
| repo stars | ★ 11 |
| Last updated | August 3, 2026 |
| Repository | nonlooped/roblox-suite ↗ |
What it does
Connect an AI coding tool to Roblox Studio via the Studio MCP server to read and write scripts, explore the data model, execute Luau, run playtests, and capture the viewport.
Files
roblox-mcp
Official sources (always check these for the latest):
- https://create.roblox.com/docs/en-us/studio/mcp
- https://create.roblox.com/docs/en-us/ai/build
- https://create.roblox.com/docs/en-us/scripting/sync
- https://modelcontextprotocol.io/docs/getting-started/intro
This skill is about the official Roblox Studio MCP server, not a third-party wrapper. Once connected, your AI client can drive an open Roblox Studio session: read and edit scripts, search the game tree, run Luau, insert assets, start playtests, simulate input, and capture the viewport.
When to use this skill
Activate when the user is:
- Setting up an AI coding tool (Cursor, VS Code + Claude Code, Claude Desktop, Codex CLI, etc.) to talk to Roblox Studio.
- Asking about the Roblox Studio MCP server, MCP tools, or the coding-harness workflow.
- Combining Script Sync with agent-driven Studio control.
- Troubleshooting why MCP tools are not showing up or not executing.
- Writing prompts or workflows that let an agent safely modify a place.
Cross-reference:
- roblox/SKILL.md for general Roblox architecture and specialized development skills.
- roblox-core/SKILL.md for services, script locations, and the data model.
What the Studio MCP server is
Roblox Studio implements a Model Context Protocol (MCP) server using stdio transport. The server runs as a local process on your machine and proxies requests from a supported AI client into the active Studio session. It is the bridge between your editor's agent and Studio: Script Sync handles disk-to-Studio file syncing, while MCP handles everything else (Explorer selection, instance inspection, script editing, Luau execution, play mode, input simulation, and asset insertion).
Prerequisites
1. Latest Roblox Studio — update through the launcher or download from the Creator Hub. 2. An MCP-capable AI client — Cursor, VS Code with Claude Code, Claude Desktop, Codex CLI, Gemini CLI, Antigravity, or any client that supports stdio transport. 3. A Roblox account signed into Studio. 4. Git (recommended) for the file-based workflow.
Enabling the server in Studio
1. Open Studio and load the place you want the agent to work on. 2. Open Assistant (button in the upper right). 3. Click ⋯ → Manage MCP Servers. 4. Turn on Enable Studio as MCP server. 5. The panel shows quick-connect options and manual configuration snippets. A green indicator appears when a client connects.
If you do not see MCP options, restart Studio after updating to the latest version.
Connecting your client
Choose the method that matches your client:
Quick connect — easiest. Supports Antigravity, Codex CLI, Claude Code, Claude Desktop, Cursor, Gemini CLI, and Visual Studio Code. 1. In Studio: Assistant → ⋯ → Manage MCP Servers → Quick connect. 2. Turn on your installed client. 3. Restart the client if the tools do not appear immediately.
JSON configuration — for clients that read an mcp.json or similar config file. See references/setup-and-connection.md for per-OS, copy-paste configurations.
CLI command — for clients that need a raw command. See references/setup-and-connection.md for Windows and macOS commands.
After connecting, verify with:
Use the Roblox MCP to read the current game tree in Roblox Studio. List what's in Workspace.
What you can do with the MCP tools
The server exposes tools in several categories. The full list, parameters, and example prompts are in references/tool-reference.md.
| Category | Examples |
|---|---|
| Scripts | script_read, multi_edit, script_search, script_grep |
| Data model | search_game_tree, inspect_instance, explore_subagent |
| Luau execution | execute_luau |
| Asset generation & insertion | generate_mesh, generate_material, generate_procedural_model, insert_from_creator_store |
| Playtesting | start_stop_play, console_output, screen_capture, playtest_subagent |
| Input simulation | character_navigation, keyboard_input, mouse_input |
| Session management | list_roblox_studios, set_active_studio |
MCP + Script Sync: the complete agent workflow
Script Sync maps folders on disk (ServerScriptService/, ReplicatedStorage/, StarterPlayerScripts/, etc.) to Studio services, so .luau files you edit locally appear in Studio automatically. MCP covers everything Script Sync cannot reach: editing StarterGui, inserting models, running commands, playtesting, and inspecting instances.
Typical agent loop: 1. Edit disk files through Script Sync for reusable modules and scripts. 2. Use MCP to inspect instances, run Luau snippets, start play mode, and capture output/screenshots. 3. Use MCP to edit scripts that live in containers not covered by Script Sync (for example, StarterGui).
See references/script-sync-integration.md for the full setup and a starter-project layout.
Multi-instance handling
You can connect one MCP client to multiple Studio windows. The server usually picks the right instance from context (for example, an object path that only exists in one place). To switch manually, use:
list_roblox_studios— show all connected Studio instances.set_active_studio— target a specific instance for subsequent calls.
Security and trust
MCP clients can read and modify your open places. Treat MCP connections like any privileged integration:
- Only connect clients you trust.
- Work on test places or version-controlled projects.
- Review agent edits before publishing.
- Keep
.rbxlxand other place files out of Git (use the starter.gitignore). - Disconnect or disable the MCP server when it is not in use.
- Treat
execute_luauas privileged code: it can publish places, write to DataStores, make HTTP requests, and access credentials loaded in Studio.
See references/security-and-troubleshooting.md for the full security checklist and troubleshooting steps.
Verification checklist
- [ ] Studio is updated and MCP is enabled.
- [ ] AI client shows the Roblox MCP tools after restart.
- [ ]
script_readorsearch_game_treereturns the current place structure. - [ ] Script Sync maps the expected service folders to disk (if using file-based workflow).
- [ ]
execute_luaucan run a simpleprintand return output. - [ ]
start_stop_playenters/exits play mode successfully.
Scripts
scripts/MCPReadyChecker.lua— a diagnostic snippet you can run withexecute_luauto verify Script Sync status and basic model health.scripts/StudioModelProbe.lua— a reusable utility for summarizing the game tree, useful as a pattern for agent exploration prompts.
How to proceed
1. Confirm prerequisites and enable MCP in Studio. 2. Connect your client using quick connect or the manual config in references/setup-and-connection.md. 3. Verify the connection with a simple tree-read or execute_luau call. 4. If using a file-based workflow, set up Script Sync per references/script-sync-integration.md. 5. Use the tool reference to craft precise agent prompts and the security guide to keep the workflow safe.
Script Sync Integration
Official guides:
- https://create.roblox.com/docs/en-us/scripting/sync
- https://create.roblox.com/docs/en-us/ai/build
What Script Sync does
Script Sync lets you edit Luau scripts on your local disk with any text editor or AI agent, then syncs those files into Roblox Studio automatically. It covers disk-to-Studio mapping for services such as:
ServerScriptService/ReplicatedStorage/StarterPlayerScripts/- Other eligible service folders
Files you create or edit in those mapped folders appear as scripts in the Explorer almost immediately.
Enable Script Sync
Script Sync is a beta feature.
1. In Studio: File → Beta Features. 2. Find Script Sync, enable it, and save. 3. Restart Studio when prompted.
Connect each service to a disk folder
1. In the Explorer, right-click a service (for example, ServerScriptService). 2. Choose Script Sync → Sync with Directory. (Older Studio builds labeled this Sync to.) 3. Browse to your project folder.
Important:
- Select the top-level project folder, not the individual service folders inside it.
- If your folders are named exactly
ServerScriptService,ReplicatedStorage, andStarterPlayerScripts, Script Sync matches them automatically.
File naming conventions
Script Sync uses the file extension to decide which Roblox script class to create. Use the exact suffixes below:
| File | Created instance | RunContext |
|---|---|---|
Name.server.luau | Script | Server |
Name.client.luau | Script | Client |
Name.local.luau | LocalScript | — |
Name.legacy.luau | Script | Legacy |
Name.plugin.luau | Script | Plugin |
Name.luau | ModuleScript | — |
init.server.luau, init.client.luau, init.local.luau, init.legacy.luau, init.plugin.luau, init.luau | Same as above, using the parent folder's name | Same as above |
Directory with no .luau file | Folder | — |
Common mistakes:
Test.shared.luaudoes not create aModuleScriptnamedTest. It creates an instance literally namedTest.shared. UseTest.luaufor aModuleScript.Test.client.luaucreates aScriptwithRunContext = Client, not aLocalScript. UseTest.local.luaufor aLocalScript.
Typical project layout
The official starter project (WaveSurvival.zip) uses this structure:
WaveSurvival/
├── .gitignore
├── WaveSurvival.rbxlx # excluded from Git by .gitignore
├── ServerScriptService/ # server logic
├── ReplicatedStorage/ # shared modules
└── StarterPlayerScripts/ # client scriptsUse .gitkeep files to preserve empty folders in Git until you add real scripts.
Where MCP fits in
Script Sync handles scripts that map to disk. MCP handles everything else:
| Task | Use |
|---|---|
Edit a .luau file in ServerScriptService/ | Script Sync |
Create a script inside StarterGui | MCP multi_edit |
Inspect a Part's properties | MCP inspect_instance |
| Insert a Creator Store model | MCP insert_from_creator_store |
| Run a quick test snippet | MCP execute_luau |
| Start play mode and check output | MCP start_stop_play + console_output |
| Capture a screenshot | MCP screen_capture |
End-to-end verification prompt
After both Script Sync and MCP are connected, ask your agent:
Use the Roblox MCP connection to verify Script Sync is working properly. CreateServerScriptService/Test.server.luau,ReplicatedStorage/Test.luau, andStarterPlayerScripts/Test.local.luauthat each print a distinct message, then rungame:GetService("InstanceFileSyncService"):GetStatus(instance)on each to confirm sync status. Start play mode, capture the output, and then delete the test scripts.
This confirms:
- MCP can create and edit scripts.
- Script Sync maps the expected folders.
execute_luauandconsole_outputwork.- Play mode starts and stops cleanly.
Script Sync warnings and limitations
- Attributes and tags are ignored. Script Sync does not preserve
Instance:SetAttribute()values orCollectionServicetags. Back up your place before syncing, or store that data outside synced scripts. - Back up your place first. Syncing can overwrite or delete instances if file names change or files are removed.
- Both Script Sync and the Studio MCP server are beta features. Behavior and menu names may change.
- Editing a synced script through MCP can cause conflicts. If Script Sync is active for a service, prefer editing the source file on disk. MCP edits may be overwritten on the next sync.
- Use caution with Team Create. Multiple authors, or an agent plus Script Sync, can overwrite each other's changes.
- Use the Luau LSP (for example, the
JohnnyMorganz.luau-lspVS Code extension) for diagnostics, autocomplete, and type-checking in the synced files.
Best practices
- Keep place files (
.rbxl,.rbxlx) out of Git; commit only source scripts and config. - Use Script Sync for long-lived code; use MCP for ad-hoc Studio operations.
- When an agent edits a script via MCP, verify the change in the Explorer or with
script_read. - Run playtests frequently when iterating with an agent.
Security and Troubleshooting
Security checklist
MCP clients have broad access to your open Studio session. Follow these rules:
- [ ] Only connect MCP clients you trust.
- [ ] Use test places or copies of live places for agent experimentation.
- [ ] Keep your project under version control so you can review and revert agent changes.
- [ ] Do not commit place files (
.rbxl,.rbxlx) or credentials to Git. - [ ] Avoid running untrusted
execute_luausnippets. Executed code can publish places, write to DataStores, make HTTP requests, access plugin-level APIs, read credentials loaded in Studio, and exfiltrate data. Run only in test places and review every snippet. - [ ] Review generated mesh/material/procedural model insertions before publishing.
- [ ] When working in a team, coordinate so only one agent session targets a given Studio instance at a time.
Trust model
The MCP server runs locally and communicates over stdio. Studio initiates the server; your AI client connects to it. While no credentials flow through the AI client directly, executed Luau runs with your signed-in Studio privileges and can access credentials stored in Studio, make network requests, and call Roblox web APIs.
Disconnecting or disabling the server when not in use
- In Studio: Assistant → ⋯ → Manage MCP Servers and turn off Enable Studio as MCP server.
- Disconnect or remove the
Roblox_Studioentry from your MCP client's configuration. - Close Studio windows you are not using.
This reduces the chance of accidental or unintended agent actions.
Common issues and fixes
MCP tools do not appear in the AI client
1. Restart the AI client completely (not just the chat panel). 2. Restart Roblox Studio. 3. Confirm Enable Studio as MCP server is turned on. 4. Check the config file path or quick-connect setting. 5. If using JSON config, validate JSON syntax (missing commas are the most common cause).
Quick connect does not list my client
- Install or update the client, then restart Studio.
- Some clients require a full machine restart of the client process to register.
execute_luau returns an error
- The code runs inside Studio, so it must be valid Luau in the current context.
- Remember the client/server boundary: code runs in Studio's edit context unless play mode is active.
- Check that instances referenced in the code exist.
Script Sync changes are not showing up
- Verify the service is synced to the correct top-level folder.
- Ensure file names end in
.luau. - Check that the beta feature is enabled and Studio was restarted.
- Use
game:GetService("InstanceFileSyncService"):GetStatus(instance)on the script to inspect sync state.
Play mode capture or input simulation fails
- Start play mode first with
start_stop_play. - Wait a moment for the play session to initialize before capturing or sending input.
- Some tools require the viewport to be in a valid state.
Multiple Studio instances are confusing the agent
- Use
list_roblox_studiosto see all open instances. - Use
set_active_studioto lock the target instance. - Close unused Studio windows when possible.
JSON syntax quick check
A valid mcpServers block has entries separated by commas:
{
"mcpServers": {
"Roblox_Studio": {
"command": "cmd.exe",
"args": ["/c", "%LOCALAPPDATA%\\Roblox\\mcp.bat"]
},
"Another_Server": {
"command": "..."
}
}
}Use an online JSON validator or your editor's JSON diagnostics if the config does not load.
Getting more help
- Official MCP connection guide: https://create.roblox.com/docs/en-us/studio/mcp
- Coding harness tutorial: https://create.roblox.com/docs/en-us/ai/build
- Script Sync docs: https://create.roblox.com/docs/en-us/scripting/sync
- MCP protocol overview: https://modelcontextprotocol.io/docs/getting-started/intro
Setup and Connection
Official guide: https://create.roblox.com/docs/en-us/studio/mcp
Quick connect
The fastest path. Studio detects supported clients installed on your machine.
Supported clients (as of the latest docs):
- Antigravity
- Codex CLI
- Claude Code
- Claude Desktop
- Cursor
- Gemini CLI
- Visual Studio Code
Steps: 1. In Studio: Assistant → ⋯ → Manage MCP Servers. 2. Make sure Enable Studio as MCP server is on. 3. Expand Quick connect. 4. Turn on the client you want to use. 5. Restart the AI client if its tool list does not update immediately.
If your client does not appear, install it and restart Studio.
JSON configuration
Most MCP clients read a JSON config file. Add the Roblox_Studio entry under mcpServers.
Windows
{
"mcpServers": {
"Roblox_Studio": {
"command": "cmd.exe",
"args": [
"/c",
"%LOCALAPPDATA%\\Roblox\\mcp.bat"
]
}
}
}macOS
{
"mcpServers": {
"Roblox_Studio": {
"command": "/Applications/RobloxStudio.app/Contents/MacOS/StudioMCP"
}
}
}Notes:
- If you already have other servers, add a comma after the previous entry and paste the
Roblox_Studioblock. - Validate JSON syntax. A missing comma or bracket prevents the config from loading.
- Paths assume the default install location. Adjust if you installed Studio elsewhere.
CLI command
Some clients accept a raw command instead of JSON.
Windows
cmd.exe /c %LOCALAPPDATA%\Roblox\mcp.batmacOS
/Applications/RobloxStudio.app/Contents/MacOS/StudioMCPClient-specific hints
Cursor
- Open Cursor Settings → MCP, or use the project's
.cursor/mcp.jsonfile. - Paste the JSON config or use quick connect if Cursor is detected by Studio.
Visual Studio Code + Claude Code
- Use VS Code's settings or the workspace's
.vscode/mcp.jsonfor the server config. - Install the Claude Code extension, sign in, and open the chat panel.
Claude Desktop
- Edit
claude_desktop_config.json(location varies by OS) and add theRoblox_Studioentry.
Codex CLI / Gemini CLI / Antigravity
- Follow the tool's own MCP config convention; the
command/argsvalues above are what matter.
Verify the connection
1. In Studio, open Assistant → ⋯ → Manage MCP Servers. 2. Look for the green indicator under Enable Studio as MCP server showing connected clients. 3. In your AI client, run:
Use the Roblox MCP to list what's in game.Workspace.You may need to approve the first request or add the tool to an allowlist, depending on the client.
If no tools appear:
- Restart both Studio and the AI client.
- Check that the command path exists on disk.
- Validate your JSON config.
MCP Tool Reference
Official source: https://create.roblox.com/docs/en-us/studio/mcp
This file describes each tool the Roblox Studio MCP server exposes, plus practical prompt patterns. All actions target the currently active Studio instance (use list_roblox_studios + set_active_studio to switch).
Scripts
script_read
Reads a script from the game using dot-notation paths such as game.ServerScriptService.MyScript.
Good for: quickly viewing source without leaving your editor.
Example prompt:
Usescript_readto show me the full contents ofgame.ServerScriptService.GameLogic.
To read a specific range:
Usescript_readongame.ReplicatedStorage.Configand return lines 10 through 30.
multi_edit
Applies multiple edits to a script in one call. If the target path does not exist, it creates a new script.
Good for: batch refactors, adding imports, or creating new scripts from a template.
Example prompt:
Usemulti_editongame.ServerScriptService.MyModuleto replaceprint("old")withprint("new")and addlocal RunService = game:GetService("RunService")at the top.
script_search
Fuzzy search for scripts by name. Returns up to 10 results.
Good for: finding a script when you only remember part of its name.
Example prompt:
Use script_search to find any script named something like "Inventory".script_grep
Searches for a string pattern across all scripts in the game. Returns up to 50 matches.
Good for: finding every usage of a function or deprecated API.
Example prompt:
Usescript_grepto find every occurrence ofHumanoid:LoadAnimation.
Data model exploration
explore_subagent
Spawns a parallel investigation of your place and returns a compact summary. Keeps the main conversation clean.
Good for: large places where a full tree dump would be overwhelming.
Example prompt:
Use explore_subagent to summarize the Workspace structure and highlight any scripts that look like they handle player input.search_game_tree
Explores the instance hierarchy as a flat JSON array. Supports filtering by path, instance type, and keywords.
Good for: targeted exploration — for example, "every Part under Workspace" or "every ModuleScript under ReplicatedStorage".
Example prompt:
Usesearch_game_treeto list allPartinstances undergame.Workspace.
inspect_instance
Returns detailed information about a specific instance: readable properties, custom attributes, and a summary of children/descendants.
Good for: debugging why something behaves a certain way or checking attributes.
Example prompt:
Useinspect_instanceongame.Workspace.SpawnLocationand tell me its properties and attributes.
Luau execution
execute_luau
Runs arbitrary Luau code inside Studio. Returns the result or an error.
Good for: quick tests, one-off fixes, inspecting runtime state, or triggering actions that do not have a dedicated tool.
Example prompt:
Useexecute_luauto runprint(game:GetService("Players").NumPlayers)and show me the output.
Security warning: execute_luau runs arbitrary Luau inside your signed-in Studio session. It can publish places, write to DataStores, make HTTP requests, access plugin-level APIs, read credentials loaded in Studio, and exfiltrate data. Only run code you have reviewed. Use a test place, and enable per-tool allowlists in your MCP client if available.
Asset and content generation
generate_mesh
Generates a textured 3D mesh.
Example prompt:
Usegenerate_meshto create a low-poly rock mesh and insert it undergame.Workspace.
generate_material
Generates a custom material or texture.
Example prompt:
Usegenerate_materialto generate a worn metal material and apply it togame.Workspace.Platform.
generate_procedural_model
Generates procedural models that scale and adapt automatically.
Example prompt:
Usegenerate_procedural_modelto generate a small procedural tree and place it atgame.Workspace.TreeSpawn.
insert_from_creator_store
Inserts assets, plugins, and models from the Creator Store.
Example prompt:
Useinsert_from_creator_storeto insert asset ID 123456789 as a model undergame.Workspace.
Playtesting
start_stop_play
Starts or stops playtesting.
Example prompt:
Use start_stop_play to start playtesting.console_output
Retrieves output logs while the game is running.
Example prompt:
Use console_output to fetch the last 50 lines of output from the running playtest.screen_capture
Captures the current Studio viewport in Play mode and returns image data.
Example prompt:
Use screen_capture to take a screenshot of the current playtest view.playtest_subagent
Spawns a test character that runs through gameplay scenarios.
Example prompt:
Useplaytest_subagentto spawn a character and walk togame.Workspace.Goal.
Player input simulation
character_navigation
Moves the player character to a position or instance.
Example prompt:
Use character_navigation to move the player to the position (0, 10, 0).keyboard_input
Simulates key presses, holds, and text input.
Example prompt:
Use keyboard_input to press the Space key once.mouse_input
Simulates mouse clicks, movement, and scrolling.
Example prompt:
Use mouse_input to click at the center of the screen.Session management
list_roblox_studios
Lists all connected Studio instances with name, ID, and active status.
Example prompt:
Use list_roblox_studios to show me all open Studio windows.set_active_studio
Sets the target Studio instance for subsequent tool calls.
Example prompt:
Use set_active_studio to target the instance named "WaveSurvival".Prompt-writing tips
- Be specific about instance paths (
game.ServerScriptService.MyScriptrather than "the server script"). - Prefer
multi_editfor batch changes instead of many single edits. - Use
explore_subagentorsearch_game_treebefore asking the agent to make broad changes. - Combine
execute_luauwithconsole_outputfor quick test-driven checks. - When playtesting, tell the agent to start play mode before capturing or simulating input.
--!strict
--[[
MCPReadyChecker.lua
Diagnostic utilities for verifying Roblox Studio MCP + Script Sync readiness.
Usage with MCP execute_luau:
local checker = require(game.ReplicatedStorage.MCPReadyChecker)
print(checker.getReport())
Or copy the functions into an execute_luau prompt for a quick one-off check.
]]
local HttpService = game:GetService("HttpService")
local MCPReadyChecker = {}
-- Summarize a service: script count, module count, sync status if available.
function MCPReadyChecker.summarizeService(service)
local syncStatus = "n/a"
local ok, syncService = pcall(function()
return game:GetService("InstanceFileSyncService")
end)
if ok and syncService and syncService.GetStatus then
local statusOk, status = pcall(function()
return syncService:GetStatus(service)
end)
if statusOk then
syncStatus = tostring(status)
end
end
local scriptCount = 0
local moduleCount = 0
for _, desc in ipairs(service:GetDescendants()) do
if desc:IsA("Script") or desc:IsA("LocalScript") then
scriptCount += 1
elseif desc:IsA("ModuleScript") then
moduleCount += 1
end
end
return {
name = service.Name,
className = service.ClassName,
syncStatus = syncStatus,
scriptCount = scriptCount,
moduleCount = moduleCount,
childCount = #service:GetChildren(),
}
end
-- Check key Studio services and whether they are present.
function MCPReadyChecker.checkServices()
local services = {
"Workspace",
"ServerScriptService",
"ReplicatedStorage",
"StarterGui",
"StarterPlayer",
"Lighting",
"Players",
}
local result = {}
for _, name in ipairs(services) do
local ok, service = pcall(function()
return game:GetService(name)
end)
result[name] = ok and {
present = true,
childCount = #service:GetChildren(),
} or {
present = false,
error = tostring(service),
}
end
return result
end
-- Build a full readiness report as a table.
function MCPReadyChecker.buildReport()
local starterPlayer = game:GetService("StarterPlayer")
local starterPlayerScripts = starterPlayer:FindFirstChild("StarterPlayerScripts")
local starterSummary
if starterPlayerScripts then
starterSummary = MCPReadyChecker.summarizeService(starterPlayerScripts)
else
starterSummary = { name = "StarterPlayerScripts", present = false }
end
local report = {
placeName = workspace.Name,
placeId = game.PlaceId,
gameId = game.GameId,
studioRuntime = "Roblox Studio",
services = MCPReadyChecker.checkServices(),
scriptSync = (function()
local ok, err = pcall(function()
return game:GetService("InstanceFileSyncService")
end)
if not ok then
warn("InstanceFileSyncService unavailable: " .. tostring(err))
return { available = false, error = tostring(err) }
end
return { available = true }
end)(),
keyServices = {
ServerScriptService = MCPReadyChecker.summarizeService(game:GetService("ServerScriptService")),
ReplicatedStorage = MCPReadyChecker.summarizeService(game:GetService("ReplicatedStorage")),
StarterPlayerScripts = starterSummary,
},
}
return report
end
-- Return the report as a pretty-printed JSON string for MCP output.
function MCPReadyChecker.getReport()
local report = MCPReadyChecker.buildReport()
local ok, encoded = pcall(function()
return HttpService:JSONEncode(report)
end)
if ok then
return encoded
else
warn("MCPReadyChecker JSON encoding failed: " .. tostring(encoded))
return "Error encoding report: " .. tostring(encoded)
end
end
return MCPReadyChecker
--!strict
--[[
StudioModelProbe.lua
A reusable utility for summarizing the Roblox data model.
Usage with MCP execute_luau:
local probe = require(game.ReplicatedStorage.StudioModelProbe)
print(probe.summarize(game.Workspace, { maxDepth = 2 }))
This is a pattern you can adapt when asking an agent to explore a large place.
]]
local HttpService = game:GetService("HttpService")
local StudioModelProbe = {}
local DEFAULT_OPTIONS = {
maxDepth = 2,
includeProperties = false,
propertyNames = { "Archivable", "Locked", "Enabled", "Visible", "Transparency", "Reflectance", "Value", "Text" },
includeAttributes = true,
maxChildren = 50,
}
-- Merge user options with defaults.
local function getOption(options, key)
if options[key] ~= nil then
return options[key]
end
return DEFAULT_OPTIONS[key]
end
local function mergeOptions(options)
options = options or {}
return {
maxDepth = getOption(options, "maxDepth"),
includeProperties = getOption(options, "includeProperties"),
propertyNames = getOption(options, "propertyNames"),
includeAttributes = getOption(options, "includeAttributes"),
maxChildren = getOption(options, "maxChildren"),
}
end
-- Recursively summarize an instance tree.
function StudioModelProbe.summarize(instance, options, currentDepth)
options = mergeOptions(options)
currentDepth = currentDepth or 0
local maxDepth = options.maxDepth or DEFAULT_OPTIONS.maxDepth
local maxChildren = options.maxChildren or DEFAULT_OPTIONS.maxChildren
local entry = {
name = instance.Name,
className = instance.ClassName,
path = instance:GetFullName(),
}
if options.includeAttributes then
local attributes = {}
for name, value in pairs(instance:GetAttributes()) do
local valueType = typeof(value)
if valueType == "string" or valueType == "number" or valueType == "boolean" or value == nil then
attributes[name] = value
else
attributes[name] = tostring(value)
end
end
if next(attributes) then
entry.attributes = attributes
end
end
if options.includeProperties then
local props = {
Parent = instance.Parent and instance.Parent.Name or nil,
}
for _, propName in ipairs(options.propertyNames or {}) do
local propOk, propValue = pcall(function()
return instance[propName]
end)
if propOk then
local valueType = typeof(propValue)
if valueType == "string" or valueType == "number" or valueType == "boolean" or propValue == nil then
props[propName] = propValue
elseif valueType ~= "Instance" then
props[propName] = tostring(propValue)
end
end
end
if next(props) then
entry.properties = props
end
end
if currentDepth < maxDepth then
local children = instance:GetChildren()
local childSummaries = {}
for i = 1, math.min(#children, maxChildren) do
table.insert(childSummaries, StudioModelProbe.summarize(children[i], options, currentDepth + 1))
end
entry.children = childSummaries
entry.childCount = #children
entry.truncated = #children > maxChildren
else
entry.childCount = #instance:GetChildren()
end
return entry
end
-- Summarize multiple top-level services at once.
function StudioModelProbe.summarizeServices(serviceNames, options)
serviceNames = serviceNames or {
"Workspace",
"ServerScriptService",
"ReplicatedStorage",
"StarterGui",
"StarterPack",
"Lighting",
}
local result = {
placeName = workspace.Name,
}
for _, name in ipairs(serviceNames) do
local ok, service = pcall(function()
return game:GetService(name)
end)
if ok then
result[name] = StudioModelProbe.summarize(service, options)
else
result[name] = { error = tostring(service) }
end
end
return result
end
-- Encode a summary as JSON for easy MCP consumption.
function StudioModelProbe.summarizeAsJson(instance, options)
local summary = StudioModelProbe.summarize(instance, options)
local ok, encoded = pcall(function()
return HttpService:JSONEncode(summary)
end)
if ok then
return encoded
end
warn("StudioModelProbe JSON encoding failed: " .. tostring(encoded))
return "Error encoding summary: " .. tostring(encoded)
end
-- Encode multiple service summaries as JSON.
function StudioModelProbe.summarizeServicesAsJson(serviceNames, options)
local summary = StudioModelProbe.summarizeServices(serviceNames, options)
local ok, encoded = pcall(function()
return HttpService:JSONEncode(summary)
end)
if ok then
return encoded
end
warn("StudioModelProbe JSON encoding failed: " .. tostring(encoded))
return "Error encoding summary: " .. tostring(encoded)
end
return StudioModelProbe