@aurite-ai/kahuna 0.1.0

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.
package/README.md ADDED
@@ -0,0 +1,215 @@
1
+ # @aurite-ai/kahuna
2
+
3
+ MCP server providing context management tools for coding copilots. Runs locally via stdio transport — copilots call Kahuna tools to learn from files, surface relevant context, and get answers from the knowledge base.
4
+
5
+ ## Installation
6
+
7
+ ### Option 1: npm (Recommended)
8
+
9
+ ```bash
10
+ npm install -g @aurite-ai/kahuna
11
+ ```
12
+
13
+ Then configure your MCP client to use `kahuna-mcp` as the command.
14
+
15
+ ### Option 2: npx (No Install)
16
+
17
+ Use directly without installing:
18
+
19
+ ```bash
20
+ npx @aurite-ai/kahuna
21
+ ```
22
+
23
+ ### Option 3: Docker
24
+
25
+ ```bash
26
+ docker pull kahuna/mcp
27
+ docker run -i kahuna/mcp
28
+ ```
29
+
30
+ ### Option 4: From Source
31
+
32
+ ```bash
33
+ git clone https://github.com/Aurite-ai/kahuna.git
34
+ cd kahuna
35
+ pnpm install
36
+ pnpm --filter @aurite-ai/kahuna build
37
+ pnpm --filter @aurite-ai/kahuna bundle
38
+ ```
39
+
40
+ ## Configuration
41
+
42
+ ### Environment Variables
43
+
44
+ Create a `.env` file or set these environment variables:
45
+
46
+ ```bash
47
+ # Required for LLM-powered tools (learn, ask, prepare-context)
48
+ ANTHROPIC_API_KEY=sk-ant-...
49
+
50
+ # Optional: Custom knowledge base location (default: ~/.kahuna/knowledge/)
51
+ KAHUNA_KNOWLEDGE_DIR=/path/to/custom/knowledge
52
+ ```
53
+
54
+ ### Connecting to MCP Clients
55
+
56
+ **Claude Code / Roo Code:**
57
+
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "kahuna": {
62
+ "command": "kahuna-mcp",
63
+ "env": {
64
+ "ANTHROPIC_API_KEY": "sk-ant-..."
65
+ }
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ **Using npx:**
72
+
73
+ ```json
74
+ {
75
+ "mcpServers": {
76
+ "kahuna": {
77
+ "command": "npx",
78
+ "args": ["@aurite-ai/kahuna"],
79
+ "env": {
80
+ "ANTHROPIC_API_KEY": "sk-ant-..."
81
+ }
82
+ }
83
+ }
84
+ }
85
+ ```
86
+
87
+ **Using Docker:**
88
+
89
+ ```json
90
+ {
91
+ "mcpServers": {
92
+ "kahuna": {
93
+ "command": "docker",
94
+ "args": ["run", "-i", "-e", "ANTHROPIC_API_KEY", "kahuna/mcp"],
95
+ "env": {
96
+ "ANTHROPIC_API_KEY": "sk-ant-..."
97
+ }
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ ## Overview
104
+
105
+ ```
106
+ ┌─────────────────────┐ MCP (stdio) ┌─────────────────────┐
107
+ │ Coding Copilot │ ◄────────────────► │ @aurite-ai/kahuna │
108
+ │ (Claude, Roo, │ │ │
109
+ │ Cursor, etc.) │ │ knowledge/ module │
110
+ └─────────────────────┘ │ ├── agents/ │
111
+ │ ├── storage/ │
112
+ │ └── surfacing/ │
113
+ └─────────────────────┘
114
+
115
+ reads/writes
116
+
117
+ ┌─────────▼──────────┐
118
+ │ ~/.kahuna/ │
119
+ │ knowledge/ │
120
+ │ (flat .mdc files) │
121
+ └────────────────────┘
122
+ ```
123
+
124
+ ## Available Tools
125
+
126
+ ### `kahuna_learn`
127
+
128
+ Send files or folders to Kahuna to learn from and add to the knowledge base.
129
+
130
+ - **Input:** `paths: string[]`, `description?: string`
131
+ - **Process:** Reads files → LLM categorization agent classifies each → stores as `.mdc` files in `~/.kahuna/knowledge/`
132
+ - **Response:** Markdown summary with file table, key topics, and `<hints>`
133
+
134
+ ### `kahuna_prepare_context`
135
+
136
+ Prepare the `.context-guide.md` file with task-relevant knowledge.
137
+
138
+ - **Input:** `task: string`, `files?: string[]`
139
+ - **Process:** LLM retrieval agent searches KB → selects relevant files → writes references to these files in `.context-guide.md`
140
+ - **Response:** Markdown with surfaced files table, "Start Here" section, and `<hints>`
141
+
142
+ ### `kahuna_ask`
143
+
144
+ Quick Q&A using the knowledge base.
145
+
146
+ - **Input:** `question: string`
147
+ - **Process:** LLM Q&A agent searches KB → reads relevant files → synthesizes answer with source citations
148
+ - **Response:** Markdown answer with sources and `<hints>`
149
+
150
+ ### `kahuna_initialize`
151
+
152
+ Initialize a project with Kahuna copilot configuration (VCK templates).
153
+
154
+ - **Input:** `targetPath: string`, `overwrite?: boolean`
155
+ - **Creates:** `.claude/` config directory, `CLAUDE.md`, copilot rules and skills
156
+
157
+ ### `kahuna_health_check`
158
+
159
+ Verify the MCP server is running.
160
+
161
+ - **Input:** `action: "ping"`
162
+ - **Response:** Server status confirmation
163
+
164
+ ## Architecture
165
+
166
+ ```
167
+ apps/mcp/src/
168
+ ├── index.ts # MCP server entry point, tool registration
169
+ ├── config.ts # Model identifiers, server constants
170
+ ├── knowledge/ # Knowledge base domain logic
171
+ │ ├── agents/ # Agent prompts, tools, shared runner
172
+ │ │ ├── prompts.ts # System prompts (categorization, retrieval, Q&A)
173
+ │ │ ├── knowledge-tools.ts # Agent tools (list, read, select, categorize)
174
+ │ │ └── run-agent.ts # Shared agentic loop runner
175
+ │ ├── storage/ # KB storage service
176
+ │ │ ├── types.ts # KnowledgeEntry, classification types
177
+ │ │ ├── knowledge-storage.ts # CRUD for .mdc files
178
+ │ │ └── utils.ts # Slug generation, frontmatter parsing
179
+ │ └── surfacing/ # Context surfacing
180
+ │ └── context-writer.ts # Write .context-guide.md
181
+ └── tools/ # MCP tool handlers (thin wrappers)
182
+ ├── types.ts # ToolContext, MCPToolResponse, markdownResponse()
183
+ ├── learn.ts # kahuna_learn handler
184
+ ├── prepare-context.ts # kahuna_prepare_context handler
185
+ ├── ask.ts # kahuna_ask handler
186
+ ├── initialize.ts # kahuna_initialize handler
187
+ └── health-check.ts # kahuna_health_check handler
188
+ ```
189
+
190
+ **Design principle:** Tool handlers are thin wrappers that validate input, call into `knowledge/`, and format markdown responses. Domain logic lives in the `knowledge/` module.
191
+
192
+ ## Development
193
+
194
+ ```bash
195
+ # Run in watch mode
196
+ pnpm --filter @aurite-ai/kahuna dev
197
+
198
+ # Run tests
199
+ pnpm --filter @aurite-ai/kahuna test
200
+
201
+ # Watch tests
202
+ pnpm --filter @aurite-ai/kahuna test:watch
203
+
204
+ # Type-check
205
+ pnpm --filter @aurite-ai/kahuna typecheck
206
+
207
+ # Create production bundle
208
+ pnpm --filter @aurite-ai/kahuna bundle
209
+ ```
210
+
211
+ The MCP server uses **stdio** transport — it reads/writes JSON-RPC over stdin/stdout. Use `dev` for local development; connect via an MCP client.
212
+
213
+ ## License
214
+
215
+ MIT