Live UI preview server with built-in inspector, responsive viewport switching, and multi-framework export β powered by MCP (Model Context Protocol).
Vite κΈ°λ° λΌμ΄λΈ UI ν리뷰 + μΈμ€νν° + λ°μν λ·°ν¬νΈ μ ν + λ©ν°νλ μμν¬ λ΄λ³΄λ΄κΈ°λ₯Ό μ§μνλ MCP μλ².
| Feature | Description |
|---|---|
| Live Preview | Vite dev server with HMR β changes reflect instantly / Vite HMRλ‘ μ¦μ λ°μλλ λΌμ΄λΈ ν리뷰 |
| Inspector | Click any element to see source location, design term, styles, and size / μλ¦¬λ¨ΌνΈ ν΄λ¦ μ μμ€ μμΉ, λμμΈ μ©μ΄, μ€νμΌ, ν¬κΈ° νμ |
| Viewport Switching | Mobile (375px), Tablet (768px), Desktop β real CSS @media breakpoints via iframe / iframe κΈ°λ° μ€μ CSS λ―Έλμ΄μΏΌλ¦¬ λ°μ |
| Multi-Framework Export | Export to Next.js, Remix, Nuxt, Astro, Vue (Vite), React (Vite) as ZIP / 6κ° νλ μμν¬λ‘ ZIP λ΄λ³΄λ΄κΈ° |
| Design Tokens | Inject CSS custom properties at session start / μΈμ μμ μ λμμΈ ν ν° μ£Όμ |
| WebSocket Bridge | Real-time communication between inspector UI and MCP server / μΈμ€νν° UIμ MCP μλ² κ° μ€μκ° ν΅μ |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AI Assistant (Claude, etc.) β
β βββ MCP Protocol (stdio) βββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β UI Friend MCP Server (index.mjs) β
β βββ PreviewManager μΈμ
κ΄λ¦¬ / Session manager β
β βββ ProjectScaffold ν
νλ¦Ώ μμ± / Scaffolding β
β βββ ViteLauncher Vite νλ‘μΈμ€ / Dev server β
β βββ WSBridge WebSocket ν΅μ / Comms β
β βββ ExportEngine νλ μμν¬ λ³ν / Conversion β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Browser β
β βββ PreviewShell ν΄λ° + iframe λνΌ β
β β βββ Viewport switcher (Mobile/Tablet/Desktop) β
β β βββ Inspector toggle β
β β βββ Export controls β
β β βββ CodePanel (element details) β
β βββ iframe (preview-content) β
β βββ App component (user code) β
β βββ IframeWrapper (WS + postMessage listener) β
β βββ InspectorOverlay (hover/click highlight) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Node.js >= 18
- npm >= 9
git clone https://github.com/beyondworks/UI-Friend-MCP.git
cd UI-Friend-MCP
npm installAdd to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
claude_desktop_config.jsonμ μλ λ΄μ©μ μΆκ°νμΈμ:
{
"mcpServers": {
"ui-friend": {
"command": "node",
"args": ["/absolute/path/to/UI-Friend-MCP/index.mjs"]
}
}
}Add to .claude/settings.json or ~/.claude.json:
.claude/settings.json λλ ~/.claude.jsonμ μΆκ°:
{
"mcpServers": {
"ui-friend": {
"command": "node",
"args": ["/absolute/path/to/UI-Friend-MCP/index.mjs"]
}
}
}Add to .cursor/mcp.json or VS Code MCP settings:
{
"mcpServers": {
"ui-friend": {
"command": "node",
"args": ["/absolute/path/to/UI-Friend-MCP/index.mjs"]
}
}
}After configuration, restart your AI client to load the MCP server.
μ€μ ν AI ν΄λΌμ΄μΈνΈλ₯Ό μ¬μμνλ©΄ MCP μλ²κ° λ‘λλ©λλ€.
| Tool | Description |
|---|---|
preview_start |
Start a live preview session / λΌμ΄λΈ ν리뷰 μΈμ μμ |
preview_update |
Update files with HMR / νμΌ μ λ°μ΄νΈ (HMR μ¦μ λ°μ) |
preview_status |
Check session status / μΈμ μν νμΈ |
preview_stop |
Stop a session / μΈμ μ’ λ£ |
preview_select_element |
Inspector: get/enable/disable / μΈμ€νν° μ μ΄ |
preview_export |
Export to framework ZIP / νλ μμν¬ ZIP λ΄λ³΄λ΄κΈ° |
preview_screenshot |
Capture screenshot / μ€ν¬λ¦°μ· μΊ‘μ² |
"Create a landing page preview called my-landing"
β Calls preview_start with project_name: "my-landing"
β Opens http://localhost:5173 in browser
"my-landingμ΄λΌλ λλ©νμ΄μ§ ν리뷰λ₯Ό μμν΄μ€"
β preview_start νΈμΆ (project_name: "my-landing")
β λΈλΌμ°μ μμ http://localhost:5173 μλ μ΄λ¦Ό
Parameters:
{
"project_name": "my-landing",
"framework": "react",
"initial_code": {
"src/App.tsx": "export default function App() { return <h1>Hello</h1> }"
},
"design_tokens": {
"colorPrimary": "#3b82f6",
"colorBackground": "#020617"
}
}"Update the hero section with a gradient background"
β Calls preview_update with session_id and new file content
β Vite HMR applies changes instantly (no page reload)
"νμ΄λ‘ μΉμ
μ κ·ΈλΌλ°μ΄μ
λ°°κ²½μ μ μ©ν΄μ€"
β preview_update νΈμΆ (session_id + μ νμΌ λ΄μ©)
β Vite HMRλ‘ μ¦μ λ°μ (μλ‘κ³ μΉ¨ μμ)
Parameters:
{
"session_id": "prev_abc123",
"files": {
"src/components/Hero.tsx": "... updated code ..."
}
}The toolbar in the browser provides:
- Inspector ON/OFF β Toggle element selection mode
- Click any element β Code panel shows:
- Source file and line number (e.g.,
src/components/Hero.tsx:26) - Design term (e.g., "Hero Section", "Call to Action", "Navigation Bar")
- Computed styles, size, text content
- Source file and line number (e.g.,
λΈλΌμ°μ ν΄λ°μμ:
- Inspector ON/OFF β μλ¦¬λ¨ΌνΈ μ ν λͺ¨λ ν κΈ
- μλ¦¬λ¨ΌνΈ ν΄λ¦ β Code ν¨λμ νμ:
- μμ€ νμΌκ³Ό λΌμΈ λ²νΈ (μ:
src/components/Hero.tsx:26) - λμμΈ μ©μ΄ (μ: "Hero Section", "Call to Action", "Navigation Bar")
- κ³μ°λ μ€νμΌ, ν¬κΈ°, ν μ€νΈ λ΄μ©
- μμ€ νμΌκ³Ό λΌμΈ λ²νΈ (μ:
Click Mobile (375px), Tablet (768px), or Desktop in the toolbar.
The preview uses a real iframe, so CSS @media queries respond correctly.
ν΄λ°μμ Mobile (375px), Tablet (768px), Desktopμ ν΄λ¦ν©λλ€.
μ€μ iframeμ μ¬μ©νλ―λ‘ CSS @media μΏΌλ¦¬κ° μ νν λ°μν©λλ€.
"Export this project as Next.js to ~/Desktop"
β Calls preview_export with target_framework: "nextjs"
β Saves ZIP to ~/Desktop/gemini-export-my-landing-nextjs.zip
"μ΄ νλ‘μ νΈλ₯Ό Next.jsλ‘ ~/Desktopμ λ΄λ³΄λ΄μ€"
β preview_export νΈμΆ (target_framework: "nextjs")
β ~/Desktop/gemini-export-my-landing-nextjs.zip μ μ₯
Parameters:
{
"session_id": "prev_abc123",
"target_framework": "nextjs",
"output_path": "~/Desktop"
}Supported frameworks / μ§μ νλ μμν¬:
vite-reactβ React + Vite (default)nextjsβ Next.js (App Router)vite-vueβ Vue 3 + Vitenuxtβ Nuxt 3astroβ Astroremixβ Remix
{
"session_id": "prev_abc123",
"keep_files": false
}The inspector automatically identifies UI patterns and labels them with design terminology:
μΈμ€νν°κ° UI ν¨ν΄μ μλ μλ³νμ¬ λμμΈ μ©μ΄λ₯Ό νμν©λλ€:
| Category | Terms |
|---|---|
| Structure | Header, Footer, Main Content, Sidebar, Section, Divider |
| Navigation | Navigation Bar, Sticky Header, Breadcrumb, Tabs, Pagination, Menu |
| Content | Card, Hero Section, Panel, Widget, Dashboard, Metric Card |
| Interactive | Button, Call to Action, Link, Dropdown, Toggle Switch, Search |
| Form | Form, Input Field, Text Area, Select Dropdown, Date Picker |
| Data | Data Table, List, Tree View, Timeline, Chart |
| Feedback | Modal, Toast, Alert, Progress Bar, Skeleton, Spinner |
| Media | Image, Avatar, Icon, Video Player, Carousel |
| Layout | Grid, Container, Stack, Spacer, Sticky Element |
UI-Friend-MCP/
βββ index.mjs MCP server entry point / MCP μλ² μ§μ
μ
βββ package.json
βββ src/
β βββ preview-manager.mjs Session orchestrator / μΈμ
μ€μΌμ€νΈλ μ΄ν°
β βββ project-scaffold.mjs Template scaffolding / ν
νλ¦Ώ μμ±
β βββ vite-launcher.mjs Vite process manager / Vite νλ‘μΈμ€ κ΄λ¦¬
β βββ ws-bridge.mjs WebSocket bridge / WebSocket λΈλ¦Ώμ§
β βββ export-engine.mjs Framework export / νλ μμν¬ λ³ν μμ§
β βββ converters/ Framework converters / νλ μμν¬ λ³νκΈ°
β β βββ nextjs.mjs
β β βββ vite-react.mjs
β β βββ vite-vue.mjs
β β βββ nuxt.mjs
β β βββ astro.mjs
β β βββ remix.mjs
β βββ templates/ Project templates / νλ‘μ νΈ ν
νλ¦Ώ
β βββ react/ React + Vite + Inspector
β βββ vue/ Vue 3 + Vite
β βββ vanilla/ Vanilla + Vite
-
Session Start:
preview_startscaffolds a project from a template, runsnpm install, and launches Vite dev server + WebSocket bridge. -
Live Editing:
preview_updatewrites files to the project directory. Vite HMR detects changes and hot-reloads the browser. -
Inspector: The preview runs inside an iframe. When Inspector is ON, an overlay captures hover/click events, identifies the element's source location (via Babel source-loc plugin), maps it to a design term, and displays details in the Code panel.
-
Viewport: The iframe's actual width changes, triggering real CSS
@mediabreakpoints β not just visual scaling. -
Export: The export engine copies user code (stripping inspector files), runs a framework-specific converter, and creates a ZIP file.
-
μΈμ μμ:
preview_startκ° ν νλ¦Ώμμ νλ‘μ νΈλ₯Ό μμ±νκ³ ,npm installν Vite κ°λ° μλ² + WebSocket λΈλ¦Ώμ§λ₯Ό μ€νν©λλ€. -
λΌμ΄λΈ νΈμ§:
preview_updateκ° νλ‘μ νΈ λλ ν 리μ νμΌμ μ°λ©΄, Vite HMRμ΄ λ³κ²½μ κ°μ§νμ¬ λΈλΌμ°μ λ₯Ό ν«λ¦¬λ‘λν©λλ€. -
μΈμ€νν°: νλ¦¬λ·°κ° iframe μμμ μ€νλ©λλ€. Inspector ON μ μ€λ²λ μ΄κ° hover/click μ΄λ²€νΈλ₯Ό μΊ‘μ²νκ³ , Babel source-loc νλ¬κ·ΈμΈμΌλ‘ μμ€ μμΉλ₯Ό μλ³νλ©°, λμμΈ μ©μ΄λ₯Ό λ§€ννμ¬ Code ν¨λμ νμν©λλ€.
-
λ·°ν¬νΈ: iframeμ μ€μ λλΉκ° λ³κ²½λμ΄ CSS
@mediaλΈλ μ΄ν¬ν¬μΈνΈκ° μ€μ λ‘ λ°μν©λλ€ β λ¨μ μκ°μ μΆμκ° μλλλ€. -
λ΄λ³΄λ΄κΈ°: λ΄λ³΄λ΄κΈ° μμ§μ΄ μ¬μ©μ μ½λλ₯Ό 볡μ¬(μΈμ€νν° νμΌ μ κ±°)νκ³ , νλ μμν¬λ³ λ³νκΈ°λ₯Ό μ€νν λ€ ZIP νμΌμ μμ±ν©λλ€.
MIT