Figma Context MCP

Figma Context MCP

A Model Context Protocol (MCP) server that enhances Figma design integration by adding element position information to API responses, enabling AI assistants to better understand spatial relationships and convert designs to code more accurately.

Category
访问服务器

README

Figma Context MCP

Forked from GLips/Figma-Context-MCP

A Model Context Protocol (MCP) server that enhances Figma design integration by adding element position information to API responses. This enables AI assistants to better understand spatial relationships and convert designs to code more accurately by inferring logical layouts from absolute positioning.

npm version npm downloads license

Key Enhancement

Position Information for Better Layout Inference

This fork's primary enhancement adds element position data (x, y coordinates, width, height) to API responses for nodes that don't use Figma's AutoLayout feature. This enables AI assistants to:

  • Infer logical layout relationships from absolute positioning
  • Better understand spatial hierarchies and component structures
  • Generate more accurate design-to-code conversions
  • Maintain full backward compatibility with the original MCP server

Features

  • Position Data Enhancement - Adds x, y, width, height for non-AutoLayout elements
  • 🧠 Layout Inference - Helps AI understand spatial relationships from absolute positioning
  • 🔄 Full Compatibility - Maintains all original functionality and integrations
  • 🚀 Multiple CLI Commands - Three convenient command aliases
  • 🛡️ Secure Integration - Uses official Figma API with personal access tokens
  • 📱 MCP Compatible - Works with Claude Desktop, Cursor, and other MCP tools

Quick Start

Get up and running in 3 simple steps:

Step 1: Get Your Figma API Token

  1. Visit Figma Account Settings
  2. Scroll to "Personal access tokens"
  3. Click "Create new token", name it (e.g., "MCP Server"), and copy the token

Step 2: Configure Your AI Assistant

See the Integration section below for detailed setup instructions for your specific AI assistant (Cursor IDE, VS Code, etc.).

✅ Verify It's Working

  1. Open your AI assistant (Cursor, VS Code, etc.)
  2. Try this example:
    "Analyze the layout structure of this Figma design:"
    https://www.figma.com/community/file/1234567890/example-design
    
  3. Your AI should access and analyze the Figma file with position information!

Troubleshooting: If it doesn't work, check the Troubleshooting section below.

How It Works

Prerequisites: Node.js 20+ and a Figma account with API access

No Installation Required:

  • Uses npx figma-context-mcp - downloads automatically when needed
  • No global packages to manage
  • Always uses the latest version
  • Works immediately without setup steps

Integration

Cursor IDE

Configure in Cursor settings (Cmd/Ctrl + , → Extensions → MCP Servers):

Configuration:

{
  "mcpServers": {
    "figma-context": {
      "command": "npx",
      "args": ["figma-context-mcp", "--figma-api-key=${FIGMA_API_KEY}", "--stdio"]
    }
  }
}

Test: Use Cursor's AI chat to analyze a Figma design URL.

VS Code (with Continue Extension)

Install the Continue extension and configure ~/.continue/config.json:

{
  "models": [...],
  "mcpServers": {
    "figma-context": {
      "command": "npx",
      "args": ["figma-context-mcp", "--figma-api-key=${FIGMA_API_KEY}", "--stdio"]
    }
  }
}

Other MCP Tools

{
  "mcpServers": {
    "figma-context": {
      "command": "npx",
      "args": ["figma-context-mcp", "--figma-api-key=${FIGMA_API_KEY}", "--stdio"]
    }
  }
}

Usage Examples

Design Analysis:

"Analyze the layout structure of this Figma design:"
https://www.figma.com/file/abc123/my-design

Component Generation:

"Generate React components from this Figma design:"
https://www.figma.com/design/abc123/component-library?node-id=123-456

Design System Extraction:

"Extract design tokens from this Figma file:"
https://www.figma.com/file/abc123/design-system

How Position Enhancement Works

Position Data for Non-AutoLayout Elements

  • What's Added: x, y coordinates (relative to root), width, and height
  • When Applied: Only for elements that don't use Figma's AutoLayout feature
  • Purpose: Enables AI to infer logical layout relationships from absolute positioning
  • Compatibility: Fully backward compatible with original MCP server responses

Benefits for AI Assistants

  • Better Layout Understanding: AI can analyze spatial relationships between elements
  • Improved Code Generation: More accurate conversion from design to responsive layouts
  • Hierarchy Inference: Builds logical component trees from positioning data
  • AutoLayout Preservation: Maintains Figma's native layout properties where they exist

Troubleshooting

Common Issues:

  • MCP server failed to start: Test manually with npx figma-context-mcp --figma-api-key=YOUR_TOKEN --stdio
  • Invalid API token: Test your token with curl -H "X-FIGMA-TOKEN: YOUR_TOKEN" https://api.figma.com/v1/me
  • Configuration errors: Validate JSON syntax and restart your AI client
  • Environment variables not working: Test with explicit token first, then debug environment setup

Getting Help:

Development

Building from Source:

git clone https://github.com/tianmuji/Figma-Context-MCP.git
cd Figma-Context-MCP
npm install && npm run build

Running Tests:

npm test

Updates:

npm update -g figma-context-mcp

Contributing

Contributions are welcome! Please submit issues and pull requests.

License

MIT License - see LICENSE file for details.

Author

yujie_wu

Attribution

This project is a fork of GLips/Figma-Context-MCP. The primary enhancement is the addition of element position information (x, y coordinates, width, height) for non-AutoLayout nodes, enabling better layout inference for AI assistants while maintaining full compatibility with the original MCP server functionality.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选