home / mcp / sketch context mcp server
MCP server to provide Sketch layout information to AI coding agents like Cursor
Configuration
View docs{
"mcpServers": {
"jshmllr-sketch-context-mcp": {
"command": "sketch-context-mcp",
"args": [
"--local-file",
"/path/to/your/file.sketch"
],
"env": {
"PORT": "3333",
"DEBUG_LEVEL": "info",
"SKETCH_API_KEY": "YOUR_TOKEN",
"LOCAL_SKETCH_PATH": "/path/to/file.sketch"
}
}
}
}You can use the Sketch Context MCP Server to expose Sketch file data to IDEs via the Model Context Protocol, enabling AI-assisted design-to-code workflows and real-time collaboration between Sketch and supported editors like Cursor. It parses Sketch files, implements MCP, and provides a UI and WebSocket-based communication pathway for seamless integration.
You run the MCP server with a Sketch file and connect your MCP client (such as Cursor) to the server to reference components, list all symbols, and create or query design elements through natural language commands. Start the server with your local Sketch file or with access to Sketch Cloud, then connect your client to the provided endpoint and begin issuing commands to inspect and modify your design.
Prerequisites you need before installing the MCP server:
Install the MCP server globally and run it with your Sketch file using one of the provided methods.
# 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 (if you have an API key)
sketch-context-mcp --sketch-api-key=<your-sketch-api-key>Alternatively, you can invoke the server directly via npx without a local install.
npx sketch-context-mcp --local-file=/path/to/your/file.sketchInstall the Sketch plugin for MCP integration: download the latest release, install the .sketchplugin file by double-clicking, and verify it appears under Plugins > Sketch Context MCP.
To connect Cursor to the MCP server after starting it, use the MCP interface in Sketch to connect to the server, then configure Cursor to reference components by ID or query design elements.
You can configure the server with environment variables or command-line options. The following environment variables are shown in usage notes and should be provided securely in your environment.
If you encounter issues, verify the MCP server is running and accessible on the configured port, ensure your Sketch API key is correct for cloud access, confirm the Sketch file is valid and uncorrupted, and check your firewall to allow WebSocket connections.
Enable detailed logging to diagnose problems by setting a debug flag in your environment when starting the server.
The server provides several MCP tools to interact with Sketch files through your MCP client. You can retrieve file contents, list components, inspect selections, and create new design elements.
This MCP server project is in development and may be unstable. Always ensure you are using compatible versions of Sketch and your MCP client, and test workflows in a safe environment before integrating into production.
Retrieve contents of a Sketch file or a specific node within it
List all components or symbols present in a Sketch file
Obtain information about the currently selected elements in the Sketch document
Create a new rectangle element with specified dimensions and styling
Create a new text element with specified content and styling