@kavachos/fastify 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +73 -0
  3. package/package.json +48 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 KavachOS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # @kavachos/fastify
2
+
3
+ Fastify adapter for KavachOS.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@kavachos/fastify)](https://www.npmjs.com/package/@kavachos/fastify)
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pnpm add kavachos @kavachos/fastify
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```typescript
16
+ import Fastify from 'fastify';
17
+ import { createKavach } from 'kavachos';
18
+ import { kavachFastify } from '@kavachos/fastify';
19
+
20
+ const app = Fastify();
21
+
22
+ const kavach = createKavach({
23
+ database: { provider: 'sqlite', url: 'kavach.db' },
24
+ });
25
+
26
+ // Register all KavachOS routes under /api/kavach
27
+ await app.register(kavachFastify(kavach), { prefix: '/api/kavach' });
28
+
29
+ await app.listen({ port: 3000 });
30
+ ```
31
+
32
+ This registers the full KavachOS REST API: agent CRUD, authorization, delegations, audit logs, and dashboard stats.
33
+
34
+ ### With MCP OAuth 2.1
35
+
36
+ ```typescript
37
+ import { createMcpModule } from 'kavachos/mcp';
38
+ import { kavachFastify } from '@kavachos/fastify';
39
+
40
+ const mcp = createMcpModule({
41
+ issuer: 'https://your-app.com',
42
+ // ...
43
+ });
44
+
45
+ await app.register(kavachFastify(kavach, { mcp }), { prefix: '/api/kavach' });
46
+ ```
47
+
48
+ When `mcp` is provided, the OAuth 2.1 endpoints are enabled:
49
+
50
+ - `GET /.well-known/oauth-authorization-server`
51
+ - `GET /.well-known/oauth-protected-resource`
52
+ - `POST /mcp/register`
53
+ - `GET /mcp/authorize`
54
+ - `POST /mcp/token`
55
+
56
+ ## API surface
57
+
58
+ `kavachFastify(kavach, options?)` returns an async Fastify plugin. Pass it to `app.register()` and use Fastify's built-in `prefix` option to choose your mount path.
59
+
60
+ | Option | Type | Description |
61
+ |--------|------|-------------|
62
+ | `mcp` | `McpAuthModule` | Enables MCP OAuth 2.1 endpoints |
63
+
64
+ For full docs on agent identity, permissions, delegation, and audit, see the main [kavachos](https://www.npmjs.com/package/kavachos) package.
65
+
66
+ ## Links
67
+
68
+ - [Documentation](https://kavachos.dev/docs)
69
+ - [GitHub](https://github.com/kavachos/kavachos)
70
+
71
+ ## License
72
+
73
+ MIT
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@kavachos/fastify",
3
+ "version": "0.0.2",
4
+ "description": "Fastify adapter for KavachOS - exposes agent auth as HTTP REST endpoints",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "keywords": [
18
+ "kavachos",
19
+ "fastify",
20
+ "auth",
21
+ "agent",
22
+ "mcp"
23
+ ],
24
+ "author": "KavachOS <hello@kavachos.com>",
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/kavachos/kavachos.git",
29
+ "directory": "packages/adapters/fastify"
30
+ },
31
+ "peerDependencies": {
32
+ "fastify": ">=4.0.0",
33
+ "zod": ">=3.0.0",
34
+ "kavachos": "0.0.2"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^22.0.0",
38
+ "fastify": "^5.0.0",
39
+ "tsup": "^8.4.0",
40
+ "typescript": "^5.8.0",
41
+ "zod": "^3.24.0",
42
+ "kavachos": "0.0.2"
43
+ },
44
+ "scripts": {
45
+ "build": "tsup",
46
+ "typecheck": "tsc --noEmit"
47
+ }
48
+ }