Sketch Context MCP
MCP server to provide Sketch layout information to AI coding agents like Cursor
README
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
# Install globally
npm install -g sketch-context-mcp
# Run with a local Sketch file
sketch-context-mcp --local-file=/path/to/your/file.sketch
# Run with Sketch Cloud access
sketch-context-mcp --sketch-api-key=<your-sketch-api-key>
Or run directly with npx:
npx sketch-context-mcp --local-file=/path/to/your/file.sketch
Integration with Cursor
To use this with Cursor:
-
Start the MCP server with your Sketch file:
sketch-context-mcp --local-file=/path/to/your/file.sketch -
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_componentstool 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
npx sketch-context-mcp --sketch-api-key=<your-sketch-api-key>
You should see output similar to:
Initializing Sketch MCP Server in HTTP mode on port 3333...
HTTP server listening on port 3333
SSE endpoint available at http://localhost:3333/sse
Message endpoint available at http://localhost:3333/messages
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:
./install-plugin.sh
Manual Installation
- Copy the
sketch-selection-helper.sketchpluginfolder to your Sketch plugins directory:~/Library/Application Support/com.bohemiancoding.sketch3/Plugins/ - 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:
DEBUG=sketch-mcp:* npx sketch-context-mcp
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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.