kavachNuxt(kavach, options?) returns an H3 EventHandler. Mount it in a catch-all server route so all KavachOS paths are handled.
Install
Setup
1
Create the kavach instance
Create this outside the event handler so it is initialized once at server startup:
2
Create the catch-all route
In Nuxt, a file named
[...].ts in the server routes directory catches all sub-paths. Create server/api/kavach/[...].ts:The
basePath option defaults to /api/kavach. If your Nuxt app uses a different route prefix, pass basePath to match.Options
MCP endpoints
Whenmcp is passed, the MCP OAuth 2.1 authorization server is available at:
Endpoint reference
Full example
/api/kavach/... within your Nuxt server.