Tutorials
MCP for email template migration

Migrate email templates using Knock's MCP server

Learn how to quickly migrate your email templates to Knock using our MCP server.

Storing your email templates in Knock comes with many advantages, but planning and executing a manual migration can require a significant amount of time and effort.

In this guide, we'll walk you through how to leverage Knock's MCP server with the LLM of your choice as a low-effort solution to quickly migrate your email templates to Knock.

Prerequisites

#

Before getting started, you'll need access to the following:

  • A Knock account.
  • A configured email provider in your Knock account. Navigate to Integrations > Channels in your dashboard to set this up if you haven't already done so.
  • A service token for your Knock account.
  • An MCP-compatible client (such as Cursor or Claude Desktop). We recommend Cursor for working with a large collection of HTML files.
  • Your existing email template files. Your templates will be upserted to Knock as HTML, so if you're using a format like MJML or React Email, you'll want to convert them to HTML before you begin.

For more information on setting up the Knock MCP server, see the Get started section of the MCP documentation.

Required MCP tools

#

When working with MCP servers, it's recommended that you expose only the tools you need for your use case to your LLM. The steps in this guide will require access to the following tools:

  • documentation.*
  • channels.*
  • commits.*
  • emailLayouts.*
  • partials.*
  • workflows.*

Learn more about configuring these tools in your MCP-compatible client here. If you're using Cursor, you can simply copy and paste the configuration below into your MCP settings under the mcpServers key.

Background

#

While not required reading, you may want to familiarize yourself with the following concepts before beginning your migration so that you can understand more about the context for the prompts you'll be providing to your LLM:

Migration steps

#

Now that you have everything you need for your migration, you're ready to get started!

Each step below contains a prompt that you can provide to your LLM. These prompts are designed to be run one at a time in order to provide the LLM with discrete tasks, thus improving the accuracy of the results.

1

Analyze your existing email templates

Before creating any resources in Knock, you'll need to analyze your existing email templates to identify patterns and shared components. Copy the prompt below and provide it to your LLM along with access to your template files.

Prompt:

2

Create partials

Based on your analysis, you'll now create the identified partials. Copy the prompt below and provide it to your LLM along with access to your template files.

Prompt:

3

Create email layouts

Now you'll create the email layouts identified in your analysis.

Prompt:

4

Create workflows

For each email template, you'll create an email step in a workflow whose template leverages the layouts and partials you created in the previous steps.

Prompt:

5

Verify the migration

After creating all resources, you need to verify that the migration was successful and the templates render correctly.

Prompt:

6

Prepare for production

Once verification of your templates is complete, you can prepare them for production use by verifying the categories and descriptions of your workflows and triggering them with test data.

Prompt: