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. 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 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.
- 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:
- Workflows
- Channel steps
- Email layouts
- Partials
- Referencing variables and your Knock data in templates
- Knock liquid helpers
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 output.
We recommend the following to ensure the best results:
- Leverage an LLM with a large context window. In Cursor, you should enable "MAX mode" on your agent. Note that this may have billing implications depending on your Cursor plan.
- If you have a large number of templates, you'll likely need to break the analysis in step 1 below into smaller chunks. We recommend providing no more than 5-10 template files per prompt. The prompt is designed so that you can run it multiple times and it will add to the existing analysis report if it has already been run.
- Start a new chat session to clear your context window if you notice that you're approaching the context window limit.