mcp-sketch

mcp-sketch

Local MCP server for parsing Sketch exported HTML zip archives and extracting design structure information.

Category
Visit Server

README

mcp-sketch

English | 中文

<a href="https://glama.ai/mcp/servers/YamadaAoi/mcp-sketch"> <img width="380" height="200" src="https://glama.ai/mcp/servers/YamadaAoi/mcp-sketch/badge" /> </a>

本地 MCP 服务,用于解析 Sketch 导出的 HTML zip 压缩包并提取设计结构信息。

功能

  • 解析 Sketch 导出的 HTML zip 压缩包并提取设计结构
    • 支持按 page、artboard 筛选
    • 支持指定矩形区域解析
    • 输出设计结构 JSON 和预览图供 AI 参考

使用方法

1. 配置 MCP 客户端

配置为本地 MCP 服务,具体配置方式参考各工具配置 MCP 的文档。

  • opencode
{
  "mcp": {
    "mcp-sketch": {
      "type": "local",
      "command": ["npx", "-y", "mcp-sketch"],
      "enabled": true,
      "environment": {
        "LOG_LEVEL": "debug"
      }
    }
  }
}
  • Trae
{
  "mcpServers": {
    "mcp-sketch": {
      "command": "npx",
      "args": ["-y", "mcp-sketch"]
    }
  }
}

2. 调用工具

使用 sketch_html_analyze 工具分析从 Sketch 导出的 HTML zip 压缩包:

参数 类型 必填 说明
file_path string Sketch HTML zip 压缩包路径
page_id string 页面 ID
page_name string 页面名称
artboard_id string 画板 ID
artboard_name string 画板名称
rect number[] 指定解析矩形区域,格式为 [x, y, width, height](x, y 为左上角坐标,width, height 为矩形宽度和高度)
assets_path string 切图存放路径,默认 src/assets/sketch
saveResult boolean 是否保存分析结果到本地文件,默认 true

选择优先级

  • page: page_id > page_name > 第一个 page
  • artboard: artboard_id > artboard_name > 第一个 artboard
  • rect: 指定解析矩形区域,过滤规则是只要元素的x,y在矩形内,就会被解析。

返回结果

工具会返回文本:Sketch Structure JSON: {解析结果}\nSketch Preview Image: {预览图路径}

  • 解析结果
    • meta: 描述信息
    • artboard: 画板数据,包含图层、样式、图片等信息

示例

  • 分析 Sketch HTML zip 压缩包中第一个页面第一个画板:
sketch_html_analyze({ file_path: "/path/to/export.zip" })
  • 分析指定页面第一个画板:
sketch_html_analyze({ file_path: "/path/to/export.zip", page_name: "首页" })
  • 分析指定页面指定画板:
sketch_html_analyze({ file_path: "/path/to/export.zip", page_name: "首页", artboard_name: "用户管理" })
  • 分析指定页面指定画板指定区域,如解析用户管理画板顶部导航栏:
sketch_html_analyze({ file_path: "/path/to/export.zip", page_name: "首页", artboard_name: "用户管理", rect: [0, 0, 1920, 64] })

输出文件位置

  • 解析的切图默认保存在 src/assets/sketch/ 目录下(可通过 assets_path 自定义)
  • 解析的设计内容默认保存到本地 JSON 文件中(用于人工审核),存放文件夹默认与 zip 包同名同级

使用建议

  • 使用支持多模态的模型,可读取预览图修正设计结构
  • 解析给 AI的数据量不超过50KB以提高 AI 分析准确率(本地存储的 JSON 文件是格式化后的,传递给 AI 的是紧凑格式)
  • 推荐使用 rect 参数解析画板中的特定区域,模块化开发,提升颗粒度。

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured