Roblox Studio Rust MCP Server

repository·main·Indexed 19 days ago

https://github.com/roblox/studio-rust-mcp-server

A reference implementation of a Model Context Protocol (MCP) server that enables AI clients like Claude Desktop and Cursor to interact with Roblox Studio via a plugin. It allows LLMs to run code, insert models, manage Studio sessions, and retrieve console output through tools such as run_code, insert_model, and get_studio_mode.

Tokens
2.3K
Snippets
6
Records
16
Agent score
66%

What's inside roblox-studio-rust-mcp-server

  1. How the Roblox Studio MCP Server works

    main

    This server acts as a bridge between an LLM (via an MCP Client like Claude Desktop or Cursor) and Roblox Studio. It uses two main components:

    • Axum Web Server: A server that the Roblox Studio plugin long-polls to receive requests.
    • rmcp Server: A server that communicates with the LLM via stdio transport.

    Workflow: When an LLM requests to run a tool, the request is sent through the long-polling mechanism to the Studio plugin. The plugin executes the command in Studio and posts the response back to the LLM.

  2. Build the MCP Server from source

    main

    To build and install the implementation manually using Rust:

    1. Ensure Roblox Studio and Claude Desktop are installed and have been opened at least once.
    2. Exit Claude and Roblox Studio.
    3. Install Rust.
    4. Clone or download this repository.
    5. Run the following command from the root directory:
    cargo run

    This command builds the Rust app, configures Claude communication, and installs the Studio plugin.

    cargo run
  3. Configure the MCP Server manually

    main

    If you prefer not to use the automatic installer, you can manually add the server to your MCP client configuration.

    Claude Desktop

    Edit your claude_desktop_config.json (found via Settings > Developer > Edit Config) to include the following:

    {
      "mcpServers": {
        "Roblox_Studio": {
          "args": [
            "--stdio"
          ],
          "command": "Path-to-downloaded\\rbx-studio-mcp.exe"
        }
      }
    }

    Note: On macOS, the command path might look like "/Applications/RobloxStudioMCP.app/Contents/MacOS/rbx-studio-mcp" if moved to the Applications directory.

    Claude Code

    Use the following command to add the server:

    claude mcp add --transport stdio Roblox_Studio -- '/Applications/RobloxStudioMCP.app/Contents/MacOS/rbx-studio-mcp' --stdio
    {
      "mcpServers": {
        "Roblox_Studio": {
          "args": [
            "--stdio"
          ],
          "command": "Path-to-downloaded\\rbx-studio-mcp.exe"
        }
      }
    }
  4. Install with release binaries

    main

    The installer automatically configures Claude Desktop and Cursor if they are installed.

    1. Ensure Roblox Studio and your MCP Client (Claude/Cursor) are installed and have been opened at least once.
    2. Exit all running instances of MCP Clients and Roblox Studio.
    3. Download the latest release for your platform from the releases page.
    4. Unzip and run the installer.
    5. Restart Claude/Cursor and Roblox Studio.
  5. How to manage Roblox Studio play modes

    main

    When interacting with Roblox Studio via MCP, you must be aware of the current studio mode. It is recommended to use get_studio_mode to infer the current state before executing commands.

    Best Practices for Play Modes

    1. Prefer start_stop_play over run_script_in_play_mode: Use start_stop_play for general session management. Only use run_script_in_play_mode when you need to run a one-time unit test on the server datamodel.
    2. Handling Session Conflicts: If run_script_in_play_mode fails with a message indicating a previous session is still active, call start_stop_play with the stop mode first to clear the state.
    3. Mode Selection: When using start_stop_play, the mode parameter must be one of start_play, stop, or run_server.
  6. Configure MCP clients (Claude, Cursor, Antigravity)

    main

    The Roblox Studio MCP server can be integrated into various MCP-compatible clients by adding the server to their respective configuration files. The server uses the stdio transport mechanism.

    Supported Clients and Config Paths

    • Claude Desktop
      • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
      • Windows: %APPDATA%\Claude\claude_desktop_config.json or within Windows App Packages if using the Microsoft Store version.
    • Cursor
      • macOS/Linux/Windows: ~/.cursor/mcp.json
    • Antigravity
      • macOS/Linux/Windows: ~/.gemini/antigravity/mcp_config.json

    Configuration Schema

    When adding the server, it should be placed under the mcpServers key in the client's configuration file using the identifier Roblox_Studio:

    {
      "mcpServers": {
        "Roblox_Studio": {
          "command": "<PATH_TO_SERVER_EXECUTABLE>",
          "args": [
            "--stdio"
          ]
        }
      }
    }
    {
      "mcpServers": {
        "Roblox_Studio": {
          "command": "/path/to/roblox-studio-mcp-server",
          "args": [
            "--stdio"
          ]
        }
      }
    }
  7. Add MCP to Claude Code CLI

    main

    To add the Roblox Studio MCP server to the Claude Code CLI, use the claude mcp add command. You must provide the path to the server executable and specify the stdio transport.

    Run the following command, replacing <EXE_PATH> with the actual path to your server binary:

    claude mcp add --transport stdio Roblox_Studio -- '<EXE_PATH>' --stdio
    claude mcp add --transport stdio Roblox_Studio -- '/path/to/executable' --stdio
  8. Verify your MCP setup

    main

    Follow these steps to ensure the connection is working:

    1. Check Roblox Studio: Go to the Plugins tab. Verify the MCP plugin appears. Clicking the icon toggles communication. Check the Studio console for: The MCP Studio plugin is ready for prompts.
    2. Check Claude Desktop: Click the hammer icon for MCP tools beneath the prompt text field. You should see a list of available tools (e.g., insert_model, run_code).

    Troubleshooting: If it fails, try restarting both Studio and Claude Desktop. Ensure Claude is fully exited from the system tray.

  9. Available Roblox Studio MCP Tools

    main

    The following tools are exposed to the LLM to interact with your Roblox Studio session:

    • run_code: Runs a command in Roblox Studio and returns the printed output. Can be used to make changes or retrieve information.
    • insert_model: Inserts a model from the Roblox Creator Store into the workspace. Returns the inserted model name.
    • get_console_output: Gets the console output from Roblox Studio.
    • start_stop_play: Starts or stops play mode or runs the server.
    • run_script_in_play_mode: Runs a script in play mode and automatically stops play after the script finishes or times out. Returns structured output including logs, errors, and duration.
    • get_studio_mode: Gets the current Studio mode (start_play, run_server, or stop).