knowzcode 0.4.0 → 0.6.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.
Files changed (79) hide show
  1. package/.claude-plugin/marketplace.json +61 -61
  2. package/.claude-plugin/plugin.json +8 -8
  3. package/LICENSE +121 -121
  4. package/README.md +379 -354
  5. package/agents/analyst.md +114 -114
  6. package/agents/architect.md +200 -200
  7. package/agents/builder.md +104 -104
  8. package/agents/closer.md +177 -177
  9. package/agents/context-scout.md +54 -54
  10. package/agents/knowledge-migrator.md +349 -349
  11. package/agents/knowz-scout.md +83 -83
  12. package/agents/knowz-scribe.md +180 -180
  13. package/agents/microfix-specialist.md +135 -135
  14. package/agents/project-advisor.md +111 -111
  15. package/agents/reviewer.md +172 -172
  16. package/agents/security-officer.md +194 -194
  17. package/agents/test-advisor.md +162 -162
  18. package/agents/update-coordinator.md +394 -394
  19. package/bin/knowzcode.mjs +1801 -1199
  20. package/commands/audit.md +328 -328
  21. package/commands/connect-mcp.md +574 -549
  22. package/commands/fix.md +107 -107
  23. package/commands/init.md +616 -500
  24. package/commands/learn.md +332 -332
  25. package/commands/plan.md +272 -272
  26. package/commands/register.md +757 -733
  27. package/commands/status.md +338 -309
  28. package/commands/telemetry-setup.md +368 -368
  29. package/commands/telemetry.md +188 -188
  30. package/commands/work.md +1204 -1204
  31. package/knowzcode/automation_manifest.md +59 -59
  32. package/knowzcode/claude_code_execution.md +431 -431
  33. package/knowzcode/copilot_execution.md +231 -231
  34. package/knowzcode/enterprise/compliance_manifest.md +137 -137
  35. package/knowzcode/enterprise/compliance_status.md +30 -30
  36. package/knowzcode/enterprise/guidelines/code-quality.md +67 -67
  37. package/knowzcode/enterprise/guidelines/security.md +355 -355
  38. package/knowzcode/enterprise/templates/guideline-template.md +55 -55
  39. package/knowzcode/gitignore.template +13 -13
  40. package/knowzcode/knowzcode_architecture.md +51 -51
  41. package/knowzcode/knowzcode_log.md +142 -142
  42. package/knowzcode/knowzcode_loop.md +601 -596
  43. package/knowzcode/knowzcode_orchestration.md +66 -66
  44. package/knowzcode/knowzcode_project.md +48 -48
  45. package/knowzcode/knowzcode_tracker.md +40 -40
  46. package/knowzcode/knowzcode_vaults.md +257 -257
  47. package/knowzcode/mcp_config.md +196 -191
  48. package/knowzcode/planning/Readme.md +6 -6
  49. package/knowzcode/platform_adapters.md +2577 -1260
  50. package/knowzcode/prompts/Execute_Micro_Fix.md +57 -57
  51. package/knowzcode/prompts/Investigate_Codebase.md +227 -227
  52. package/knowzcode/prompts/Migrate_Knowledge.md +301 -301
  53. package/knowzcode/prompts/Refactor_Node.md +72 -72
  54. package/knowzcode/prompts/Spec_Verification_Checkpoint.md +59 -59
  55. package/knowzcode/prompts/[LOOP_1A]__Propose_Change_Set.md +52 -52
  56. package/knowzcode/prompts/[LOOP_1B]__Draft_Specs.md +75 -75
  57. package/knowzcode/prompts/[LOOP_2A]__Implement_Change_Set.md +55 -55
  58. package/knowzcode/prompts/[LOOP_2B]__Verify_Implementation.md +72 -72
  59. package/knowzcode/prompts/[LOOP_3]__Finalize_And_Commit.md +67 -67
  60. package/knowzcode/specs/Readme.md +10 -10
  61. package/knowzcode/telemetry_config.md +89 -89
  62. package/knowzcode/user_preferences.md +120 -120
  63. package/package.json +53 -53
  64. package/skills/alias-resolver.json +15 -15
  65. package/skills/architecture-diff.json +12 -12
  66. package/skills/check-installation-status.json +14 -14
  67. package/skills/continue.md +126 -126
  68. package/skills/environment-guard.json +12 -12
  69. package/skills/generate-workgroup-id.json +25 -25
  70. package/skills/install-knowzcode.json +21 -21
  71. package/skills/load-core-context.json +18 -18
  72. package/skills/log-entry-builder.json +15 -15
  73. package/skills/spec-quality-check.json +14 -14
  74. package/skills/spec-template.json +15 -15
  75. package/skills/spec-validator.json +25 -25
  76. package/skills/start-work.md +224 -224
  77. package/skills/tracker-scan.json +12 -12
  78. package/skills/tracker-update.json +28 -28
  79. package/skills/validate-installation.json +14 -14
@@ -1,549 +1,574 @@
1
- ---
2
- description: Configure KnowzCode MCP server for vector-powered code search and context
3
- ---
4
-
5
- # KnowzCode MCP Server Connection
6
-
7
- You are the **KnowzCode MCP Connection Agent**. Your task is to configure the KnowzCode MCP (Model Context Protocol) server to enable vector-based code search and context retrieval.
8
-
9
- ## Command Syntax
10
-
11
- ```bash
12
- /kc:connect-mcp <api-key> [--endpoint <url>] [--scope <local|project|user>] [--dev] [--configure-vaults]
13
- ```
14
-
15
- **Note:** If you don't have an API key yet, run `/kc:register` to create an account and get one automatically.
16
- Registration also auto-configures your vault - no manual setup needed!
17
-
18
- **Parameters:**
19
- - `<api-key>` - Required. Your KnowzCode API key (or omit for interactive prompt)
20
- - `--endpoint <url>` - Optional. Custom MCP endpoint (overrides environment default)
21
- - `--scope <scope>` - Optional. Configuration scope: local (default), project, or user
22
- - `--dev` - Optional. Use development environment instead of production
23
- - `--configure-vaults` - Optional. Force vault configuration prompts (even if already configured)
24
-
25
- **Environments:**
26
- | Environment | Endpoint | When to Use |
27
- |:------------|:---------|:------------|
28
- | **Production** (default) | `https://mcp.knowz.io/mcp` | Normal usage |
29
- | **Development** | `https://mcp.dev.knowz.io/mcp` | Testing new features |
30
-
31
- **Examples:**
32
- ```bash
33
- # Basic usage (production - default)
34
- /kc:connect-mcp kz_live_abc123...
35
-
36
- # Interactive mode (production)
37
- /kc:connect-mcp
38
-
39
- # Development environment
40
- /kc:connect-mcp kz_test_abc123... --dev
41
-
42
- # Self-hosted endpoint
43
- /kc:connect-mcp kz_live_abc123... --endpoint https://your-domain.com/mcp
44
-
45
- # Project-wide configuration (production)
46
- /kc:connect-mcp kz_live_team456... --scope project
47
-
48
- # Development with project scope
49
- /kc:connect-mcp kz_test_team456... --dev --scope project
50
- ```
51
-
52
- ## What This Enables
53
-
54
- Once connected, you get access to these tools:
55
-
56
- - **`search_knowledge`** - Vector similarity search across vaults
57
- - **`ask_question`** - Q&A with optional research mode
58
- - **`create_knowledge`** - Save learnings to vault (used by finalization)
59
- - **`update_knowledge`** - Update existing knowledge items
60
- - **`find_entities`** - Find people, locations, or events in your knowledge
61
-
62
- ### Default Vault Types
63
-
64
- KnowzCode ships with three default vault types:
65
-
66
- | Vault Type | Purpose | Query Examples |
67
- |------------|---------|----------------|
68
- | **Code** | Implementation patterns, workarounds, performance | "Find auth middleware", "JWT validation" |
69
- | **Ecosystem** | Conventions, decisions, integrations, business rules | "Error handling conventions", "Why Redis?" |
70
- | **Finalizations** | WorkGroup completion summaries, outcome records | "What happened in WG-feat-auth?" |
71
-
72
- Types are user-configurable labels — users can add custom types freely.
73
-
74
- ## Your Task
75
-
76
- Configure the KnowzCode MCP server using Claude Code's built-in MCP management.
77
-
78
- ### Steps to Execute
79
-
80
- 1. **Parse command arguments**
81
- - Extract API key from first positional argument (if provided)
82
- - Parse `--dev` flag to determine environment
83
- - Parse `--endpoint <url>` flag (overrides environment default if provided)
84
- - Default endpoint: `https://mcp.knowz.io/mcp` (production)
85
- - With `--dev` flag: `https://mcp.dev.knowz.io/mcp` (development)
86
- - Parse `--scope <scope>` flag (default: `local`)
87
- - Parse `--configure-vaults` flag (forces vault prompts)
88
- - Store parsed values for use in configuration
89
-
90
- 2. **Check for existing configuration**
91
- - Check if MCP server already configured: `CLAUDECODE= claude mcp get knowz`
92
- - If already configured, ask if user wants to reconfigure
93
- - If yes, run `CLAUDECODE= claude mcp remove knowz` first
94
-
95
- 3. **Prompt for API key (if not provided)**
96
- - If no API key in arguments, prompt user interactively:
97
- ```
98
- Enter your KnowzCode API key
99
- (Get one at https://knowz.io/api-keys)
100
- ```
101
- - Validate format (should start with `kz_live_` or `kz_test_`)
102
- - Never display the full API key back to user
103
-
104
- 4. **Confirm scope (if not provided)**
105
- - If `--scope` not provided, ask user which scope to use:
106
- - **local** (default): Only this project, private to you
107
- - **project**: Shared with team via `.mcp.json` (committed to git)
108
- - **user**: Available across all your projects
109
-
110
- Present as options to user if not specified in command.
111
-
112
- 5. **Validate endpoint URL (if custom)**
113
- - If custom endpoint provided via `--endpoint`, validate it's a valid URL
114
- - Ensure it starts with `https://` (or `http://` for local dev)
115
- - Show which endpoint will be used
116
-
117
- 6. **Configure Vault IDs (Conditional with Discovery)**
118
-
119
- First, check if vaults are already configured in `knowzcode/knowzcode_vaults.md`:
120
- - Read the file and check for connected vaults section
121
-
122
- **If vaults already configured AND `--configure-vaults` NOT set:**
123
- - Skip vault prompts entirely
124
- - Display:
125
- ```
126
- Vaults already configured (from previous setup or /kc:register):
127
- {List vaults from knowzcode_vaults.md}
128
-
129
- To reconfigure vaults, run: /kc:connect-mcp --configure-vaults
130
- ```
131
-
132
- **If vaults NOT configured OR `--configure-vaults` IS set:**
133
-
134
- **Step 6a: Fetch available vaults using list_vaults()**
135
-
136
- Call the `list_vaults` MCP tool to discover available vaults:
137
- ```
138
- list_vaults(includeStats: true)
139
- ```
140
-
141
- If successful, display available vaults:
142
- ```
143
- ◆━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
144
- VAULT DISCOVERY
145
- ◆━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
146
-
147
- Fetching your available vaults...
148
-
149
- Available Vaults:
150
- ┌────┬──────────────────────┬──────────────────┬───────────┐
151
- # │ Name │ Type │ Documents │
152
- ├────┼──────────────────────┼──────────────────┼───────────┤
153
- 1 │ KnowzCode │ ecosystem │ 42 │
154
- │ 2 │ my-project-code │ code │ 1,234
155
- │ 3 │ team-wiki │ ecosystem │ 89 │
156
- └────┴──────────────────────┴──────────────────┴───────────┘
157
- ◆━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
158
- ```
159
-
160
- If `list_vaults` fails or returns empty:
161
- - Fall back to manual vault ID entry (legacy behavior)
162
- - Prompt:
163
- ```
164
- Could not fetch vaults automatically.
165
-
166
- Enter vault IDs manually:
167
-
168
- Ecosystem Vault ID (required for /kc:learn):
169
- • Get from: https://knowz.io/vaults
170
-
171
- Code Vault ID (optional):
172
- • Leave blank to use grep/glob for code search
173
- ```
174
-
175
- **Step 6b: Interactive vault selection**
176
-
177
- For each discovered vault, ask if user wants to connect it:
178
-
179
- ```
180
- Would you like to connect "KnowzCode" (research)?
181
- ```
182
- Use AskUserQuestion with options: [Yes] [No]
183
-
184
- **If "Yes":**
185
- - Prompt for description:
186
- ```
187
- Describe what this vault contains (for intelligent routing):
188
-
189
- Tips for good descriptions:
190
- Be specific about content type
191
- • Include example queries that should route here
192
- Mention key topics covered
193
-
194
- Examples:
195
- "Team learnings, conventions, architectural decisions. Use for 'why did we choose X?' questions."
196
- "Source code for the main API. Use for 'where is X defined?' questions."
197
- ```
198
-
199
- - Collect description via AskUserQuestion (free text input)
200
-
201
- **Step 6c: Loop for additional vaults**
202
-
203
- After each vault selection:
204
- ```
205
- Would you like to connect another vault?
206
- ```
207
- Options: [Yes] [No]
208
-
209
- - If "Yes" and more vaults available: Continue selection loop
210
- - If "No" or no more vaults: Exit loop
211
-
212
- **Step 6d: Write vault configuration**
213
-
214
- Write selected vaults to `knowzcode/knowzcode_vaults.md`:
215
-
216
- ```markdown
217
- # KnowzCode Vault Configuration
218
-
219
- Multi-vault routing configuration for intelligent vault selection.
220
-
221
- ---
222
-
223
- ## Connected Vaults
224
-
225
- ### {vault_id_1}
226
- - **Name**: {vault_name}
227
- - **ID**: {vault_id}
228
- - **Type**: {code | ecosystem | finalizations}
229
- - **Description**: {user_provided_description}
230
-
231
- ### {vault_id_2}
232
- - **Name**: {vault_name}
233
- - **ID**: {vault_id}
234
- - **Type**: {code | ecosystem | finalizations}
235
- - **Description**: {user_provided_description}
236
-
237
- ---
238
-
239
- ## Vault Routing Rules
240
-
241
- - **Code questions** (implementations, files, structure) → {first code vault ID}
242
- - **Convention questions** (patterns, decisions, best practices) → {first ecosystem vault ID}
243
- - **Completion records** {first finalizations vault ID}
244
- - **Learning capture** → {default ecosystem vault ID}
245
- ```
246
-
247
- **Also update `knowzcode/mcp_config.md`** to reflect primary vault (for backwards compatibility):
248
- - Set Ecosystem Vault ID to first ecosystem vault selected
249
- - Set Code Vault ID to first code vault selected (or "not configured")
250
-
251
- **Step 6d.5: Detect uncreated default vaults**
252
-
253
- After writing vault configuration, check `knowzcode/knowzcode_vaults.md` for entries with empty **ID** fields:
254
-
255
- 1. Parse all vault entries in the Connected Vaults section
256
- 2. Find entries where the **ID** field is empty (null GUID — indicates "not yet created on server")
257
- 3. If uncreated entries found:
258
- ```
259
- Found {N} default vault(s) not yet created: {names}. Create them now?
260
- ```
261
- Use AskUserQuestion with options: [Yes, create them] [No, skip for now]
262
- 4. If user confirms: for each uncreated entry, call MCP tool to create the vault on the server. Update the entry's **ID** field with the server-returned vault ID. Update the H3 heading from `(not created)` to the vault ID.
263
- 5. If user declines: proceed normally — vaults can be created later via `/kc:register` or `/kc:connect-mcp --configure-vaults`
264
-
265
- **Step 6e: Show vault configuration summary**
266
-
267
- ```
268
- Vault configuration saved to knowzcode/knowzcode_vaults.md
269
-
270
- Connected Vaults:
271
- KnowzCode (ecosystem) - "Team learnings and conventions"
272
- • my-code (code) - "Source code for API project"
273
-
274
- Routing:
275
- Code questions my-code
276
- • Convention questions → KnowzCode
277
- Completion records Finalizations
278
- • Learning capture → KnowzCode
279
-
280
- You can edit knowzcode/knowzcode_vaults.md to update descriptions or routing rules.
281
- ```
282
-
283
- **Step 6f: Update CLAUDE.md with vault targeting guidance**
284
-
285
- Ensure agents always know to pass `vaultId` by adding a reference section to the project's CLAUDE.md:
286
-
287
- 1. Read the project's `CLAUDE.md`
288
- 2. Search for an existing `### Vault Targeting` or `### Knowz MCP` section
289
- 3. **If found:** Replace the existing section with the updated content below
290
- 4. **If NOT found:** Append the section after the `# KnowzCode Integration` block (or at the end if not found)
291
- 5. Insert a vault targeting reference section that points to the central config:
292
-
293
- ```markdown
294
- ### Vault Targeting (MCP Writes)
295
- **Always pass `vaultId`** when calling `create_knowledge` or `update_knowledge`.
296
- Omitting it saves to the tenant default vault — NOT the project vault.
297
-
298
- Vault IDs and routing rules: `knowzcode/knowzcode_vaults.md`
299
- If vault IDs are already in context from a previous read, do not re-read the file.
300
- For ad-hoc learning capture, prefer `/kc:learn "insight"` — it handles routing automatically.
301
- ```
302
-
303
- 6. Confirm: `"Updated CLAUDE.md with vault targeting guidance (vault IDs managed in knowzcode/knowzcode_vaults.md)."`
304
-
305
- **Idempotent:** Replaces existing `### Vault Targeting` section rather than duplicating.
306
-
307
- 7. **Add MCP server using CLI**
308
- ```bash
309
- claude mcp add --transport http \
310
- --scope <chosen-scope> \
311
- knowz \
312
- <endpoint-url> \
313
- --header "Authorization: Bearer <api-key>" \
314
- --header "X-Project-Path: $(pwd)"
315
- ```
316
-
317
- 8. **Verify configuration**
318
- - Run: `CLAUDECODE= claude mcp get knowz`
319
- - Confirm server appears in the list
320
- - Check for any error messages
321
-
322
- 9. **Update mcp_config.md**
323
- - Update `knowzcode/mcp_config.md` with connection details:
324
- - Set `Connected: Yes`
325
- - Set `Endpoint: <endpoint-url>`
326
- - Set `Last Verified: <timestamp>`
327
- - Set Ecosystem Vault ID and name (if provided or already set)
328
- - Set Code Vault ID and name (if provided)
329
- - Set `Auto-configured: No` (to distinguish from /kc:register setup)
330
-
331
- 10. **Test connection (optional)**
332
- - If verification succeeds, optionally test with a simple tool call
333
- - This validates the API key is valid
334
-
335
- 11. **Report success**
336
- ```
337
- KnowzCode MCP server configured!
338
-
339
- Scope: <chosen-scope>
340
- Endpoint: <endpoint-url>
341
-
342
- Vaults Configured:
343
- Code Vault: <vault-name or "Not configured">
344
- Ecosystem Vault: <vault-name or "Not configured">
345
- • Finalizations Vault: <vault-name or "Not configured">
346
-
347
- 🔄 Please restart Claude Code to activate these features:
348
- • search_knowledge - Vector search across vaults
349
- • ask_question - AI Q&A with research mode
350
- • create_knowledge - Save learnings (via finalization)
351
- update_knowledge - Update existing items
352
- find_entities - Find people/locations/events
353
-
354
- After restart, these tools will be available to all KnowzCode agents.
355
-
356
- Check connection status: /kc:status
357
- ```
358
-
359
- ## Configuration Details
360
-
361
- ### Scope Comparison
362
-
363
- **Local (default)**:
364
- - ✅ Private to you
365
- - ✅ Project-specific
366
- - ❌ Not shared with team
367
- - **Use when:** Personal API key, working solo
368
-
369
- **Project**:
370
- - Shared with team
371
- - ✅ Committed to git via `.mcp.json`
372
- - ⚠️ API key visible to team
373
- - **Use when:** Team API key, collaborative project
374
-
375
- **User**:
376
- - Available everywhere
377
- - Set once, works across projects
378
- - ❌ Not project-specific
379
- - **Use when:** Single API key for all your work
380
-
381
- ### Security Considerations
382
-
383
- - **Never log API keys** in command output
384
- - **Mask displayed keys**: Show only first/last 4 chars (e.g., `kz_live_abc...xyz`)
385
- - **Warn about project scope**: API key will be in git-committed `.mcp.json`
386
- - **Suggest environment variables**: For team setups, recommend storing in CI/CD secrets
387
-
388
- ### MCP Server Details
389
-
390
- The KnowzCode MCP server (default: `https://mcp.knowz.io/mcp`):
391
- - **Protocol:** HTTP transport with JSON-RPC
392
- - **Authentication:** Bearer token in `Authorization` header
393
- - **Project Context:** `X-Project-Path` header identifies project
394
- - **Rate Limiting:** Standard API rate limits apply
395
- - **Caching:** Responses cached for performance
396
-
397
- ### Environment Endpoints
398
-
399
- **Available Environments:**
400
-
401
- | Environment | Endpoint | Flag | Use Case |
402
- |:------------|:---------|:-----|:---------|
403
- | **Production** (default) | `https://mcp.knowz.io/mcp` | (none) | Normal usage |
404
- | **Development** | `https://mcp.dev.knowz.io/mcp` | `--dev` | Testing new features |
405
-
406
- **Switching Environments:**
407
- ```bash
408
- # Production (default)
409
- /kc:connect-mcp kz_live_abc123...
410
-
411
- # Development
412
- /kc:connect-mcp kz_test_abc123... --dev
413
-
414
- # Local development server
415
- /kc:connect-mcp kz_test_local... --endpoint http://localhost:3000/mcp
416
-
417
- # Self-hosted enterprise
418
- /kc:connect-mcp kz_live_abc123... --endpoint https://knowzcode.mycompany.com/mcp
419
- ```
420
-
421
- ## Error Handling
422
-
423
- ### API Key Invalid
424
- ```
425
- ❌ Authentication failed
426
- The API key appears to be invalid or expired.
427
-
428
- Get a new key at: https://knowz.io/api-keys
429
- Then run: /kc:connect-mcp <new-key>
430
- ```
431
-
432
- ### Already Configured
433
- ```
434
- ⚠️ KnowzCode MCP server is already configured
435
- Current scope: <scope>
436
-
437
- Do you want to reconfigure?
438
- ```
439
-
440
- ### Claude CLI Not Available
441
- ```
442
- Cannot configure MCP server
443
- The 'claude' CLI command is not available.
444
-
445
- This is unusual - Claude Code should provide this command.
446
- Please restart Claude Code or report this issue.
447
- ```
448
-
449
- ### Network/Connection Error
450
- ```
451
- Cannot reach KnowzCode API
452
- Failed to connect to {endpoint}
453
-
454
- Check your internet connection and try again.
455
- If using --dev environment, verify the dev server is running.
456
- ```
457
-
458
- ## Advanced Usage
459
-
460
- ### Switching Scopes
461
- To change from local to project scope:
462
- ```bash
463
- # Remove existing (or the command will prompt to reconfigure)
464
- CLAUDECODE= claude mcp remove knowz
465
-
466
- # Re-add with new scope
467
- /kc:connect-mcp <api-key> --scope project
468
- ```
469
-
470
- ### Switching Endpoints
471
- To switch between environments or self-hosted:
472
- ```bash
473
- # Switch to development
474
- /kc:connect-mcp <api-key> --dev
475
-
476
- # Switch back to production (default)
477
- /kc:connect-mcp <api-key>
478
-
479
- # Switch to self-hosted
480
- /kc:connect-mcp <api-key> --endpoint https://knowzcode.mycompany.com/mcp
481
- ```
482
-
483
- ## Integration with KnowzCode Agents
484
-
485
- Once configured, agents automatically detect and use MCP tools with dual vault support:
486
-
487
- **analyst**:
488
- - Uses `search_knowledge` with **code vault** to find related code
489
- - Uses `search_knowledge` with **ecosystem vault** to find past decisions
490
- - Uses `ask_question` with **ecosystem vault** for architectural context
491
-
492
- **architect**:
493
- - Uses `search_knowledge` with **code vault** for implementation examples
494
- - Uses `ask_question` with **ecosystem vault** for conventions
495
-
496
- **builder**:
497
- - Uses `search_knowledge` with **code vault** for similar patterns
498
- - Uses `search_knowledge` with **ecosystem vault** for best practices
499
-
500
- **reviewer**:
501
- - Uses `search_knowledge` with **ecosystem vault** for standards
502
- - Uses `search_knowledge` with **code vault** for precedent checks
503
-
504
- **closer**:
505
- - Uses `search_knowledge` with **ecosystem vault** to check for duplicate learnings
506
- - Uses `create_knowledge` to save new learnings to **ecosystem vault**
507
-
508
- **All agents**:
509
- - Automatically leverage MCP tools when available
510
- - Gracefully degrade if MCP server unavailable
511
-
512
- ## Next Steps
513
-
514
- After configuration:
515
- 1. **Restart Claude Code** (required to activate MCP server)
516
- 2. **Verify connection**: `/kc:status`
517
- 3. **Start building**: `/kc:work "your feature"`
518
- 4. **Watch agents use MCP tools** automatically during workflow
519
-
520
- ## Tool Control & Filtering
521
-
522
- Tools are controlled **server-side** at the MCP endpoint:
523
-
524
- **Server controls which tools to expose based on:**
525
- - API key tier (free/pro/enterprise)
526
- - Project type (monorepo, microservices, etc.)
527
- - Feature flags per user
528
- - Runtime conditions
529
-
530
- **Agents automatically discover and use available tools** - no client-side filtering needed.
531
-
532
- See `docs/MCP_SERVER_IMPLEMENTATION.md` for complete server implementation guide.
533
-
534
- ## Related Commands
535
-
536
- - `/kc:register` - Register for KnowzCode and configure MCP automatically
537
- - `/kc:status` - Check MCP connection status and available tools
538
- - `/kc:init` - Initialize KnowzCode in project
539
- - `/kc:work` - Start feature development (uses MCP tools)
540
-
541
- ## Implementation Notes
542
-
543
- **For Server Developers:**
544
- - See `docs/MCP_SERVER_IMPLEMENTATION.md` for complete specification
545
- - Required methods: `initialize`, `tools/list`, `tools/call`
546
- - Authentication via `Authorization: Bearer` header
547
- - Project context via `X-Project-Path` header
548
-
549
- Execute this configuration now.
1
+ ---
2
+ description: Configure KnowzCode MCP server for vector-powered code search and context
3
+ ---
4
+
5
+ # KnowzCode MCP Server Connection
6
+
7
+ You are the **KnowzCode MCP Connection Agent**. Your task is to configure the KnowzCode MCP (Model Context Protocol) server to enable vector-based code search and context retrieval.
8
+
9
+ ## Command Syntax
10
+
11
+ ```bash
12
+ /kc:connect-mcp <api-key> [--endpoint <url>] [--scope <local|project|user>] [--dev] [--configure-vaults]
13
+ ```
14
+
15
+ **Note:** If you don't have an API key yet, run `/kc:register` to create an account and get one automatically.
16
+ Registration also auto-configures your vault - no manual setup needed!
17
+
18
+ **Parameters:**
19
+ - `<api-key>` - Required. Your KnowzCode API key (or omit for interactive prompt)
20
+ - `--endpoint <url>` - Optional. Custom MCP endpoint (overrides environment default)
21
+ - `--scope <scope>` - Optional. Configuration scope: local (default), project, or user
22
+ - `--dev` - Optional. Use development environment instead of production
23
+ - `--configure-vaults` - Optional. Force vault configuration prompts (even if already configured)
24
+
25
+ **Environments:**
26
+ | Environment | Endpoint | When to Use |
27
+ |:------------|:---------|:------------|
28
+ | **Production** (default) | `https://mcp.knowz.io/mcp` | Normal usage |
29
+ | **Development** | `https://mcp.dev.knowz.io/mcp` | Testing new features |
30
+
31
+ **Examples:**
32
+ ```bash
33
+ # Basic usage (production - default)
34
+ /kc:connect-mcp kz_live_abc123...
35
+
36
+ # Interactive mode (production)
37
+ /kc:connect-mcp
38
+
39
+ # Development environment
40
+ /kc:connect-mcp kz_test_abc123... --dev
41
+
42
+ # Self-hosted endpoint
43
+ /kc:connect-mcp kz_live_abc123... --endpoint https://your-domain.com/mcp
44
+
45
+ # Project-wide configuration (production)
46
+ /kc:connect-mcp kz_live_team456... --scope project
47
+
48
+ # Development with project scope
49
+ /kc:connect-mcp kz_test_team456... --dev --scope project
50
+ ```
51
+
52
+ ## What This Enables
53
+
54
+ Once connected, you get access to these tools:
55
+
56
+ - **`search_knowledge`** - Vector similarity search across vaults
57
+ - **`ask_question`** - Q&A with optional research mode
58
+ - **`create_knowledge`** - Save learnings to vault (used by finalization)
59
+ - **`update_knowledge`** - Update existing knowledge items
60
+ - **`find_entities`** - Find people, locations, or events in your knowledge
61
+
62
+ ### Default Vault Types
63
+
64
+ KnowzCode ships with three default vault types:
65
+
66
+ | Vault Type | Purpose | Query Examples |
67
+ |------------|---------|----------------|
68
+ | **Code** | Implementation patterns, workarounds, performance | "Find auth middleware", "JWT validation" |
69
+ | **Ecosystem** | Conventions, decisions, integrations, business rules | "Error handling conventions", "Why Redis?" |
70
+ | **Finalizations** | WorkGroup completion summaries, outcome records | "What happened in WG-feat-auth?" |
71
+
72
+ Types are user-configurable labels — users can add custom types freely.
73
+
74
+ ## Your Task
75
+
76
+ Configure the KnowzCode MCP server using Claude Code's built-in MCP management.
77
+
78
+ ### Steps to Execute
79
+
80
+ 1. **Parse command arguments**
81
+ - Extract API key from first positional argument (if provided)
82
+ - Parse `--dev` flag to determine environment
83
+ - Parse `--endpoint <url>` flag (overrides environment default if provided)
84
+ - Default endpoint: `https://mcp.knowz.io/mcp` (production)
85
+ - With `--dev` flag: `https://mcp.dev.knowz.io/mcp` (development)
86
+ - Parse `--scope <scope>` flag (default: `local`)
87
+ - Parse `--configure-vaults` flag (forces vault prompts)
88
+ - Store parsed values for use in configuration
89
+
90
+ 1.5. **Smart Config Discovery (if no API key in arguments)**
91
+
92
+ Before prompting for an API key, check known config sources:
93
+
94
+ a. **Environment variable**: Check `KNOWZ_API_KEY`
95
+ - If set: use as the API key, display "Using API key from KNOWZ_API_KEY (ending ...{last4})"
96
+
97
+ b. **Project config**: Read `knowzcode/mcp_config.md`
98
+ - If `Connected: Yes` and endpoint set: pre-populate endpoint for Step 5
99
+ - If `API Key (last 4)` set: note for confirmation prompt
100
+
101
+ c. **Vault config**: Read `knowzcode/knowzcode_vaults.md`
102
+ - If vaults have non-empty IDs: note for Step 6 (skip vault prompts unless `--configure-vaults`)
103
+
104
+ d. **Cross-platform config files** (check for API key in other platforms):
105
+ - `.gemini/settings.json` `mcpServers.knowz.headers.Authorization`
106
+ - `~/.gemini/settings.json` same
107
+ - `.vscode/mcp.json` `servers.knowz.headers`
108
+ - If found: extract Bearer token, offer to reuse:
109
+ "Found existing API key (ending ...{last4}) in {source}. Use this key? [Yes/No]"
110
+
111
+ If a key was discovered, skip Step 3 (interactive API key prompt).
112
+ If vaults were discovered, skip vault prompts in Step 6.
113
+
114
+ 2. **Check for existing configuration**
115
+ - Check if MCP server already configured: `CLAUDECODE= claude mcp get knowz`
116
+ - If already configured, ask if user wants to reconfigure
117
+ - If yes, run `CLAUDECODE= claude mcp remove knowz` first
118
+
119
+ 3. **Prompt for API key (if not provided)**
120
+ - If no API key in arguments, prompt user interactively:
121
+ ```
122
+ Enter your KnowzCode API key
123
+ (Get one at https://knowz.io/api-keys)
124
+ ```
125
+ - Validate format (should start with `kz_live_` or `kz_test_`)
126
+ - Never display the full API key back to user
127
+
128
+ 4. **Confirm scope (if not provided)**
129
+ - If `--scope` not provided, ask user which scope to use:
130
+ - **local** (default): Only this project, private to you
131
+ - **project**: Shared with team via `.mcp.json` (committed to git)
132
+ - **user**: Available across all your projects
133
+
134
+ Present as options to user if not specified in command.
135
+
136
+ 5. **Validate endpoint URL (if custom)**
137
+ - If custom endpoint provided via `--endpoint`, validate it's a valid URL
138
+ - Ensure it starts with `https://` (or `http://` for local dev)
139
+ - Show which endpoint will be used
140
+
141
+ 6. **Configure Vault IDs (Conditional with Discovery)**
142
+
143
+ First, check if vaults are already configured in `knowzcode/knowzcode_vaults.md`:
144
+ - Read the file and check for connected vaults section
145
+
146
+ **If vaults already configured AND `--configure-vaults` NOT set:**
147
+ - Skip vault prompts entirely
148
+ - Display:
149
+ ```
150
+ Vaults already configured (from previous setup or /kc:register):
151
+ {List vaults from knowzcode_vaults.md}
152
+
153
+ To reconfigure vaults, run: /kc:connect-mcp --configure-vaults
154
+ ```
155
+
156
+ **If vaults NOT configured OR `--configure-vaults` IS set:**
157
+
158
+ **Step 6a: Fetch available vaults using list_vaults()**
159
+
160
+ Call the `list_vaults` MCP tool to discover available vaults:
161
+ ```
162
+ list_vaults(includeStats: true)
163
+ ```
164
+
165
+ If successful, display available vaults:
166
+ ```
167
+ ◆━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
168
+ VAULT DISCOVERY
169
+ ◆━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
170
+
171
+ Fetching your available vaults...
172
+
173
+ Available Vaults:
174
+ ┌────┬──────────────────────┬──────────────────┬───────────┐
175
+ # │ Name │ Type │ Documents │
176
+ ├────┼──────────────────────┼──────────────────┼───────────┤
177
+ 1 │ KnowzCode │ ecosystem │ 42 │
178
+ │ 2 │ my-project-code │ code │ 1,234 │
179
+ │ 3 │ team-wiki │ ecosystem │ 89 │
180
+ └────┴──────────────────────┴──────────────────┴───────────┘
181
+ ◆━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
182
+ ```
183
+
184
+ If `list_vaults` fails or returns empty:
185
+ - Fall back to manual vault ID entry (legacy behavior)
186
+ - Prompt:
187
+ ```
188
+ Could not fetch vaults automatically.
189
+
190
+ Enter vault IDs manually:
191
+
192
+ Ecosystem Vault ID (required for /kc:learn):
193
+ • Get from: https://knowz.io/vaults
194
+
195
+ Code Vault ID (optional):
196
+ Leave blank to use grep/glob for code search
197
+ ```
198
+
199
+ **Step 6b: Interactive vault selection**
200
+
201
+ For each discovered vault, ask if user wants to connect it:
202
+
203
+ ```
204
+ Would you like to connect "KnowzCode" (research)?
205
+ ```
206
+ Use AskUserQuestion with options: [Yes] [No]
207
+
208
+ **If "Yes":**
209
+ - Prompt for description:
210
+ ```
211
+ Describe what this vault contains (for intelligent routing):
212
+
213
+ Tips for good descriptions:
214
+ Be specific about content type
215
+ • Include example queries that should route here
216
+ • Mention key topics covered
217
+
218
+ Examples:
219
+ "Team learnings, conventions, architectural decisions. Use for 'why did we choose X?' questions."
220
+ • "Source code for the main API. Use for 'where is X defined?' questions."
221
+ ```
222
+
223
+ - Collect description via AskUserQuestion (free text input)
224
+
225
+ **Step 6c: Loop for additional vaults**
226
+
227
+ After each vault selection:
228
+ ```
229
+ Would you like to connect another vault?
230
+ ```
231
+ Options: [Yes] [No]
232
+
233
+ - If "Yes" and more vaults available: Continue selection loop
234
+ - If "No" or no more vaults: Exit loop
235
+
236
+ **Step 6d: Write vault configuration**
237
+
238
+ Write selected vaults to `knowzcode/knowzcode_vaults.md`:
239
+
240
+ ```markdown
241
+ # KnowzCode Vault Configuration
242
+
243
+ Multi-vault routing configuration for intelligent vault selection.
244
+
245
+ ---
246
+
247
+ ## Connected Vaults
248
+
249
+ ### {vault_id_1}
250
+ - **Name**: {vault_name}
251
+ - **ID**: {vault_id}
252
+ - **Type**: {code | ecosystem | finalizations}
253
+ - **Description**: {user_provided_description}
254
+
255
+ ### {vault_id_2}
256
+ - **Name**: {vault_name}
257
+ - **ID**: {vault_id}
258
+ - **Type**: {code | ecosystem | finalizations}
259
+ - **Description**: {user_provided_description}
260
+
261
+ ---
262
+
263
+ ## Vault Routing Rules
264
+
265
+ - **Code questions** (implementations, files, structure) → {first code vault ID}
266
+ - **Convention questions** (patterns, decisions, best practices) → {first ecosystem vault ID}
267
+ - **Completion records** → {first finalizations vault ID}
268
+ - **Learning capture** {default ecosystem vault ID}
269
+ ```
270
+
271
+ **Also update `knowzcode/mcp_config.md`** to reflect primary vault (for backwards compatibility):
272
+ - Set Ecosystem Vault ID to first ecosystem vault selected
273
+ - Set Code Vault ID to first code vault selected (or "not configured")
274
+
275
+ **Step 6d.5: Detect uncreated default vaults**
276
+
277
+ After writing vault configuration, check `knowzcode/knowzcode_vaults.md` for entries with empty **ID** fields:
278
+
279
+ 1. Parse all vault entries in the Connected Vaults section
280
+ 2. Find entries where the **ID** field is empty (null GUID — indicates "not yet created on server")
281
+ 3. If uncreated entries found:
282
+ ```
283
+ Found {N} default vault(s) not yet created: {names}. Create them now?
284
+ ```
285
+ Use AskUserQuestion with options: [Yes, create them] [No, skip for now]
286
+ 4. If user confirms: for each uncreated entry, call MCP tool to create the vault on the server. Update the entry's **ID** field with the server-returned vault ID. Update the H3 heading from `(not created)` to the vault ID.
287
+ 5. If user declines: proceed normally — vaults can be created later via `/kc:register` or `/kc:connect-mcp --configure-vaults`
288
+
289
+ **Step 6e: Show vault configuration summary**
290
+
291
+ ```
292
+ Vault configuration saved to knowzcode/knowzcode_vaults.md
293
+
294
+ Connected Vaults:
295
+ KnowzCode (ecosystem) - "Team learnings and conventions"
296
+ my-code (code) - "Source code for API project"
297
+
298
+ Routing:
299
+ Code questions my-code
300
+ Convention questions KnowzCode
301
+ • Completion records → Finalizations
302
+ • Learning capture → KnowzCode
303
+
304
+ You can edit knowzcode/knowzcode_vaults.md to update descriptions or routing rules.
305
+ ```
306
+
307
+ **Step 6f: Update CLAUDE.md with vault targeting guidance**
308
+
309
+ Ensure agents always know to pass `vaultId` by adding a reference section to the project's CLAUDE.md:
310
+
311
+ 1. Read the project's `CLAUDE.md`
312
+ 2. Search for an existing `### Vault Targeting` or `### Knowz MCP` section
313
+ 3. **If found:** Replace the existing section with the updated content below
314
+ 4. **If NOT found:** Append the section after the `# KnowzCode Integration` block (or at the end if not found)
315
+ 5. Insert a vault targeting reference section that points to the central config:
316
+
317
+ ```markdown
318
+ ### Vault Targeting (MCP Writes)
319
+ **Always pass `vaultId`** when calling `create_knowledge` or `update_knowledge`.
320
+ Omitting it saves to the tenant default vault — NOT the project vault.
321
+
322
+ Vault IDs and routing rules: `knowzcode/knowzcode_vaults.md`
323
+ If vault IDs are already in context from a previous read, do not re-read the file.
324
+ For ad-hoc learning capture, prefer `/kc:learn "insight"` — it handles routing automatically.
325
+ ```
326
+
327
+ 6. Confirm: `"Updated CLAUDE.md with vault targeting guidance (vault IDs managed in knowzcode/knowzcode_vaults.md)."`
328
+
329
+ **Idempotent:** Replaces existing `### Vault Targeting` section rather than duplicating.
330
+
331
+ 7. **Add MCP server using CLI**
332
+ ```bash
333
+ claude mcp add --transport http \
334
+ --scope <chosen-scope> \
335
+ knowz \
336
+ <endpoint-url> \
337
+ --header "Authorization: Bearer <api-key>" \
338
+ --header "X-Project-Path: $(pwd)"
339
+ ```
340
+
341
+ 8. **Verify configuration**
342
+ - Run: `CLAUDECODE= claude mcp get knowz`
343
+ - Confirm server appears in the list
344
+ - Check for any error messages
345
+
346
+ 9. **Update mcp_config.md**
347
+ - Update `knowzcode/mcp_config.md` with connection details:
348
+ - Set `Connected: Yes`
349
+ - Set `Endpoint: <endpoint-url>`
350
+ - Set `Last Verified: <timestamp>`
351
+ - Set `API Key (last 4): <last 4 characters of the API key>`
352
+ - Set Ecosystem Vault ID and name (if provided or already set)
353
+ - Set Code Vault ID and name (if provided)
354
+ - Set `Auto-configured: No` (to distinguish from /kc:register setup)
355
+
356
+ 10. **Test connection (optional)**
357
+ - If verification succeeds, optionally test with a simple tool call
358
+ - This validates the API key is valid
359
+
360
+ 11. **Report success**
361
+ ```
362
+ ✅ KnowzCode MCP server configured!
363
+
364
+ Scope: <chosen-scope>
365
+ Endpoint: <endpoint-url>
366
+
367
+ Vaults Configured:
368
+ • Code Vault: <vault-name or "Not configured">
369
+ • Ecosystem Vault: <vault-name or "Not configured">
370
+ • Finalizations Vault: <vault-name or "Not configured">
371
+
372
+ 🔄 Please restart Claude Code to activate these features:
373
+ search_knowledge - Vector search across vaults
374
+ • ask_question - AI Q&A with research mode
375
+ • create_knowledge - Save learnings (via finalization)
376
+ • update_knowledge - Update existing items
377
+ find_entities - Find people/locations/events
378
+
379
+ After restart, these tools will be available to all KnowzCode agents.
380
+
381
+ Check connection status: /kc:status
382
+ ```
383
+
384
+ ## Configuration Details
385
+
386
+ ### Scope Comparison
387
+
388
+ **Local (default)**:
389
+ - ✅ Private to you
390
+ - Project-specific
391
+ - Not shared with team
392
+ - **Use when:** Personal API key, working solo
393
+
394
+ **Project**:
395
+ - Shared with team
396
+ - ✅ Committed to git via `.mcp.json`
397
+ - ⚠️ API key visible to team
398
+ - **Use when:** Team API key, collaborative project
399
+
400
+ **User**:
401
+ - Available everywhere
402
+ - ✅ Set once, works across projects
403
+ - Not project-specific
404
+ - **Use when:** Single API key for all your work
405
+
406
+ ### Security Considerations
407
+
408
+ - **Never log API keys** in command output
409
+ - **Mask displayed keys**: Show only first/last 4 chars (e.g., `kz_live_abc...xyz`)
410
+ - **Warn about project scope**: API key will be in git-committed `.mcp.json`
411
+ - **Suggest environment variables**: For team setups, recommend storing in CI/CD secrets
412
+
413
+ ### MCP Server Details
414
+
415
+ The KnowzCode MCP server (default: `https://mcp.knowz.io/mcp`):
416
+ - **Protocol:** HTTP transport with JSON-RPC
417
+ - **Authentication:** Bearer token in `Authorization` header
418
+ - **Project Context:** `X-Project-Path` header identifies project
419
+ - **Rate Limiting:** Standard API rate limits apply
420
+ - **Caching:** Responses cached for performance
421
+
422
+ ### Environment Endpoints
423
+
424
+ **Available Environments:**
425
+
426
+ | Environment | Endpoint | Flag | Use Case |
427
+ |:------------|:---------|:-----|:---------|
428
+ | **Production** (default) | `https://mcp.knowz.io/mcp` | (none) | Normal usage |
429
+ | **Development** | `https://mcp.dev.knowz.io/mcp` | `--dev` | Testing new features |
430
+
431
+ **Switching Environments:**
432
+ ```bash
433
+ # Production (default)
434
+ /kc:connect-mcp kz_live_abc123...
435
+
436
+ # Development
437
+ /kc:connect-mcp kz_test_abc123... --dev
438
+
439
+ # Local development server
440
+ /kc:connect-mcp kz_test_local... --endpoint http://localhost:3000/mcp
441
+
442
+ # Self-hosted enterprise
443
+ /kc:connect-mcp kz_live_abc123... --endpoint https://knowzcode.mycompany.com/mcp
444
+ ```
445
+
446
+ ## Error Handling
447
+
448
+ ### API Key Invalid
449
+ ```
450
+ ❌ Authentication failed
451
+ The API key appears to be invalid or expired.
452
+
453
+ Get a new key at: https://knowz.io/api-keys
454
+ Then run: /kc:connect-mcp <new-key>
455
+ ```
456
+
457
+ ### Already Configured
458
+ ```
459
+ ⚠️ KnowzCode MCP server is already configured
460
+ Current scope: <scope>
461
+
462
+ Do you want to reconfigure?
463
+ ```
464
+
465
+ ### Claude CLI Not Available
466
+ ```
467
+ Cannot configure MCP server
468
+ The 'claude' CLI command is not available.
469
+
470
+ This is unusual - Claude Code should provide this command.
471
+ Please restart Claude Code or report this issue.
472
+ ```
473
+
474
+ ### Network/Connection Error
475
+ ```
476
+ Cannot reach KnowzCode API
477
+ Failed to connect to {endpoint}
478
+
479
+ Check your internet connection and try again.
480
+ If using --dev environment, verify the dev server is running.
481
+ ```
482
+
483
+ ## Advanced Usage
484
+
485
+ ### Switching Scopes
486
+ To change from local to project scope:
487
+ ```bash
488
+ # Remove existing (or the command will prompt to reconfigure)
489
+ CLAUDECODE= claude mcp remove knowz
490
+
491
+ # Re-add with new scope
492
+ /kc:connect-mcp <api-key> --scope project
493
+ ```
494
+
495
+ ### Switching Endpoints
496
+ To switch between environments or self-hosted:
497
+ ```bash
498
+ # Switch to development
499
+ /kc:connect-mcp <api-key> --dev
500
+
501
+ # Switch back to production (default)
502
+ /kc:connect-mcp <api-key>
503
+
504
+ # Switch to self-hosted
505
+ /kc:connect-mcp <api-key> --endpoint https://knowzcode.mycompany.com/mcp
506
+ ```
507
+
508
+ ## Integration with KnowzCode Agents
509
+
510
+ Once configured, agents automatically detect and use MCP tools with dual vault support:
511
+
512
+ **analyst**:
513
+ - Uses `search_knowledge` with **code vault** to find related code
514
+ - Uses `search_knowledge` with **ecosystem vault** to find past decisions
515
+ - Uses `ask_question` with **ecosystem vault** for architectural context
516
+
517
+ **architect**:
518
+ - Uses `search_knowledge` with **code vault** for implementation examples
519
+ - Uses `ask_question` with **ecosystem vault** for conventions
520
+
521
+ **builder**:
522
+ - Uses `search_knowledge` with **code vault** for similar patterns
523
+ - Uses `search_knowledge` with **ecosystem vault** for best practices
524
+
525
+ **reviewer**:
526
+ - Uses `search_knowledge` with **ecosystem vault** for standards
527
+ - Uses `search_knowledge` with **code vault** for precedent checks
528
+
529
+ **closer**:
530
+ - Uses `search_knowledge` with **ecosystem vault** to check for duplicate learnings
531
+ - Uses `create_knowledge` to save new learnings to **ecosystem vault**
532
+
533
+ **All agents**:
534
+ - Automatically leverage MCP tools when available
535
+ - Gracefully degrade if MCP server unavailable
536
+
537
+ ## Next Steps
538
+
539
+ After configuration:
540
+ 1. **Restart Claude Code** (required to activate MCP server)
541
+ 2. **Verify connection**: `/kc:status`
542
+ 3. **Start building**: `/kc:work "your feature"`
543
+ 4. **Watch agents use MCP tools** automatically during workflow
544
+
545
+ ## Tool Control & Filtering
546
+
547
+ Tools are controlled **server-side** at the MCP endpoint:
548
+
549
+ **Server controls which tools to expose based on:**
550
+ - API key tier (free/pro/enterprise)
551
+ - Project type (monorepo, microservices, etc.)
552
+ - Feature flags per user
553
+ - Runtime conditions
554
+
555
+ **Agents automatically discover and use available tools** - no client-side filtering needed.
556
+
557
+ See `docs/MCP_SERVER_IMPLEMENTATION.md` for complete server implementation guide.
558
+
559
+ ## Related Commands
560
+
561
+ - `/kc:register` - Register for KnowzCode and configure MCP automatically
562
+ - `/kc:status` - Check MCP connection status and available tools
563
+ - `/kc:init` - Initialize KnowzCode in project
564
+ - `/kc:work` - Start feature development (uses MCP tools)
565
+
566
+ ## Implementation Notes
567
+
568
+ **For Server Developers:**
569
+ - See `docs/MCP_SERVER_IMPLEMENTATION.md` for complete specification
570
+ - Required methods: `initialize`, `tools/list`, `tools/call`
571
+ - Authentication via `Authorization: Bearer` header
572
+ - Project context via `X-Project-Path` header
573
+
574
+ Execute this configuration now.