Skip to main content

MCP

Under active development

Unlayer's MCP server is under active development and coming soon. The endpoint, install commands, and connection instructions on this page describe the shape of what's shipping. Interested? Tell us how you'd use it — email support@unlayer.com or use the in-product chat in Console, and we'll loop you in early.

The Model Context Protocol (MCP) is an open standard for connecting AI clients — Claude Desktop, Cursor, Codex, Claude Code — to external tools and data sources. Unlayer's MCP server is a hosted Streamable HTTP endpoint at:

https://api.unlayer.com/mcp

Point any MCP-compatible client at that URL with a bearer token and you get a typed surface over your Unlayer workspace — no glue code, no custom integration.

Tools

The first release ships 14 tools, grouped by what they do:

Templates

ToolWhat it does
diagnose_templateInspect a template for common issues — schema problems, missing alt text, WCAG AA contrast, oversized images, malformed merge tags.
get_templateFetch one template by ID, including its design JSON.
list_templatesList templates in a project (cursor-paginated).

AI generation

ToolWhat it does
ai_generate_designGenerate a design or refine an inline/saved design with the AI Assistant.
import_html_to_designTurn an existing HTML email or page into an editable Unlayer design.

Render & export

ToolWhat it does
export_designExport a saved template to HTML, PNG, or PDF.
render_emailRender an email design (HTML output tuned for email clients).
render_preview_imageRender a design to a PNG preview image (S3-hosted URL).

Unlayer Elements

ToolWhat it does
get_elements_schemaGet the supported Unlayer Elements component and property schema.
render_elementsRender an Elements component tree to source code, production HTML, design JSON, and preview.

Workspace & account

ToolWhat it does
get_my_subscriptionLook up the caller's plan, customer-facing features, and usage limits.
list_recent_releasesGet a link to Unlayer's official changelog — point users there for what's new and what changed.
list_workspacesList the workspaces the caller has access to.

Discovery

ToolWhat it does
search_documentationFull-text search over docs.unlayer.com — useful for grounding an AI client's answers in our docs.

Each tool's schema is fully typed; MCP clients introspect them on connection (tools/list), so the AI client knows exactly what arguments each tool accepts and what it returns.

Authentication

Every request must carry a Bearer token in the Authorization header. Use an API Key (unlayer_sk_*) for CI and single-project automation, a Personal Access Token (unlayer_pat_*) for developer tools that span projects, or OAuth 2.1 for interactive clients such as Claude and ChatGPT. OAuth uses PKCE and Dynamic Client Registration; the client token is accepted only by the MCP resource and is never forwarded to the Cloud API.

OAuth connections are bound to the project selected during consent and grant three permissions:

ScopePermission
templates:readList and read templates in the selected project.
designs:writeGenerate, import, and edit temporary designs.
render:executeRender designs to HTML, PDF, or images.

See Authentication for step-by-step instructions on how to get each token type from Console.

Connecting from an MCP client

Claude Desktop (OAuth)

Claude Desktop connects over OAuth — no token to copy or paste. Claude registers itself with Unlayer and walks you through sign-in on first use.

  1. Open Settings → Connectors → Add custom connector.

  2. Give it a name (e.g. Unlayer) and paste the server URL:

    https://api.unlayer.com/mcp
  3. Save, then click Connect. A Unlayer sign-in window opens.

  4. Approve the requested permissions. Claude stores the access token and refreshes it automatically — you won't be asked again unless you disconnect.

Once listed in Anthropic's Connectors Directory you'll be able to add Unlayer in one click instead of entering the URL by hand.

Cursor / Codex / Claude Code (bearer token)

Any client that speaks MCP over Streamable HTTP can connect with the same URL plus a bearer token.

  1. Get a token from Console — either an API Key (unlayer_sk_*, scoped to one project) or a Personal Access Token (unlayer_pat_*, works across your projects). Both go in the same place.

  2. Add the server to your client's MCP config. Most clients accept a url plus a headers block:

    {
    "mcpServers": {
    "unlayer": {
    "url": "https://api.unlayer.com/mcp",
    "headers": {
    "Authorization": "Bearer <your-token>"
    }
    }
    }
    }
  3. Restart the client. It introspects the tool list on connect (tools/list) and the tools become available to the agent.

Which token, and do I need a projectId?

An API Key (unlayer_sk_*) embeds its project, and an OAuth connection is bound to the project selected during consent, so both can omit projectId. A Personal Access Token (unlayer_pat_*) spans your projects — call list_workspaces first, then pass the projectId to project-scoped tools.

Testing your connection

You don't need a client to check a token works — the server is plain JSON-RPC over POST /mcp. Drop in either token type:

curl https://api.unlayer.com/mcp \
-H "Authorization: Bearer <your-token>" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": { "name": "list_templates", "arguments": { "limit": 2 } }
}'

A successful call returns your templates; a bad token returns 401.

Example: generate a design and preview it

A typical agent flow chains a few tools. Here's "make me a product-launch email and show me what it looks like".

1. Establish the project context. OAuth uses the project selected during consent, and an API Key embeds its project, so both can skip this step. With a PAT, call list_workspaces with no arguments to discover the projectId required by project-scoped tools:

{
"data": [
{
"id": 1,
"name": "Acme",
"projects": [{ "id": 12345, "name": "Marketing" }]
}
]
}

2. Generate the design. Call ai_generate_design with the prompt. Include the projectId from step 1 only when using a PAT. This opens an ephemeral editor session — nothing is saved to the project:

{
"prompt": "Product launch newsletter for Nova Pro, dark theme",
"displayMode": "email"
}

It returns an editor URL, a preview image, and the design JSON (abbreviated here):

{
"editorUrl": "https://editor.unlayer.com/?session=...",
"previewImageUrl": "https://s3.../preview.png",
"displayMode": "email",
"design": { "body": {} }
}

Render previewImageUrl inline to show the design, and surface editorUrl as the call-to-action. The hosted editor saves changes only into the temporary session; use Download design or Download HTML before it expires when a durable copy is needed.

3. Refine without saving. Pass the returned design and displayMode back into ai_generate_design with the next prompt. The refinement starts from that exact design and opens another temporary editor session:

{
"prompt": "Make the call-to-action button red",
"design": { "body": {} },
"displayMode": "email"
}

Use templateId instead of design when the starting point is already saved as a project template. Do not pass both.

4. Preview. Pass the current design straight into render_preview_image (no save needed) to regenerate the PNG after a change:

{
"design": { "body": {} },
"displayMode": "email"
}

It returns the new image URL:

{ "data": { "url": "https://s3.../preview.png" } }
Editor sessions are temporary

ai_generate_design, import_html_to_design, render_*, and export_* never create, edit, or delete a template in your project. Save updates the short-lived editor session; it does not create a project template. Download the current design JSON or HTML before the session expires when you need to retain it.

Production guarantees

  • Origin allowlist — the server enforces an allowed-origin list (Anthropic Connectors Directory requirement).
  • Request limits — 1 MiB request body cap, per-client request and concurrency limits, and a 240s upstream timeout (sized for AI-heavy tools like ai_generate_design).
  • Tool-result truncation — results larger than 140K characters are truncated (under Anthropic's 150K cap).
  • Header redactionAuthorization, Cookie, and X-Unlayer-Project-Id are redacted from server logs.
  • Cloud API — the REST surface every MCP tool wraps.
  • Skills — packaged context for AI coding agents that work alongside MCP.
  • SDK — alternative way to call the same endpoints from code.
  • CLI — terminal tool for managing templates and projects.
  • Model Context Protocol specification — upstream protocol docs.