Skip to main content
kavachAstro(kavach, options?) returns named route handlers { GET, POST, PATCH, DELETE, OPTIONS, ALL }. Mount them in a catch-all API page so all KavachOS paths are handled. Use individual named exports or the ALL catch-all handler.

Install

Setup

1

Create the kavach instance

2

Create the catch-all route

Create src/pages/api/kavach/[...path].ts. The [...path] spread catches every sub-path under /api/kavach/.
Or use the ALL handler to catch every HTTP method in one export:
Astro requires output: 'server' or output: 'hybrid' in astro.config.mjs to enable API routes. Static output mode does not support server-side route handlers.

Options

MCP endpoints

When mcp is passed, the MCP OAuth 2.1 endpoints are available at:

Endpoint reference

Full example

Last modified on April 29, 2026