MCP
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
| Tool | What it does |
|---|---|
diagnose_template | Inspect a template for common issues — schema problems, missing alt text, WCAG AA contrast, oversized images, malformed merge tags. |
get_template | Fetch one template by ID, including its design JSON. |
list_templates | List templates in a project (cursor-paginated). |
AI generation
| Tool | What it does |
|---|---|
ai_generate_design | Generate a design or refine an inline/saved design with the AI Assistant. |
import_html_to_design | Turn an existing HTML email or page into an editable Unlayer design. |
Render & export
| Tool | What it does |
|---|---|
export_design | Export a saved template to HTML, PNG, or PDF. |
render_email | Render an email design (HTML output tuned for email clients). |
render_preview_image | Render a design to a PNG preview image (S3-hosted URL). |
Unlayer Elements
| Tool | What it does |
|---|---|
get_elements_schema | Get the supported Unlayer Elements component and property schema. |
render_elements | Render an Elements component tree to source code, production HTML, design JSON, and preview. |
Workspace & account
| Tool | What it does |
|---|---|
get_my_subscription | Look up the caller's plan, customer-facing features, and usage limits. |
list_recent_releases | Get a link to Unlayer's official changelog — point users there for what's new and what changed. |
list_workspaces | List the workspaces the caller has access to. |
Discovery
| Tool | What it does |
|---|---|
search_documentation | Full-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:
| Scope | Permission |
|---|---|
templates:read | List and read templates in the selected project. |
designs:write | Generate, import, and edit temporary designs. |
render:execute | Render 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.
-
Open Settings → Connectors → Add custom connector.
-
Give it a name (e.g. Unlayer) and paste the server URL:
https://api.unlayer.com/mcp -
Save, then click Connect. A Unlayer sign-in window opens.
-
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.
-
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. -
Add the server to your client's MCP config. Most clients accept a
urlplus aheadersblock:{"mcpServers": {"unlayer": {"url": "https://api.unlayer.com/mcp","headers": {"Authorization": "Bearer <your-token>"}}}} -
Restart the client. It introspects the tool list on connect (
tools/list) and the tools become available to the agent.
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" } }
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 redaction —
Authorization,Cookie, andX-Unlayer-Project-Idare redacted from server logs.
Related
- 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.