docs
Set up penui in your AI client
penui is an MCP server with a library of Roblox UI pieces. Your AI client searches the library, previews a layout, and generates one Luau ScreenGui script that you run in Roblox Studio. It needs Node 20+ and runs over stdio.
You also need the Roblox Studio MCP in the same client. See MCP UI tools for the tool reference.
- stdio · node 20+
- 33 MCP tools
- 2,576+ UI units
how it works
What the server does
Instead of inventing coordinates and gradients, the agent picks existing pieces from the library (extracted from Figma), checks the layout with preview_units, and compiles it with compose_units or compose_screen. The result runs in Studio through execute_luau.
Each piece carries its size, 9-slice insets, text layers, palette tokens and parent offsets. There are two levels:
Pre-split layered pieces (full.png, notext.png, parts/*.png): a button, a currency bar, a card, an icon.
Assembled from atomics with children, offsetInParent and repeatPositions: headers, grids, tiles and full reference screens.
step 1
Install & connect
Install Node.js 20+ and an MCP client on Windows, macOS or Linux. The npm package includes the four Starter packs. Access to the packs in your plan requires your penui API key.
$ npx -y penui-mcp setup --client cursor
Replace cursor with your client name, then restart or reload that client. Run npx -y penui-mcp setup --list to see supported clients. If Windows PowerShell blocks npx.ps1, run the command with npx.cmd.
--client accepts claude-code, claude-desktop, cursor, windsurf, vscode, vscode-workspace, zed, gemini, codex, antigravity, continue, cline, roo or all. Use --print <client> (for example --print cursor) to see the config snippet without writing any file.
optional
Set your PENUI_API_KEY
Search, browsing and preview_units are free. Metered Luau generation needs an API key (rk_...) from your dashboard; see pricing. The server reads PENUI_API_KEY from the environment. Use either local setup option to keep the key out of chat.
Set PENUI_API_KEY in your terminal and run setup again. It copies the key into the client's env block and downloads the packs in your plan.
Add "env": { "PENUI_API_KEY": "rk_..." } to the penui entry in your AI client's MCP config file, then restart or reload the client.
$ npx -y penui-mcp setup --client cursor
After reloading the client, call ping to verify key configuration and usage to check the plan and quota.
Where each client keeps its MCP config (put PENUI_API_KEY in the penui env block):
- Claude Code:
claude mcp add-json -s useror~/.claude.json(repo includes portable.mcp.json) - Claude Desktop:
claude_desktop_config.json(macOS Application Support / Windows%APPDATA%\Claude/ Linux XDG) - Cursor:
~/.cursor/mcp.json(requires"type": "stdio") - Windsurf:
~/.codeium/windsurf/mcp_config.json - VS Code / GitHub Copilot: user
mcp.json(servers.penui) or.vscode/mcp.jsonper workspace - Zed:
settings.jsonundercontext_servers.penui - Gemini CLI:
~/.gemini/settings.jsonundermcpServers.penui - OpenAI Codex:
~/.codex/config.tomlunder[mcp_servers.penui.env] - Google Antigravity:
~/.gemini/antigravity/mcp_config.json - Continue:
~/.continue/mcpServers/penui.yaml - Cline: extension globalStorage
cline_mcp_settings.json - Roo Code: extension globalStorage
mcp_settings.json - Visual Studio / JetBrains Junie / Kiro / opencode:
~/.mcp.json,~/.junie/mcp/mcp.json,~/.kiro/settings/mcp.json,opencode.json(usesenvironment)
Do not commit workspace configs containing API keys (such as .vscode/mcp.json or project .cursor/mcp.json). Keep keys in user-level configs or .env.local.
step 2
Tools & resources
Discovery and preview tools are free. Only Luau generation is metered; see usage and MCP UI tools.
Orient & Theme
freeVerify server health, inspect quota, and match game genres.
ping,usage,set_api_key— server version, library counts, plan quota, key activationget_studio_workflow— exact step-by-step workflow for building UI in Roblox Studiolist_themes,match_theme— match prompts like simulator, tycoon, anime, or RPG to a base pack
Discover & Preview
freeFind curated screen combos and pre-split units, then preview before building.
decide_screen— plans the screen from your prompt (hierarchy, uniform scale, texture bans) and returns thecompose_unitsargssuggest_combos,get_combo,suggest_icons— example layouts and icons in one imagesearch_units,get_unit— pre-split layered units (full,notext,partsPNGs; supportscontact_sheet: true)preview_units— free PNG + HTML preview with your texts, bounding boxes, and overlap critiquesearch_components,get_component,get_hierarchy,get_reconnection— parent offsets, siblings, and repeat grids
Compose Luau
meteredTurn verified UI layouts into one scaled Roblox ScreenGui script.
compose_units— multiple units → one Luau script withlayout=zones, repeats cloned viaClone()compose_screen— full screen of components + positions + texts → one scaledScreenGuiscriptget_luau— Luau snippet for a single unit or component (mode:auto/asset/native)
Packs & Tokens
freeKeep one screen visually consistent.
list_packs,list_categories— all 15 packs (13 UI, 2 icon) and their categoriesget_design_tokens— fonts (Fredoka One, Montserrat) and color palettes per packlist_textures,get_texture— browse bitmap textures and metadata
Roblox Image IDs & Uploads
optionalRequired only when you want pixel-exact Figma art in Studio instead of native instances.
asset_status— inspect which units or packs already have Robloxrbxassetid://mappingsupload_unit_assets,upload_assets— stage localhostimagePathsfor Studio MCPupload_image, or upload via Open Cloudregister_uploaded_assets— store returned IDs from Roblox Studio MCPupload_imageunchangedset_asset_id,set_file_asset_id— assign an existingrbxassetid://manuallyget_private_version— check private pack version sync for licensed packs
Resources: penui://index, penui://docs/usage, penui://docs/studio-workflow, penui://pack/{id}, penui://component/{id}. Prompt: build-roblox-ui.
step 3
Build it in Studio
Use penui together with the Roblox Studio MCP. The agent calls get_studio_workflow, previews the layout, generates one Luau script and runs it with execute_luau. That creates StarterGui/<name> and replaces any previous draft.
- Search & PreviewThe agent finds pieces with
search_unitsandget_unit, then checks spacing withpreview_units. - Upload & ComposeTo use the original art:
upload_unit_assets, Studioupload_image,register_uploaded_assets. Thencompose_unitsemits the script. - Execute in StudioThe Studio MCP runs
execute_luauand buildsStarterGui/<name>.
art pipeline
Native instances vs. uploaded art
Native Luau, zero uploads
Without uploads, pieces compile to Frame, UICorner, UIGradient, UIStroke and TextLabel.
Good for quick prototypes. Native surfaces can also be mixed with library art.
Uploaded art
Upload through the Studio MCP upload_image (no Open Cloud key needed), or batch upload per pack with ROBLOX_API_KEY.
Mapped IDs persist in library/roblox-ids.json.
# optional: server environment for Open Cloud batch uploads
ROBLOX_API_KEY=... # asset read+write permission
ROBLOX_USER_ID=... # or ROBLOX_GROUP_ID
# then call upload_assets per pack via MCP, or run from terminal:
node tools/upload-roblox.mjs --pack <id>
questions
Frequently asked questions
What is penui?
A library of Roblox UI pieces (2,576+ across 15 packs, extracted from Figma) exposed as an MCP server with 33 tools.
Which clients work?
Any MCP client that supports stdio, with Node.js 20+. npx -y penui-mcp@latest setup can configure Claude Code, Claude Desktop, Cursor, Windsurf, VS Code, Zed, Gemini CLI, Codex, Antigravity, Continue, Cline and Roo Code. Others can use the snippet from --print.
Do I have to upload images first?
No. Without uploads the pieces compile to native instances. To use the original art, call upload_unit_assets, pass the returned paths to the Studio MCP upload_image, then register_uploaded_assets. Or set ROBLOX_API_KEY and call upload_assets.
Does the result scale across devices?
Yes. compose_units and compose_screen use scale-based sizing and 9-slice insets, and the script adds a UIScale that fits the screen.
What is metered?
Only Luau generation: get_luau costs 1 unit, compose_screen and compose_units cost 1 unit per 10 distinct items. Everything else is free. Plans are on the pricing page.
How do I set the API key without pasting it into chat?
Set PENUI_API_KEY in your local environment before running npx -y penui-mcp@latest setup --client NAME, or set it directly in your client’s private configuration. Reload the client once saved.