Overview
Roblox Studio MCP uses a dual-component architecture to bridge the gap between AI assistants and Roblox Studio’s sandboxed environment. Since AI assistants cannot directly access Studio’s APIs, the system uses an HTTP bridge to enable seamless communication.Key Insight: Roblox Studio’s security model prevents external applications from directly accessing its APIs. The MCP architecture works around this by using HTTP as a communication protocol.
Architecture Components
The system consists of three main components:1. MCP Server (Node.js/TypeScript)
Location: Runs on your local machine vianpx robloxstudio-mcp
Responsibilities:
- Exposes 37+ tools to AI assistants via stdio (MCP protocol)
- Manages the HTTP bridge on
localhost:3002 - Queues incoming requests from AI assistants
- Handles request/response lifecycle with 30-second timeouts
- Provides HTTP API endpoints for all tools
dist/index.js- Main MCP server entry pointdist/http-server.js- HTTP bridge implementationdist/bridge-service.js- Request queue managerdist/tools/- 37+ tool implementations
2. HTTP Bridge (localhost:3002)
Purpose: Communication layer between MCP server and Studio plugin Key Endpoints:| Endpoint | Method | Purpose |
|---|---|---|
/health | GET | Server health check |
/poll | GET | Long-polling for pending requests (25s hold) |
/response | POST | Plugin submits results |
/ready | POST | Plugin connection notification |
/status | GET | Connection status |
/mcp/* | POST | Direct HTTP access to all tools |
- Long polling: Holds connections up to 25 seconds for instant response
- Request queuing: UUID-based request tracking
- Connection monitoring: Tracks plugin and MCP server activity
- CORS enabled: Allows cross-origin requests
- 50MB request limit: Supports large payloads (scripts, trees)
3. Studio Plugin (Luau)
Location:%LOCALAPPDATA%/Roblox/Plugins/MCPPlugin.rbxmx
Responsibilities:
- Polls HTTP bridge via long-polling (instant response)
- Executes Roblox Studio API calls
- Returns results to HTTP bridge
- Provides visual status indicators
- Logs activity with copy/export functionality
- Modern UI with connection status visualization
- Activity logger with 200-entry buffer
- Exponential backoff for connection failures
- Client disconnect handling with request unclaiming
- Step-by-step connection status display
Communication Flow
Component Interaction
MCP Server → HTTP Bridge
- Queues requests with UUID
- 30-second timeout per request
- Tracks MCP server activity
- Resolves/rejects promises
HTTP Bridge → Studio Plugin
- Long-polling with 25s hold time
- JSON request/response format
- Connection status tracking
- Request claiming mechanism
Studio Plugin → Roblox APIs
- Direct API access via Luau
- Service access (Workspace, etc.)
- Instance manipulation
- Script source reading/writing
AI Assistant → MCP Server
- stdio communication (MCP protocol)
- 37+ specialized tools
- Structured responses
- Error handling
Data Flow Example
Here’s what happens when an AI assistant callsget_file_tree:
MCP server queues request
Server generates UUID, creates HTTP request object, stores in
BridgeService.pendingRequests MapPlugin polls and receives
Plugin’s active
/poll request immediately receives the pending work with UUIDPlugin executes Roblox APIs
Plugin recursively walks
game hierarchy using GetChildren(), builds tree structureWhy This Architecture?
Why not direct API access?
Why not direct API access?
Roblox Studio runs in a sandboxed environment and doesn’t expose APIs to external applications. The plugin running inside Studio is the only way to access these APIs.
Why HTTP instead of stdio?
Why HTTP instead of stdio?
Studio plugins can only communicate via HTTP requests. The plugin uses
HttpService:RequestAsync() to talk to the bridge.Why long polling instead of WebSockets?
Why long polling instead of WebSockets?
Roblox’s
HttpService only supports HTTP requests, not WebSocket connections. Long polling (25s holds) provides near-instant response while staying within Studio’s API constraints.Why 30-second timeouts?
Why 30-second timeouts?
Balances responsiveness with complex operations. Large projects with thousands of instances can take time to traverse. The timeout prevents infinite hangs while allowing substantial work.
Performance Considerations
Optimization Strategies
- Request Queuing: FIFO queue with UUID tracking prevents request duplication
- Long Polling: Eliminates wasteful 500ms interval polling (v1.x)
- Connection Reuse: HTTP keep-alive reduces connection overhead
- Payload Limits: 50MB limit supports large script content and deep trees
- Exponential Backoff: Failed connections retry with increasing delays (1.2x multiplier, max 5s)
Security Model
Local-Only
All communication happens on
localhost. No external servers involved.HTTP Required
Plugin requires “Allow HTTP Requests” enabled in Game Settings → Security.
No Authentication
Assumes trusted local environment. Anyone with localhost access can use the bridge.
Read/Write Access
Plugin has full Studio API access - can modify instances, scripts, and properties.
Configuration
The architecture supports customization via environment variables and plugin settings:Next Steps
Communication Protocol
Deep dive into request/response flow, long polling, and error handling
Plugin System
Learn how the Studio plugin polls, executes, and logs activities