This MCP server converts Figma designs into React Native components, extracting components from your Figma designs and generating corresponding React Native code with proper typing and styling. It streamlines the process of turning your Figma UI designs into functional React Native components.
Install the MCP server directly in your Cursor IDE with the following command:
npx -y @smithery/cli@latest install @kailashg101/mcp-figma-to-code --client claude --config "{
\"figmaToken\": \"YOUR_FIGMA_TOKEN\",
\"figmaFile\": \"YOUR_FIGMA_FILE_ID\",
\"projectDir\": \"YOUR_PROJECT_DIRECTORY\"
}"
To add the server through your eas.json
configuration:
eas.json
file:{
"mcpServers": {
"figma-to-code": {
"command": "node",
"args": ["PATH_TO_REPO/build/index.js"],
"env": {
"FIGMA_TOKEN": "your_figma_token",
"FIGMA_FILE": "your_figma_file_id",
"PROJECT_DIR": "your_project_directory"
}
}
}
}
The configuration requires the following parameters:
{
"figmaToken": string, // Your Figma access token
"figmaFile": string, // Your Figma file ID (from the URL)
"projectDir": string // Where to generate the components
}
If running locally, make sure these variables are defined in your environment or .env
file:
FIGMA_TOKEN
: Your Figma access tokenFIGMA_FILE
: The ID of your Figma file (found in the URL)PROJECT_DIR
: The directory where components will be generatedAfter installation, you can use the following prompts in Cursor IDE:
To generate all components from your Figma file:
using the extract_components mcp tool get all components from figma and generate their corresponding react native components in components folder
To generate only a specific component:
using the extract_components mcp tool get the [ComponentName] component from figma and generate its corresponding react native component in components folder
Replace [ComponentName]
with the actual name of your component in Figma.
If you encounter errors, check for these common issues:
The MCP tool currently supports:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.