milvus-knowledge-mcp-server 1.0.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge-tools.d.ts","sourceRoot":"","sources":["../../src/tools/knowledge-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA+JpE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAwJ9D;AAED,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,258 @@
1
+ import { z } from 'zod';
2
+ import { getMilvusClient } from '../milvus-client.js';
3
+ const DEFAULT_COLLECTIONS = ['components', 'asserts', 'chunks_v1'];
4
+ const MAX_RESULTS = 20;
5
+ const MAX_CONTENT_LENGTH = 8000;
6
+ var OutputFormat;
7
+ (function (OutputFormat) {
8
+ OutputFormat["MARKDOWN"] = "markdown";
9
+ OutputFormat["JSON"] = "json";
10
+ })(OutputFormat || (OutputFormat = {}));
11
+ const KnowledgeSearchSchema = z.object({
12
+ query: z.string()
13
+ .min(2, 'Query must be at least 2 characters')
14
+ .max(500, 'Query must not exceed 500 characters')
15
+ .describe('The search query to find relevant knowledge from the database'),
16
+ collections: z.array(z.string())
17
+ .default(DEFAULT_COLLECTIONS)
18
+ .describe('Collections to search in (default: components, asserts, chunks_v1)'),
19
+ top_k: z.number()
20
+ .int()
21
+ .min(1)
22
+ .max(MAX_RESULTS)
23
+ .default(5)
24
+ .describe('Number of top results to return per collection'),
25
+ output_format: z.nativeEnum(OutputFormat)
26
+ .default(OutputFormat.MARKDOWN)
27
+ .describe('Output format: markdown or json'),
28
+ min_score: z.number()
29
+ .min(0)
30
+ .max(1)
31
+ .default(0.5)
32
+ .describe('Minimum similarity score threshold (0-1)')
33
+ }).strict();
34
+ const ListCollectionsSchema = z.object({
35
+ output_format: z.nativeEnum(OutputFormat)
36
+ .default(OutputFormat.MARKDOWN)
37
+ .describe('Output format: markdown or json')
38
+ }).strict();
39
+ const GetCollectionInfoSchema = z.object({
40
+ collection_name: z.string()
41
+ .min(1, 'Collection name is required')
42
+ .describe('Name of the collection to get information about'),
43
+ output_format: z.nativeEnum(OutputFormat)
44
+ .default(OutputFormat.MARKDOWN)
45
+ .describe('Output format: markdown or json')
46
+ }).strict();
47
+ function formatResultsAsMarkdown(results, minScore) {
48
+ const lines = ['# Knowledge Search Results', ''];
49
+ let totalResults = 0;
50
+ for (const [collection, searchResults] of results) {
51
+ const filtered = searchResults.filter(r => r.score >= minScore);
52
+ if (filtered.length === 0)
53
+ continue;
54
+ totalResults += filtered.length;
55
+ lines.push(`## Collection: ${collection}`);
56
+ lines.push(`Found ${filtered.length} relevant results`);
57
+ lines.push('');
58
+ for (let i = 0; i < filtered.length; i++) {
59
+ const result = filtered[i];
60
+ lines.push(`### Result ${i + 1} (Score: ${result.score.toFixed(3)})`);
61
+ if (result.content) {
62
+ const truncatedContent = result.content.length > MAX_CONTENT_LENGTH
63
+ ? result.content.substring(0, MAX_CONTENT_LENGTH) + '...(truncated)'
64
+ : result.content;
65
+ lines.push(truncatedContent);
66
+ }
67
+ if (result.metadata && Object.keys(result.metadata).length > 0) {
68
+ lines.push('');
69
+ lines.push('**Metadata:**');
70
+ for (const [key, value] of Object.entries(result.metadata)) {
71
+ lines.push(`- ${key}: ${JSON.stringify(value)}`);
72
+ }
73
+ }
74
+ lines.push('');
75
+ }
76
+ }
77
+ if (totalResults === 0) {
78
+ lines.push('No results found matching the criteria.');
79
+ lines.push('Try lowering the min_score threshold or using different keywords.');
80
+ }
81
+ else {
82
+ lines.unshift(`Total results: ${totalResults}`, '');
83
+ }
84
+ return lines.join('\n');
85
+ }
86
+ function formatResultsAsJson(results, minScore) {
87
+ const output = {
88
+ total: 0,
89
+ collections: {}
90
+ };
91
+ let total = 0;
92
+ for (const [collection, searchResults] of results) {
93
+ const filtered = searchResults.filter(r => r.score >= minScore);
94
+ total += filtered.length;
95
+ output.collections[collection] = {
96
+ count: filtered.length,
97
+ results: filtered.map(r => ({
98
+ id: r.id,
99
+ score: r.score,
100
+ content: r.content?.length && r.content.length > MAX_CONTENT_LENGTH
101
+ ? r.content.substring(0, MAX_CONTENT_LENGTH) + '...(truncated)'
102
+ : r.content,
103
+ metadata: r.metadata
104
+ }))
105
+ };
106
+ }
107
+ output.total = total;
108
+ return JSON.stringify(output, null, 2);
109
+ }
110
+ function formatCollectionsAsMarkdown(collections) {
111
+ const lines = ['# Available Collections', ''];
112
+ if (collections.length === 0) {
113
+ lines.push('No collections found in the knowledge base.');
114
+ return lines.join('\n');
115
+ }
116
+ lines.push(`Total collections: ${collections.length}`);
117
+ lines.push('');
118
+ for (const col of collections) {
119
+ lines.push(`## ${col.name}`);
120
+ lines.push(`- **Documents**: ${col.rowCount.toLocaleString()}`);
121
+ lines.push('');
122
+ }
123
+ return lines.join('\n');
124
+ }
125
+ export function registerKnowledgeTools(server) {
126
+ server.registerTool('knowledge_search', {
127
+ title: 'Search Knowledge Base',
128
+ description: `Search the Milvus knowledge base for relevant information.
129
+
130
+ This tool performs semantic search across specified collections to find documents,
131
+ code snippets, documentation, or other knowledge relevant to the query.
132
+
133
+ Use this tool when:
134
+ - User message contains "@知识库" prefix
135
+ - User asks for documentation, code examples, or technical information
136
+ - User needs to reference project-specific knowledge
137
+
138
+ Args:
139
+ - query (string): The search query
140
+ - collections (string[]): Collections to search (default: components, asserts, chunks_v1)
141
+ - top_k (number): Number of results per collection (default: 5, max: 20)
142
+ - output_format ('markdown' | 'json'): Output format (default: markdown)
143
+ - min_score (number): Minimum similarity score (default: 0.5)
144
+
145
+ Returns:
146
+ Search results with content, scores, and metadata for each collection.
147
+
148
+ Examples:
149
+ - "@知识库 How to implement authentication?"
150
+ - "@知识库 API documentation for user service"
151
+ - "@知识库 Error handling patterns in the codebase"`,
152
+ inputSchema: KnowledgeSearchSchema,
153
+ annotations: {
154
+ readOnlyHint: true,
155
+ destructiveHint: false,
156
+ idempotentHint: true,
157
+ openWorldHint: false
158
+ }
159
+ }, async (params) => {
160
+ try {
161
+ const client = getMilvusClient();
162
+ const results = await client.hybridSearch(params.collections, params.query, params.top_k);
163
+ const output = params.output_format === OutputFormat.MARKDOWN
164
+ ? formatResultsAsMarkdown(results, params.min_score)
165
+ : formatResultsAsJson(results, params.min_score);
166
+ return {
167
+ content: [{ type: 'text', text: output }]
168
+ };
169
+ }
170
+ catch (error) {
171
+ const errorMsg = error instanceof Error ? error.message : String(error);
172
+ return {
173
+ content: [{
174
+ type: 'text',
175
+ text: `Error searching knowledge base: ${errorMsg}\n\nPlease ensure:\n1. Milvus server is running at the configured address\n2. The specified collections exist\n3. Network connectivity is available`
176
+ }]
177
+ };
178
+ }
179
+ });
180
+ server.registerTool('knowledge_list_collections', {
181
+ title: 'List Knowledge Collections',
182
+ description: `List all available collections in the Milvus knowledge base.
183
+
184
+ Use this tool to discover what collections are available for searching.
185
+
186
+ Returns:
187
+ List of collections with their document counts.`,
188
+ inputSchema: ListCollectionsSchema,
189
+ annotations: {
190
+ readOnlyHint: true,
191
+ destructiveHint: false,
192
+ idempotentHint: true,
193
+ openWorldHint: false
194
+ }
195
+ }, async (params) => {
196
+ try {
197
+ const client = getMilvusClient();
198
+ const collections = await client.listCollections();
199
+ const output = params.output_format === OutputFormat.MARKDOWN
200
+ ? formatCollectionsAsMarkdown(collections)
201
+ : JSON.stringify({ collections }, null, 2);
202
+ return {
203
+ content: [{ type: 'text', text: output }]
204
+ };
205
+ }
206
+ catch (error) {
207
+ const errorMsg = error instanceof Error ? error.message : String(error);
208
+ return {
209
+ content: [{
210
+ type: 'text',
211
+ text: `Error listing collections: ${errorMsg}`
212
+ }]
213
+ };
214
+ }
215
+ });
216
+ server.registerTool('knowledge_get_collection_info', {
217
+ title: 'Get Collection Information',
218
+ description: `Get detailed information about a specific collection including its schema.
219
+
220
+ Use this tool to understand the structure and fields available in a collection.
221
+
222
+ Args:
223
+ - collection_name (string): Name of the collection
224
+ - output_format ('markdown' | 'json'): Output format (default: markdown)
225
+
226
+ Returns:
227
+ Collection schema and metadata.`,
228
+ inputSchema: GetCollectionInfoSchema,
229
+ annotations: {
230
+ readOnlyHint: true,
231
+ destructiveHint: false,
232
+ idempotentHint: true,
233
+ openWorldHint: false
234
+ }
235
+ }, async (params) => {
236
+ try {
237
+ const client = getMilvusClient();
238
+ const schema = await client.getCollectionSchema(params.collection_name);
239
+ const output = params.output_format === OutputFormat.MARKDOWN
240
+ ? `# Collection: ${params.collection_name}\n\n\`\`\`json\n${JSON.stringify(schema, null, 2)}\n\`\`\``
241
+ : JSON.stringify(schema, null, 2);
242
+ return {
243
+ content: [{ type: 'text', text: output }]
244
+ };
245
+ }
246
+ catch (error) {
247
+ const errorMsg = error instanceof Error ? error.message : String(error);
248
+ return {
249
+ content: [{
250
+ type: 'text',
251
+ text: `Error getting collection info: ${errorMsg}`
252
+ }]
253
+ };
254
+ }
255
+ });
256
+ }
257
+ export default registerKnowledgeTools;
258
+ //# sourceMappingURL=knowledge-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge-tools.js","sourceRoot":"","sources":["../../src/tools/knowledge-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAgB,MAAM,qBAAqB,CAAC;AAEpE,MAAM,mBAAmB,GAAG,CAAC,YAAY,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AACnE,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC,IAAK,YAGJ;AAHD,WAAK,YAAY;IACf,qCAAqB,CAAA;IACrB,6BAAa,CAAA;AACf,CAAC,EAHI,YAAY,KAAZ,YAAY,QAGhB;AAED,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;SACd,GAAG,CAAC,CAAC,EAAE,qCAAqC,C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AAC;AAED,eAAe,sBAAsB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "milvus-knowledge-mcp-server",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for Milvus knowledge base integration with semantic search capabilities",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "milvus-knowledge-mcp-server": "dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "scripts": {
16
+ "start": "node dist/index.js",
17
+ "dev": "tsx watch src/index.ts",
18
+ "build": "tsc",
19
+ "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
20
+ "test": "vitest run",
21
+ "test:watch": "vitest",
22
+ "test:coverage": "vitest run --coverage",
23
+ "inspector": "npx @modelcontextprotocol/inspector node dist/index.js",
24
+ "prepublishOnly": "npm run clean && npm run build"
25
+ },
26
+ "keywords": [
27
+ "mcp",
28
+ "model-context-protocol",
29
+ "milvus",
30
+ "vector-database",
31
+ "knowledge-base",
32
+ "semantic-search",
33
+ "ai",
34
+ "llm",
35
+ "claude"
36
+ ],
37
+ "author": "",
38
+ "license": "Apache-2.0",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://gitee.com/xywdy/knowage_mcp.git"
42
+ },
43
+ "homepage": "https://gitee.com/xywdy/knowage_mcp",
44
+ "bugs": {
45
+ "url": "https://gitee.com/xywdy/knowage_mcp/issues"
46
+ },
47
+ "engines": {
48
+ "node": ">=18"
49
+ },
50
+ "dependencies": {
51
+ "@modelcontextprotocol/sdk": "^1.6.1",
52
+ "@zilliz/milvus2-sdk-node": "^2.4.9",
53
+ "express": "^4.21.0",
54
+ "zod": "^3.23.8"
55
+ },
56
+ "devDependencies": {
57
+ "@types/express": "^4.17.21",
58
+ "@types/node": "^22.10.0",
59
+ "tsx": "^4.19.2",
60
+ "typescript": "^5.7.2",
61
+ "vitest": "^1.3.0"
62
+ }
63
+ }