UX Planet - Medium 7小时前
Figma MCP: Complete Guide
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

Figma MCP(Model Context Protocol)旨在弥合视觉设计与可生产代码之间的差距。本文详细介绍了如何使用Figma MCP,从在Figma和Cursor中的设置到解决常见问题,并通过实例展示了MCP如何改进设计到代码的工作流程。MCP使AI代码生成器能够从语义层面理解设计,从而实现设计与代码的更紧密对齐。文章还提供了解决MCP使用过程中可能出现的错误的实用技巧,帮助设计师和开发者更高效地协作。

💡 **什么是MCP?** MCP是一个开放标准,允许大型语言模型(LLMs)与外部工具、系统和数据源交互,使得AI应用能够访问和利用来自互联网的信息。在Figma中,MCP实现了Figma和AI驱动的开发环境之间的互操作,从而减少了设计和代码之间的差距。

✨ **MCP的优势:** 与仅基于截图生成代码的方法相比,MCP提供了对设计更深入的理解。Cursor可以访问精确的变量名、了解层次结构、变体和约束。这使得生成的代码与设计系统更加一致,即使对于简单的设计,差异也很明显。

🛠️ **如何设置Figma MCP:** 设置Figma MCP包括在Figma桌面应用中启用MCP服务器,以及在代码编辑器(如Cursor)中配置MCP客户端。文章提供了详细的配置步骤,包括Figma和Cursor的设置,确保成功连接。

⚠️ **解决常见问题:** 文章详细介绍了在使用Figma MCP时可能遇到的问题,例如使用'get_code'和'get_image'工具时出现的错误,并提供了相应的解决方案。这些解决方案包括重启Figma MCP服务器、重启Cursor中的MCP客户端,以及调整设计区域大小和选择合适的LLM模型。

Bridging the gap between visual design and production-ready code has always been a top priority for most product teams. Figma MCP (Model Context Protocol) is a solution to this problem. MCP allows AI code generators like Cursor to understand your design at a semantic level, not just mimic it visually.

In this guide, I’ll walk you through everything you need to know to start using Figma MCP — from setup in Figma & Cursor to troubleshooting common problems, with real-world examples showing why this method is a leap forward for design-to-code workflows.

https://medium.com/media/60d24f2ace52d0245c714538fcaf8626/href

What is MCP

MCP stands for Model Context Protocol, and it’s an open standard that enables large language models (LLMs) to interact with external tools, systems, and data sources. It allows AI applications to access and utilize information from the internet, making them more powerful and versatile.

In the context of Figma, MCP enables Figma and the AI-powered development environment to interact with each other, minimizing the gap between design and code.

Below I will show you how to use MCP to turn your Figma card design into code.

Figma card design that I will turn in code.

Why you want to use MCP

I’m starting to see more and more comments like this:

“Don’t see a reason to use MCP. I can simply take a screenshot of my design, attach this image in Cursor, and ask it to code it!”

While, in general, this approach of turning a screenshot into a working solution works fine, it has one but important limitation — Cursor will parse the image to generate code and it won’t have an in-depth understanding of your design. But when you use MCP, and feed Cursor Figma link with your design it will have a semantic understanding of your design: Cursor will have design token awareness and semantic precision.

It means that you will get a much better alignment between design and code, and that’s what makes MCP super valuable — it allows generating code aligned with your design system.

Even for simple designs, the difference between 2 approaches is clearly noticeable. Let me demonstrate it on our card example. Below is my attempt to attach screenshot of card (referenced above) and prompting Cursor to code it in HTML and CSS.

Prompt I submit to Cursor.

Here is a result of this operation:

Preview of a card that Cursor generated for design provided as an image.

Lets make another try, but this time with MCP and link to Figma with design.

Chat window is located at the top right corner of the Cursor window.

And here is a design generated with the Figma MCP (side note: yes, it also has some visual difference with the original design, but I think it’s better aligned with the original design).

Code that Cursor generated using Figma MCP.

What you need to use Figma MCP

How to set up Figma MCP

Its very easy. All you need to do is enable the Figma MCP Server in the Figma Desktop app (shown below). Before doing that, I recommend you update the Figma app to ensure you’re running the latest version of Figma.

How to enable MCP Server in Figma.

Then, in your code editor (in my case, Cursor), you need to configure the MCP client. Click Cursor → Settings → Cursor Settings → MCP Tools. Choose a New MCP Server.

And write configuration for your code environrment. Here a configuration for MCP Server for Cursor:

{
"mcpServers": {
"Figma": {
"url": "http://127.0.0.1:3845/sse"
}
}
}

This is how it looks to me:

Figma MCP server configuration in Cursor.

If you do it correctly, you will see the following state: Figma with a green badge, indicating a successful connection.

Configuration for Figma MCP server is enabled, and the Cursor MCP client established a successful connection.

How to use Figma MCP

Also easy. All you need to do is to copy a link to the section of your design in Figma. Right mouse click on the frame, select Copy/Paste as, and choose Copy link to section.

Add this link to the Cursor AI chatbot input field and provide a prompt.

Chat window is located at the top right corner of the Cursor window.

Solving typical problems

Error when using ‘get_code’ tool

If you see error message like for ‘get_code’ MCP method in Cursor output:

The Figma design at this link references a “[Name of component]” component, but the code export suggests the main content is currently missing or hidden.

It’s a clear indication that Cursor cannot get design from Figma. Without fixing this problem, the Cursor will code some generic design, and it will mention that in the output:

Since the actual card content is not visible, I will create a generic card layout using these styles in HTML and CSS. You can later adjust the content as needed.

To solve this problem, do two things:

Step 1: Restart Figma MCP Server. In Figma for Desktop, navigate Preferences → Enable Dev Mode MCP Server. Turn it OFF and then ON.

Figma Preferences (Enable Dev Mode MCP Server).

Step 2: Restart MCP Client in Cursor. Click Cursor → Settings → Cursor Settings → MCP Tools. Turn the toggle for Figma off and then On.

Error when using ‘get_image’ tool

get_image allows Cursor to fetch embedded images for processing or summarization. For example, this method will be used to extract additional visual attributes from the design of a UI card.

Asking the Cursor to code the design from Figma. Cursor uses the get_image method to retrieve visuals embedded in the design.

If you see error message like this one:

Your request failed. Please try again. Request id: [number]

It can be a clear indication that get_image is not working properly. Based on my experience working with this method, there are two main issues with it:

Issue 1: get_image fails when you select large areas of your design. Currently, when you select large areas in your Figma design and pass this link to Cursor, the get_image function cannot process them within the defined timeout, resulting in an error. To solve this, you can feed Cursor smaller areas of your design and then iterate from it (side note: I know that this is not an optimal solution, yet it works).

Issue 2: get_image can be unstable with Claude-4-sonnet and Gemini 2.5-pro models. You can disable this model in Cursor globally (Cursor → Cursor Settings → Models and turn off Claude-4-sonnet model, leaving only Claude-3.5-sonnet model).

Disabling LLM in Cursor models.

Or you can do it locally, in the context of the chat window.

By default, the agent model is set to Auto, but you can turn this off and choose a model you want to use manually.

So, if you choose claude-3.5-sonnet, you chat window will look like this:

Selecting a particular model for AI assistant.

Note that this decision will have a negative impact on the code that Cursor will generate for you (as claude-3.5-sonnet is the older model in comparison to 4, which is considered the most advanced model at this moment).

Written by Nick Babich


Figma MCP: Complete Guide was originally published in UX Planet on Medium, where people are continuing the conversation by highlighting and responding to this story.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

Figma MCP 设计到代码 AI
相关文章