New in Sketch: A major redesign, an all-new Inspector, and more Learn more

Skip Navigation

MCP Server

Last updated on 1 Dec 2025
4 min read

Sketch includes a built-in MCP Server, a lightweight local-only web server that lets AI clients like ChatGPT or Claude interact directly with Sketch. Through the MCP Server, these clients can access or modify data in your Sketch documents using a set of defined MCP commands (also called tools).

When an AI client connects to the Sketch MCP Server, it automatically learns which tools are available and how to use them. These details are supplied by the server and injected into the model’s context, allowing it to reason about Sketch-specific actions.

Once you connect it, your AI agent can issue requests such as “export all icons for developer handoff” or “find inconsistencies in the design system”. The AI then selects the most suitable MCP command and calls it.

Typical use cases include:

  • Exporting assets for developer handoff
  • Reviewing or auditing design systems for inconsistencies
  • Generating new screens from templates using existing components

How to start Sketch’s MCP Server

  1. In Sketch, press K to open the Command Bar and type “MCP”.
  2. Choose Start MCP Server.
  3. At this point, a macOS security dialog may ask you to allow Sketch to access your Local Network. This is required for the MCP server to operate. Please choose “Allow”.
  4. At the bottom of your Sketch document you should see a confirmation message confirming the MCP server’s address and port.

Alternatively, you can enable and disable the MCP Server in Settings > General > MCP Server.

An image highlighting the MCP Server section in the Settings window.

If you see an error message when you attempt to start the MCP server, please let us know.

How to connect your AI client

Once you’ve activated the MCP server, you may connect your AI client application to it.

  1. Run the following command to connect Claude Code to the Sketch MCP server:

    claude mcp add --transport http sketch http://localhost:31126/mcp
    
  2. And then verify that Claude Code is connected to the MCP server:

    claude mcp get sketch
    
  1. Press P to open the Command Palette, type in MCP Add.
  2. Choose the MCP: Add Server option.
  3. Select HTTP as the MCP server type when prompted.
  4. Paste this URL when prompted:

    http://localhost:31126/mcp
    
  5. Give this server a name, e.g. sketch.
  6. Press I to open a new Copilot chat in Agent mode.
  1. Go to Cursor > Settings > Cursor Settings menu
  2. Navigate to the Tools & MCP tab
  3. Click Add Custom MCP
  4. Insert the following text into the auto-generated mcp.json file:

    {
      "mcpServers": {
        "sketch": {
          "url": "http://localhost:31126/mcp",
          "type": "http"
        }
      }
    }
    
  5. Switch back to Cursor Settings tab and make sure there’s a green dot next to the sketch MCP server entry.
  1. Add the following lines to your ~/.codex/config.toml file:

    [mcp_servers.sketch]
    url = "http://localhost:31126/mcp"
    
  2. Run codex, type /mcp and verify that the Sketch MCP server is active:

    /mcp
    
    🔌  MCP Tools
      • Server: sketch
        • URL: http://localhost:31126/mcp
        • Tools: get_selection_as_image, run_code
    

Sketch’s MCP tools

For now, we’ve focused on two tools that should cover most use cases:

  1. get_selection_as_image captures an image of the user’s current selection in the frontmost Sketch document and returns it to the AI client for analysis.
  2. run_code allows the AI to write and execute SketchAPI code to complete a task you’ve prompted it with.

The run_code tool is especially powerful. Since AI models excel at writing code, we let them access the entire SketchAPI — just like a Sketch plugin would. This means the AI can automate and control Sketch through scripts with multiple steps, branching, and even error handling.

If the AI encounters code errors, it can review them, adjust the script, and try again — iterating automatically until the code achieves the intended result. You can watch this process unfold or step in at any point, but the AI can often complete the loop entirely on its own.

How to work with Sketch and your AI tool

You generally don’t need to specify which MCP tool to call — the AI will decide that on its own. That said, you can still mention a tool explicitly if you want to guide its approach. Here are some examples of the type of prompts you could use:

  • Explain the visual layout of the selected Sketch frame
  • Are there any symbol masters in my active Sketch document that don’t have any instances?
  • List all design tokens used in my Sketch selection
  • Create a vertical stack of four rectangles in Sketch and add a unique gradient pattern to each
  • Fix grammar and spelling mistakes on the selected Sketch frame
  • Export all Sketch symbols prefixed with “icon/” from the current page as SVGs to my Desktop
  • Show the full component hierarchy of my Sketch selection as a tree
  • Generate my current Sketch selection in React
  • Replace every text layer on the selected frame with a random Apple product name (including text inside symbols).

The prompt ideas above are basic examples. A good prompt would typically include more detail, break the task into well-defined steps, provide some rules for your AI client to follow, and even suggest how to validate the results.

Troubleshooting

If you’re having trouble setting up or using the MCP Server — for example, if the connection between your AI client and Sketch isn’t working or certain tools don’t respond as expected — head over to the Troubleshooting page.

Security

The MCP server is local-only and cannot be accessed remotely. Each call is handled locally by the MCP server — that is, by Sketch itself — and the results are sent back to the AI client for further processing. The server is off by default, and you have full control over when and how external AI clients connect to it.