penpot-headless

penpot-headless

A portable MCP server for headless Penpot project/file/content management, using Penpot's RPC API directly. No browser, no Penpot plugin session.

Category
访问服务器

README

penpot-headless

A portable MCP server for headless Penpot project/file/content management, using Penpot's RPC API directly. No browser, no Penpot plugin session.

This package has zero project-specific knowledge — no hardcoded colors, fonts, or Penpot instance URL. Every consuming project supplies its own config and token file, so it can be installed from npm or copied as-is into another project.

What this does

  • Team/project/file/page CRUD (penpot_list_teams, penpot_create_file, etc.)
  • Shape creation — rect, frame, text — via penpot_add_shapes, with colors/fonts resolved either from a literal value or a { "token": "name" } reference against your project's token file.
  • Reading a file's current shape tree via penpot_get_file_snapshot.
  • Rendering a shape or page to PNG/SVG via penpot_export_shape (requires PENPOT_LOGIN_EMAIL/PENPOT_LOGIN_PASSWORD, see below) — no browser tab or Penpot plugin session needed on your end.

Render/export capability

penpot_export_shape renders a shape (or an entire page, by passing its root frame's id) to PNG or SVG, using Penpot's own server-side exporter — the same headless-Chromium-backed service Penpot's self-hosted stack already runs (the penpotapp/exporter container). No browser automation happens in this package; it's two HTTP calls (login, then export) against your Penpot instance.

This needs a second, separate auth mode from the rest of this package: Penpot's export pipeline (POST /api/export) is a distinct microservice from the /api/rpc/command/* surface everything else here uses, and it authenticates purely via a session cookie — a personal access token in an Authorization header is never read on this path (confirmed by reading Penpot's exporter source: its wrap-auth looks for a literal auth-token cookie and nothing else). So this tool logs in with PENPOT_LOGIN_EMAIL/PENPOT_LOGIN_PASSWORD to obtain that cookie, independently of PENPOT_ACCESS_TOKEN.

Important: PENPOT_ACCESS_TOKEN and PENPOT_LOGIN_EMAIL/ PENPOT_LOGIN_PASSWORD must belong to the same Penpot account (or at least accounts with access to the same team). If they're different accounts, penpot_export_shape will time out — the export session can't see a file it has no permission to open, and Penpot's exporter doesn't distinguish "shape not visible" from "access denied," so the failure surfaces as a generic 10-second render timeout.

If your Penpot instance doesn't expose password login (e.g. SSO-only instances), or you'd rather not configure these credentials, simply omit PENPOT_LOGIN_EMAIL/PENPOT_LOGIN_PASSWORD — the export tool won't be registered, and every other tool works exactly as before.

Also out of scope: rotated shapes (only rotation: 0 is supported — selrect/points/transform are computed as identity-matrix math, which only holds for unrotated shapes), and components/variants/auto-layout.

Setup

  1. Generate a Penpot access token: your Penpot instance → Account settings → Access tokens. (Self-hosted instances: this section is hidden unless the backend/frontend are started with PENPOT_FLAGS including enable-access-tokens.)

  2. Create a token file for your project (see design-tokens/*.tokens.json in the consuming repo for an example — or write your own matching the schema below).

  3. If you want penpot_export_shape, also set PENPOT_LOGIN_EMAIL/ PENPOT_LOGIN_PASSWORD to the same account the access token above belongs to (see "Render/export capability" above for why). Skip this if you don't need rendering.

  4. Register this server in your MCP client config, e.g.:

    {
      "mcpServers": {
        "penpot-headless": {
          "command": "npx",
          "args": ["-y", "@ai-dala/penpot-headless"],
          "env": {
            "PENPOT_BASE_URL": "https://your-penpot-instance.example.com",
            "PENPOT_ACCESS_TOKEN": "your-token-here",
            "PENPOT_TOKENS_PATH": "/path/to/your-project/design-tokens/tokens.json",
            "PENPOT_LOGIN_EMAIL": "same-account-as-the-token-above@example.com",
            "PENPOT_LOGIN_PASSWORD": "that-account's-password"
          }
        }
      }
    }
    

    Or, if working from a local clone instead of the published package:

    {
      "mcpServers": {
        "penpot-headless": {
          "command": "npx",
          "args": ["tsx", "/path/to/penpot-mcp/src/server.ts"],
          "env": {
            "PENPOT_BASE_URL": "https://your-penpot-instance.example.com",
            "PENPOT_ACCESS_TOKEN": "your-token-here",
            "PENPOT_TOKENS_PATH": "/path/to/your-project/design-tokens/tokens.json",
            "PENPOT_LOGIN_EMAIL": "same-account-as-the-token-above@example.com",
            "PENPOT_LOGIN_PASSWORD": "that-account's-password"
          }
        }
      }
    }
    

Token file schema

{
  "colors": {
    "accent": "#7AA2FF",
    "bg-surface": "#111726"
  },
  "fonts": {
    "sans": { "family": "Inter", "weights": ["400", "500", "600"] }
  }
}

Any color-typed field in penpot_add_shapes accepts either a literal hex string or { "token": "accent" }, resolved against this file at call time.

Copying to another project

This package is published to npm as @ai-dala/penpot-headless, so most consuming projects can just reference it via npx (see above) without a local copy.

If you'd rather vendor it, this directory has its own package.json/tsconfig.json and depends only on @modelcontextprotocol/sdk and zod — no framework dependencies. Copy the whole penpot-headless/ directory into the new project, run npm install, write a token file for that project, and register the server with a PENPOT_TOKENS_PATH pointing at it.

Known limitations

  • penpot_export_shape requires password-login credentials for the same account as the access token — see "Render/export capability" above. Instances that are SSO/OIDC-only (no password login) can't use it.
  • Unrotated shapes only.
  • No component, variant, or auto-layout tool support — only rect, frame, text.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选