On this pageWhat the model receives decides the result
Any capable model can turn a picture of a web page into HTML. The hard part is getting code your team would merge: components from your own library, your spacing and color tokens instead of hard-coded values, markup that passes an accessibility check. How close you get depends mostly on what the model receives, far more than on the brand of the tool. Start there.
What the model receives decides the result
| You hand the model | What it can see | What usually comes back |
|---|---|---|
| A design file over MCP | Layer tree, auto layout, variables, component names, plus a screenshot | Code that can reuse your tokens and, with mappings, your components |
| A screenshot or screen recording | Pixels only | A close visual match with invented class names and fixed values |
| A written prompt | Your words | A new app in the generator's own stack and style |
| Any of these, inside your repository with rules | All of the above, plus your existing components | The best chance of code you can merge |
The gap between the first two rows is structure. From a screenshot, a model has to guess that a gray is your neutral-600 token and that a box with a shadow is your Card component. From a design file, it can read both.
Connect a design tool to your coding agent
Figma's MCP server
Figma runs a remote MCP server at https://mcp.figma.com/mcp. It needs no desktop app: you sign in with your Figma account the first time a client connects. A desktop server inside the Figma app also exists for specific organization needs, and it requires a Dev or Full seat on a paid plan. Figma's catalog of supported clients includes Claude Code, Codex, Cursor, VS Code and OpenCode.
# Claude Code, for every project
claude mcp add --scope user --transport http figma https://mcp.figma.com/mcp
# Codex CLI
codex mcp add figma --url https://mcp.figma.com/mcp
In Claude Code, run /mcp, pick figma and authenticate in the browser. Figma recommends its Claude Code plugin over the manual route because the plugin bundles Figma's skills as well. The tools that matter most for code:
get_design_contextreturns structured design data and code for a selection, in React with Tailwind unless you ask for something else.get_variable_defslists the variables and styles a selection uses.get_screenshotlets the agent see what it is supposed to match.get_metadatareturns a light XML outline, handy on large pages before the agent fetches details.get_code_connect_mapreturns the links between Figma components and components in your code.create_design_system_rulesis a prompt that writes a rules file describing how your codebase builds UI.
Select one frame at a time. A whole page in one request produces long, generic output; a single section with its components produces code you can review.
Penpot
Penpot, the open-source design tool (MPL-2.0), has an official MCP server, now developed in Penpot's main repository. It reaches the design file through a Penpot plugin running in your browser session, and it lets an agent read, change and create design elements. Penpot is also one of the design tools backing the token format described next, which makes it a good fit for a token-driven workflow on your own infrastructure.
Make tokens the contract
Design tokens are named values for color, spacing, type and radius. When the design file and the codebase share the same names, the agent has a vocabulary to map onto, and a reviewer can reject any raw value it invents. The Design Tokens Community Group published the first stable version of its format, 2025.10, in October 2025. A color, a semantic alias and a spacing step look like this:
{
"color": {
"blue-600": {
"$type": "color",
"$value": { "colorSpace": "srgb", "components": [0, 0.4, 0.8], "hex": "#0066cc" }
},
"primary": { "$type": "color", "$value": "{color.blue-600}" }
},
"space": {
"4": { "$type": "dimension", "$value": { "value": 1, "unit": "rem" } }
}
}
Files take the .tokens or .tokens.json extension. A build tool such as Style Dictionary turns them into CSS custom properties, Tailwind theme values or platform constants, so design and code read from one source. Then make the contract enforceable:
- Say it in the rules file. State in your
AGENTS.mdthat colors, spacing and radii come only from tokens, and name the file. The context files guide covers what else belongs there. - Lint for it. Stylelint's
color-no-hexrule rejects raw hex colors in stylesheets, so the check does not depend on a reviewer noticing. - Map the components. With Code Connect mappings in place,
get_design_contextcan point the agent to your<Button variant="primary">instead of a freshly invented div.
When you only have pixels
A screenshot, an old app with no design file or a competitor's layout still works as input. Expect to refactor what comes back. screenshot-to-code (MIT) turns screenshots, mockups and screen recordings into HTML with Tailwind or plain CSS, React, Vue, Bootstrap or Ionic, using a hosted model API you supply; video input needs a Gemini key. It runs with Docker Compose:
git clone https://github.com/abi/screenshot-to-code.git && cd screenshot-to-code
echo "OPENAI_API_KEY=sk-your-key" > .env
docker-compose up -d --build # frontend on port 5173, backend on 7001
# from your laptop, reach both through one SSH session
ssh -L 5173:localhost:5173 -L 7001:localhost:7001 you@203.0.113.10
Compose publishes both ports on every interface, and Docker's published ports skip UFW rules. On a server, block 5173 and 7001 in the provider's firewall and use the tunnel, or anyone who finds the page can spend your API credits.
When you only have words
Prompt-to-app generators build a working app from a description. Hosted services include v0, Lovable and Bolt.new. bolt.diy is the MIT-licensed open-source version of Bolt that you host yourself and point at more than 20 model providers, local Ollama models included. Generators are fast for prototypes and internal tools, but their output follows the generator's own stack and component choices. Treat it as a sketch: keep the layout and the logic, then rebuild the interface with your components before it ships.
To keep designs and generated apps on a server you control, CloudSat's one-click apps include Penpot and bolt.diy.
Check the output before it merges
- Visual match. Screenshot the running page at the width of the design and compare it with the design's own screenshot.
- Tokens, not values. Search the diff for hex codes and pixel values. Each one is either a missing token or a mistake.
- Accessibility. Generated markup often skips form labels, alt text, focus styles and a sensible heading order. Run an automated checker such as axe, then tab through the page yourself.
- The widths in between. A design shows one or two breakpoints. Check the sizes nobody drew.
- Reuse. If the diff adds a button or card that resembles one you already have, send it back and ask for yours.
The first two checks are easy to script:
npx playwright screenshot --viewport-size "1440, 900" --full-page http://localhost:3000/pricing pricing.png
git diff main -- '*.css' '*.tsx' | grep -nE '^\+.*#[0-9a-fA-F]{3,8}\b'
FAQ
Do I need a paid Figma plan for the MCP server?
Connecting to the remote server needs only a Figma account, though what you can do through it depends on your plan and seat; writing to the canvas outside your drafts requires a Full seat. The desktop server requires a Dev or Full seat on a paid plan. Check Figma's current terms, because these details change.
Can AI-generated UI code go straight to production?
Rarely without review. Treat it like a pull request from a fast new colleague: check component reuse, tokens, accessibility and tests before you merge.
Which input gives the best result?
A design file with variables and mapped components, read over MCP by an agent working inside your repository. Screenshots come next. Prompts come last when the result must follow your own design system.
Can I use a local model for this?
bolt.diy accepts local Ollama models, and agents such as OpenCode accept local endpoints. Image understanding varies widely between open-weight models, so compare candidates on one of your own screens before you commit.
Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.




