agentic-knowledge-mcp 0.1.13 β†’ 1.0.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 CHANGED
@@ -1,484 +1,134 @@
1
1
  # 🧠 Agentic Knowledge
2
2
 
3
- > **⚠️ WORK IN PROGRESS ⚠️**
4
- > This project is under active development and not yet ready for production use. APIs may change without notice.
3
+ **Search any documentation as if you had written it yourself**
5
4
 
6
- <div align="center">
7
- <h3>The End of RAG. The Dawn of Agentic Search. Maybe.</h3>
8
- <p><em>Intelligent navigation instructions that guide AI assistants through documentation using filesystem-like exploration instead of traditional retrieval</em></p>
9
-
10
- <a href="https://github.com/yourusername/agentic-knowledge/blob/main/LICENSE">
11
- <img src="https://img.shields.io/github/license/yourusername/agentic-knowledge.svg?style=for-the-badge" alt="License" />
12
- </a>
13
- <a href="https://linkedin.com/in/yourusername">
14
- <img src="https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555" alt="LinkedIn" />
15
- </a>
16
- </div>
5
+ An MCP server that guides AI assistants to navigate documentation using their built-in tools (grep, file reading) instead of traditional RAG. Leverages ever growing capabilities of large language models, better tool-calling and interpretation and agentic search patterns for precise, intelligent documentation discovery.
17
6
 
18
7
  ---
19
8
 
20
- ## 🎯 What Is This?
21
-
22
- **Agentic Knowledge** represents a fundamental paradigm shift away from traditional Retrieval-Augmented Generation (RAG) toward **agentic search patterns**. Instead of chunking documents, computing embeddings, and retrieving fragments, this system provides **intelligent navigation instructions** that leverage the AI agent's existing tools (grep, ripgrep, file reading) and the explosion of context windows.
23
-
24
- ### The Core Insight
25
-
26
- Modern AI assistants are **context-rich** (200K+ tokens) and equipped with powerful filesystem tools. Rather than building complex search infrastructure, we can guide them to navigate documentation intelligentlyβ€”just like Claude Code revolutionized code analysis by ditching RAG for direct filesystem exploration.
27
-
28
- ## πŸͺ¦ Why RAG is Dead
29
-
30
- _Inspired by [The RAG Obituary](https://www.nicolasbustamante.com/p/the-rag-obituary-killed-by-agents) by Nicolas Bustamante_
31
-
32
- Traditional RAG was a brilliant workaround for the **context-poor era** (GPT-4's 8K tokens). But it came with fundamental limitations:
33
-
34
- ### The RAG Problem Stack
35
-
36
- ```
37
- ❌ Chunking destroys document relationships
38
- ❌ Embeddings fail on precise terminology
39
- ❌ Similarity search misses exact matches
40
- ❌ Reranking adds latency and complexity
41
- ❌ Context fragmentation loses coherence
42
- ❌ Infrastructure burden is massive
43
- ```
44
-
45
- ### The Agentic Solution
46
-
47
- ```
48
- βœ… Direct filesystem navigation
49
- βœ… Intelligent reference following
50
- βœ… Complete document context
51
- βœ… Zero infrastructure overhead
52
- βœ… Sub-10ms response times
53
- βœ… Deterministic, precise results
54
- ```
55
-
56
- ## πŸ”„ From Retrieval to Navigation
57
-
58
- Traditional RAG says: _"Here are 50 fragments that mention your keywords"_
59
-
60
- Agentic Knowledge says: _"Search for 'useState' in `./docs/react-18.2/hooks/`. If that doesn't help, try 'state management' in `./docs/patterns/`. Follow any 'See also' references you find."_
61
-
62
- The difference? **Guidance over fragments. Investigation over retrieval.**
63
-
64
- ## πŸ— How It Works
9
+ ## 🎯 What Is This For?
65
10
 
66
- ### MCP Server Integration
67
-
68
- Implements the [Model Context Protocol](https://modelcontextprotocol.io/) with two core tools:
69
-
70
- ```typescript
71
- // Get navigation guidance for specific queries
72
- search_docs({
73
- docset: "react-docs",
74
- keywords: ["useEffect", "cleanup"],
75
- generalized_keywords: ["lifecycle", "memory"],
76
- });
77
-
78
- // Discover available documentation sets
79
- list_docsets();
80
- ```
81
-
82
- ### Configuration-Driven Intelligence
83
-
84
- Simple `.knowledge/config.yaml` pattern:
85
-
86
- ```yaml
87
- version: "1.0"
88
- docsets:
89
- - id: react-docs
90
- name: React Documentation
91
- description: "React framework documentation"
92
- sources:
93
- - type: local_folder
94
- paths: ["./docs/react-18.2"]
95
- template: |
96
- Search for '{{keywords}}' in {{local_path}}/hooks/.
97
- If not found, try '{{generalized_keywords}}' in {{local_path}}/patterns/.
98
- Follow any cross-references you discover.
99
- ```
100
-
101
- ### The Navigation Response
102
-
103
- Instead of document fragments, you get **actionable instructions**:
104
-
105
- ```
106
- Based on your React useEffect cleanup query:
107
-
108
- 1. Start with `./docs/react-18.2/hooks/effect.md` - contains useEffect fundamentals
109
- 2. Search for "cleanup function" patterns in `./docs/react-18.2/patterns/`
110
- 3. Check `./examples/lifecycle/` for practical cleanup implementations
111
- 4. Review `./docs/react-18.2/performance/memory.md` for memory leak prevention
112
-
113
- Focus on the cleanup function return pattern and dependency array management.
114
- ```
11
+ Give your AI assistant access to any documentationβ€”yours or third-partyβ€”so it can find answers as naturally as you would. No embeddings, no vector databases, no complex infrastructure.
115
12
 
116
- ## πŸš€ Why This Matters
117
-
118
- ### The Context Revolution
119
-
120
- - **2022**: GPT-4 had 8K tokens (~12 pages)
121
- - **2025**: Claude Sonnet has 200K tokens (~700 pages)
122
- - **Future**: Heading toward 2M+ tokens (~6,000 pages)
123
-
124
- ### The Tool Evolution
125
-
126
- AI assistants now have sophisticated filesystem tools:
127
-
128
- - **Grep/Ripgrep**: Lightning-fast regex search through files
129
- - **Glob**: Direct file discovery by patterns
130
- - **Direct File Access**: Read complete documents in context
131
- - **Reference Following**: Navigate cross-references naturally
132
-
133
- ### The Infrastructure Shift
134
-
135
- - **RAG**: Elasticsearch clusters, embedding models, rerankers, vector databases
136
- - **Agentic**: Simple YAML config, zero infrastructure, filesystem tools
137
-
138
- ## 🎯 Core Principles
139
-
140
- ### 1. **Guidance Over Search**
141
-
142
- Provide intelligent navigation instructions instead of search results
143
-
144
- ### 2. **Context Abundance**
145
-
146
- Leverage massive context windows instead of working around limitations
147
-
148
- ### 3. **Tool Evolution Compatibility**
149
-
150
- Instructions remain stable as agent capabilities evolve (grep β†’ AST parsing β†’ future tools)
151
-
152
- ### 4. **Zero AI Dependency**
153
-
154
- Pure logic-based guidance for reliability and speed
155
-
156
- ### 5. **Investigation Over Retrieval**
157
-
158
- Agents follow references and build understanding incrementally
13
+ **Perfect for:**
14
+ - πŸ“š **Project documentation** - Your team's internal docs, APIs, guides
15
+ - πŸ”§ **Framework references** - React, TypeScript, MCP SDK, any library
16
+ - 🏒 **Enterprise knowledge** - Company wikis, architecture docs, runbooks
17
+ - 🌐 **Open source projects** - Clone any repo's docs for instant access
159
18
 
160
19
  ## πŸš€ Quick Start
161
20
 
162
- ### Installation
163
-
164
- ```bash
165
- npm install -g agentic-knowledge
166
- # or
167
- npx agentic-knowledge
168
- ```
169
-
170
- ### Basic Setup
171
-
172
- 1. **Create configuration directory**:
173
-
174
- ```bash
175
- mkdir .knowledge
176
- ```
177
-
178
- 2. **Add configuration** (`.knowledge/config.yaml`):
179
-
180
- ```yaml
181
- version: "1.0"
182
- docsets:
183
- - id: my-docs
184
- name: My Project Documentation
185
- description: "Local project documentation"
186
- sources:
187
- - type: local_folder
188
- paths: ["./docs"]
189
-
190
- - id: react-docs
191
- name: React Documentation
192
- description: "Official React documentation from GitHub"
193
- sources:
194
- - type: git_repo
195
- url: "https://github.com/facebook/react.git"
196
- branch: "main"
197
- paths: ["docs/"]
198
- ```
199
-
200
- 3. **Start the MCP server**:
201
-
202
- ```bash
203
- agentic-knowledge
204
- ```
205
-
206
- 4. **Connect your AI assistant** using MCP protocol
207
-
208
- ## πŸ“‹ Configuration Guide
209
-
210
- ### Local Folder Sources
211
-
212
- For documentation stored locally in your project:
213
-
214
- ```yaml
215
- docsets:
216
- - id: my-project
217
- name: My Project Docs
218
- sources:
219
- - type: local_folder
220
- paths:
221
- - "./docs" # Single directory
222
- - "./guides" # Multiple directories
223
- - "./api/README.md" # Specific files
224
- ```
225
-
226
- **Benefits:**
227
- - βœ… **No file duplication** - creates symlinks to original locations
228
- - βœ… **Real-time updates** - changes immediately visible
229
- - βœ… **Relative paths** - returns clean relative paths for LLM navigation
230
-
231
- ### Git Repository Sources
232
-
233
- For documentation from remote repositories:
234
-
235
- ```yaml
236
- docsets:
237
- - id: external-docs
238
- name: External Documentation
239
- sources:
240
- - type: git_repo
241
- url: "https://github.com/owner/repo.git"
242
- branch: "main" # Optional, defaults to main
243
- paths: ["docs/", "README.md"] # Optional, extracts specific paths
244
- ```
245
-
246
- **Benefits:**
247
- - βœ… **Automatic downloads** - fetches latest documentation
248
- - βœ… **Selective extraction** - only downloads specified paths
249
- - βœ… **Branch selection** - target specific branches or tags
250
-
251
- ### Mixed Configuration
252
-
253
- Combine local and remote sources in one configuration:
254
-
255
- ```yaml
256
- version: "1.0"
257
- docsets:
258
- - id: local-guides
259
- name: Local User Guides
260
- sources:
261
- - type: local_folder
262
- paths: ["./docs/guides"]
263
-
264
- - id: api-reference
265
- name: API Reference
266
- sources:
267
- - type: git_repo
268
- url: "https://github.com/company/api-docs.git"
269
- paths: ["reference/"]
270
-
271
- - id: mixed-sources
272
- name: Combined Documentation
273
- sources:
274
- - type: local_folder
275
- paths: ["./internal-docs"]
276
- - type: git_repo
277
- url: "https://github.com/external/docs.git"
278
- ```
279
-
280
- ## 🎯 How to Use
281
-
282
- ### Step 1: Set Up Your Documentation
283
-
284
- Create a `.knowledge/config.yaml` file in your project root:
285
-
286
- ```yaml
287
- version: "1.0"
288
- docsets:
289
- - id: my-project
290
- name: My Project Documentation
291
- description: "Main project documentation"
292
- sources:
293
- - type: local_folder
294
- paths: ["./docs", "./README.md"]
295
- ```
296
-
297
- ### Step 2: Start the MCP Server
298
-
299
- ```bash
300
- # Install globally
301
- npm install -g agentic-knowledge
302
-
303
- # Start the server
304
- agentic-knowledge
305
- ```
306
-
307
- The server will:
308
- - βœ… Create symlinks for local folders in `.knowledge/docsets/`
309
- - βœ… Validate your configuration
310
- - βœ… Start listening for MCP requests
311
-
312
- ### Step 3: Connect Your AI Assistant
313
-
314
- Configure your AI assistant (Claude Desktop, etc.) to use the MCP server:
21
+ ### 1. Configure an MCP Client
315
22
 
23
+ Add to your coding agent config something along the lines of
316
24
  ```json
317
25
  {
318
26
  "mcpServers": {
319
27
  "agentic-knowledge": {
320
- "command": "agentic-knowledge"
28
+ "command": "npx",
29
+ "args": ["-y", "agentic-knowledge-mcp"]
321
30
  }
322
31
  }
323
32
  }
324
33
  ```
325
34
 
326
- ### Step 4: Search Your Documentation
327
-
328
- Use the `search_docs` tool in your AI assistant:
329
-
330
- ```
331
- search_docs({
332
- docset_id: "my-project",
333
- keywords: "authentication setup",
334
- generalized_keywords: "login, auth, security"
335
- })
336
- ```
337
-
338
- **Response:**
339
- ```
340
- # πŸ“š Search My Project Documentation
341
-
342
- **Primary terms:** authentication setup
343
- **Related terms:** login, auth, security
344
- **Location:** docs
345
-
346
- ## πŸ” Search Strategy
347
-
348
- 1. **Start with Specific Terms**
349
- Use your text search tools (grep, rg, ripgrep) to search for: `authentication setup`
350
35
 
351
- 2. **Expand to Related Terms**
352
- If initial search doesn't yield results, try: `login, auth, security`
36
+ ### 2. Set Up Your First Docset
353
37
 
354
- 3. **What to Avoid**
355
- Skip these directories: `node_modules/`, `.git/`, `.knowledge/`
356
- ```
357
-
358
- ### Step 5: Follow the Guidance
359
-
360
- Your AI assistant will use the provided search strategy to:
361
- 1. πŸ” Search your documentation with the suggested terms
362
- 2. πŸ“‚ Navigate to the right files and directories
363
- 3. 🎯 Find exactly what you're looking for
364
- 4. πŸ”— Follow cross-references and related content
38
+ **Option A: Use the CLI (Recommended)**
365
39
 
366
- ## πŸ’‘ Pro Tips
40
+ ```bash
41
+ # For a Git repository
42
+ npx agentic-knowledge-mcp create \
43
+ --preset git-repo \
44
+ --id react-docs \
45
+ --name "React Documentation" \
46
+ --url https://github.com/facebook/react.git
367
47
 
368
- ### Local Development Workflow
48
+ # Initialize (downloads the docs)
49
+ npx agentic-knowledge-mcp init react-docs
369
50
 
370
- ```yaml
371
- # Perfect for active development
372
- docsets:
373
- - id: current-project
374
- name: Current Project
375
- sources:
376
- - type: local_folder
377
- paths: ["./docs", "./README.md", "./CHANGELOG.md"]
51
+ # The MCP server starts automatically when Claude Desktop launches
378
52
  ```
379
53
 
380
- **Benefits:**
381
- - Changes in your docs are immediately available
382
- - No copying or syncing needed
383
- - Works with any file type
54
+ **Option B: Manual Configuration**
384
55
 
385
- ### Multi-Repository Setup
56
+ Create `.knowledge/config.yaml`:
386
57
 
387
58
  ```yaml
388
- # Combine multiple sources
59
+ version: "1.0"
389
60
  docsets:
390
- - id: frontend-docs
391
- name: Frontend Documentation
61
+ - id: my-docs
62
+ name: My Project Documentation
392
63
  sources:
393
64
  - type: local_folder
394
- paths: ["./frontend/docs"]
395
- - type: git_repo
396
- url: "https://github.com/company/design-system.git"
397
- paths: ["docs/"]
398
-
399
- - id: backend-docs
400
- name: Backend Documentation
401
- sources:
402
- - type: git_repo
403
- url: "https://github.com/company/api-docs.git"
404
- branch: "main"
65
+ paths: ["./docs"]
405
66
  ```
406
67
 
407
- ### Advanced Search Strategies
408
68
 
409
- Use specific and generalized keywords for better results:
69
+ ### 3. Use It
410
70
 
411
- ```javascript
412
- // βœ… Good: Specific + General
413
- search_docs({
414
- docset_id: "react-docs",
415
- keywords: "useEffect cleanup function",
416
- generalized_keywords: "hooks, lifecycle, memory management"
417
- })
71
+ Your AI assistant now has access to `search_docs` and `list_docsets` tools. Ask questions naturally:
418
72
 
419
- // ❌ Too vague
420
- search_docs({
421
- docset_id: "react-docs",
422
- keywords: "react",
423
- generalized_keywords: "javascript"
424
- })
73
+ ```
74
+ "How do I implement a cleanup function in React useEffect?"
75
+ "Show me the authentication setup in our docs"
76
+ "Find examples of rate limiting in the API docs"
425
77
  ```
426
78
 
427
- ## πŸ“Š Performance vs RAG
428
-
429
- | Metric | Traditional RAG | Agentic Knowledge |
430
- | ------------------ | ------------------------- | ----------------- |
431
- | **Setup Time** | Hours (indexing) | Seconds (config) |
432
- | **Response Time** | 300-2000ms | <10ms |
433
- | **Infrastructure** | Elasticsearch + Vector DB | Zero |
434
- | **Maintenance** | High (reindexing) | None |
435
- | **Accuracy** | Fragment-based | Complete context |
436
- | **Cost** | High (compute) | Minimal |
79
+ The assistant will receive intelligent navigation instructions and use grep/file reading to find the exact information.
437
80
 
438
- ## πŸ”¬ The Future of Knowledge Systems
81
+ ## πŸ“– Documentation
439
82
 
440
- We're entering the **post-retrieval age**. The winners won't be those with the biggest vector databases, but those who design the smartest navigation systems for abundant context.
83
+ - **[User Guide](./USER_GUIDE.md)** - Detailed CLI commands, lifecycle, configuration
84
+ - **[Examples](./examples/)** - Configuration examples and integration guides
85
+ - **[Testing Guide](./TESTING.md)** - Comprehensive testing documentation
441
86
 
442
- **RAG was training wheels**β€”useful, necessary, but temporary. The future belongs to systems that read, navigate, and reason end-to-end.
87
+ ## πŸ’‘ How and Why It Works
443
88
 
444
- ## πŸš€ Local Development & Installation
89
+ ### The Paradigm Shift
445
90
 
446
- ### Installing from Source (Before NPM Publication)
91
+ Traditional RAG (Retrieval-Augmented Generation) was built for the **context-poor era** when models had 8K token limits. It:
92
+ - Chunks documents (losing relationships)
93
+ - Computes embeddings (missing precise terminology)
94
+ - Retrieves fragments (losing context)
95
+ - Requires massive infrastructure (vector DBs, rerankers)
447
96
 
448
- Since the packages aren't published to npm yet, you can install them locally:
97
+ **Agentic Knowledge** leverages modern AI capabilities:
98
+ - βœ… **200K+ token context windows** - Can read entire documentation sets
99
+ - βœ… **Powerful filesystem tools** - grep, ripgrep, file reading built-in
100
+ - βœ… **Intelligent navigation** - Provides search strategies, not fragments
101
+ - βœ… **Zero infrastructure** - Just a config file and your docs
449
102
 
450
- 1. **Build all packages:**
103
+ ### From Retrieval to Navigation
451
104
 
452
- ```bash
453
- pnpm install
454
- pnpm build
455
- ```
105
+ **Traditional RAG says:**
106
+ *"Here are 50 fragments that mention your keywords"*
456
107
 
457
- 2. **Create local installation packages:**
108
+ **Agentic Knowledge says:**
109
+ *"Search for 'useState' in `./docs/react-18.2/hooks/`. If that doesn't help, try 'state management' in `./docs/patterns/`. Follow any 'See also' references you find."*
458
110
 
459
- ```bash
460
- pnpm run pack:local
461
- ```
111
+ **The difference?** Guidance over fragments. Investigation over retrieval.
462
112
 
463
- This creates `dist-local/` directory with packages that have workspace dependencies converted to relative file paths.
113
+ ### How It Actually Works
464
114
 
465
- 3. **Install the MCP server locally:**
115
+ 1. **Configure docsets** - Point to local folders or Git repositories
116
+ 2. **Initialize** - Downloads/symlinks documentation to `.knowledge/docsets/`
117
+ 3. **MCP server** - Exposes `search_docs` and `list_docsets` tools
118
+ 4. **AI searches** - Gets navigation instructions, uses grep/file tools
119
+ 5. **Finds answers** - Reads complete documents with full context
466
120
 
467
- ```bash
468
- # Option 1: Install from tarball
469
- cd dist-local/mcp-server && npm pack
470
- npm install -g codemcp-knowledge-mcp-server-0.1.0.tgz
121
+ **Performance:**
122
+ - **Setup**: Seconds (vs hours for RAG indexing)
123
+ - **Response**: <10ms (vs 300-2000ms for RAG)
124
+ - **Infrastructure**: None (vs Elasticsearch + Vector DB)
125
+ - **Accuracy**: Complete context (vs fragment-based)
471
126
 
472
- # Option 2: Install directly from directory
473
- npm install -g ./dist-local/mcp-server/
474
- ```
127
+ ### Inspired By
475
128
 
476
- 4. **Verify installation:**
477
- ```bash
478
- agentic-knowledge --help
479
- ```
129
+ This approach is inspired by [The RAG Obituary](https://www.nicolasbustamante.com/p/the-rag-obituary-killed-by-agents) by Nicolas Bustamante and how Claude Code revolutionized code analysis by ditching RAG for direct filesystem exploration.
480
130
 
481
- ### Development
131
+ ## πŸš€ Local Development
482
132
 
483
133
  ```bash
484
134
  # Install dependencies
@@ -492,27 +142,9 @@ pnpm test
492
142
 
493
143
  # Build all packages
494
144
  pnpm build
495
-
496
- # Format and lint
497
- pnpm format
498
- pnpm lint
499
145
  ```
500
146
 
501
- ## πŸ§ͺ Development Status
502
-
503
- **Current Phase**: Finalization βœ…
504
-
505
- - βœ… Core implementation complete (107 tests passing)
506
- - βœ… MCP protocol compliance verified
507
- - βœ… Performance validated (0.47ms response time)
508
- - βœ… Full documentation and examples
509
- - ⚠️ Ready for community feedback and real-world testing
510
-
511
- ## πŸ“š Examples & Documentation
512
-
513
- - [`examples/`](./examples/) - Configuration examples and integration guides
514
- - [`TESTING.md`](./TESTING.md) - Comprehensive testing documentation
515
- - [Architecture docs](./.vibe/docs/) - Detailed technical specifications
147
+ See [User Guide](./USER_GUIDE.md) for installation from source.
516
148
 
517
149
  ## 🀝 Contributing
518
150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-knowledge-mcp",
3
- "version": "0.1.13",
3
+ "version": "1.0.9",
4
4
  "description": "A Model Context Protocol server for agentic knowledge guidance with web-based documentation loading and intelligent search instructions",
5
5
  "type": "module",
6
6
  "main": "packages/cli/dist/index.js",
@@ -29,9 +29,9 @@
29
29
  "commander": "^12.0.0",
30
30
  "chalk": "^5.3.0",
31
31
  "ora": "^8.0.1",
32
- "@codemcp/knowledge-core": "0.1.13",
33
- "@codemcp/knowledge-mcp-server": "0.1.13",
34
- "@codemcp/knowledge-content-loader": "0.1.13"
32
+ "@codemcp/knowledge-core": "1.0.9",
33
+ "@codemcp/knowledge-content-loader": "1.0.9",
34
+ "@codemcp/knowledge-mcp-server": "1.0.9"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@modelcontextprotocol/inspector": "0.16.8",
@@ -107,7 +107,7 @@ async function createLocalFolderDocset(options) {
107
107
  throw new Error(`Path is not a directory: ${options.path}`);
108
108
  }
109
109
  }
110
- catch (error) {
110
+ catch {
111
111
  throw new Error(`Path does not exist: ${options.path}`);
112
112
  }
113
113
  return {
@@ -114,40 +114,22 @@ function displaySummary(statuses) {
114
114
  continue;
115
115
  }
116
116
  if (!initialized) {
117
- console.log(`${chalk.yellow("⚠️")} ${chalk.bold(docset.id)} - ${chalk.yellow("Not initialized")}`);
118
- console.log(chalk.gray(` ${docset.sources?.length || 0} source(s) configured`));
117
+ console.log(`${chalk.bold(docset.id)} (${docset.name})`);
118
+ console.log(chalk.gray(` Not initialized | ${docset.sources?.length || 0} source(s) configured`));
119
+ console.log();
120
+ console.log(chalk.blue(` πŸ’‘ Run: agentic-knowledge init ${docset.id}`));
119
121
  continue;
120
122
  }
121
123
  if (!metadata) {
122
124
  console.log(`${chalk.red("❌")} ${chalk.bold(docset.id)} - ${chalk.red("Metadata corrupted")}`);
123
125
  continue;
124
126
  }
125
- // Calculate status
126
- const lastActivity = metadata.last_refreshed || metadata.initialized_at;
127
- const lastActivityTime = new Date(lastActivity);
128
- const timeSince = Date.now() - lastActivityTime.getTime();
129
- const hoursSince = timeSince / (1000 * 60 * 60);
130
- const daysSince = timeSince / (1000 * 60 * 60 * 24);
131
- let timeDisplay;
132
- let statusIcon;
133
- if (hoursSince < 1) {
134
- timeDisplay = `${Math.round(hoursSince * 60)} minutes ago`;
135
- statusIcon = chalk.green("βœ…");
136
- }
137
- else if (hoursSince < 24) {
138
- timeDisplay = `${Math.round(hoursSince)} hours ago`;
139
- statusIcon = chalk.green("βœ…");
140
- }
141
- else if (daysSince < 7) {
142
- timeDisplay = `${Math.round(daysSince)} days ago`;
143
- statusIcon = chalk.yellow("⚠️");
144
- }
145
- else {
146
- timeDisplay = `${Math.round(daysSince)} days ago`;
147
- statusIcon = chalk.red("πŸ”„");
148
- }
149
- console.log(`${statusIcon} ${chalk.bold(docset.id)} - ${chalk.gray(metadata.total_files)} files`);
150
- console.log(chalk.gray(` Last updated: ${timeDisplay} | ${sources.length}/${metadata.sources_count} sources loaded`));
127
+ // Format initialization date
128
+ const initDate = new Date(metadata.initialized_at);
129
+ const dateDisplay = initDate.toISOString().split("T")[0]; // YYYY-MM-DD format
130
+ console.log(`${chalk.bold(docset.id)} (${docset.name})`);
131
+ console.log(chalk.gray(` Initialized | ${metadata.total_files} files | ${sources.length}/${metadata.sources_count} source(s) loaded`));
132
+ console.log(chalk.gray(` Initialized: ${dateDisplay}`));
151
133
  }
152
134
  }
153
135
  function displayDetailedStatus(status) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemcp/knowledge-cli",
3
- "version": "0.1.13",
3
+ "version": "1.0.9",
4
4
  "description": "Command-line interface for agentic knowledge web content management",
5
5
  "type": "module",
6
6
  "main": "dist/exports.js",
@@ -32,9 +32,9 @@
32
32
  "typecheck": "tsc --noEmit"
33
33
  },
34
34
  "dependencies": {
35
- "@codemcp/knowledge-core": "^0.1.13",
36
- "@codemcp/knowledge-content-loader": "^0.1.13",
37
- "@codemcp/knowledge-mcp-server": "^0.1.13",
35
+ "@codemcp/knowledge-core": "^1.0.9",
36
+ "@codemcp/knowledge-content-loader": "^1.0.9",
37
+ "@codemcp/knowledge-mcp-server": "^1.0.9",
38
38
  "commander": "^12.0.0",
39
39
  "chalk": "^5.3.0",
40
40
  "ora": "^8.0.1"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemcp/knowledge-content-loader",
3
- "version": "0.1.13",
3
+ "version": "1.0.9",
4
4
  "description": "Web content loading and metadata management for agentic knowledge system",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -9,4 +9,4 @@ export { findConfigPath, findConfigPathSync } from "./config/discovery.js";
9
9
  export { loadConfig, loadConfigSync, validateConfig } from "./config/loader.js";
10
10
  export { ConfigManager } from "./config/manager.js";
11
11
  export { calculateLocalPath, calculateLocalPathWithSymlinks, formatPath, validatePath, validatePathSync, getRelativePath, ensureKnowledgeGitignore, ensureKnowledgeGitignoreSync, } from "./paths/calculator.js";
12
- export { processTemplate, getEffectiveTemplate, validateTemplate, extractVariables, createTemplateContext, } from "./templates/processor.js";
12
+ export { processTemplate, getEffectiveTemplate, validateTemplate, extractVariables, createTemplateContext, createStructuredResponse, } from "./templates/processor.js";
@@ -13,4 +13,4 @@ export { ConfigManager } from "./config/manager.js";
13
13
  // Export path calculation utilities
14
14
  export { calculateLocalPath, calculateLocalPathWithSymlinks, formatPath, validatePath, validatePathSync, getRelativePath, ensureKnowledgeGitignore, ensureKnowledgeGitignoreSync, } from "./paths/calculator.js";
15
15
  // Export template processing
16
- export { processTemplate, getEffectiveTemplate, validateTemplate, extractVariables, createTemplateContext, } from "./templates/processor.js";
16
+ export { processTemplate, getEffectiveTemplate, validateTemplate, extractVariables, createTemplateContext, createStructuredResponse, } from "./templates/processor.js";
@@ -38,3 +38,12 @@ export declare function extractVariables(template: string): string[];
38
38
  * @returns Template context object
39
39
  */
40
40
  export declare function createTemplateContext(localPath: string, keywords: string, generalizedKeywords: string, docset: DocsetConfig): TemplateContext;
41
+ /**
42
+ * Create structured search response
43
+ * @param instructions - Processed instruction text
44
+ * @param keywords - Search keywords
45
+ * @param generalizedKeywords - Generalized keywords
46
+ * @param localPath - Calculated local path
47
+ * @returns Structured response object
48
+ */
49
+ export declare function createStructuredResponse(instructions: string, keywords: string, generalizedKeywords: string, localPath: string): import("../types.js").SearchDocsResponse;
@@ -109,3 +109,19 @@ export function createTemplateContext(localPath, keywords, generalizedKeywords,
109
109
  docset,
110
110
  };
111
111
  }
112
+ /**
113
+ * Create structured search response
114
+ * @param instructions - Processed instruction text
115
+ * @param keywords - Search keywords
116
+ * @param generalizedKeywords - Generalized keywords
117
+ * @param localPath - Calculated local path
118
+ * @returns Structured response object
119
+ */
120
+ export function createStructuredResponse(instructions, keywords, generalizedKeywords, localPath) {
121
+ return {
122
+ instructions,
123
+ search_terms: keywords,
124
+ generalized_search_terms: generalizedKeywords,
125
+ path: localPath,
126
+ };
127
+ }
@@ -77,14 +77,12 @@ export interface SearchDocsParams {
77
77
  export interface SearchDocsResponse {
78
78
  /** Instructions for the agent on how to search */
79
79
  instructions: string;
80
- /** The docset that was searched */
81
- docset: string;
80
+ /** The processed keywords for searching */
81
+ search_terms: string;
82
+ /** The processed generalized keywords for broader context */
83
+ generalized_search_terms: string;
82
84
  /** The calculated local path for searching */
83
- local_path: string;
84
- /** Keywords that were processed */
85
- keywords: string;
86
- /** Generalized keywords that were processed */
87
- generalized_keywords: string;
85
+ path: string;
88
86
  }
89
87
  /**
90
88
  * Response from the list_docsets tool
@@ -110,6 +108,8 @@ export interface TemplateContext {
110
108
  }
111
109
  /**
112
110
  * Error types that can occur in the core system
111
+ * Note: Linter may warn about "unused" enum values, but these are used throughout
112
+ * the codebase as ErrorType.CONFIG_NOT_FOUND, etc. The warnings are false positives.
113
113
  */
114
114
  export declare enum ErrorType {
115
115
  CONFIG_NOT_FOUND = "CONFIG_NOT_FOUND",
@@ -130,7 +130,7 @@ export declare class KnowledgeError extends Error {
130
130
  /**
131
131
  * Default instruction template
132
132
  */
133
- export declare const DEFAULT_TEMPLATE = "# \uD83D\uDCDA Search {{docset_name}} Documentation\n\n**Primary terms:** {{keywords}} \n**Related terms:** {{generalized_keywords}} \n**Location:** {{local_path}}\n\n## \uD83D\uDD0D Search Strategy\n\n### 1. **Start with Specific Terms**\nUse your text search tools (grep, rg, ripgrep) to search for: `{{keywords}}`\n\n### 2. **Expand to Related Terms**\nIf initial search doesn't yield results, try: `{{generalized_keywords}}`\n\n### 3. **What to Avoid**\nSkip these directories to save time:\n- `node_modules/`, `.git/`, `.knowledge/`\n- `build/`, `dist/`, `target/`, `vendor/`\n\n## \uD83D\uDCA1 Search Tips\n- Use **case-insensitive** search when possible\n- Look for **exact matches first**, then partial matches\n- Check **cross-references** and `See also` sections\n- If stuck, try **broader terms** or ask the user to clarify\n";
133
+ export declare const DEFAULT_TEMPLATE = "Use text search tools (grep, rg, ripgrep) to search for {{keywords}} in {{local_path}}. Try broader terms if needed. Skip: node_modules/, .git/, build/, dist/.";
134
134
  /**
135
135
  * Allowed template variables that can be used in instruction templates
136
136
  */
@@ -3,6 +3,8 @@
3
3
  */
4
4
  /**
5
5
  * Error types that can occur in the core system
6
+ * Note: Linter may warn about "unused" enum values, but these are used throughout
7
+ * the codebase as ErrorType.CONFIG_NOT_FOUND, etc. The warnings are false positives.
6
8
  */
7
9
  export var ErrorType;
8
10
  (function (ErrorType) {
@@ -29,31 +31,7 @@ export class KnowledgeError extends Error {
29
31
  /**
30
32
  * Default instruction template
31
33
  */
32
- export const DEFAULT_TEMPLATE = `# πŸ“š Search {{docset_name}} Documentation
33
-
34
- **Primary terms:** {{keywords}}
35
- **Related terms:** {{generalized_keywords}}
36
- **Location:** {{local_path}}
37
-
38
- ## πŸ” Search Strategy
39
-
40
- ### 1. **Start with Specific Terms**
41
- Use your text search tools (grep, rg, ripgrep) to search for: \`{{keywords}}\`
42
-
43
- ### 2. **Expand to Related Terms**
44
- If initial search doesn't yield results, try: \`{{generalized_keywords}}\`
45
-
46
- ### 3. **What to Avoid**
47
- Skip these directories to save time:
48
- - \`node_modules/\`, \`.git/\`, \`.knowledge/\`
49
- - \`build/\`, \`dist/\`, \`target/\`, \`vendor/\`
50
-
51
- ## πŸ’‘ Search Tips
52
- - Use **case-insensitive** search when possible
53
- - Look for **exact matches first**, then partial matches
54
- - Check **cross-references** and \`See also\` sections
55
- - If stuck, try **broader terms** or ask the user to clarify
56
- `;
34
+ export const DEFAULT_TEMPLATE = `Use text search tools (grep, rg, ripgrep) to search for {{keywords}} in {{local_path}}. Try broader terms if needed. Skip: node_modules/, .git/, build/, dist/.`;
57
35
  /**
58
36
  * Allowed template variables that can be used in instruction templates
59
37
  */
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemcp/knowledge-core",
3
- "version": "0.1.13",
3
+ "version": "1.0.9",
4
4
  "description": "Core functionality for agentic knowledge guidance system",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -4,7 +4,9 @@
4
4
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
5
5
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
6
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
7
- import { loadConfig, findConfigPath, calculateLocalPath, processTemplate, createTemplateContext, getEffectiveTemplate, } from "@codemcp/knowledge-core";
7
+ import { loadConfig, findConfigPath, calculateLocalPath, processTemplate, createTemplateContext, getEffectiveTemplate, createStructuredResponse, } from "@codemcp/knowledge-core";
8
+ import { existsSync } from "node:fs";
9
+ import { resolve, dirname } from "node:path";
8
10
  /**
9
11
  * Create an agentic knowledge MCP server
10
12
  * @returns MCP server instance
@@ -23,7 +25,7 @@ export function createAgenticKnowledgeServer() {
23
25
  let configLoadTime = 0;
24
26
  const CONFIG_CACHE_TTL = 60000; // 1 minute cache
25
27
  /**
26
- * Load configuration with caching
28
+ * Load configuration with caching (returns null if no config found)
27
29
  */
28
30
  async function getConfiguration() {
29
31
  const now = Date.now();
@@ -34,7 +36,7 @@ export function createAgenticKnowledgeServer() {
34
36
  // Find configuration file path
35
37
  const configPath = await findConfigPath();
36
38
  if (!configPath) {
37
- throw new Error("No configuration file found. Please create a .knowledge/config.yaml file in your project.");
39
+ return null; // No config file found - server can still start
38
40
  }
39
41
  // Load configuration
40
42
  const config = await loadConfig(configPath);
@@ -47,51 +49,70 @@ export function createAgenticKnowledgeServer() {
47
49
  // Clear cache on error to force retry next time
48
50
  configCache = null;
49
51
  configLoadTime = 0;
50
- throw error;
52
+ // Return null instead of throwing - allow server to start
53
+ console.error("Error loading configuration:", error);
54
+ return null;
51
55
  }
52
56
  }
53
57
  // Register tool handlers
54
58
  server.setRequestHandler(ListToolsRequestSchema, async () => {
55
- try {
56
- // Load configuration to get available docsets
57
- const { config } = await getConfiguration();
58
- // Build rich description with available docsets
59
- const docsetInfo = config.docsets
60
- .map((docset) => {
61
- const description = docset.description
62
- ? ` - ${docset.description}`
63
- : "";
64
- return `β€’ **${docset.id}** (${docset.name})${description}`;
65
- })
66
- .join("\n");
67
- const searchDocsDescription = `Search for documentation in available docsets. Returns structured search strategy.
68
-
69
- πŸ“š **AVAILABLE DOCSETS:**
70
- ${docsetInfo}
71
-
72
- πŸ” **SEARCH STRATEGY:**
73
- - Use the tools you have to search in text files (grep, rg, ripgrep, find)
74
- - Start with specific terms, expand to generalized terms`;
59
+ // Load configuration to get available docsets
60
+ const configData = await getConfiguration();
61
+ // If no configuration, return tools with setup instructions
62
+ if (!configData) {
75
63
  return {
76
64
  tools: [
77
65
  {
78
66
  name: "search_docs",
79
- description: searchDocsDescription,
67
+ description: `Search for documentation in configured docsets. Returns structured response with search instructions and parameters.
68
+
69
+ ⚠️ **NO DOCSETS CONFIGURED**
70
+
71
+ To configure docsets and use this tool:
72
+
73
+ **Option 1: Use CLI (recommended)**
74
+ \`\`\`bash
75
+ # Create a docset for a Git repository
76
+ agentic-knowledge create \\
77
+ --preset git-repo \\
78
+ --id my-docs \\
79
+ --name "My Documentation" \\
80
+ --url https://github.com/user/repo.git
81
+
82
+ # Initialize it (downloads the docs)
83
+ agentic-knowledge init my-docs
84
+
85
+ # Restart the MCP server
86
+ agentic-knowledge
87
+ \`\`\`
88
+
89
+ **Option 2: Manual configuration**
90
+ Create \`.knowledge/config.yaml\`:
91
+ \`\`\`yaml
92
+ version: "1.0"
93
+ docsets:
94
+ - id: my-docs
95
+ name: My Documentation
96
+ sources:
97
+ - type: local_folder
98
+ paths: ["./docs"]
99
+ \`\`\`
100
+
101
+ After configuring, the tool will show available docsets here.`,
80
102
  inputSchema: {
81
103
  type: "object",
82
104
  properties: {
83
105
  docset_id: {
84
106
  type: "string",
85
- description: "Choose the docset to search in.",
86
- enum: config.docsets.map((d) => d.id),
107
+ description: "The identifier of the docset to search in. (No docsets configured - see tool description for setup instructions)",
87
108
  },
88
109
  keywords: {
89
110
  type: "string",
90
- description: 'Primary search terms or concepts you\'re looking for. Be specific about what you want to find (e.g., "authentication middleware", "user validation", "API rate limiting"). Include the exact terms you expect to appear in the documentation.',
111
+ description: 'Primary search terms or concepts you\'re looking for. Be specific about what you want to find (e.g., "authentication middleware", "user validation", "API rate limiting").',
91
112
  },
92
113
  generalized_keywords: {
93
114
  type: "string",
94
- description: 'Related terms, synonyms, or contextual keywords that may appear alongside your primary keywords but are not your main target. These help broaden the search context and catch relevant content that might use different terminology (e.g., for "authentication" you might include "login, signin, oauth, credentials, tokens"). Think of terms that would appear in the same sections or discussions as your main keywords.',
115
+ description: "Related terms, synonyms, or contextual keywords that may appear alongside your primary keywords but are not your main target.",
95
116
  },
96
117
  },
97
118
  required: ["docset_id", "keywords"],
@@ -100,7 +121,7 @@ ${docsetInfo}
100
121
  },
101
122
  {
102
123
  name: "list_docsets",
103
- description: "List all available documentation sets (docsets) with detailed information. Note: The search_docs tool already shows available docsets in its description, so this tool is mainly for getting additional metadata.",
124
+ description: "List all available documentation sets (docsets) with detailed information. (Currently no docsets configured - see search_docs description for setup instructions)",
104
125
  inputSchema: {
105
126
  type: "object",
106
127
  properties: {},
@@ -110,45 +131,66 @@ ${docsetInfo}
110
131
  ],
111
132
  };
112
133
  }
113
- catch (error) {
114
- // Fallback to basic tools if configuration fails
115
- return {
116
- tools: [
117
- {
118
- name: "search_docs",
119
- description: "Search for documentation guidance based on keywords and context. Returns intelligent navigation instructions to help you find relevant information in a specific docset. (Configuration error - use list_docsets to see available options)",
120
- inputSchema: {
121
- type: "object",
122
- properties: {
123
- docset_id: {
124
- type: "string",
125
- description: "The identifier of the docset to search in. Use list_docsets to see available options.",
126
- },
127
- keywords: {
128
- type: "string",
129
- description: 'Primary search terms or concepts you\'re looking for. Be specific about what you want to find (e.g., "authentication middleware", "user validation", "API rate limiting"). Include the exact terms you expect to appear in the documentation.',
130
- },
131
- generalized_keywords: {
132
- type: "string",
133
- description: 'Related terms, synonyms, or contextual keywords that may appear alongside your primary keywords but are not your main target. These help broaden the search context and catch relevant content that might use different terminology (e.g., for "authentication" you might include "login, signin, oauth, credentials, tokens"). Think of terms that would appear in the same sections or discussions as your main keywords.',
134
- },
134
+ // Configuration exists - build rich description with available docsets
135
+ const { config } = configData;
136
+ const docsetInfo = config.docsets
137
+ .map((docset) => {
138
+ const description = docset.description
139
+ ? ` - ${docset.description}`
140
+ : "";
141
+ return `β€’ **${docset.id}** (${docset.name})${description}`;
142
+ })
143
+ .join("\n");
144
+ const searchDocsDescription = `Search for documentation in available docsets. Returns structured response with search instructions and parameters.
145
+
146
+ πŸ“š **AVAILABLE DOCSETS:**
147
+ ${docsetInfo}
148
+
149
+ πŸ” **STRUCTURED RESPONSE:**
150
+ Returns JSON object with:
151
+ - instructions: Search guidance text
152
+ - search_terms: Primary keywords to search for
153
+ - generalized_search_terms: Broader terms for context
154
+ - path: Local directory path to search in
155
+
156
+ Use the path and search terms with your text search tools (grep, rg, ripgrep, find).`;
157
+ return {
158
+ tools: [
159
+ {
160
+ name: "search_docs",
161
+ description: searchDocsDescription,
162
+ inputSchema: {
163
+ type: "object",
164
+ properties: {
165
+ docset_id: {
166
+ type: "string",
167
+ description: "Choose the docset to search in.",
168
+ enum: config.docsets.map((d) => d.id),
169
+ },
170
+ keywords: {
171
+ type: "string",
172
+ description: 'Primary search terms or concepts you\'re looking for. Be specific about what you want to find (e.g., "authentication middleware", "user validation", "API rate limiting"). Include the exact terms you expect to appear in the documentation.',
173
+ },
174
+ generalized_keywords: {
175
+ type: "string",
176
+ description: 'Related terms, synonyms, or contextual keywords that may appear alongside your primary keywords but are not your main target. These help broaden the search context and catch relevant content that might use different terminology (e.g., for "authentication" you might include "login, signin, oauth, credentials, tokens"). Think of terms that would appear in the same sections or discussions as your main keywords.',
135
177
  },
136
- required: ["docset_id", "keywords"],
137
- additionalProperties: false,
138
178
  },
179
+ required: ["docset_id", "keywords"],
180
+ additionalProperties: false,
139
181
  },
140
- {
141
- name: "list_docsets",
142
- description: "List all available documentation sets (docsets) that can be searched. Each docset represents a specific project, library, or knowledge base.",
143
- inputSchema: {
144
- type: "object",
145
- properties: {},
146
- additionalProperties: false,
147
- },
182
+ },
183
+ {
184
+ name: "list_docsets",
185
+ description: "List all available documentation sets (docsets) with detailed information. Note: The search_docs tool already shows available docsets in its description, so this tool is mainly for getting additional metadata.",
186
+ inputSchema: {
187
+ type: "object",
188
+ properties: {},
189
+ additionalProperties: false,
148
190
  },
149
- ],
150
- };
151
- }
191
+ },
192
+ ],
193
+ };
152
194
  });
153
195
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
154
196
  const { name, arguments: args } = request.params;
@@ -164,32 +206,89 @@ ${docsetInfo}
164
206
  throw new Error("keywords is required and must be a string");
165
207
  }
166
208
  // Load configuration
167
- const { config, configPath } = await getConfiguration();
209
+ const configData = await getConfiguration();
210
+ if (!configData) {
211
+ throw new Error("No configuration file found.\n\n" +
212
+ "To configure docsets:\n\n" +
213
+ "**Option 1: Use CLI (recommended)**\n" +
214
+ 'agentic-knowledge create --preset git-repo --id my-docs --name "My Docs" --url <repo-url>\n' +
215
+ "agentic-knowledge init my-docs\n\n" +
216
+ "**Option 2: Manual configuration**\n" +
217
+ "Create .knowledge/config.yaml in your project root.\n" +
218
+ "See the search_docs tool description for example configuration.");
219
+ }
220
+ const { config, configPath } = configData;
168
221
  // Find the requested docset
169
222
  const docset = config.docsets.find((d) => d.id === docset_id);
170
223
  if (!docset) {
171
224
  const availableIds = config.docsets.map((d) => d.id).join(", ");
172
- throw new Error(`Docset '${docset_id}' not found. Available docsets: ${availableIds}`);
225
+ throw new Error(`Docset '${docset_id}' not found.\n\n` +
226
+ `Available docsets: ${availableIds}\n\n` +
227
+ `To create a new docset:\n` +
228
+ `agentic-knowledge create --preset git-repo --id ${docset_id} --name "My Docs" --url <repo-url>\n` +
229
+ `agentic-knowledge init ${docset_id}`);
173
230
  }
174
231
  // Calculate local path
175
232
  const localPath = calculateLocalPath(docset, configPath);
233
+ // Check if docset is initialized by checking for metadata file
234
+ const primarySource = docset.sources?.[0];
235
+ if (primarySource?.type === "git_repo") {
236
+ // For git repos, check if .agentic-metadata.json exists
237
+ const configDir = dirname(configPath);
238
+ const projectRoot = dirname(configDir);
239
+ const absolutePath = resolve(projectRoot, localPath);
240
+ const metadataPath = resolve(absolutePath, ".agentic-metadata.json");
241
+ if (!existsSync(metadataPath)) {
242
+ throw new Error(`Docset '${docset_id}' is not initialized.\n\n` +
243
+ `The docset is configured but hasn't been initialized yet.\n\n` +
244
+ `To initialize this docset:\n` +
245
+ `agentic-knowledge init ${docset_id}\n\n` +
246
+ `To check status of all docsets:\n` +
247
+ `agentic-knowledge status`);
248
+ }
249
+ }
176
250
  // Create template context with proper function signature
177
251
  const templateContext = createTemplateContext(localPath, keywords.trim(), (generalized_keywords || "").trim(), docset);
178
252
  // Get effective template and process it
179
253
  const effectiveTemplate = getEffectiveTemplate(docset, config.template);
180
254
  const instructions = processTemplate(effectiveTemplate, templateContext);
255
+ // Create structured response
256
+ const structuredResponse = createStructuredResponse(instructions, keywords.trim(), (generalized_keywords || "").trim(), localPath);
181
257
  return {
182
- content: [
183
- {
184
- type: "text",
185
- text: instructions,
186
- },
187
- ],
258
+ structuredContent: structuredResponse,
188
259
  };
189
260
  }
190
261
  case "list_docsets": {
191
262
  // Load configuration
192
- const { config, configPath } = await getConfiguration();
263
+ const configData = await getConfiguration();
264
+ if (!configData) {
265
+ return {
266
+ content: [
267
+ {
268
+ type: "text",
269
+ text: "No docsets configured.\n\n" +
270
+ "To configure docsets:\n\n" +
271
+ "**Option 1: Use CLI (recommended)**\n" +
272
+ "```bash\n" +
273
+ 'agentic-knowledge create --preset git-repo --id my-docs --name "My Docs" --url <repo-url>\n' +
274
+ "agentic-knowledge init my-docs\n" +
275
+ "```\n\n" +
276
+ "**Option 2: Manual configuration**\n" +
277
+ "Create `.knowledge/config.yaml`:\n" +
278
+ "```yaml\n" +
279
+ 'version: "1.0"\n' +
280
+ "docsets:\n" +
281
+ " - id: my-docs\n" +
282
+ " name: My Documentation\n" +
283
+ " sources:\n" +
284
+ " - type: local_folder\n" +
285
+ ' paths: ["./docs"]\n' +
286
+ "```",
287
+ },
288
+ ],
289
+ };
290
+ }
291
+ const { config, configPath } = configData;
193
292
  // Return list of available docsets with calculated paths
194
293
  const docsets = await Promise.all(config.docsets.map(async (docset) => ({
195
294
  docset_id: docset.id,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemcp/knowledge-mcp-server",
3
- "version": "0.1.13",
3
+ "version": "1.0.9",
4
4
  "description": "MCP server implementation for agentic knowledge guidance system",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -30,7 +30,7 @@
30
30
  "typecheck": "tsc --noEmit"
31
31
  },
32
32
  "dependencies": {
33
- "@codemcp/knowledge-core": "^0.1.13",
33
+ "@codemcp/knowledge-core": "^1.0.9",
34
34
  "@modelcontextprotocol/sdk": "^1.19.1"
35
35
  },
36
36
  "devDependencies": {