Learn how to quickly migrate your email templates to Knock using our MCP server.
Storing your email templates in Knock comes with many advantages. In this guide, we'll walk you through how to leverage Knock's MCP server with the large language model (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 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.
An MCP-compatible client (such as Cursor or Claude Desktop). We recommend Cursor for working with a large collection of HTML files.
For the purposes of this guide, we will assume that you're familiar with prompting an agentic LLM and understand how to provide access to files as context for your prompts. If you're not sure what this means, we recommend checking out this guide on working with context from Cursor.
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.*
users.*
Learn more about configuring these tools in your MCP-compatible client here. If you're using Cursor or Claude Desktop, you can simply copy and paste the relevant configuration below into your MCP settings, under the mcpServers key. Be sure to update the configuration with your own service token.
Background
#
While not required reading, you may want to familiarize yourself with the following Knock concepts before beginning your migration so that you can understand more about the prompts you'll be providing to your LLM:
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 output.
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. We recommend limiting your prompt to 5-10 template files at a time to avoid exceeding the context window limit.
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 the analysis report that was generated in the previous step.
Prompt:
3
Create email layouts
Now you'll create the email layouts identified in your analysis. Copy the prompt below and provide it to your LLM along with access to the analysis report.
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.
For this step, you'll need to follow the same pattern as we did in step 1; we recommend providing no more than 10-15 templates per prompt. You should provide the prompt below to your LLM along with access to the analysis report and your template files.
Prompt:
5
Summarize the migration and generate test data
After creating all resources, you need to verify that the migration was successful and the templates render correctly. We'll ask our LLM to provide a summary report of the migration and to generate appropriate test data for each workflow.
Provide the prompt below to your LLM along with access to the analysis report.
Prompt:
6
Test the migrated templates
Once you've summarized the migration and verified that you've created all of the resources identified in the analysis, you can use the Knock MCP server to test the migrated templates with the generated test data in your summary report. Provide the prompt below to your LLM along with access to the summary report. Make sure that you update the prompt to target the correct test user.
You can use the MCP server to create a user that you'd like to send the test emails to, if you don't already have one in your development environment. You should update the example prompt to use a real email address for the user so that you can view the test emails in your inbox.