Model Context Protocol (MCP) server

Use the Knock MCP server to make Knock accessible to LLMs and AI agents via tool calling.
🚧
Note: the Knock MCP server is currently in beta. Due to the non-deterministic nature of LLMs it's recommended that you test running the MCP against resources in your development environment before running it in production.

Knock ships an MCP server that exposes the primitives of Knock to LLMs and AI via the Model Context Protocol (MCP) so that your AI agents can discover and use Knock via tool calling.

Here are some examples of how you can use the MCP server in your workflow:

  • Create workflows using natural language. "Create a welcome email workflow for my B2B SaaS app."
  • Trigger a specific workflow to test your integration. "Trigger the comment-created workflow for Dennis Nedry."
  • Create a set of test user and tenant data in your account. "Create a user called Dennis Nedry and a tenant called acme-corp."

Get started

To get started with the MCP server, you'll need to create a service token to use to authenticate against your Knock account. You can do so under the Settings > Service tokens page in the Knock dashboard.

Once you have your service, you can then setup the MCP Server in any MCP Client-compatible AI application. We've added the setup instructions below for both Cursor and Claude Desktop, but the same instructions apply to any other MCP Client-compatible application.

Note: To run the local MCP server you must have Node 20 or higher installed and accessible globally on your system. You can test this by running node --version in your terminal.

Cursor

  1. Go to your Cursor settings and find the "MCP" section
  2. Click "Add new global MCP server"
  3. Inside of your mcp.json file under the mcpServers key, add the following:

Claude Desktop

  1. Open the Claude Desktop settings and find the "Developer" section
  2. Click to "Edit Config"
  3. Open your claude_desktop_config.json file in your preferred text editor
  4. Add the following to the mcpServers section (or add the key if it doesn't exist):

Configuring the available tools

It's not recommended to expose all tools that the Knock MCP server has to the LLM. Instead, you should expose only the tools that are required to complete the task at hand. You can configure the available tools by passing in the --tools flag when starting the MCP server.

Here are some examples of how you can configure the available tools:

  • Expose all tools: --tools *
  • Expose all user tools: --tools users.*
  • Expose only the users.create tool: --tools users.create

Workflows-as-tools

The Knock MCP server also supports exposing your workflows as individual tools. This allows you to provide a specific and precise interface to the LLM for invoking workflow triggers, including describing the data trigger requirements for your workflows.

By default, the MCP server will not expose any workflows-as-tools. To opt into this behavior, you can pass in the --workflows flag when starting the MCP server.

By default, passing the --workflows flag will expose all workflows in your Knock account as tools. If you want to control the exact workflows that are exposed as tools, you can pass a list of workflow keys to the --workflows flag. For example:

What tools are available?

The MCP server ships with tools to interact with all Knock resources. You can find the full list of available tools in the tools reference of the Knock agent toolkit, which the MCP server is built on top of.

Please note that at this time, the MCP server does not ship with any tools to delete resources. This is intentional to prevent the accidental deletion of resources in your Knock account.

Workflow-specific tools

The Knock MCP server exposes a full suite of tools for creating and managing workflows. Using the MCP server you can:

  • Create a workflow with natural language: "create a workflow that sends a welcome email to new users"
  • Create a delay or batch step within your workflow: "delay for 3 days" or "batch for 10 minutes"
  • Create an email step within your workflow: "create a credit card expiring email with a link back to the dashboard"
  • Create an SMS, push, or in-app feed step within your workflow

Using these tools you can create a complex prompt that describes one or more workflows that you'd like to create with natural language.

Frequently asked questions