kavachFastify(kavach, options?) returns an async Fastify plugin. Register it with fastify.register and use Fastify’s built-in prefix option to control the mount path.
Install
Setup
1
Create the kavach instance
2
Register the plugin
The prefix is controlled by Fastify’s
register options, not by a basePath option on the adapter. This is consistent with how Fastify plugins work.MCP endpoints
Whenmcp is passed, the MCP OAuth 2.1 endpoints are registered on the same plugin. Because Fastify’s prefix scopes routes, the well-known paths are served relative to the plugin root: