agentic-knowledge-mcp 0.1.13 → 1.0.6
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 +25 -20
- package/package.json +4 -4
- package/packages/cli/package.json +4 -4
- package/packages/content-loader/package.json +1 -1
- package/packages/core/dist/index.d.ts +1 -1
- package/packages/core/dist/index.js +1 -1
- package/packages/core/dist/templates/processor.d.ts +9 -0
- package/packages/core/dist/templates/processor.js +16 -0
- package/packages/core/dist/types.d.ts +6 -8
- package/packages/core/dist/types.js +1 -25
- package/packages/core/package.json +1 -1
- package/packages/mcp-server/dist/server.js +13 -11
- package/packages/mcp-server/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# 🧠 Agentic Knowledge
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
> This project is under active development and not yet ready for production use. APIs may change without notice.
|
|
3
|
+
A way to handle knowledge cut-off: Provide all sources you and your development team need to your agents.
|
|
5
4
|
|
|
6
5
|
<div align="center">
|
|
7
6
|
<h3>The End of RAG. The Dawn of Agentic Search. Maybe.</h3>
|
|
@@ -186,7 +185,7 @@ docsets:
|
|
|
186
185
|
sources:
|
|
187
186
|
- type: local_folder
|
|
188
187
|
paths: ["./docs"]
|
|
189
|
-
|
|
188
|
+
|
|
190
189
|
- id: react-docs
|
|
191
190
|
name: React Documentation
|
|
192
191
|
description: "Official React documentation from GitHub"
|
|
@@ -217,13 +216,14 @@ docsets:
|
|
|
217
216
|
name: My Project Docs
|
|
218
217
|
sources:
|
|
219
218
|
- type: local_folder
|
|
220
|
-
paths:
|
|
221
|
-
- "./docs"
|
|
222
|
-
- "./guides"
|
|
223
|
-
- "./api/README.md"
|
|
219
|
+
paths:
|
|
220
|
+
- "./docs" # Single directory
|
|
221
|
+
- "./guides" # Multiple directories
|
|
222
|
+
- "./api/README.md" # Specific files
|
|
224
223
|
```
|
|
225
224
|
|
|
226
225
|
**Benefits:**
|
|
226
|
+
|
|
227
227
|
- ✅ **No file duplication** - creates symlinks to original locations
|
|
228
228
|
- ✅ **Real-time updates** - changes immediately visible
|
|
229
229
|
- ✅ **Relative paths** - returns clean relative paths for LLM navigation
|
|
@@ -239,11 +239,12 @@ docsets:
|
|
|
239
239
|
sources:
|
|
240
240
|
- type: git_repo
|
|
241
241
|
url: "https://github.com/owner/repo.git"
|
|
242
|
-
branch: "main"
|
|
242
|
+
branch: "main" # Optional, defaults to main
|
|
243
243
|
paths: ["docs/", "README.md"] # Optional, extracts specific paths
|
|
244
244
|
```
|
|
245
245
|
|
|
246
246
|
**Benefits:**
|
|
247
|
+
|
|
247
248
|
- ✅ **Automatic downloads** - fetches latest documentation
|
|
248
249
|
- ✅ **Selective extraction** - only downloads specified paths
|
|
249
250
|
- ✅ **Branch selection** - target specific branches or tags
|
|
@@ -260,14 +261,14 @@ docsets:
|
|
|
260
261
|
sources:
|
|
261
262
|
- type: local_folder
|
|
262
263
|
paths: ["./docs/guides"]
|
|
263
|
-
|
|
264
|
+
|
|
264
265
|
- id: api-reference
|
|
265
266
|
name: API Reference
|
|
266
267
|
sources:
|
|
267
268
|
- type: git_repo
|
|
268
269
|
url: "https://github.com/company/api-docs.git"
|
|
269
270
|
paths: ["reference/"]
|
|
270
|
-
|
|
271
|
+
|
|
271
272
|
- id: mixed-sources
|
|
272
273
|
name: Combined Documentation
|
|
273
274
|
sources:
|
|
@@ -305,6 +306,7 @@ agentic-knowledge
|
|
|
305
306
|
```
|
|
306
307
|
|
|
307
308
|
The server will:
|
|
309
|
+
|
|
308
310
|
- ✅ Create symlinks for local folders in `.knowledge/docsets/`
|
|
309
311
|
- ✅ Validate your configuration
|
|
310
312
|
- ✅ Start listening for MCP requests
|
|
@@ -336,11 +338,12 @@ search_docs({
|
|
|
336
338
|
```
|
|
337
339
|
|
|
338
340
|
**Response:**
|
|
341
|
+
|
|
339
342
|
```
|
|
340
343
|
# 📚 Search My Project Documentation
|
|
341
344
|
|
|
342
345
|
**Primary terms:** authentication setup
|
|
343
|
-
**Related terms:** login, auth, security
|
|
346
|
+
**Related terms:** login, auth, security
|
|
344
347
|
**Location:** docs
|
|
345
348
|
|
|
346
349
|
## 🔍 Search Strategy
|
|
@@ -348,7 +351,7 @@ search_docs({
|
|
|
348
351
|
1. **Start with Specific Terms**
|
|
349
352
|
Use your text search tools (grep, rg, ripgrep) to search for: `authentication setup`
|
|
350
353
|
|
|
351
|
-
2. **Expand to Related Terms**
|
|
354
|
+
2. **Expand to Related Terms**
|
|
352
355
|
If initial search doesn't yield results, try: `login, auth, security`
|
|
353
356
|
|
|
354
357
|
3. **What to Avoid**
|
|
@@ -358,8 +361,9 @@ search_docs({
|
|
|
358
361
|
### Step 5: Follow the Guidance
|
|
359
362
|
|
|
360
363
|
Your AI assistant will use the provided search strategy to:
|
|
364
|
+
|
|
361
365
|
1. 🔍 Search your documentation with the suggested terms
|
|
362
|
-
2. 📂 Navigate to the right files and directories
|
|
366
|
+
2. 📂 Navigate to the right files and directories
|
|
363
367
|
3. 🎯 Find exactly what you're looking for
|
|
364
368
|
4. 🔗 Follow cross-references and related content
|
|
365
369
|
|
|
@@ -378,6 +382,7 @@ docsets:
|
|
|
378
382
|
```
|
|
379
383
|
|
|
380
384
|
**Benefits:**
|
|
385
|
+
|
|
381
386
|
- Changes in your docs are immediately available
|
|
382
387
|
- No copying or syncing needed
|
|
383
388
|
- Works with any file type
|
|
@@ -395,8 +400,8 @@ docsets:
|
|
|
395
400
|
- type: git_repo
|
|
396
401
|
url: "https://github.com/company/design-system.git"
|
|
397
402
|
paths: ["docs/"]
|
|
398
|
-
|
|
399
|
-
- id: backend-docs
|
|
403
|
+
|
|
404
|
+
- id: backend-docs
|
|
400
405
|
name: Backend Documentation
|
|
401
406
|
sources:
|
|
402
407
|
- type: git_repo
|
|
@@ -413,15 +418,15 @@ Use specific and generalized keywords for better results:
|
|
|
413
418
|
search_docs({
|
|
414
419
|
docset_id: "react-docs",
|
|
415
420
|
keywords: "useEffect cleanup function",
|
|
416
|
-
generalized_keywords: "hooks, lifecycle, memory management"
|
|
417
|
-
})
|
|
421
|
+
generalized_keywords: "hooks, lifecycle, memory management",
|
|
422
|
+
});
|
|
418
423
|
|
|
419
424
|
// ❌ Too vague
|
|
420
425
|
search_docs({
|
|
421
|
-
docset_id: "react-docs",
|
|
426
|
+
docset_id: "react-docs",
|
|
422
427
|
keywords: "react",
|
|
423
|
-
generalized_keywords: "javascript"
|
|
424
|
-
})
|
|
428
|
+
generalized_keywords: "javascript",
|
|
429
|
+
});
|
|
425
430
|
```
|
|
426
431
|
|
|
427
432
|
## 📊 Performance vs RAG
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-knowledge-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.6",
|
|
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.
|
|
33
|
-
"@codemcp/knowledge-mcp-server": "0.
|
|
34
|
-
"@codemcp/knowledge-content-loader": "0.
|
|
32
|
+
"@codemcp/knowledge-core": "1.0.6",
|
|
33
|
+
"@codemcp/knowledge-mcp-server": "1.0.6",
|
|
34
|
+
"@codemcp/knowledge-content-loader": "1.0.6"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@modelcontextprotocol/inspector": "0.16.8",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemcp/knowledge-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.6",
|
|
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.
|
|
36
|
-
"@codemcp/knowledge-content-loader": "^0.
|
|
37
|
-
"@codemcp/knowledge-mcp-server": "^0.
|
|
35
|
+
"@codemcp/knowledge-core": "^1.0.6",
|
|
36
|
+
"@codemcp/knowledge-content-loader": "^1.0.6",
|
|
37
|
+
"@codemcp/knowledge-mcp-server": "^1.0.6",
|
|
38
38
|
"commander": "^12.0.0",
|
|
39
39
|
"chalk": "^5.3.0",
|
|
40
40
|
"ora": "^8.0.1"
|
|
@@ -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
|
|
81
|
-
|
|
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
|
-
|
|
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
|
|
@@ -130,7 +128,7 @@ export declare class KnowledgeError extends Error {
|
|
|
130
128
|
/**
|
|
131
129
|
* Default instruction template
|
|
132
130
|
*/
|
|
133
|
-
export declare const DEFAULT_TEMPLATE = "
|
|
131
|
+
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
132
|
/**
|
|
135
133
|
* Allowed template variables that can be used in instruction templates
|
|
136
134
|
*/
|
|
@@ -29,31 +29,7 @@ export class KnowledgeError extends Error {
|
|
|
29
29
|
/**
|
|
30
30
|
* Default instruction template
|
|
31
31
|
*/
|
|
32
|
-
export const DEFAULT_TEMPLATE =
|
|
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
|
-
`;
|
|
32
|
+
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
33
|
/**
|
|
58
34
|
* Allowed template variables that can be used in instruction templates
|
|
59
35
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
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
8
|
/**
|
|
9
9
|
* Create an agentic knowledge MCP server
|
|
10
10
|
* @returns MCP server instance
|
|
@@ -64,14 +64,19 @@ export function createAgenticKnowledgeServer() {
|
|
|
64
64
|
return `• **${docset.id}** (${docset.name})${description}`;
|
|
65
65
|
})
|
|
66
66
|
.join("\n");
|
|
67
|
-
const searchDocsDescription = `Search for documentation in available docsets. Returns structured search
|
|
67
|
+
const searchDocsDescription = `Search for documentation in available docsets. Returns structured response with search instructions and parameters.
|
|
68
68
|
|
|
69
69
|
📚 **AVAILABLE DOCSETS:**
|
|
70
70
|
${docsetInfo}
|
|
71
71
|
|
|
72
|
-
🔍 **
|
|
73
|
-
|
|
74
|
-
-
|
|
72
|
+
🔍 **STRUCTURED RESPONSE:**
|
|
73
|
+
Returns JSON object with:
|
|
74
|
+
- instructions: Search guidance text
|
|
75
|
+
- search_terms: Primary keywords to search for
|
|
76
|
+
- generalized_search_terms: Broader terms for context
|
|
77
|
+
- path: Local directory path to search in
|
|
78
|
+
|
|
79
|
+
Use the path and search terms with your text search tools (grep, rg, ripgrep, find).`;
|
|
75
80
|
return {
|
|
76
81
|
tools: [
|
|
77
82
|
{
|
|
@@ -178,13 +183,10 @@ ${docsetInfo}
|
|
|
178
183
|
// Get effective template and process it
|
|
179
184
|
const effectiveTemplate = getEffectiveTemplate(docset, config.template);
|
|
180
185
|
const instructions = processTemplate(effectiveTemplate, templateContext);
|
|
186
|
+
// Create structured response
|
|
187
|
+
const structuredResponse = createStructuredResponse(instructions, keywords.trim(), (generalized_keywords || "").trim(), localPath);
|
|
181
188
|
return {
|
|
182
|
-
|
|
183
|
-
{
|
|
184
|
-
type: "text",
|
|
185
|
-
text: instructions,
|
|
186
|
-
},
|
|
187
|
-
],
|
|
189
|
+
structuredContent: structuredResponse,
|
|
188
190
|
};
|
|
189
191
|
}
|
|
190
192
|
case "list_docsets": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemcp/knowledge-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.6",
|
|
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.
|
|
33
|
+
"@codemcp/knowledge-core": "^1.0.6",
|
|
34
34
|
"@modelcontextprotocol/sdk": "^1.19.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|