# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Commands
- **Build**: `npm run build` - Compiles TypeScript to JavaScript in `dist/`
- **Start**: `npm start` - Runs the compiled MCP server (`dist/index.js`)
- **Test**: No test suite is currently configured.
- **Install Dependencies**: `npm install`
## Architecture
This project implements a **Model Context Protocol (MCP)** server that bridges an LLM with a running **Roblox** instance via WebSockets.
1. **MCP Server (`src/`)**: Node.js server that implements MCP tools.
2. **WebSocket Bridge (`src/bridge.ts`)**: The MCP server hosts a WebSocket server (default port 3000).
3. **Roblox Client (`roblox/Bridge.lua`)**: A Luau script running inside Roblox (via executor or plugin) that connects to the WebSocket bridge to receive and execute commands.
## Code Structure
- **`src/`**: TypeScript source code
- **`index.ts`**: Entry point. Defines MCP tools (`list_children`, `get_properties`, `read_script`, `run_script`).
- **`bridge.ts`**: `BridgeManager` class handling WebSocket connections and message routing.
- **`types.ts`**: Zod schemas and TypeScript interfaces for protocol messages.
- **`roblox/`**: Lua source code
- **`Bridge.lua`**: Client-side script handling WebSocket communication and Roblox API calls.
- **`dist/`**: Compiled output directory (ignored in git).
## Style & Conventions
- **TypeScript**:
- Use ES Modules (`import`/`export`).
- Use `zod` for runtime validation of MCP tool arguments.
- Async/await for asynchronous operations.
- **Lua (Luau)**:
- Standard Roblox Luau syntax.
- Uses `WebSocket` services (requires specific Roblox environment permissions).