@hiveai/mcp 0.2.8 → 0.2.9

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,362 @@
1
+ # @hiveai/mcp
2
+
3
+ > **hAIve MCP server** — exposes shared team memory and project context to any MCP-compatible AI client (Claude Code, Cursor, GitHub Copilot, VS Code, etc.)
4
+
5
+ Connect your AI coding tools to a shared, version-controlled knowledge base. Every convention, architectural decision, and gotcha your team has discovered is surfaced automatically when relevant — no more re-explaining the same things in every session.
6
+
7
+ ---
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install -g @hiveai/mcp
13
+ ```
14
+
15
+ Also install the CLI to manage memories:
16
+
17
+ ```bash
18
+ npm install -g @hiveai/cli
19
+ ```
20
+
21
+ ---
22
+
23
+ ## Quick start
24
+
25
+ ```bash
26
+ # 1. Initialize hAIve in your project
27
+ haive init
28
+
29
+ # 2. Add your AI client config (see below)
30
+ # 3. Ask your AI to call get_briefing before starting any task
31
+ ```
32
+
33
+ ---
34
+
35
+ ## Client configuration
36
+
37
+ ### Claude Code
38
+
39
+ Add to `~/.claude.json` (global) or `.claude/settings.json` (per-project):
40
+
41
+ ```json
42
+ {
43
+ "mcpServers": {
44
+ "haive": {
45
+ "command": "haive-mcp",
46
+ "args": ["--root", "/absolute/path/to/your/project"]
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ ### Cursor
53
+
54
+ Add to `~/.cursor/mcp.json`:
55
+
56
+ ```json
57
+ {
58
+ "mcpServers": {
59
+ "haive": {
60
+ "command": "haive-mcp",
61
+ "args": ["--root", "/absolute/path/to/your/project"]
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ ### VS Code
68
+
69
+ ```bash
70
+ code --add-mcp '{"name":"haive","command":"haive-mcp","args":["--root","/absolute/path/to/project"]}'
71
+ ```
72
+
73
+ ### Project-scoped (auto-detected)
74
+
75
+ Add a `.mcp.json` at the project root:
76
+
77
+ ```json
78
+ {
79
+ "mcpServers": {
80
+ "haive": {
81
+ "command": "haive-mcp",
82
+ "args": ["--root", "."]
83
+ }
84
+ }
85
+ }
86
+ ```
87
+
88
+ The project root can also be set via the `HAIVE_PROJECT_ROOT` environment variable, or auto-detected from the nearest `.ai/`, `.git/`, or `package.json`.
89
+
90
+ ---
91
+
92
+ ## MCP Tools
93
+
94
+ ### `get_briefing` ⭐ Start every task with this
95
+
96
+ One-shot onboarding: returns project context + module contexts + ranked relevant memories under a token budget. Replaces 4–5 separate calls at the start of a session.
97
+
98
+ ```json
99
+ {
100
+ "task": "add a Stripe payment integration",
101
+ "files": ["src/payments/PaymentService.ts"],
102
+ "max_tokens": 8000,
103
+ "max_memories": 8,
104
+ "format": "full",
105
+ "semantic": true
106
+ }
107
+ ```
108
+
109
+ **Parameters:**
110
+
111
+ | Parameter | Default | Description |
112
+ |---|---|---|
113
+ | `task` | — | What you're about to do. Used to rank memories by relevance. |
114
+ | `files` | `[]` | Files you're editing. Surfaces memories anchored to these files. |
115
+ | `max_tokens` | `8000` | Token budget for the entire response. Sections are truncated to fit. |
116
+ | `max_memories` | `8` | Max memories to include. |
117
+ | `format` | `"full"` | `"full"` = complete bodies · `"compact"` = 1-line summaries (call `mem_get` for details) |
118
+ | `semantic` | `true` | Use embedding-based ranking if `@hiveai/embeddings` is indexed. |
119
+ | `include_stale` | `false` | Include stale memories (may be outdated). |
120
+ | `track` | `true` | Increment read_count for returned memories. |
121
+
122
+ **Response includes:**
123
+ - `project_context` — the contents of `.ai/project-context.md`
124
+ - `module_contexts` — relevant `.ai/modules/<name>/context.md` files
125
+ - `memories` — ranked list of relevant memories with body, confidence, and match reason
126
+ - `decay_warnings` — memory IDs not read in >90 days (review or deprecate)
127
+ - `search_mode` — `"semantic"` | `"literal_fallback"` | `"literal"`
128
+
129
+ ---
130
+
131
+ ### `mem_save`
132
+
133
+ Save a new memory. For failed approaches, use `mem_tried` instead — it enforces better structure.
134
+
135
+ ```json
136
+ {
137
+ "type": "gotcha",
138
+ "slug": "open-in-view-false",
139
+ "scope": "team",
140
+ "body": "spring.jpa.open-in-view=false is intentional — do not re-enable. Lazy loading outside transactions causes N+1 queries.",
141
+ "paths": ["src/main/resources/application.properties"],
142
+ "tags": ["spring", "jpa", "performance"]
143
+ }
144
+ ```
145
+
146
+ | Parameter | Required | Description |
147
+ |---|---|---|
148
+ | `type` | ✅ | `convention` · `decision` · `gotcha` · `architecture` · `glossary` |
149
+ | `slug` | ✅ | Short kebab-case identifier |
150
+ | `scope` | — | `personal` (default) · `team` · `module` |
151
+ | `body` | ✅ | Markdown content |
152
+ | `paths` | — | File paths to anchor to (enables staleness detection) |
153
+ | `symbols` | — | Function/class names to anchor to |
154
+ | `tags` | — | Tags for filtering |
155
+ | `domain` | — | Business domain (e.g. `payments`) |
156
+ | `author` | — | Author handle |
157
+
158
+ ---
159
+
160
+ ### `mem_tried` ⭐ Record failures immediately
161
+
162
+ Record a failed approach. Automatically surfaces first in future `get_briefing` calls so agents don't repeat the same mistake.
163
+
164
+ ```json
165
+ {
166
+ "what": "using require() to import gray-matter in an ESM package",
167
+ "why_failed": "The package is ESM-only — require() throws ERR_REQUIRE_ESM",
168
+ "instead": "Use import matter from 'gray-matter' (named default import)",
169
+ "scope": "team",
170
+ "paths": ["src/parser.ts"]
171
+ }
172
+ ```
173
+
174
+ Auto-validated — no approval cycle needed.
175
+
176
+ ---
177
+
178
+ ### `mem_search`
179
+
180
+ Search memories by substring or semantic similarity.
181
+
182
+ ```json
183
+ {
184
+ "query": "flyway migration",
185
+ "scope": "team",
186
+ "semantic": true,
187
+ "limit": 10
188
+ }
189
+ ```
190
+
191
+ Falls back to literal search if embeddings are not indexed.
192
+
193
+ ---
194
+
195
+ ### `mem_get`
196
+
197
+ Fetch a single memory with full body, anchor, confidence, and usage stats.
198
+
199
+ ```json
200
+ { "id": "2025-01-15-gotcha-flyway-strict" }
201
+ ```
202
+
203
+ ---
204
+
205
+ ### `mem_list`
206
+
207
+ List memories with optional filters.
208
+
209
+ ```json
210
+ {
211
+ "scope": "team",
212
+ "type": "gotcha",
213
+ "status": "validated",
214
+ "tags": ["payments"]
215
+ }
216
+ ```
217
+
218
+ ---
219
+
220
+ ### `mem_for_files`
221
+
222
+ Given the files you're editing, return relevant memories grouped by reason (anchor overlap, module, domain).
223
+
224
+ ```json
225
+ {
226
+ "files": ["src/payments/PaymentService.java", "src/payments/WaveProvider.java"]
227
+ }
228
+ ```
229
+
230
+ ---
231
+
232
+ ### `mem_update`
233
+
234
+ Update a memory's body, tags, or anchor without changing its id or usage history.
235
+
236
+ ```json
237
+ {
238
+ "id": "2025-01-15-gotcha-flyway-strict",
239
+ "body": "Updated explanation...",
240
+ "paths": ["src/main/resources/db/migration"]
241
+ }
242
+ ```
243
+
244
+ ---
245
+
246
+ ### `mem_verify`
247
+
248
+ Check if anchor paths and symbols still exist in the current code. Detects stale memories and suggests possible renames when files have moved.
249
+
250
+ ```json
251
+ { "id": "2025-01-15-gotcha-flyway-strict", "update": true }
252
+ ```
253
+
254
+ ---
255
+
256
+ ### `mem_diff`
257
+
258
+ Compare two memories side-by-side: shows frontmatter fields that differ and lines unique to each body. Useful before merging duplicates.
259
+
260
+ ```json
261
+ { "id_a": "2025-01-15-gotcha-flyway-strict", "id_b": "2025-02-01-decision-flyway-naming" }
262
+ ```
263
+
264
+ ---
265
+
266
+ ### `mem_approve` / `mem_reject` / `mem_pending` / `mem_delete`
267
+
268
+ Lifecycle operations:
269
+
270
+ ```json
271
+ { "id": "2025-01-15-gotcha-flyway-strict" } // mem_approve
272
+ { "id": "2025-01-15-gotcha-old", "reason": "Outdated" } // mem_reject
273
+ {} // mem_pending (list all)
274
+ { "id": "2025-01-15-gotcha-old" } // mem_delete
275
+ ```
276
+
277
+ ---
278
+
279
+ ### `get_project_context`
280
+
281
+ Read `.ai/project-context.md` directly (without token budgeting).
282
+
283
+ ```json
284
+ { "module": "payments" } // Also loads .ai/modules/payments/context.md
285
+ ```
286
+
287
+ ---
288
+
289
+ ### `bootstrap_project_save`
290
+
291
+ Persist a project (or module) context document generated by the AI.
292
+
293
+ ```json
294
+ {
295
+ "content": "# Project context\n\n## Architecture\n...",
296
+ "module": "payments" // Optional: save as .ai/modules/payments/context.md
297
+ }
298
+ ```
299
+
300
+ ---
301
+
302
+ ### `code_map`
303
+
304
+ Browse the pre-computed code map (file → exports + descriptions) instead of grepping.
305
+
306
+ ```json
307
+ { "query": "payment" } // Filter by keyword
308
+ { "file": "src/payments" } // Filter by file prefix
309
+ { "symbol": "PaymentService" } // Find a specific export
310
+ ```
311
+
312
+ Requires `haive index code` to be run first.
313
+
314
+ ---
315
+
316
+ ## MCP Prompts
317
+
318
+ ### `post_task` ⭐ Run before closing every session
319
+
320
+ Post-task reflection checklist. Guides the AI through capturing failed approaches, conventions, decisions, and gotchas before the session ends.
321
+
322
+ ```
323
+ Use the post_task prompt with:
324
+ task_summary: "Added Stripe payment integration"
325
+ files_touched: ["src/payments/StripeService.ts", "src/payments/PaymentController.ts"]
326
+ ```
327
+
328
+ ### `bootstrap_project`
329
+
330
+ Instructions for the AI to analyze the current project and save a structured context document to `.ai/project-context.md`. Run once after `haive init`.
331
+
332
+ ### `import_docs`
333
+
334
+ Analyze documentation (README, ADR, wiki page, API spec) and save actionable knowledge as hAIve memories.
335
+
336
+ ```
337
+ Use the import_docs prompt with:
338
+ content: "<full document text>"
339
+ source: "docs/architecture.md"
340
+ scope: "team"
341
+ ```
342
+
343
+ The AI extracts up to 10 memories (conventions, decisions, gotchas, architecture) and calls `mem_save` for each.
344
+
345
+ ---
346
+
347
+ ## Memory lifecycle
348
+
349
+ ```
350
+ mem_save / mem_tried → draft (personal) or proposed (team)
351
+ mem_approve → validated
352
+ mem_verify → stale (if anchors broken)
353
+ mem_reject → rejected
354
+ ```
355
+
356
+ Validated team memories appear in `get_briefing`. Stale memories are excluded by default (pass `include_stale: true` to override).
357
+
358
+ ---
359
+
360
+ ## License
361
+
362
+ MIT
package/dist/index.js CHANGED
@@ -1401,7 +1401,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
1401
1401
 
1402
1402
  // src/server.ts
1403
1403
  var SERVER_NAME = "haive";
1404
- var SERVER_VERSION = "0.2.8";
1404
+ var SERVER_VERSION = "0.2.9";
1405
1405
  function jsonResult(data) {
1406
1406
  return {
1407
1407
  content: [
package/dist/server.js CHANGED
@@ -1396,7 +1396,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
1396
1396
 
1397
1397
  // src/server.ts
1398
1398
  var SERVER_NAME = "haive";
1399
- var SERVER_VERSION = "0.2.8";
1399
+ var SERVER_VERSION = "0.2.9";
1400
1400
  function jsonResult(data) {
1401
1401
  return {
1402
1402
  content: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiveai/mcp",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "hAIve MCP server — exposes memory + project context to any MCP-compatible AI client",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -10,15 +10,7 @@
10
10
  },
11
11
  "bugs": "https://github.com/Doucs91/hAIve/issues",
12
12
  "homepage": "https://github.com/Doucs91/hAIve#readme",
13
- "keywords": [
14
- "ai",
15
- "memory",
16
- "mcp",
17
- "haive",
18
- "model-context-protocol",
19
- "agent",
20
- "team"
21
- ],
13
+ "keywords": ["ai", "memory", "mcp", "haive", "model-context-protocol", "agent", "team"],
22
14
  "type": "module",
23
15
  "main": "./dist/server.js",
24
16
  "types": "./dist/server.d.ts",
@@ -32,14 +24,18 @@
32
24
  "bin": {
33
25
  "haive-mcp": "./dist/index.js"
34
26
  },
35
- "files": [
36
- "dist",
37
- "LICENSE"
38
- ],
27
+ "files": ["dist", "LICENSE"],
28
+ "scripts": {
29
+ "build": "tsup",
30
+ "test": "vitest run",
31
+ "test:watch": "vitest",
32
+ "typecheck": "tsc --noEmit",
33
+ "clean": "rm -rf dist .tsbuildinfo"
34
+ },
39
35
  "dependencies": {
36
+ "@hiveai/core": "workspace:*",
40
37
  "@modelcontextprotocol/sdk": "^1.29.0",
41
- "zod": "^3.23.8",
42
- "@hiveai/core": "0.2.8"
38
+ "zod": "^3.23.8"
43
39
  },
44
40
  "peerDependencies": {
45
41
  "@hiveai/embeddings": "^0.2.2"
@@ -48,12 +44,5 @@
48
44
  "@hiveai/embeddings": {
49
45
  "optional": true
50
46
  }
51
- },
52
- "scripts": {
53
- "build": "tsup",
54
- "test": "vitest run",
55
- "test:watch": "vitest",
56
- "typecheck": "tsc --noEmit",
57
- "clean": "rm -rf dist .tsbuildinfo"
58
47
  }
59
- }
48
+ }