Skip to main content
Glama

MJML MCP Server

A comprehensive Model Context Protocol (MCP) server for MJML email template generation, compilation, and validation. This server provides powerful tools for creating professional email templates using the MJML markup language.

Features

  • MJML Compilation: Compile MJML to responsive HTML with advanced options

  • Template Generation: Pre-built templates for common email types

  • Validation: Validate MJML syntax and structure with configurable levels

  • Component Reference: Get documentation and examples for MJML components

  • File Support: Work with both MJML strings and files

  • Robust Error Handling: Comprehensive error reporting and logging

Related MCP server: SMTP MCP Server

Tools

1. compile_mjml

Compile MJML content to responsive HTML email.

Parameters:

  • input (required): MJML content or file path

  • filePath (optional): Treat input as file path (default: false)

  • beautify (optional): Beautify output HTML (default: true)

  • minify (optional): Minify output HTML (default: false)

  • validationLevel (optional): Validation level - "skip", "soft", "strict" (default: "soft")

  • keepComments (optional): Keep comments in output (default: false)

  • fonts (optional): Custom fonts configuration

  • outputPath (optional): Save compiled HTML to file path

2. validate_mjml

Validate MJML syntax and structure.

Parameters:

  • input (required): MJML content or file path

  • filePath (optional): Treat input as file path (default: false)

  • validationLevel (optional): Validation level - "skip", "soft", "strict" (default: "strict")

3. generate_template

Generate pre-built email templates.

Parameters:

  • template (required): Template type - "newsletter", "welcome", "promotional", "transactional", "password-reset", "verification", "announcement", "invitation"

  • variables (optional): Template variables to replace

  • customColors (optional): Custom color scheme

  • customFonts (optional): Custom fonts

  • outputPath (optional): Save template to file path

4. get_component_info

Get MJML component reference and documentation.

Parameters:

  • component (optional): Specific component name

  • category (optional): Component category - "all", "standard", "advanced", "structural" (default: "all")

Installation

  1. Clone or create the project directory

  2. Install dependencies:

npm install

Usage

Start the Server

npm start

Development Mode

npm run dev

Running Tests

npm test

Template Variables

When generating templates, you can use these variables:

  • company_name: Your company name

  • company_logo: URL to company logo

  • user_name: Recipient's name

  • newsletter_date: Date for newsletter

  • main_title: Main title/heading

  • main_subtitle: Main subtitle

  • featured_image: Featured image URL

  • featured_title: Featured article title

  • featured_content: Featured article content

  • featured_link: Featured article link

  • update1_title, update1_content: First update

  • update2_title, update2_content: Second update

  • discount_percentage: Discount percentage for promotions

  • time_remaining: Time remaining for promotions

  • product_name, product_image, product_description: Product details

  • original_price, sale_price: Pricing information

  • shop_url: Shopping URL

  • dashboard_url: Dashboard URL

  • support_email: Support email address

  • unsubscribe_url: Unsubscribe link

  • website_url: Website URL

  • facebook_url, twitter_url, instagram_url: Social media URLs

  • current_year: Current year (automatically filled)

Example Usage

Compile MJML from String

{
  "name": "compile_mjml",
  "arguments": {
    "input": "<mjml><mj-body><mj-section><mj-column><mj-text>Hello World!</mj-text></mj-column></mj-section></mj-body></mjml>",
    "beautify": true,
    "validationLevel": "soft"
  }
}

Generate Welcome Template

{
  "name": "generate_template",
  "arguments": {
    "template": "welcome",
    "variables": {
      "company_name": "Acme Corp",
      "user_name": "John Doe",
      "support_email": "support@acme.com"
    },
    "customColors": {
      "primary": "#007bff",
      "success": "#28a745"
    },
    "outputPath": "./welcome-email.mjml"
  }
}

Validate MJML File

{
  "name": "validate_mjml",
  "arguments": {
    "input": "./templates/newsletter.mjml",
    "filePath": true,
    "validationLevel": "strict"
  }
}

Get Component Information

{
  "name": "get_component_info",
  "arguments": {
    "component": "mj-button"
  }
}

Error Handling

The server provides comprehensive error handling with detailed error messages:

  • File access errors

  • MJML syntax errors

  • Validation failures

  • Configuration issues

Logging

The server includes structured logging with different levels:

  • INFO: General information

  • WARN: Warnings

  • ERROR: Error messages

  • DEBUG: Debug information (enable with DEBUG environment variable)

Enable debug logging:

DEBUG=1 npm start

Configuration

The server supports various MJML options:

  • Custom fonts configuration

  • Validation levels

  • Output formatting options

  • File input/output handling

Dependencies

  • @modelcontextprotocol/sdk: MCP SDK for server implementation

  • mjml: MJML compiler and validator

  • zod: Schema validation

  • fs-extra: Enhanced file system operations

License

MIT License

Contributing

  1. Fork the repository

  2. Create a feature branch

  3. Make your changes

  4. Add tests if applicable

  5. Submit a pull request

Support

For issues and questions, please open an issue in the project repository.

Available Tools

4 tools
compile_mjmlC

Compile MJML to HTML with various options

ParametersJSON Schema
NameRequiredDescriptionDefault
inputYesMJML content or file path
beautifyNoBeautify the output HTML
minifyNoMinify the output HTML
validationLevelNoValidation levelsoft
filePathNoTreat input as file path
keepCommentsNoKeep comments in output
fontsNoCustom fonts configuration
outputPathNoSave compiled HTML to file path

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Compile') but doesn't describe what happens during compilation (e.g., error handling, performance implications, or output format). It mentions 'various options' but doesn't explain their behavioral impact beyond what the schema covers.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. However, it could be more structured by explicitly listing key options or use cases, but it avoids redundancy and wastes no words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (8 parameters, nested objects) and lack of annotations or output schema, the description is insufficient. It doesn't explain the compilation process, error handling, or what the output looks like (e.g., HTML string or file). For a tool with rich parameters and no structured output info, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 8 parameters. The description adds no additional meaning beyond implying 'various options' exist, which doesn't enhance understanding of individual parameters. The baseline score of 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Compile') and resource ('MJML to HTML'), specifying the core transformation. It distinguishes from siblings like 'validate_mjml' (validation) and 'generate_template' (template creation) by focusing on compilation. However, it doesn't explicitly differentiate from 'get_component_info' in terms of resource scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'validate_mjml' for validation or 'generate_template' for template generation. It mentions 'various options' but doesn't specify contexts or prerequisites for choosing this tool over others.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

generate_templateC

Generate pre-built email templates

ParametersJSON Schema
NameRequiredDescriptionDefault
templateYesTemplate type
variablesNoTemplate variables to replace
customColorsNoCustom color scheme
customFontsNoCustom fonts
outputPathNoSave template to file path

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'generate' but doesn't clarify if this creates new files, requires specific permissions, has rate limits, or what the output looks like (e.g., HTML code, file saved). This is inadequate for a tool with multiple parameters and potential side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded and appropriately sized for the tool's complexity, making it easy for an agent to parse quickly without unnecessary details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects like what happens when 'outputPath' is omitted or how 'customColors' and 'customFonts' are applied, leaving significant gaps for the agent to handle.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters well. The description adds no additional meaning beyond the schema, such as explaining how 'variables' map to template placeholders or what 'outputPath' defaults to. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'generate' and the resource 'pre-built email templates', making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'compile_mjml' or 'validate_mjml', which might also involve template processing, so it misses the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'compile_mjml' or 'validate_mjml'. It lacks context about prerequisites, such as whether it's for creating new templates from scratch or modifying existing ones, leaving the agent to infer usage scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_component_infoC

Get MJML component reference and documentation

ParametersJSON Schema
NameRequiredDescriptionDefault
componentNoSpecific component name (optional)
categoryNoComponent categoryall

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe behavioral traits like whether it's read-only (implied by 'Get'), what happens if parameters are omitted, error conditions, or response format. For a tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence: 'Get MJML component reference and documentation'. It's front-loaded with the core purpose, has zero waste, and is appropriately sized for a simple tool. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (2 parameters, no output schema, no annotations), the description is incomplete. It doesn't explain what the tool returns (e.g., documentation text, examples, or structured data), how to interpret results, or any limitations. Without annotations or output schema, the description should provide more context about behavior and outputs.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description doesn't add any meaning beyond what the input schema provides. The schema has 100% description coverage, with clear documentation for both parameters ('component' and 'category'), including enum values for 'category'. With high schema coverage, the baseline is 3, as the schema does the heavy lifting and the description doesn't compensate with additional context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get MJML component reference and documentation' - a specific verb ('Get') and resource ('MJML component reference and documentation'). It distinguishes from siblings like 'compile_mjml', 'generate_template', and 'validate_mjml' which focus on different operations. However, it doesn't explicitly differentiate itself from potential similar documentation tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to use it (e.g., for learning about MJML components) versus when to use sibling tools like 'compile_mjml' for processing MJML code. There's no context about prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

validate_mjmlB

Validate MJML syntax and structure

ParametersJSON Schema
NameRequiredDescriptionDefault
inputYesMJML content or file path
filePathNoTreat input as file path
validationLevelNoValidation levelstrict

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool validates MJML but doesn't describe what happens during validation (e.g., returns errors/warnings, checks against a schema), whether it's read-only or has side effects, or any performance or permission considerations. For a validation tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just four words ('Validate MJML syntax and structure'), with zero wasted language. It's front-loaded with the core purpose and appropriately sized for a simple validation tool, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (validation with three parameters) and no output schema, the description is minimally adequate but incomplete. It states what the tool does but lacks details on behavior, usage context, or return values. With no annotations and no output schema, the agent must rely heavily on the schema and tool name, leaving gaps in understanding the full context of validation results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter semantics beyond what the input schema provides. Since schema description coverage is 100%, the baseline score is 3. The schema fully documents all three parameters (input, filePath, validationLevel) with descriptions and defaults, so the description doesn't need to compensate, but it also doesn't add any extra context about parameter usage or interactions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Validate MJML syntax and structure', which is a specific verb ('validate') applied to a specific resource ('MJML syntax and structure'). It distinguishes from sibling tools like 'compile_mjml' (which transforms MJML) and 'generate_template' (which creates templates), though it doesn't explicitly mention these distinctions in the description text itself.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when validation is needed (e.g., before compilation), what scenarios it's best for, or how it differs from sibling tools like 'compile_mjml' (which might include validation implicitly). The agent must infer usage from the tool name and context alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updates
    • First observedcompile_mjml
    • First observedgenerate_template
    • First observedget_component_info
    • First observedvalidate_mjml

TDQS

A3.6/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: compiling MJML to HTML, generating email templates, retrieving component documentation, and validating MJML syntax. There is no overlap in functionality, making it easy for an agent to select the correct tool for each task without confusion.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern (e.g., compile_mjml, generate_template, get_component_info, validate_mjml). The naming is uniform and predictable, using snake_case throughout with clear action-object pairs.

Tool Count5/5

With 4 tools, this server is well-scoped for its MJML-focused purpose. Each tool earns its place by covering essential aspects: compilation, template generation, documentation access, and validation, without being overly sparse or bloated.

Completeness5/5

The tool surface provides complete coverage for the MJML domain, including core operations like compilation and validation, as well as supporting features like template generation and documentation. There are no obvious gaps that would hinder an agent's workflow.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Provides IMAP and SMTP capabilities, enabling developers to manage email services with seamless integration and automated workflows.
    18
    322
    BSD 3-Clause
  • A
    license
    A
    quality
    A
    maintenance
    Enables sending emails via SMTP with template management, supporting multiple SMTP configurations, template creation with variable substitution, and bulk email sending with rate limiting.
    6
    122
    19
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Enables management of AI-powered email marketing automation, including subscriber segments, campaigns, and templates. It allows users to generate email sequences with AI and track detailed analytics through natural language commands.
    100
    1,310
    2
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/shaunie2fly/mjml_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server