The Knock Agent toolkit enables popular agent frameworks including OpenAI and Vercel's AI SDK to integrate with Knock's APIs using tools (otherwise known as function calling). It also allows you to integrate Knock into a Model Context Protocol (MCP) client such as Cursor, Windsurf, or Claude Code. Using the Knock agent toolkit allows you to build powerful agent systems that are capable of sending cross-channel notifications to the humans who need to be in the loop. As a developer, it also helps you build Knock integrations and manage your Knock account. You can read more in the documentation.
API reference
The Knock Agent Toolkit provides four main entry points:
@knocklabs/agent-toolkit/ai-sdk: Helpers for integrating with Vercel's AI SDK.
@knocklabs/agent-tookkit/langchain: Helpers for integrating with Langchain's JS SDK.
@knocklabs/agent-toolkit/openai: Helpers for integrating with the OpenAI SDK.
@knocklabs/agent-toolkit/modelcontextprotocol: Low level helpers for integrating with the Model Context Protocol (MCP).
You must have a service token generated on your Knock account. The Knock agent toolkit uses your service token to interact with your Knock account.
Available tools
The agent toolkit exposes a large subset of the Knock Management API and API that you might need to invoke via an agent. You can see the full list of tools in the source code.
Context
It's possible to pass additional context to the configuration of each library to help scope the calls made by the agent toolkit to Knock. The available properties to configure are:
environment: The slug of the Knock environment you wish to execute actions in by default, such as development.
userId: The user ID of the current user. When set, this will be the default passed to user tools.
tenantId: The ID of the current tenant. When set, will be the default passed to any tool that accepts the tenant.
Usage## Model Context Protocol (MCP)
To start using the Knock MCP as a local server, you must start it with a service token. You can run it using npx.
By default, the MCP server will expose all tools to the LLM. To limit the tools available you can use the --tools (-t) flag:
// Pass all tools
npx -y @knocklabs/agent-toolkit -p local-mcp --tools="*"
// Specific category
npx -y @knocklabs/agent-toolkit -p local-mcp --tools "workflows.*"
// Specific tools
npx -y @knocklabs/agent-toolkit -p local-mcp --tools "workflows.triggerWorkflow"
If you wish to enable workflows-as-tools within the MCP server, you must set the --workflows flag to pass in a list of approved workflow keys to expose. This ensures that you keep the number of tools exposed to your MCP client to a minimum.
It's also possible to pass environment, userId, and tenant to the local MCP server to set default values. Use the --help flag to view additional server options.