@g99/lightrag-mcp-server 1.0.8 → 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/index.js +27 -54
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* LightRAG MCP Server - Complete Node.js Implementation
|
|
5
5
|
*
|
|
6
|
-
* Model Context Protocol server for LightRAG with
|
|
6
|
+
* Model Context Protocol server for LightRAG with 28 tools
|
|
7
7
|
*
|
|
8
8
|
* Author: Lalit Suryan
|
|
9
9
|
* License: MIT
|
|
@@ -27,8 +27,8 @@ const httpClient = axios.create({
|
|
|
27
27
|
baseURL: LIGHTRAG_SERVER_URL,
|
|
28
28
|
headers: {
|
|
29
29
|
'Content-Type': 'application/json',
|
|
30
|
-
|
|
31
|
-
'X-
|
|
30
|
+
// Use X-API-Key header as per OpenAPI spec
|
|
31
|
+
...(LIGHTRAG_API_KEY && { 'X-API-Key': LIGHTRAG_API_KEY }),
|
|
32
32
|
},
|
|
33
33
|
timeout: 30000
|
|
34
34
|
});
|
|
@@ -37,7 +37,7 @@ const httpClient = axios.create({
|
|
|
37
37
|
const server = new Server(
|
|
38
38
|
{
|
|
39
39
|
name: '@g99/lightrag-mcp-server',
|
|
40
|
-
version: '1.0.
|
|
40
|
+
version: '1.0.9',
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
capabilities: {
|
|
@@ -46,7 +46,7 @@ const server = new Server(
|
|
|
46
46
|
}
|
|
47
47
|
);
|
|
48
48
|
|
|
49
|
-
// All
|
|
49
|
+
// All 28 Tool definitions (10 Document + 3 Query + 10 Knowledge Graph + 5 System)
|
|
50
50
|
const tools = [
|
|
51
51
|
// ===== DOCUMENT MANAGEMENT TOOLS (10) =====
|
|
52
52
|
{
|
|
@@ -300,9 +300,10 @@ const tools = [
|
|
|
300
300
|
inputSchema: {
|
|
301
301
|
type: 'object',
|
|
302
302
|
properties: {
|
|
303
|
-
|
|
303
|
+
source_entity: { type: 'string', description: 'Source entity name' },
|
|
304
|
+
target_entity: { type: 'string', description: 'Target entity name' }
|
|
304
305
|
},
|
|
305
|
-
required: ['
|
|
306
|
+
required: ['source_entity', 'target_entity']
|
|
306
307
|
}
|
|
307
308
|
},
|
|
308
309
|
{
|
|
@@ -319,14 +320,15 @@ const tools = [
|
|
|
319
320
|
inputSchema: {
|
|
320
321
|
type: 'object',
|
|
321
322
|
properties: {
|
|
322
|
-
|
|
323
|
+
source_id: { type: 'string', description: 'Source entity name' },
|
|
324
|
+
target_id: { type: 'string', description: 'Target entity name' },
|
|
323
325
|
properties: { type: 'object', description: 'Properties to update' }
|
|
324
326
|
},
|
|
325
|
-
required: ['
|
|
327
|
+
required: ['source_id', 'target_id', 'properties']
|
|
326
328
|
}
|
|
327
329
|
},
|
|
328
330
|
|
|
329
|
-
// ===== SYSTEM MANAGEMENT TOOLS (
|
|
331
|
+
// ===== SYSTEM MANAGEMENT TOOLS (5) =====
|
|
330
332
|
{
|
|
331
333
|
name: 'get_pipeline_status',
|
|
332
334
|
description: 'Get the processing pipeline status from LightRAG',
|
|
@@ -362,14 +364,6 @@ const tools = [
|
|
|
362
364
|
properties: {}
|
|
363
365
|
}
|
|
364
366
|
},
|
|
365
|
-
{
|
|
366
|
-
name: 'get_status',
|
|
367
|
-
description: 'Get detailed system status and statistics',
|
|
368
|
-
inputSchema: {
|
|
369
|
-
type: 'object',
|
|
370
|
-
properties: {}
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
367
|
{
|
|
374
368
|
name: 'clear_cache',
|
|
375
369
|
description: 'Clear LightRAG internal cache',
|
|
@@ -379,22 +373,6 @@ const tools = [
|
|
|
379
373
|
cache_type: { type: 'string', description: 'Type of cache to clear' }
|
|
380
374
|
}
|
|
381
375
|
}
|
|
382
|
-
},
|
|
383
|
-
{
|
|
384
|
-
name: 'get_config',
|
|
385
|
-
description: 'Get current LightRAG server configuration',
|
|
386
|
-
inputSchema: {
|
|
387
|
-
type: 'object',
|
|
388
|
-
properties: {}
|
|
389
|
-
}
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
name: 'get_workspace_info',
|
|
393
|
-
description: 'Get information about the current workspace',
|
|
394
|
-
inputSchema: {
|
|
395
|
-
type: 'object',
|
|
396
|
-
properties: {}
|
|
397
|
-
}
|
|
398
376
|
}
|
|
399
377
|
];
|
|
400
378
|
|
|
@@ -533,16 +511,23 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
533
511
|
break;
|
|
534
512
|
|
|
535
513
|
case 'delete_relation':
|
|
536
|
-
response = await httpClient.delete(
|
|
514
|
+
response = await httpClient.delete('/documents/delete_relation', {
|
|
515
|
+
data: {
|
|
516
|
+
source_entity: args.source_entity,
|
|
517
|
+
target_entity: args.target_entity
|
|
518
|
+
}
|
|
519
|
+
});
|
|
537
520
|
break;
|
|
538
521
|
|
|
539
522
|
case 'get_graph_labels':
|
|
540
|
-
response = await httpClient.get('/graph/
|
|
523
|
+
response = await httpClient.get('/graph/label/list');
|
|
541
524
|
break;
|
|
542
525
|
|
|
543
526
|
case 'update_relation':
|
|
544
|
-
response = await httpClient.
|
|
545
|
-
|
|
527
|
+
response = await httpClient.post('/graph/relation/edit', {
|
|
528
|
+
source_id: args.source_id,
|
|
529
|
+
target_id: args.target_id,
|
|
530
|
+
updated_data: args.properties
|
|
546
531
|
});
|
|
547
532
|
break;
|
|
548
533
|
|
|
@@ -563,24 +548,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
563
548
|
response = await httpClient.get('/health');
|
|
564
549
|
break;
|
|
565
550
|
|
|
566
|
-
case 'get_status':
|
|
567
|
-
response = await httpClient.get('/status');
|
|
568
|
-
break;
|
|
569
|
-
|
|
570
551
|
case 'clear_cache':
|
|
571
552
|
response = await httpClient.post('/cache/clear', {
|
|
572
553
|
cache_type: args.cache_type || 'all'
|
|
573
554
|
});
|
|
574
555
|
break;
|
|
575
556
|
|
|
576
|
-
case 'get_config':
|
|
577
|
-
response = await httpClient.get('/config');
|
|
578
|
-
break;
|
|
579
|
-
|
|
580
|
-
case 'get_workspace_info':
|
|
581
|
-
response = await httpClient.get('/workspace/info');
|
|
582
|
-
break;
|
|
583
|
-
|
|
584
557
|
default:
|
|
585
558
|
throw new Error(`Unknown tool: ${name}`);
|
|
586
559
|
}
|
|
@@ -610,12 +583,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
610
583
|
async function main() {
|
|
611
584
|
const transport = new StdioServerTransport();
|
|
612
585
|
await server.connect(transport);
|
|
613
|
-
console.error('
|
|
614
|
-
console.error('
|
|
615
|
-
console.error('
|
|
586
|
+
console.error('â•”â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•—');
|
|
587
|
+
console.error('║ LightRAG MCP Server v1.0.9 - Started Successfully ║');
|
|
588
|
+
console.error('╚â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•');
|
|
616
589
|
console.error(`Server: ${LIGHTRAG_SERVER_URL}`);
|
|
617
590
|
console.error(`Workspace: ${LIGHTRAG_WORKSPACE}`);
|
|
618
|
-
console.error(`Tools:
|
|
591
|
+
console.error(`Tools: 26 tools available`);
|
|
619
592
|
console.error('Ready for connections...\n');
|
|
620
593
|
}
|
|
621
594
|
|
package/package.json
CHANGED