reference / model context protocol

Model Context Protocol UI server, complete tool & client reference

penui-mcp is a local Model Context Protocol UI server for Node 20+. Connect it to Claude Code, Cursor, Windsurf, VS Code Copilot, Zed, Gemini CLI, Codex, or Antigravity so your agent can search 2,576+ Figma-derived Roblox UI pieces, preview screens for free, and compile deterministic ScreenGui Luau.

penui is paired with the AI coding agent you already run. Read Build UI with your AI for that pairing, and Figma to Roblox for how a Figma file becomes the screen.

  • stdio + Streamable HTTP
  • Node 20+
  • 33 MCP tools
  • 6 resources + 1 prompt

protocol architecture

An MCP UI tool built for deterministic agent workflows

Instead of asking an AI model to hallucinate UI layout coordinates in code, the penui MCP server gives the agent structured discovery, visual contact sheets, free local PNG/HTML layout previews, spatial reconnection data, and single-call Luau compilation.

penui mcp (library + compiler)

Runs locally over stdio (or bearer-protected Streamable HTTP on 127.0.0.1) using @modelcontextprotocol/sdk and zod. Serves compact JSON and PNG previews from 15 packs (13 design + 2 icon packs).

roblox studio mcp (executor)

Runs beside penui in your IDE or CLI. Accepts localhost imagePaths via upload_image and places the compiled ScreenGui directly into StarterGui with execute_luau.

exact tool surface

All 33 MCP tools grouped by intent

Verified directly against mcp/server.mjs and its tool modules (32 registered MCP tools). Discovery, preview, token, and upload-registration tools are free; only Luau compilation is metered.

1. Discovery & Health

free

Inspect server version, library counts, quota, packs, categories, and game genres.

  • ping — server version, update status, library counts (packs, components, units, textures, uploaded assets), API key & upload config.
  • usage — active plan, remaining weekly/monthly quota, and allowed packs.
  • get_studio_workflow — returns the complete step-by-step Studio MCP build guide (read once).
  • list_packs — lists all 15 packs with component/unit counts and style summaries.
  • list_categories — counts pieces across every category (button, panel, tile, bar, icon, etc.).
  • list_themes — lists all 14 game genres (simulator, tycoon, anime-fighting, rpg, etc.) with coverage scores.
  • match_theme — maps any genre prompt (any language) to a base pack, screen pieces, and cross-pack remix accents.

2. Combo & Layout Preview

free

Start with curated screens or inspect a custom layout as PNG + HTML before spending quota.

  • decide_screen — takes the request and returns the role tree plus ready compose_units args (uniform scale, parent boxes, texture bans such as no studded). Use it for the layout; suggest_combos is a gallery.
  • suggest_combos — returns curated, art-directed screen compositions as one numbered contact-sheet PNG (filter by screen, theme, pack, tags).
  • get_combo — returns exact compose_units args, editable text slots, matching pairings, and preview image for a combo ID.
  • suggest_icons — returns a numbered contact sheet of curated icons by group, screen, rarity, or query.
  • preview_units — free local render with the exact same arguments as compose_units (supports layout: zones|row|column|manual); returns PNG, overlap critique, sight lines, and HTML file.

3. Unit & Component Search

free

Find pre-split layered units (preferred) or raw Figma components with visual previews.

  • search_units — finds pre-split units; contact_sheet: true returns one numbered grid image of up to 24 results.
  • find_close_buttons — finds complete close controls with numbered previews and ready-to-place compose items.
  • get_unit — fetches 1 (id) or up to 10 (ids) units with layers, notext/full preview, optional parts_images, and parent context.
  • search_components — searches by query, pack, theme, category, or kind (atomic|composite|screen; excludes effect-layer unless asked).
  • get_component — fetches 1 or up to 10 components with preview (thumb|1x|2x|notext|notext@2x), nativeBuildable, nativeColors, and reconnection metadata.
  • get_private_version — authorized read of a private pack asset version from the private R2 bucket when included in your plan.

4. Spatial Reconnection

free

Recover parent frames, offsets, repeat grids, and sibling coordinates.

  • get_reconnection — returns parent frame, offsetInParent, marginsInParent, zOrderInParent, repeatPositions, siblingsInParent, context image, and ready-to-call compose recipes.
  • get_hierarchy — returns ancestor chain, nested descendant tree, sibling offsets, and reconnection recipes for any unit, component, or pack.

5. Luau Composition

Compile units or components into responsive Roblox ScreenGui Luau scripts.

  • compose_units — builds one AutoScale ScreenGui from unit IDs (hierarchy: nested|flat, layout: manual|row|column|zones, expand_repeats cloning via f:Clone(), texts overrides, validation header, and STAGE_URLS). Cost: 1 per 10 distinct items (min 1).
  • compose_screen — builds one scaled ScreenGui from component or unit IDs, supporting native fallback or uploaded rbxassetid:// art and 9-slice w/h resizing. Cost: 1 per 10 distinct items (min 1).
  • get_luau — generates Luau for a single component or unit (mode: auto|asset|native, repeat, count, texts, parent). Cost: 1 unit.

6. Design Tokens & Textures

free

Keep typography, palette colors, and bitmap textures consistent across a screen.

  • get_design_tokens — returns pack palettes (top 16 colors per pack) and Roblox fonts (Fredoka One, Montserrat via Font.fromName).
  • list_textures — lists tileable/bitmap textures (optional pack filter) with size, KB, usedBy count, and library-relative paths.
  • get_texture — returns metadata, bound rbxassetid://, and preview image for one texture ID.

7. Roblox Asset Upload & Registration

optional

Only needed for pixel-exact PNG artwork instead of native Frame/UIStroke instances. Works with Roblox Studio MCP upload_image (no API key needed) or Roblox Open Cloud.

  • asset_status — checks per-pack uploaded counts in library/roblox-ids.json and whether Open Cloud credentials are set.
  • upload_assets — uploads component/unit PNGs via Open Cloud (ROBLOX_API_KEY) or returns localhost imagePaths batches for Studio MCP upload_image.
  • upload_unit_assets — uploads unit PNGs (full, notext, and parts) by pack or ids, or stages localhost imagePaths for Studio upload_image.
  • register_uploaded_assets — stores the rbxassetid:// map returned by Studio MCP upload_image into library/roblox-ids.json.
  • set_asset_id — manually binds an rbxassetid to a component or unit variant (1x, notext, preview, textMask).
  • set_file_asset_id — manually binds an rbxassetid to any library-relative PNG path from get_unit or list_textures.

8. API Key Setup

free

Authenticate metered Luau composition calls in local stdio mode.

  • set_api_key — verifies an rk_... key, activates it immediately without restarting the client, and optionally persists it to .env.local (stdio mode; HTTP mode reads PENUI_API_KEY from environment).

mcp surface

6 MCP resources & build-roblox-ui prompt

MCP clients that expose resources and slash-prompts can read penui’s structured catalog and workflow directly before calling any tool.

penui://index

JSON entry point: all 15 packs with component/unit counts, intent-based tool routing, and doc resource URIs.

penui://docs/usage

Markdown guide explaining library organization, component granularity, and MCP usage patterns.

penui://docs/studio-workflow

Markdown runbook for pairing penui MCP with Roblox Studio MCP (upload_image, execute_luau, verification).

penui://pack/{id}

Resource template listing every component inside a given pack ID (e.g. penui://pack/skibidifig).

penui://component/{id}

Resource template returning complete machine-readable metadata for a single component ID.

penui://themes

Bonus theme resource mapping 14 Roblox game genres to recommended packs, required screens, and coverage scores.

Prompt: build-roblox-ui (args: request, pack?)

Guided MCP prompt that instructs the AI agent to run match_theme if a genre is named, read get_studio_workflow, inspect units/components, upload images via upload_unit_assets + Studio upload_image + register_uploaded_assets, compose with compose_units or compose_screen, and place the result with execute_luau.

multi-client setup matrix

Install once across 12+ AI coding agents

Run npx penui-mcp setup --client <name> (or node tools/setup.mjs --client <name> from a clone) to register penui cleanly with automatic .bak backups and 0600 key permissions.

one-command setup
# Via npm (downloads library automatically on first run):
$ npx penui-mcp setup --list
$ npx penui-mcp setup --client cursor              # or: claude-code, windsurf, vscode, zed, gemini, codex, antigravity, all

# Or from GitHub clone:
$ git clone https://github.com/StefNoob/roferoUI && cd roferoUI
$ node tools/setup.mjs --client all --key rk_your_key
AI Client / IDE Setup Flag Config File & Key Notes
Claude Code --client claude-code ~/.claude.json (mcpServers) or repo .mcp.json Uses claude mcp add-json -s user when CLI is on PATH; repo root already includes portable .mcp.json.
Claude Desktop --client claude-desktop claude_desktop_config.json (mcpServers) Local stdio only (no type or url field). Updates Microsoft Store MSIX path on Windows too.
Cursor --client cursor ~/.cursor/mcp.json (mcpServers) Requires "type": "stdio". Uses absolute Node path so GUI launches without shell PATH.
Windsurf --client windsurf ~/.codeium/windsurf/mcp_config.json (mcpServers) Standard stdio mcpServers.penui entry; supports PENUI_API_KEY in env.
VS Code / Copilot --client vscode User mcp.json or .vscode/mcp.json (servers) Uses top-level "servers" key instead of "mcpServers". Use vscode-workspace for per-repo config.
Zed --client zed settings.json (context_servers) Writes { source: "custom", command, args, env } under context_servers.penui.
Gemini CLI --client gemini ~/.gemini/settings.json (mcpServers) Automatically sets timeout: 60000 for library warmup and image responses.
OpenAI Codex --client codex ~/.codex/config.toml ([mcp_servers.penui]) TOML format with startup_timeout_sec = 30 and optional [mcp_servers.penui.env].
Google Antigravity --client antigravity ~/.gemini/antigravity/mcp_config.json (mcpServers) Standard stdio mcpServers.penui entry; auto-detected by --client all.
Continue --client continue ~/.continue/mcpServers/penui.yaml Generates dedicated YAML server manifest under mcpServers.
Cline --client cline cline_mcp_settings.json (extension storage) Updates VS Code / Cursor / Windsurf / VSCodium / Trae extension storage with disabled: false.
Roo Code --client roo mcp_settings.json (extension storage) Updates detected editor extension storage under rooveterinaryinc.roo-cline.

tools/setup.mjs also supports visual-studio, copilot-cli, kiro, junie, amazon-q, opencode, lm-studio, and generic --client stdio --out <file>.

transports & security

Stdio default & authenticated Streamable HTTP

Stdio is recommended for every desktop and CLI client because there is no open port. When a client requires an HTTP endpoint, mcp/server.mjs includes a hardened loopback Streamable HTTP + legacy SSE server.

stdio json & authenticated streamable http
// 1. Standard stdio config (npm / npx install):
{
  "mcpServers": {
    "penui": {
      "command": "npx",
      "args": ["-y", "penui-mcp@latest"],
      "env": { "PENUI_API_KEY": "rk_your_key" }
    }
  }
}

# 2. Authenticated Streamable HTTP mode (token >= 16 chars, no whitespace):
$ export PENUI_MCP_HTTP_TOKEN="your_long_random_token_16plus"
$ npm run mcp:http   # listens on http://127.0.0.1:4174 (POST /mcp, GET /sse, GET /health)

// Client URL config (`node tools/setup.mjs --print http`):
{
  "mcpServers": {
    "penui": {
      "url": "http://127.0.0.1:4174/mcp",
      "headers": { "Authorization": "Bearer ${env:PENUI_MCP_HTTP_TOKEN}" }
    }
  }
}

HTTP security: binds strictly to 127.0.0.1, enforces Host and Origin checks against DNS-rebinding, caps idle sessions, and refuses startup if PENUI_MCP_HTTP_TOKEN is under 16 characters. Note: .env.local auto-loading only reads ROBLOX_*, PENUI_*, and ROFERO_* variables.

quotas & pricing

Metering rules & current plans

Browsing, searching, contact sheets, preview_units, design tokens, and Studio upload helpers never consume quota. Only Luau generation is metered: get_luau = 1 unit; compose_units and compose_screen = 1 unit per 10 distinct items (minimum 1). Compare full details on /pricing.

Starter

€0 forever

4 starter/open-source packs (starter-frames, buttons, game-icons, penui-icons with 800+ CC0 icons), native builds, ~4 full frames/mo.

Unlocked

€22.99 / mo

Or €18.39/mo billed yearly (€220.68/yr). Everything in Indie, no weekly cap (~125 full frames/mo).

Lifetime

€199 once

Pay once, own forever. All current and future Figma packs included, with no monthly MCP cap.

questions & answers

Frequently asked questions

How many tools does the penui MCP UI server expose?

The penui MCP server includes 33 MCP tools, grouped into Discovery & Health, Combo & Layout Preview, Unit & Component Search, Spatial Reconnection, Luau Composition, Design Tokens & Textures, Roblox Asset Upload & Registration, and API Key Setup.

Which AI coding clients support the penui Model Context Protocol UI server?

Any MCP-capable client on Node 20+ works. tools/setup.mjs includes built-in registration for Claude Code, Claude Desktop, Cursor, Windsurf, VS Code / GitHub Copilot, Zed, Gemini CLI, OpenAI Codex, Google Antigravity, Continue, Cline, Roo Code, Visual Studio, JetBrains Junie, Kiro, Amazon Q, opencode, and LM Studio.

Does penui MCP support Streamable HTTP as well as stdio?

Yes. Standard stdio is the default for local MCP clients. When a client requires a URL, run node mcp/server.mjs --http (or npm run mcp:http) with PENUI_MCP_HTTP_TOKEN set to at least 16 non-whitespace characters. It binds strictly to 127.0.0.1:4174 and serves Streamable HTTP on /mcp, legacy SSE on /sse, and health on /health.

Which penui MCP tools are free vs. metered?

All discovery, search, combo suggestion, preview_units, reconnection, hierarchy, design token, texture, and upload/asset registration tools are free. Only Luau generation tools are metered: get_luau costs 1 unit, and compose_units / compose_screen cost 1 unit per 10 distinct items (minimum 1).

How do penui MCP and Roblox Studio MCP work together?

penui MCP serves Figma-accurate UI components, previews layouts, stages PNGs with upload_unit_assets, and compiles a responsive ScreenGui Luau script via compose_units or compose_screen. The Roblox Studio MCP executes that Luau inside StarterGui via execute_luau and uploads staged PNGs via upload_image.

Can I configure PENUI_API_KEY without pasting it into AI chat?

Yes. Run node tools/setup.mjs --client <name> --key rk_... (or set PENUI_API_KEY in your shell before running setup without --key), or add PENUI_API_KEY to the server env block in your client config. The set_api_key tool is optional for convenience when pasting a key in chat.

Does penui replace the AI coding agent I already run?

No. penui is paired with the AI coding agent you already run. It is the UI library beside that agent, not a separate chatbot.