Логотип Sketch Context

Sketch Context

Спільнота
jshmllr

MCP server to provide Sketch layout information to AI coding agents like Cursor

Видавецьjshmllr
РепозиторійSketch-Context-MCP
МоваJavaScript
Форки
20
Зірки
72
Доступні інструменти
0
Тип транспортуstdio
Категорії
ЛіцензіяMIT
Посилання
  • Підключайте інструменти до робочих процесів із ШІ

    Sketch Context надає можливості MCP, які можуть використовувати сумісні клієнтські ШІ-застосунки та агенти.

  • Доступні інструменти: 0

    Перегляньте нижче дії, які можна викликати, з назвами й описами, якщо сервер їх надає.

  • Готова конфігурація для копіювання

    Скористайтеся прикладами конфігурації, щоб налаштувати цей сервер у вибраному клієнті MCP.

  • Показники інтересу до відкритого коду

    Зірки: 72, форки: 20 — у пов’язаному репозиторії.

[!NOTE] This repository has been archived as of February 5, 2026. Please refer to the official Sketch MCP at https://www.sketch.com/docs/mcp-server/

Note: This project was currently in dev/testing phase and was not 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:

  1. Providing a server that parses Sketch files (.sketch)
  2. Implementing the MCP protocol that Cursor or other IDEs use for context
  3. Allowing you to reference specific components and layers from your Sketch files
  4. Providing a UI interface for Sketch that communicates with Cursor
  5. Enabling real-time bidirectional communication between Sketch and Cursor

Components

This project consists of two main components:

  1. MCP Server: A Node.js server that implements the Model Context Protocol to provide Sketch file data to Cursor IDE
  2. Sketch Plugin: A Sketch plugin with UI interface that communicates with the MCP server via WebSockets

Available MCP Tools

The server provides the following tools to Cursor:

  • get_file: Retrieve contents of a Sketch file or specific node within it
  • list_components: List all components/symbols in a Sketch file
  • get_selection: Get information about currently selected elements
  • create_rectangle: Create new rectangles with specified dimensions and properties
  • create_text: Create new text elements with custom content and styling

These tools enable Cursor to:

  • Access and inspect Sketch design files
  • Query specific components and layers
  • Create and modify design elements through natural language commands
  • Maintain real-time synchronization with Sketch

Supported Features

  • Local and Cloud Sketch file parsing
  • Component/Symbol extraction
  • Asset management and automatic downloads
  • Selection links support via the Sketch plugin
  • Real-time updates via WebSockets and SSE
  • Interactive UI for connecting Sketch to Cursor
  • 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
  • Creating rectangles, text and other elements via commands from Cursor

UI & Experience Principles

Review the Accessible, Fast, Delightful UI Principles before shipping changes to the plugin or MCP UI. The guide enumerates the MUST/SHOULD/NEVER rules for interaction patterns, accessibility, performance, and visual design to keep user experiences inclusive and resilient.

Getting Started

Prerequisites

  • Node.js (v14 or later)
  • Sketch (v70 or later)
  • Cursor IDE, VS Code or similar
  • A Sketch account (local) or use API access (Sketch Cloud files)

Installation

bash
# 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:

bash
npx sketch-context-mcp --local-file=/path/to/your/file.sketch

Installing the Sketch Plugin

  1. Download the latest release of the plugin from the releases page
  2. Double-click the .sketchplugin file to install it in Sketch
  3. The plugin will be available in Sketch under Plugins > Sketch Context MCP

Integration with Cursor

To use this with Cursor:

  1. Start the MCP server with your Sketch file:

    bash
    sketch-context-mcp --local-file=/path/to/your/file.sketch
  2. In Sketch, open the plugin:

    • Go to Plugins > Sketch Context MCP > Open MCP Interface
    • Enter the server port (default: 3333)
    • Click "Connect"
  3. In Cursor, connect to the MCP server:

    • Go to Settings > Features > Context
    • Add a new MCP server with the URL: http://localhost:3333/sse
    • Click "Connect"
  4. 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"
    • Create new elements: "Create a rectangle with width 200 and height 100"

Obtaining a Sketch API Key

The Sketch API key is an OAuth access token required for accessing Sketch Cloud-hosted files. Follow these steps to obtain and use the token:

Step 1: Authenticate with Sketch Cloud

Use your Sketch Cloud credentials (email and password) to generate an access token by making a POST request to the authentication endpoint:

bash
curl -X "POST" "https://auth.sketch.cloud/oauth/token" \
  -H 'Content-Type: application/json' \
  -d '{
    "email": "YOUR_EMAIL",
    "password": "YOUR_PASSWORD",
    "grant_type": "password"
  }'

Replace YOUR_EMAIL and YOUR_PASSWORD with your Sketch Cloud account credentials.

Step 2: Access Token

The response will include an access_token. This token serves as your API key for accessing Sketch Cloud-hosted files.

Step 3: Using the Token

For security, it is recommended to pass the token as an environment variable:

bash
export SKETCH_API_KEY=<your-access-token>

Or include it as a command-line argument:

bash
sketch-context-mcp --sketch-api-key=<your-access-token>

Step 4: Refreshing the Token

If your token expires, use the refresh_token provided in the initial response to obtain a new access token.

Security Best Practices

To ensure your API key is secure, follow these guidelines:

  • Do Not Hard-Code the Key: Never hard-code an API key into the application or source code. Instead, use environment variables or secret management tools.

  • Use .env Files for Local Development: Store your API key in a .env file and load it using a library like dotenv:

    SKETCH_API_KEY=<your-access-token>

    Ensure the .env file is added to .gitignore to avoid accidental exposure.

  • Rotate Tokens Regularly: If your token is leaked or compromised, revoke it and generate a new one immediately.

  • Monitor and Audit: Use tools to scan your repository for exposed credentials (e.g., GitHub’s secret scanning feature).

  • Use Short-Lived Tokens: If possible, use short-lived tokens and refresh them as needed to minimize the impact of a leaked token.

How It Works in Sketch-Context-MCP

The Sketch API key is required for accessing Sketch Cloud-hosted files. The server uses this key to authenticate requests to Sketch Cloud and retrieve the necessary design data. The key is passed securely via the Authorization header when making API requests.

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

Using the Sketch Plugin

Connection Tab

The Connection tab allows you to connect to the Sketch Context MCP server:

  1. Enter the port number (default is 3333)
  2. Click "Connect" to establish a WebSocket connection
  3. Once connected, you'll see a confirmation message with the channel ID
  4. Follow the instructions for connecting Cursor to the server

Selection Tab

The Selection tab displays information about selected layers in your Sketch document:

  1. Select one or more layers in your Sketch document
  2. The selected layers will be displayed in the list
  3. Click "Copy Selection IDs" to copy the layer IDs to your clipboard
  4. Use these IDs in Cursor to reference specific layers

About Tab

The About tab provides information about the plugin and how to use it.

Using with Cursor

Once both Sketch and Cursor are connected to the MCP server:

  1. Select elements in Sketch
  2. Copy their IDs using the Sketch Context MCP plugin
  3. In Cursor, reference these elements by their IDs

Example commands in Cursor:

  • "Show me the details of the layer with ID 12345"
  • "Create a blue rectangle with width 300 and height 200"
  • "Add a text layer with the content 'Hello World'"

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
  • WebSocket Connection Failed: Ensure the port is not blocked by a firewall

Logs

To enable detailed logging, set the DEBUG environment variable:

bash
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.

Встановлення

TypingMind
Передумови:

Node.js 18+

{
  "mcpServers": {
    "sketch-context-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "sketch-context-mcp"
      ],
      "env": {
        "SKETCH_API_KEY": "your-sketch-api-key-here"
      }
    }
  }
}

Використовуйте MCP Sketch Context з різними моделями ШІ

TypingMind підключає інструменти MCP на рівні робочого простору, тож після підключення Sketch Context ви можете використовувати їх із різними моделями ШІ в TypingMind, а не налаштовувати окремо для кожної моделі. Ця інтеграція MCP працює локально через конектор MCP TypingMind на вашому пристрої.

Інструкція з налаштування локального конектора

Виберіть цей варіант, якщо серверу MCP потрібен доступ до локальних файлів, програм або приватних ресурсів на вашому комп’ютері.

1

Відкрийте налаштування MCP

У TypingMind перейдіть до розділу «Налаштування», відкрийте «Розширені налаштування», потім «Протокол контексту моделі» й виберіть «Параметри конектора».

  1. Відкрийте TypingMind у браузері.
  2. Натисніть значок налаштувань.
  3. Перейдіть до розділу «Розширені налаштування».
  4. Відкрийте розділ «Протокол контексту моделі».
  5. Натисніть «Параметри конектора» й виберіть «Цей пристрій».
Екран налаштування конектора MCP у TypingMind з вибраним варіантом «Цей пристрій»
2

Виконайте команду конектора

Виберіть «Цей пристрій», скопіюйте команду з TypingMind і виконайте її в терміналі. Не зупиняйте процес, поки користуєтеся MCP.

  1. Скопіюйте команду налаштування, показану в TypingMind.
  2. Відкрийте «Термінал» у macOS або Windows Terminal у Windows.
  3. Вставте й виконайте команду.
  4. Підтвердьте встановлення пакета, якщо термінал запитає дозволу продовжити.
  5. Не закривайте вікно термінала й не зупиняйте процес, поки користуєтеся інструментами MCP.
3

Додайте Sketch Context як сервер

Коли статус конектора зміниться на «Готово», натисніть «Змінити сервери» та вставте конфігурацію сервера MCP.

  1. Зачекайте, доки статус конектора зміниться на «Готово».
  2. Натисніть «Змінити сервери».
  3. Вставте конфігурацію сервера MCP Sketch Context.
  4. Збережіть список серверів.
  5. Оновіть дані, щоб переконатися, що конектор досі готовий до роботи.
Налаштування MCP у TypingMind з активним сервером і кнопкою «Змінити сервери»
{
  "mcpServers": {
    "sketch-context": {
      "command": "npx",
      "args": [
        "-y",
        "sketch-context-mcp"
      ]
    }
  }
}
4

Використовуйте підключення з різними моделями

Збережіть список серверів, відкрийте «Плагіни», увімкніть інструменти MCP для Sketch Context, а потім виберіть будь-яку підтримувану модель ШІ в TypingMind і використовуйте інструменти в чаті або призначте їх агенту ШІ.

  1. Відкрийте сторінку «Плагіни» в TypingMind.
  2. Увімкніть інструменти MCP для Sketch Context.
  3. Почніть чат і виберіть модель ШІ, яку хочете використовувати.
  4. Використовуйте інструменти MCP у чаті або призначте їх агенту ШІ.
  5. За потреби перемикайтеся на іншу модель ШІ без повторного підключення MCP.
Чат TypingMind із використанням увімкнених інструментів MCP і вибраної моделі ШІ
Допоможете з цим завданням через Sketch Context?
Sketch Context
Звісно. Я це прочитав.
Ось що я знайшов за допомогою Sketch Context.

Поширені запитання

Для чого використовується сервер MCP Sketch Context?

Sketch Context — це сервер MCP, який дає змогу сумісним клієнтам ШІ підключатися до зовнішніх інструментів і контексту. У TypingMind ви можете додати цей сервер MCP один раз і зробити його інструменти доступними у своєму робочому просторі ШІ.

Чи можу я використовувати MCP Sketch Context з кількома моделями ШІ в TypingMind?

Так. TypingMind підключає інструменти MCP на рівні робочого простору, тому ви можете використовувати Sketch Context з різними моделями ШІ, як-от Claude, ChatGPT, Gemini або іншими моделями, які ви налаштували в TypingMind, без окремого налаштування сервера MCP для кожної моделі.

Навіщо використовувати MCP Sketch Context із TypingMind?

TypingMind — один із найкращих інтерфейсів для чату з великими мовними моделями, адже він об’єднує різні моделі ШІ, промпти, плагіни, агентів ШІ, ключі API та інструменти MCP в одному робочому просторі. Підключивши Sketch Context, ви зможете використовувати його інструменти MCP з вибраними моделями та впорядковано працювати з чатами в TypingMind.

Як підключити MCP Sketch Context до TypingMind?

Sketch Context працює через локальний конектор MCP TypingMind. Це найкращий варіант, коли серверу MCP потрібен доступ до локальних файлів, настільних застосунків, інструментів командного рядка або приватних ресурсів на вашому комп’ютері.

Які інструменти надає MCP Sketch Context у TypingMind?

Sketch Context надає можливості MCP, які можна ввімкнути на сторінці «Плагіни» в TypingMind і використовувати в чаті або призначати агентам ШІ.

Чи потрібно передавати свої ключі API в TypingMind, щоб використовувати MCP Sketch Context?

Ні. TypingMind орієнтований насамперед на локальну роботу й дає змогу зберігати контроль над постачальниками моделей, ключами API, промптами та конфігурацією MCP. Якщо Sketch Context потребує автентифікації, під час створення підключення додайте потрібні заголовки, налаштування OAuth або локальну конфігурацію для цього сервера MCP.

Схожі сервери MCP

Усі

Створіть власний ШІ-простір уже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇