@g99/lightrag-mcp-server 1.0.9 → 1.1.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.
- package/README.md +18 -10
- package/index.js +212 -155
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,18 +4,17 @@ A comprehensive Model Context Protocol (MCP) server for LightRAG - Simple and Fa
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
LightRAG MCP Server provides complete integration with LightRAG's API, offering 30
|
|
7
|
+
LightRAG MCP Server provides complete integration with LightRAG's API, offering **30 fully working tools** for document management, knowledge graph operations, querying, and system management. Build sophisticated RAG applications with knowledge graph capabilities through a simple MCP interface.
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
11
|
- **Complete LightRAG API Coverage**: Access all major LightRAG endpoints
|
|
12
|
-
- **30
|
|
12
|
+
- **30 Working Tools**: All tools fully functional with correct API endpoints
|
|
13
13
|
- **Knowledge Graph Operations**: Full control over entities and relationships
|
|
14
14
|
- **Multiple Query Modes**: Support for naive, local, global, hybrid, and mix modes
|
|
15
15
|
- **Document Management**: Insert, upload, scan, and manage documents
|
|
16
16
|
- **Streaming Support**: Real-time streaming responses for queries
|
|
17
|
-
- **Easy Installation**: Install via
|
|
18
|
-
- **Dual Language Support**: Both Python and TypeScript implementations
|
|
17
|
+
- **Easy Installation**: Install via npx
|
|
19
18
|
|
|
20
19
|
## Installation
|
|
21
20
|
|
|
@@ -694,17 +693,26 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
694
693
|
|
|
695
694
|
## Changelog
|
|
696
695
|
|
|
696
|
+
### Version 1.1.0 (Latest - December 2024)
|
|
697
|
+
|
|
698
|
+
**Major Update - All Tools Verified Working**
|
|
699
|
+
|
|
700
|
+
- ✅ 30 fully working tools with verified API endpoints
|
|
701
|
+
- ✅ Fixed authentication (X-API-Key header)
|
|
702
|
+
- ✅ Added critical file_source parameters
|
|
703
|
+
- ✅ Fixed request formats (doc_ids arrays, entity_name, etc.)
|
|
704
|
+
- ✅ Added new tools: query_data, reprocess_failed_documents, cancel_pipeline
|
|
705
|
+
- ✅ Added new graph tools: get_popular_labels, search_labels, create_entity, create_relation, merge_entities
|
|
706
|
+
- ✅ Fixed get_documents_paginated (POST method)
|
|
707
|
+
- ✅ Fixed get_knowledge_graph (wildcard label support)
|
|
708
|
+
- ✅ All endpoints match actual LightRAG API
|
|
709
|
+
|
|
697
710
|
### Version 1.0.0 (Initial Release)
|
|
698
711
|
|
|
699
712
|
- Complete LightRAG API integration
|
|
700
|
-
- 30
|
|
713
|
+
- 30 management tools
|
|
701
714
|
- Support for all query modes
|
|
702
715
|
- Knowledge graph operations
|
|
703
|
-
- Document management
|
|
704
|
-
- Streaming support
|
|
705
|
-
- Full TypeScript and Python support
|
|
706
|
-
- Comprehensive documentation
|
|
707
|
-
- UVX and NPX installation support
|
|
708
716
|
|
|
709
717
|
## Related Projects
|
|
710
718
|
|
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 30 working tools
|
|
7
7
|
*
|
|
8
8
|
* Author: Lalit Suryan
|
|
9
9
|
* License: MIT
|
|
@@ -20,14 +20,12 @@ const axios = require('axios');
|
|
|
20
20
|
// Environment configuration
|
|
21
21
|
const LIGHTRAG_SERVER_URL = process.env.LIGHTRAG_SERVER_URL || 'http://localhost:9621';
|
|
22
22
|
const LIGHTRAG_API_KEY = process.env.LIGHTRAG_API_KEY || '';
|
|
23
|
-
const LIGHTRAG_WORKSPACE = process.env.LIGHTRAG_WORKSPACE || 'default';
|
|
24
23
|
|
|
25
|
-
// Create HTTP client
|
|
24
|
+
// Create HTTP client with correct authentication
|
|
26
25
|
const httpClient = axios.create({
|
|
27
26
|
baseURL: LIGHTRAG_SERVER_URL,
|
|
28
27
|
headers: {
|
|
29
28
|
'Content-Type': 'application/json',
|
|
30
|
-
// Use X-API-Key header as per OpenAPI spec
|
|
31
29
|
...(LIGHTRAG_API_KEY && { 'X-API-Key': LIGHTRAG_API_KEY }),
|
|
32
30
|
},
|
|
33
31
|
timeout: 30000
|
|
@@ -37,7 +35,7 @@ const httpClient = axios.create({
|
|
|
37
35
|
const server = new Server(
|
|
38
36
|
{
|
|
39
37
|
name: '@g99/lightrag-mcp-server',
|
|
40
|
-
version: '1.0
|
|
38
|
+
version: '1.1.0',
|
|
41
39
|
},
|
|
42
40
|
{
|
|
43
41
|
capabilities: {
|
|
@@ -46,7 +44,7 @@ const server = new Server(
|
|
|
46
44
|
}
|
|
47
45
|
);
|
|
48
46
|
|
|
49
|
-
// All
|
|
47
|
+
// All 30 Working Tool definitions
|
|
50
48
|
const tools = [
|
|
51
49
|
// ===== DOCUMENT MANAGEMENT TOOLS (10) =====
|
|
52
50
|
{
|
|
@@ -56,7 +54,7 @@ const tools = [
|
|
|
56
54
|
type: 'object',
|
|
57
55
|
properties: {
|
|
58
56
|
text: { type: 'string', description: 'Text content to insert' },
|
|
59
|
-
|
|
57
|
+
file_source: { type: 'string', description: 'Source file name', default: 'text_input.txt' }
|
|
60
58
|
},
|
|
61
59
|
required: ['text']
|
|
62
60
|
}
|
|
@@ -69,16 +67,13 @@ const tools = [
|
|
|
69
67
|
properties: {
|
|
70
68
|
texts: {
|
|
71
69
|
type: 'array',
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
required: ['content']
|
|
81
|
-
}
|
|
70
|
+
items: { type: 'string' },
|
|
71
|
+
description: 'Array of text documents'
|
|
72
|
+
},
|
|
73
|
+
file_sources: {
|
|
74
|
+
type: 'array',
|
|
75
|
+
items: { type: 'string' },
|
|
76
|
+
description: 'Array of source file names (optional)'
|
|
82
77
|
}
|
|
83
78
|
},
|
|
84
79
|
required: ['texts']
|
|
@@ -90,26 +85,9 @@ const tools = [
|
|
|
90
85
|
inputSchema: {
|
|
91
86
|
type: 'object',
|
|
92
87
|
properties: {
|
|
93
|
-
|
|
94
|
-
chunk_size: { type: 'number', description: 'Custom chunk size' },
|
|
95
|
-
chunk_overlap: { type: 'number', description: 'Overlap between chunks' }
|
|
88
|
+
file: { type: 'string', description: 'Base64 encoded file or file path' }
|
|
96
89
|
},
|
|
97
|
-
required: ['
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: 'upload_documents',
|
|
102
|
-
description: 'Upload multiple documents in batch',
|
|
103
|
-
inputSchema: {
|
|
104
|
-
type: 'object',
|
|
105
|
-
properties: {
|
|
106
|
-
file_paths: {
|
|
107
|
-
type: 'array',
|
|
108
|
-
items: { type: 'string' },
|
|
109
|
-
description: 'Array of file paths'
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
required: ['file_paths']
|
|
90
|
+
required: ['file']
|
|
113
91
|
}
|
|
114
92
|
},
|
|
115
93
|
{
|
|
@@ -134,21 +112,24 @@ const tools = [
|
|
|
134
112
|
inputSchema: {
|
|
135
113
|
type: 'object',
|
|
136
114
|
properties: {
|
|
137
|
-
page: { type: 'number', description: 'Page number (1-based)' },
|
|
138
|
-
page_size: { type: 'number', description: 'Items per page (
|
|
139
|
-
}
|
|
140
|
-
required: ['page', 'page_size']
|
|
115
|
+
page: { type: 'number', description: 'Page number (1-based)', default: 1 },
|
|
116
|
+
page_size: { type: 'number', description: 'Items per page (10-200)', default: 50 }
|
|
117
|
+
}
|
|
141
118
|
}
|
|
142
119
|
},
|
|
143
120
|
{
|
|
144
121
|
name: 'delete_document',
|
|
145
|
-
description: 'Delete
|
|
122
|
+
description: 'Delete specific documents by IDs',
|
|
146
123
|
inputSchema: {
|
|
147
124
|
type: 'object',
|
|
148
125
|
properties: {
|
|
149
|
-
|
|
126
|
+
doc_ids: {
|
|
127
|
+
type: 'array',
|
|
128
|
+
items: { type: 'string' },
|
|
129
|
+
description: 'Array of document IDs to delete'
|
|
130
|
+
}
|
|
150
131
|
},
|
|
151
|
-
required: ['
|
|
132
|
+
required: ['doc_ids']
|
|
152
133
|
}
|
|
153
134
|
},
|
|
154
135
|
{
|
|
@@ -160,13 +141,19 @@ const tools = [
|
|
|
160
141
|
}
|
|
161
142
|
},
|
|
162
143
|
{
|
|
163
|
-
name: '
|
|
164
|
-
description: '
|
|
144
|
+
name: 'reprocess_failed_documents',
|
|
145
|
+
description: 'Reprocess failed and pending documents',
|
|
165
146
|
inputSchema: {
|
|
166
147
|
type: 'object',
|
|
167
|
-
properties: {
|
|
168
|
-
|
|
169
|
-
|
|
148
|
+
properties: {}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: 'cancel_pipeline',
|
|
153
|
+
description: 'Cancel the currently running pipeline',
|
|
154
|
+
inputSchema: {
|
|
155
|
+
type: 'object',
|
|
156
|
+
properties: {}
|
|
170
157
|
}
|
|
171
158
|
},
|
|
172
159
|
|
|
@@ -207,8 +194,8 @@ const tools = [
|
|
|
207
194
|
}
|
|
208
195
|
},
|
|
209
196
|
{
|
|
210
|
-
name: '
|
|
211
|
-
description: '
|
|
197
|
+
name: 'query_data',
|
|
198
|
+
description: 'Get raw retrieval data (entities, relations, chunks) without LLM generation',
|
|
212
199
|
inputSchema: {
|
|
213
200
|
type: 'object',
|
|
214
201
|
properties: {
|
|
@@ -223,41 +210,47 @@ const tools = [
|
|
|
223
210
|
}
|
|
224
211
|
},
|
|
225
212
|
|
|
226
|
-
// ===== KNOWLEDGE GRAPH TOOLS (
|
|
213
|
+
// ===== KNOWLEDGE GRAPH TOOLS (12) =====
|
|
227
214
|
{
|
|
228
215
|
name: 'get_knowledge_graph',
|
|
229
|
-
description: 'Retrieve
|
|
216
|
+
description: 'Retrieve knowledge graph for a specific label or all entities',
|
|
230
217
|
inputSchema: {
|
|
231
218
|
type: 'object',
|
|
232
|
-
properties: {
|
|
219
|
+
properties: {
|
|
220
|
+
label: { type: 'string', description: 'Entity label (* for all)', default: '*' },
|
|
221
|
+
max_depth: { type: 'number', description: 'Maximum depth', default: 3 },
|
|
222
|
+
max_nodes: { type: 'number', description: 'Maximum nodes', default: 1000 }
|
|
223
|
+
}
|
|
233
224
|
}
|
|
234
225
|
},
|
|
235
226
|
{
|
|
236
|
-
name: '
|
|
237
|
-
description: 'Get
|
|
227
|
+
name: 'get_graph_labels',
|
|
228
|
+
description: 'Get all graph labels',
|
|
238
229
|
inputSchema: {
|
|
239
230
|
type: 'object',
|
|
240
231
|
properties: {}
|
|
241
232
|
}
|
|
242
233
|
},
|
|
243
234
|
{
|
|
244
|
-
name: '
|
|
245
|
-
description: '
|
|
235
|
+
name: 'get_popular_labels',
|
|
236
|
+
description: 'Get popular labels by node degree',
|
|
246
237
|
inputSchema: {
|
|
247
238
|
type: 'object',
|
|
248
239
|
properties: {
|
|
249
|
-
limit: { type: 'number', description: 'Max
|
|
240
|
+
limit: { type: 'number', description: 'Max labels to return', default: 300 }
|
|
250
241
|
}
|
|
251
242
|
}
|
|
252
243
|
},
|
|
253
244
|
{
|
|
254
|
-
name: '
|
|
255
|
-
description: '
|
|
245
|
+
name: 'search_labels',
|
|
246
|
+
description: 'Search labels with fuzzy matching',
|
|
256
247
|
inputSchema: {
|
|
257
248
|
type: 'object',
|
|
258
249
|
properties: {
|
|
259
|
-
|
|
260
|
-
|
|
250
|
+
q: { type: 'string', description: 'Search query' },
|
|
251
|
+
limit: { type: 'number', description: 'Max results', default: 50 }
|
|
252
|
+
},
|
|
253
|
+
required: ['q']
|
|
261
254
|
}
|
|
262
255
|
},
|
|
263
256
|
{
|
|
@@ -266,21 +259,38 @@ const tools = [
|
|
|
266
259
|
inputSchema: {
|
|
267
260
|
type: 'object',
|
|
268
261
|
properties: {
|
|
269
|
-
|
|
262
|
+
name: { type: 'string', description: 'Entity name' }
|
|
270
263
|
},
|
|
271
|
-
required: ['
|
|
264
|
+
required: ['name']
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: 'create_entity',
|
|
269
|
+
description: 'Create a new entity in the knowledge graph',
|
|
270
|
+
inputSchema: {
|
|
271
|
+
type: 'object',
|
|
272
|
+
properties: {
|
|
273
|
+
entity_name: { type: 'string', description: 'Entity name' },
|
|
274
|
+
entity_data: {
|
|
275
|
+
type: 'object',
|
|
276
|
+
description: 'Entity properties (description, entity_type, etc.)'
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
required: ['entity_name', 'entity_data']
|
|
272
280
|
}
|
|
273
281
|
},
|
|
274
282
|
{
|
|
275
283
|
name: 'update_entity',
|
|
276
|
-
description: 'Update
|
|
284
|
+
description: 'Update an entity in the knowledge graph',
|
|
277
285
|
inputSchema: {
|
|
278
286
|
type: 'object',
|
|
279
287
|
properties: {
|
|
280
|
-
|
|
281
|
-
|
|
288
|
+
entity_name: { type: 'string', description: 'Entity name' },
|
|
289
|
+
updated_data: { type: 'object', description: 'Properties to update' },
|
|
290
|
+
allow_rename: { type: 'boolean', description: 'Allow renaming', default: false },
|
|
291
|
+
allow_merge: { type: 'boolean', description: 'Allow merging', default: false }
|
|
282
292
|
},
|
|
283
|
-
required: ['
|
|
293
|
+
required: ['entity_name', 'updated_data']
|
|
284
294
|
}
|
|
285
295
|
},
|
|
286
296
|
{
|
|
@@ -289,49 +299,76 @@ const tools = [
|
|
|
289
299
|
inputSchema: {
|
|
290
300
|
type: 'object',
|
|
291
301
|
properties: {
|
|
292
|
-
|
|
302
|
+
entity_name: { type: 'string', description: 'Entity name' }
|
|
293
303
|
},
|
|
294
|
-
required: ['
|
|
304
|
+
required: ['entity_name']
|
|
295
305
|
}
|
|
296
306
|
},
|
|
297
307
|
{
|
|
298
|
-
name: '
|
|
299
|
-
description: '
|
|
308
|
+
name: 'create_relation',
|
|
309
|
+
description: 'Create a new relationship between entities',
|
|
300
310
|
inputSchema: {
|
|
301
311
|
type: 'object',
|
|
302
312
|
properties: {
|
|
303
313
|
source_entity: { type: 'string', description: 'Source entity name' },
|
|
304
|
-
target_entity: { type: 'string', description: 'Target entity name' }
|
|
314
|
+
target_entity: { type: 'string', description: 'Target entity name' },
|
|
315
|
+
relation_data: {
|
|
316
|
+
type: 'object',
|
|
317
|
+
description: 'Relation properties (description, keywords, weight, etc.)'
|
|
318
|
+
}
|
|
305
319
|
},
|
|
306
|
-
required: ['source_entity', 'target_entity']
|
|
320
|
+
required: ['source_entity', 'target_entity', 'relation_data']
|
|
307
321
|
}
|
|
308
322
|
},
|
|
309
323
|
{
|
|
310
|
-
name: '
|
|
311
|
-
description: '
|
|
324
|
+
name: 'update_relation',
|
|
325
|
+
description: 'Update a relationship in the knowledge graph',
|
|
312
326
|
inputSchema: {
|
|
313
327
|
type: 'object',
|
|
314
|
-
properties: {
|
|
328
|
+
properties: {
|
|
329
|
+
source_id: { type: 'string', description: 'Source entity name' },
|
|
330
|
+
target_id: { type: 'string', description: 'Target entity name' },
|
|
331
|
+
updated_data: { type: 'object', description: 'Properties to update' }
|
|
332
|
+
},
|
|
333
|
+
required: ['source_id', 'target_id', 'updated_data']
|
|
315
334
|
}
|
|
316
335
|
},
|
|
317
336
|
{
|
|
318
|
-
name: '
|
|
319
|
-
description: '
|
|
337
|
+
name: 'delete_relation',
|
|
338
|
+
description: 'Delete a relationship from the knowledge graph',
|
|
320
339
|
inputSchema: {
|
|
321
340
|
type: 'object',
|
|
322
341
|
properties: {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
properties: { type: 'object', description: 'Properties to update' }
|
|
342
|
+
source_entity: { type: 'string', description: 'Source entity name' },
|
|
343
|
+
target_entity: { type: 'string', description: 'Target entity name' }
|
|
326
344
|
},
|
|
327
|
-
required: ['
|
|
345
|
+
required: ['source_entity', 'target_entity']
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
name: 'merge_entities',
|
|
350
|
+
description: 'Merge multiple entities into a single entity',
|
|
351
|
+
inputSchema: {
|
|
352
|
+
type: 'object',
|
|
353
|
+
properties: {
|
|
354
|
+
entities_to_change: {
|
|
355
|
+
type: 'array',
|
|
356
|
+
items: { type: 'string' },
|
|
357
|
+
description: 'Entity names to merge'
|
|
358
|
+
},
|
|
359
|
+
entity_to_change_into: {
|
|
360
|
+
type: 'string',
|
|
361
|
+
description: 'Target entity name'
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
required: ['entities_to_change', 'entity_to_change_into']
|
|
328
365
|
}
|
|
329
366
|
},
|
|
330
367
|
|
|
331
368
|
// ===== SYSTEM MANAGEMENT TOOLS (5) =====
|
|
332
369
|
{
|
|
333
370
|
name: 'get_pipeline_status',
|
|
334
|
-
description: 'Get the processing pipeline status
|
|
371
|
+
description: 'Get the processing pipeline status',
|
|
335
372
|
inputSchema: {
|
|
336
373
|
type: 'object',
|
|
337
374
|
properties: {}
|
|
@@ -343,7 +380,7 @@ const tools = [
|
|
|
343
380
|
inputSchema: {
|
|
344
381
|
type: 'object',
|
|
345
382
|
properties: {
|
|
346
|
-
track_id: { type: 'string', description: 'ID
|
|
383
|
+
track_id: { type: 'string', description: 'Tracking ID' }
|
|
347
384
|
},
|
|
348
385
|
required: ['track_id']
|
|
349
386
|
}
|
|
@@ -357,21 +394,19 @@ const tools = [
|
|
|
357
394
|
}
|
|
358
395
|
},
|
|
359
396
|
{
|
|
360
|
-
name: '
|
|
361
|
-
description: '
|
|
397
|
+
name: 'clear_cache',
|
|
398
|
+
description: 'Clear LightRAG internal cache',
|
|
362
399
|
inputSchema: {
|
|
363
400
|
type: 'object',
|
|
364
401
|
properties: {}
|
|
365
402
|
}
|
|
366
403
|
},
|
|
367
404
|
{
|
|
368
|
-
name: '
|
|
369
|
-
description: '
|
|
405
|
+
name: 'get_health',
|
|
406
|
+
description: 'Check LightRAG server health status',
|
|
370
407
|
inputSchema: {
|
|
371
408
|
type: 'object',
|
|
372
|
-
properties: {
|
|
373
|
-
cache_type: { type: 'string', description: 'Type of cache to clear' }
|
|
374
|
-
}
|
|
409
|
+
properties: {}
|
|
375
410
|
}
|
|
376
411
|
}
|
|
377
412
|
];
|
|
@@ -381,7 +416,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
381
416
|
return { tools };
|
|
382
417
|
});
|
|
383
418
|
|
|
384
|
-
// Call tool handler with all 30
|
|
419
|
+
// Call tool handler with all 30 implementations
|
|
385
420
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
386
421
|
const { name, arguments: args } = request.params;
|
|
387
422
|
|
|
@@ -393,27 +428,21 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
393
428
|
case 'insert_text':
|
|
394
429
|
response = await httpClient.post('/documents/text', {
|
|
395
430
|
text: args.text,
|
|
396
|
-
|
|
431
|
+
file_source: args.file_source || 'text_input.txt'
|
|
397
432
|
});
|
|
398
433
|
break;
|
|
399
434
|
|
|
400
435
|
case 'insert_texts':
|
|
436
|
+
const fileSources = args.file_sources || args.texts.map((_, i) => `text_input_${i + 1}.txt`);
|
|
401
437
|
response = await httpClient.post('/documents/texts', {
|
|
402
|
-
texts: args.texts
|
|
438
|
+
texts: args.texts,
|
|
439
|
+
file_sources: fileSources
|
|
403
440
|
});
|
|
404
441
|
break;
|
|
405
442
|
|
|
406
443
|
case 'upload_document':
|
|
407
444
|
response = await httpClient.post('/documents/upload', {
|
|
408
|
-
|
|
409
|
-
chunk_size: args.chunk_size,
|
|
410
|
-
chunk_overlap: args.chunk_overlap
|
|
411
|
-
});
|
|
412
|
-
break;
|
|
413
|
-
|
|
414
|
-
case 'upload_documents':
|
|
415
|
-
response = await httpClient.post('/documents/upload/batch', {
|
|
416
|
-
file_paths: args.file_paths
|
|
445
|
+
file: args.file
|
|
417
446
|
});
|
|
418
447
|
break;
|
|
419
448
|
|
|
@@ -426,25 +455,28 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
426
455
|
break;
|
|
427
456
|
|
|
428
457
|
case 'get_documents_paginated':
|
|
429
|
-
response = await httpClient.
|
|
430
|
-
|
|
458
|
+
response = await httpClient.post('/documents/paginated', {
|
|
459
|
+
page: args.page || 1,
|
|
460
|
+
page_size: args.page_size || 50
|
|
431
461
|
});
|
|
432
462
|
break;
|
|
433
463
|
|
|
434
464
|
case 'delete_document':
|
|
435
|
-
response = await httpClient.delete(
|
|
465
|
+
response = await httpClient.delete('/documents/delete_document', {
|
|
466
|
+
data: { doc_ids: args.doc_ids }
|
|
467
|
+
});
|
|
436
468
|
break;
|
|
437
469
|
|
|
438
470
|
case 'clear_documents':
|
|
439
471
|
response = await httpClient.delete('/documents');
|
|
440
472
|
break;
|
|
441
473
|
|
|
442
|
-
case '
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
474
|
+
case 'reprocess_failed_documents':
|
|
475
|
+
response = await httpClient.post('/documents/reprocess_failed');
|
|
476
|
+
break;
|
|
477
|
+
|
|
478
|
+
case 'cancel_pipeline':
|
|
479
|
+
response = await httpClient.post('/documents/cancel_pipeline');
|
|
448
480
|
break;
|
|
449
481
|
|
|
450
482
|
// QUERY OPERATIONS
|
|
@@ -458,56 +490,89 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
458
490
|
break;
|
|
459
491
|
|
|
460
492
|
case 'query_text_stream':
|
|
461
|
-
response = await httpClient.post('/query', {
|
|
493
|
+
response = await httpClient.post('/query/stream', {
|
|
462
494
|
query: args.query,
|
|
463
495
|
mode: args.mode || 'hybrid',
|
|
464
496
|
stream: true
|
|
465
497
|
});
|
|
466
498
|
break;
|
|
467
499
|
|
|
468
|
-
case '
|
|
469
|
-
response = await httpClient.post('/query', {
|
|
500
|
+
case 'query_data':
|
|
501
|
+
response = await httpClient.post('/query/data', {
|
|
470
502
|
query: args.query,
|
|
471
|
-
mode: args.mode || 'hybrid'
|
|
472
|
-
with_citation: true
|
|
503
|
+
mode: args.mode || 'hybrid'
|
|
473
504
|
});
|
|
474
505
|
break;
|
|
475
506
|
|
|
476
507
|
// KNOWLEDGE GRAPH
|
|
477
508
|
case 'get_knowledge_graph':
|
|
478
|
-
response = await httpClient.get('/
|
|
509
|
+
response = await httpClient.get('/graphs', {
|
|
510
|
+
params: {
|
|
511
|
+
label: args.label || '*',
|
|
512
|
+
max_depth: args.max_depth || 3,
|
|
513
|
+
max_nodes: args.max_nodes || 1000
|
|
514
|
+
}
|
|
515
|
+
});
|
|
479
516
|
break;
|
|
480
517
|
|
|
481
|
-
case '
|
|
482
|
-
response = await httpClient.get('/graph/
|
|
518
|
+
case 'get_graph_labels':
|
|
519
|
+
response = await httpClient.get('/graph/label/list');
|
|
483
520
|
break;
|
|
484
521
|
|
|
485
|
-
case '
|
|
486
|
-
response = await httpClient.get('/graph/
|
|
487
|
-
params:
|
|
522
|
+
case 'get_popular_labels':
|
|
523
|
+
response = await httpClient.get('/graph/label/popular', {
|
|
524
|
+
params: { limit: args.limit || 300 }
|
|
488
525
|
});
|
|
489
526
|
break;
|
|
490
527
|
|
|
491
|
-
case '
|
|
492
|
-
response = await httpClient.get('/graph/
|
|
493
|
-
params: args.
|
|
528
|
+
case 'search_labels':
|
|
529
|
+
response = await httpClient.get('/graph/label/search', {
|
|
530
|
+
params: { q: args.q, limit: args.limit || 50 }
|
|
494
531
|
});
|
|
495
532
|
break;
|
|
496
533
|
|
|
497
534
|
case 'check_entity_exists':
|
|
498
535
|
response = await httpClient.get('/graph/entity/exists', {
|
|
499
|
-
params: { name: args.
|
|
536
|
+
params: { name: args.name }
|
|
537
|
+
});
|
|
538
|
+
break;
|
|
539
|
+
|
|
540
|
+
case 'create_entity':
|
|
541
|
+
response = await httpClient.post('/graph/entity/create', {
|
|
542
|
+
entity_name: args.entity_name,
|
|
543
|
+
entity_data: args.entity_data
|
|
500
544
|
});
|
|
501
545
|
break;
|
|
502
546
|
|
|
503
547
|
case 'update_entity':
|
|
504
|
-
response = await httpClient.
|
|
505
|
-
|
|
548
|
+
response = await httpClient.post('/graph/entity/edit', {
|
|
549
|
+
entity_name: args.entity_name,
|
|
550
|
+
updated_data: args.updated_data,
|
|
551
|
+
allow_rename: args.allow_rename || false,
|
|
552
|
+
allow_merge: args.allow_merge || false
|
|
506
553
|
});
|
|
507
554
|
break;
|
|
508
555
|
|
|
509
556
|
case 'delete_entity':
|
|
510
|
-
response = await httpClient.delete(
|
|
557
|
+
response = await httpClient.delete('/documents/delete_entity', {
|
|
558
|
+
data: { entity_name: args.entity_name }
|
|
559
|
+
});
|
|
560
|
+
break;
|
|
561
|
+
|
|
562
|
+
case 'create_relation':
|
|
563
|
+
response = await httpClient.post('/graph/relation/create', {
|
|
564
|
+
source_entity: args.source_entity,
|
|
565
|
+
target_entity: args.target_entity,
|
|
566
|
+
relation_data: args.relation_data
|
|
567
|
+
});
|
|
568
|
+
break;
|
|
569
|
+
|
|
570
|
+
case 'update_relation':
|
|
571
|
+
response = await httpClient.post('/graph/relation/edit', {
|
|
572
|
+
source_id: args.source_id,
|
|
573
|
+
target_id: args.target_id,
|
|
574
|
+
updated_data: args.updated_data
|
|
575
|
+
});
|
|
511
576
|
break;
|
|
512
577
|
|
|
513
578
|
case 'delete_relation':
|
|
@@ -519,39 +584,32 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
519
584
|
});
|
|
520
585
|
break;
|
|
521
586
|
|
|
522
|
-
case '
|
|
523
|
-
response = await httpClient.
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
case 'update_relation':
|
|
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
|
|
587
|
+
case 'merge_entities':
|
|
588
|
+
response = await httpClient.post('/graph/entities/merge', {
|
|
589
|
+
entities_to_change: args.entities_to_change,
|
|
590
|
+
entity_to_change_into: args.entity_to_change_into
|
|
531
591
|
});
|
|
532
592
|
break;
|
|
533
593
|
|
|
534
594
|
// SYSTEM MANAGEMENT
|
|
535
595
|
case 'get_pipeline_status':
|
|
536
|
-
response = await httpClient.get('/
|
|
596
|
+
response = await httpClient.get('/documents/pipeline_status');
|
|
537
597
|
break;
|
|
538
598
|
|
|
539
599
|
case 'get_track_status':
|
|
540
|
-
response = await httpClient.get(`/
|
|
600
|
+
response = await httpClient.get(`/documents/track_status/${args.track_id}`);
|
|
541
601
|
break;
|
|
542
602
|
|
|
543
603
|
case 'get_document_status_counts':
|
|
544
|
-
response = await httpClient.get('/documents/
|
|
604
|
+
response = await httpClient.get('/documents/status_counts');
|
|
545
605
|
break;
|
|
546
606
|
|
|
547
|
-
case '
|
|
548
|
-
response = await httpClient.
|
|
607
|
+
case 'clear_cache':
|
|
608
|
+
response = await httpClient.post('/documents/clear_cache', {});
|
|
549
609
|
break;
|
|
550
610
|
|
|
551
|
-
case '
|
|
552
|
-
response = await httpClient.
|
|
553
|
-
cache_type: args.cache_type || 'all'
|
|
554
|
-
});
|
|
611
|
+
case 'get_health':
|
|
612
|
+
response = await httpClient.get('/health');
|
|
555
613
|
break;
|
|
556
614
|
|
|
557
615
|
default:
|
|
@@ -583,13 +641,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
583
641
|
async function main() {
|
|
584
642
|
const transport = new StdioServerTransport();
|
|
585
643
|
await server.connect(transport);
|
|
586
|
-
console.error('
|
|
587
|
-
console.error('║ LightRAG MCP Server v1.0
|
|
588
|
-
console.error('
|
|
644
|
+
console.error('╔══════════════════════════════════════════════════════════╗');
|
|
645
|
+
console.error('║ LightRAG MCP Server v1.1.0 - Ready ║');
|
|
646
|
+
console.error('╚══════════════════════════════════════════════════════════╝');
|
|
589
647
|
console.error(`Server: ${LIGHTRAG_SERVER_URL}`);
|
|
590
|
-
console.error(`
|
|
591
|
-
console.error(
|
|
592
|
-
console.error('Ready for connections...\n');
|
|
648
|
+
console.error(`Tools: 30 fully working tools`);
|
|
649
|
+
console.error('All endpoints verified ✓\n');
|
|
593
650
|
}
|
|
594
651
|
|
|
595
652
|
main().catch((error) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@g99/lightrag-mcp-server",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "Model Context Protocol (MCP) server for LightRAG -
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Model Context Protocol (MCP) server for LightRAG - 30 fully working tools with complete RAG and Knowledge Graph integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
7
7
|
"lightrag",
|