Integrations
Supports configuration through environment variables via .env files for settings like API keys, port configuration, and debug levels.
Uses Node.js as the server platform for implementing the Model Context Protocol to provide Sketch file data to compatible IDEs.
Parses Sketch design files (.sketch), enabling access to components, symbols, and design elements. Supports both local and Cloud Sketch files, component extraction, asset management, and selection links via a Sketch Selection Helper plugin.
Note: This project is currently in testing phase and may not be fully stable.
Sketch Context MCP
A Model Context Protocol (MCP) server for integrating Sketch designs with IDEs such as Cursor, Cline, or Windsurf.
Overview
This tool allows Cursor IDE to access and interpret Sketch design files, enabling AI-powered design-to-code workflows. It works by:
- Providing a server that parses Sketch files (.sketch)
- Implementing the MCP protocol that Cursor or other IDEs use for context
- Allowing you to reference specific components and layers from your Sketch files
Components
This project consists of two main components:
- MCP Server: A Node.js server that implements the Model Context Protocol to provide Sketch file data to Cursor IDE
- Sketch Selection Helper Plugin: A Sketch plugin that helps you copy selection IDs to use with the MCP server
Supported Features
- Local and Cloud Sketch file parsing
- Component/Symbol extraction
- Asset management and automatic downloads
- Selection links support via the Sketch Selection Helper plugin
- Real-time updates via SSE
- Parsing both local and Sketch Cloud-hosted files
- Extracting document structure and component information
- Accessing specific nodes by ID
- Listing all components in a Sketch file
Getting Started
Prerequisites
- Node.js (v14 or later)
- A Sketch account with API access (only needed for Sketch Cloud files)
Installation
Or run directly with npx:
Integration with Cursor
To use this with Cursor:
- Start the MCP server with your Sketch file:Copy
- In Cursor, connect to the MCP server:
- Go to Settings > Features > Context
- Enter the URL:
http://localhost:3333
- Click "Connect"
- In the Cursor composer, you can now:
- Reference components by ID: "Show me the component with ID 12345"
- List all components: "List all components in the design"
- Get details about specific elements: "Describe the button in the header"
Working with Sketch Files
Since Sketch doesn't have a built-in "Copy Link to Selection" feature like Figma, you can:
- Use the
list_components
tool to see all available components - Reference specific components by their ID
- Use the Sketch plugin API to export selection IDs (see the Sketch Plugin section below)
Configuration
The server can be configured using either environment variables (via .env
file) or command-line arguments. Command-line arguments take precedence over environment variables.
Environment Variables
SKETCH_API_KEY
: Your Sketch API access token (required for Sketch Cloud files)PORT
: The port to run the server on (default: 3333)LOCAL_SKETCH_PATH
: Path to local Sketch file (alternative to --local-file argument)DEBUG_LEVEL
: Set logging verbosity (default: 'info')
Command-line Arguments
--version
: Show version number--sketch-api-key
: Your Sketch API access token--port
: The port to run the server on--stdio
: Run the server in command mode, instead of default HTTP/SSE--help
: Show help menu
Connecting to Cursor
Start the Server
You should see output similar to:
Connect Cursor to the MCP Server
- Open Cursor IDE
- Go to Settings (⚙️)
- Navigate to the Features tab
- Find the "Context" section
- Enter the URL for your MCP server:
http://localhost:3333
- Click "Connect"
After the server has been connected, you should see a green status indicator in Cursor's settings.
Using with Cursor
Once the MCP server is connected, you can start using it with Cursor:
- Make sure you're using Cursor in agent mode
- Drop a link to a Sketch file in the Cursor composer
- Ask Cursor to analyze or work with the design
For example, you could say: "Analyze this Sketch design and create a React component that matches the layout"
Working with Selection Links
To reference specific elements in your Sketch file:
- Install the Sketch Selection Helper plugin (see below)
- Select elements in Sketch
- Run the plugin from the Plugins menu (or use the keyboard shortcut)
- The IDs will be copied to your clipboard
- Use these IDs when talking to Cursor about specific elements
Installing the Sketch Selection Helper Plugin
The plugin helps you get the IDs of selected elements in Sketch to use with the MCP server.
Automatic Installation
Run the installation script:
Manual Installation
- Copy the
sketch-selection-helper.sketchplugin
folder to your Sketch plugins directory:Copy - Restart Sketch if it's already running
Using the Plugin
- Open a Sketch document
- Select one or more layers
- Go to Plugins > Sketch Selection Helper > Copy Selection IDs
- The IDs will be copied to your clipboard
- Use these IDs with the MCP server to reference specific elements
For example, after copying the IDs, you might ask Cursor: "Analyze the button with ID 12345 from the Sketch design"
Working with Components
To reference specific components in your Sketch file:
- Open your Sketch file
- Select the component you want to reference
- Copy its ID or create a link to it
- Use this ID/link when talking to Cursor
Asset Management
Assets are automatically handled when:
- Accessing components with images
- Working with symbols
- Handling exported assets
The server will automatically:
- Download required assets
- Manage asset versions
- Handle asset references in components
Troubleshooting
Common Issues
- Connection Errors: Make sure your server is running and the port is accessible
- Authentication Failures: Verify your Sketch API key is correct
- File Parsing Issues: Ensure your Sketch file is valid and not corrupted
Logs
To enable detailed logging, set the DEBUG environment variable:
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
This server cannot be installed
MCP server to provide Sketch layout information to AI coding agents like Cursor