Unlayer MCP
Unlayer's hosted MCP server is live and ready to try in beta. The endpoint and all 14 tools documented on this page are available now. While in beta, tool behavior may evolve as we learn from real-world use. Try it and tell us what you build — email support@unlayer.com or use the in-product chat in Console.
The Model Context Protocol (MCP) is an open standard for connecting AI clients — Claude Desktop, Cursor, Codex, Claude Code, and others — to external tools and data sources. Unlayer MCP is a hosted Streamable HTTP server at:
https://api.unlayer.com/mcp
Connect an MCP-compatible client to that URL and you get a typed surface over your Unlayer workspace — no glue code or custom integration required.
Connect to Unlayer MCP
Browser sign-in with OAuth (recommended)
Use this path with any MCP client that supports OAuth. The client discovers Unlayer's authorization server, opens a browser, and manages access-token refreshes for you.
-
Add a custom MCP server in your client. Name it Unlayer MCP and enter:
https://api.unlayer.com/mcp -
Select Connect or Sign in. Your browser opens the Unlayer authorization flow.
-
Sign in, choose the project the client can access, and approve the requested permissions. Don't have an Unlayer account? Sign up free.
-
Return to your client. The 14 Unlayer tools are ready to use.
The flow uses OAuth 2.1 with PKCE (S256), Dynamic Client Registration, authorization codes, and rotating refresh tokens. You don't need to create or paste a token.
In Claude Desktop, open Settings → Connectors → Add custom connector, enter the URL above, save, and select Connect. Other OAuth-capable clients use the same server URL and browser flow.
Manual bearer token setup
If your client doesn't offer browser sign-in, configure a bearer token manually:
-
Open Console and choose the project you want to use. Don't have an account? Sign up free.
-
Create either an API Key (
unlayer_sk_*, scoped to one project) or a Personal Access Token (unlayer_pat_*, works across your projects). -
Add the server URL and token to your client's MCP configuration:
{"mcpServers": {"unlayer": {"url": "https://api.unlayer.com/mcp","headers": {"Authorization": "Bearer <your-token>"}}}} -
Restart or reconnect the client. It discovers the available tools automatically with
tools/list.
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.
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 the full token and OAuth details.
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; an invalid token returns an authentication error. Depending on the token shape, that may be an HTTP 401 response or an MCP tool result with isError: true.
Available tools
The live beta includes 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.
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 — typed access to supported Cloud API operations from server-side code.
- CLI — terminal tool for managing templates and projects.
- Model Context Protocol specification — upstream protocol docs.