Render markdown into email-safe HTML, lint drafts for deliverability problems, and preview emails.
emailmd โ Model Context Protocol (MCP) Server
The dev.emailmd/emailmd MCP server provides tools to convert markdown into email-safe HTML, generate a plain-text version for text/plain MIME, lint drafts for deliverability problems, and preview emails. It targets compatibility across major mail clients including Gmail, Outlook, Apple Mail, Yahoo, and others.
๐ ๏ธ Key Features
Markdown-to-HTML conversion for responsive, email-safe output
Plain-text generation alongside HTML (text/plain support)
Linting for deliverability issues
Email preview capability
๐ Use Cases
Prepare email content authored in markdown
Produce multi-part email payloads with both HTML and text bodies
Check markdown drafts for deliverability-related problems
Preview rendered emails before sending
โก Developer Benefits
Returns complete email-safe HTML and a plain text version from a render call
Markdown workflow using a simple render API
โ ๏ธ Limitations
Focused on email HTML/text output and deliverability linting; specifics beyond these functions are not provided.
Captured live from the server via tools/list.
render
Render emailmd markdown into email-safe HTML. Returns html (the complete email document), text (the plain-text MIME part), meta (frontmatter), warnings (non-fatal repairs made while rendering; aim for none), htmlBytes, and previewUrl (a live browser preview of this exact document to share with the user).
Parameters3
markdown
string
required
The emailmd markdown document, optionally starting with YAML frontmatter.
minify
boolean
optional
Minify the HTML. Recommended for sending; helps stay under Gmail's 102KB clip limit.
partials
object
optional
Named markdown partials spliced in wherever the document says "::: include <name>".
Check emailmd markdown for deliverability, accessibility, and readability problems without rendering it: missing alt text, http:// links, Gmail's 102KB clip limit, generic link text, spam-trigger phrases, and more. Fix warnings before sending; suggestions are sometimes intentional (e.g. transactional emails without an unsubscribe link).
Parameters2
markdown
string
required
The emailmd markdown document, optionally starting with YAML frontmatter.
partials
object
optional
Named markdown partials spliced in wherever the document says "::: include <name>".
Fetch emailmd documentation from emailmd.dev. Call with no arguments for the index of all pages; pass page to read one (e.g. 'buttons', 'frontmatter', 'theme', 'directives/hero'). Read the relevant page before using syntax you are not sure about.
Parameters1
page
string
optional
Docs page path, e.g. 'buttons' or 'directives/hero'. Omit for the index.
Raw schema
{
"type": "object",
"properties": {
"page": {
"description": "Docs page path, e.g. 'buttons' or 'directives/hero'. Omit for the index.",
"type": "string",
"maxLength": 200,
"pattern": "^[a-z0-9][a-z0-9/-]*$"
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}
emailmd converts markdown into responsive, email-safe HTML that works across Gmail, Outlook, Apple Mail, Yahoo, and every other client.
Install
bash
npm install emailmd
Quick Start
typescript
import { render } from"emailmd";
const { html, text } = awaitrender(`
# Welcome!
Thanks for signing up.
[Get Started](https://example.com){button}
`);
// html โ complete email-safe HTML// text โ plain text version for text/plain MIME part
v0.3.0 migration:render() is now async. Update calls from render(md) to await render(md). Requires Node 20+ (MJML 5).
Charts & Data
Bar charts, progress meters, sparklines, KPI tiles, step trackers, and star ratings, each written as a plain markdown list:
markdown
::: chart
- Spotify: 16,900
- Apple Podcasts: 12,400
- Web player: 6,200
- RSS: 2,900
:::
KPI tiles, a bar chart and a sparkline, rendered by emailmd from plain markdown lists
They are drawn from table cells and text glyphs rather than images or SVG, so they still render when the client blocks remote images, and they redraw themselves in the plain-text part instead of collapsing to a list of numbers. See the directives reference.
CLI
emailmd also ships with a command-line interface.
bash
# Render to HTML
emailmd input.md
# Write to file
emailmd input.md -o output.html
# Plain text output
emailmd input.md --text
# Pipe from another commandecho"# Hello" | emailmd
Run emailmd --help for all options.
React
@emailmd/react provides a live-preview hook (useEmailmd), an <EmailPreview /> iframe component, and <EmailmdBuilder /> โ the full builder as a drop-in component for your own app.
bash
npm install @emailmd/react emailmd
Learn More
Docs โ full syntax reference, theming, frontmatter, directives, and API
Templates โ ready-made email templates you can copy and customize
Builder โ live editor to write and preview emails in your browser
MCP
emailmd ships a Model Context Protocol server, so an AI assistant can render, lint, and preview emails for you. It exposes three tools โ render (markdown to email-safe HTML), lint (flag deliverability problems without rendering), and read_docs (look up emailmd syntax) โ over either transport:
bash
# Hosted (Streamable HTTP)
https://www.emailmd.dev/api/mcp
# Or run it locally over stdio
npx emailmd mcp
Published to the official MCP registry as dev.emailmd/emailmd. See the MCP docs for per-client setup.
AI
Prefer plain context over tools? emailmd is just markdown, so AI is great at writing templates. Feed the full docs to your AI tool:
code
https://www.emailmd.dev/llms-full.txt
Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request.
emailmd is under active development. The API may change between minor versions until we hit 1.0 โ breaking changes are always called out in the changelog. See Stability & Versioning for what the semver contract covers.