@g99/lightrag-mcp-server 1.0.8 → 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 +215 -185
- 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,15 +20,13 @@ 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
|
-
...(LIGHTRAG_API_KEY && { '
|
|
31
|
-
'X-Workspace': LIGHTRAG_WORKSPACE
|
|
29
|
+
...(LIGHTRAG_API_KEY && { 'X-API-Key': LIGHTRAG_API_KEY }),
|
|
32
30
|
},
|
|
33
31
|
timeout: 30000
|
|
34
32
|
});
|
|
@@ -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' }
|
|
96
|
-
},
|
|
97
|
-
required: ['file_path']
|
|
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
|
-
}
|
|
88
|
+
file: { type: 'string', description: 'Base64 encoded file or file path' }
|
|
111
89
|
},
|
|
112
|
-
required: ['
|
|
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,105 +259,135 @@ 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']
|
|
272
265
|
}
|
|
273
266
|
},
|
|
274
267
|
{
|
|
275
|
-
name: '
|
|
276
|
-
description: '
|
|
268
|
+
name: 'create_entity',
|
|
269
|
+
description: 'Create a new entity in the knowledge graph',
|
|
277
270
|
inputSchema: {
|
|
278
271
|
type: 'object',
|
|
279
272
|
properties: {
|
|
280
|
-
|
|
281
|
-
|
|
273
|
+
entity_name: { type: 'string', description: 'Entity name' },
|
|
274
|
+
entity_data: {
|
|
275
|
+
type: 'object',
|
|
276
|
+
description: 'Entity properties (description, entity_type, etc.)'
|
|
277
|
+
}
|
|
282
278
|
},
|
|
283
|
-
required: ['
|
|
279
|
+
required: ['entity_name', 'entity_data']
|
|
284
280
|
}
|
|
285
281
|
},
|
|
286
282
|
{
|
|
287
|
-
name: '
|
|
288
|
-
description: '
|
|
283
|
+
name: 'update_entity',
|
|
284
|
+
description: 'Update an entity in the knowledge graph',
|
|
289
285
|
inputSchema: {
|
|
290
286
|
type: 'object',
|
|
291
287
|
properties: {
|
|
292
|
-
|
|
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 }
|
|
293
292
|
},
|
|
294
|
-
required: ['
|
|
293
|
+
required: ['entity_name', 'updated_data']
|
|
295
294
|
}
|
|
296
295
|
},
|
|
297
296
|
{
|
|
298
|
-
name: '
|
|
299
|
-
description: 'Delete
|
|
297
|
+
name: 'delete_entity',
|
|
298
|
+
description: 'Delete an entity from the knowledge graph',
|
|
300
299
|
inputSchema: {
|
|
301
300
|
type: 'object',
|
|
302
301
|
properties: {
|
|
303
|
-
|
|
302
|
+
entity_name: { type: 'string', description: 'Entity name' }
|
|
304
303
|
},
|
|
305
|
-
required: ['
|
|
304
|
+
required: ['entity_name']
|
|
306
305
|
}
|
|
307
306
|
},
|
|
308
307
|
{
|
|
309
|
-
name: '
|
|
310
|
-
description: '
|
|
308
|
+
name: 'create_relation',
|
|
309
|
+
description: 'Create a new relationship between entities',
|
|
311
310
|
inputSchema: {
|
|
312
311
|
type: 'object',
|
|
313
|
-
properties: {
|
|
312
|
+
properties: {
|
|
313
|
+
source_entity: { type: 'string', description: 'Source 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
|
+
}
|
|
319
|
+
},
|
|
320
|
+
required: ['source_entity', 'target_entity', 'relation_data']
|
|
314
321
|
}
|
|
315
322
|
},
|
|
316
323
|
{
|
|
317
324
|
name: 'update_relation',
|
|
318
|
-
description: 'Update
|
|
325
|
+
description: 'Update a relationship in the knowledge graph',
|
|
319
326
|
inputSchema: {
|
|
320
327
|
type: 'object',
|
|
321
328
|
properties: {
|
|
322
|
-
|
|
323
|
-
|
|
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' }
|
|
324
332
|
},
|
|
325
|
-
required: ['
|
|
333
|
+
required: ['source_id', 'target_id', 'updated_data']
|
|
326
334
|
}
|
|
327
335
|
},
|
|
328
|
-
|
|
329
|
-
// ===== SYSTEM MANAGEMENT TOOLS (8) =====
|
|
330
336
|
{
|
|
331
|
-
name: '
|
|
332
|
-
description: '
|
|
337
|
+
name: 'delete_relation',
|
|
338
|
+
description: 'Delete a relationship from the knowledge graph',
|
|
333
339
|
inputSchema: {
|
|
334
340
|
type: 'object',
|
|
335
|
-
properties: {
|
|
341
|
+
properties: {
|
|
342
|
+
source_entity: { type: 'string', description: 'Source entity name' },
|
|
343
|
+
target_entity: { type: 'string', description: 'Target entity name' }
|
|
344
|
+
},
|
|
345
|
+
required: ['source_entity', 'target_entity']
|
|
336
346
|
}
|
|
337
347
|
},
|
|
338
348
|
{
|
|
339
|
-
name: '
|
|
340
|
-
description: '
|
|
349
|
+
name: 'merge_entities',
|
|
350
|
+
description: 'Merge multiple entities into a single entity',
|
|
341
351
|
inputSchema: {
|
|
342
352
|
type: 'object',
|
|
343
353
|
properties: {
|
|
344
|
-
|
|
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
|
+
}
|
|
345
363
|
},
|
|
346
|
-
required: ['
|
|
364
|
+
required: ['entities_to_change', 'entity_to_change_into']
|
|
347
365
|
}
|
|
348
366
|
},
|
|
367
|
+
|
|
368
|
+
// ===== SYSTEM MANAGEMENT TOOLS (5) =====
|
|
349
369
|
{
|
|
350
|
-
name: '
|
|
351
|
-
description: 'Get
|
|
370
|
+
name: 'get_pipeline_status',
|
|
371
|
+
description: 'Get the processing pipeline status',
|
|
352
372
|
inputSchema: {
|
|
353
373
|
type: 'object',
|
|
354
374
|
properties: {}
|
|
355
375
|
}
|
|
356
376
|
},
|
|
357
377
|
{
|
|
358
|
-
name: '
|
|
359
|
-
description: '
|
|
378
|
+
name: 'get_track_status',
|
|
379
|
+
description: 'Get track status by ID',
|
|
360
380
|
inputSchema: {
|
|
361
381
|
type: 'object',
|
|
362
|
-
properties: {
|
|
382
|
+
properties: {
|
|
383
|
+
track_id: { type: 'string', description: 'Tracking ID' }
|
|
384
|
+
},
|
|
385
|
+
required: ['track_id']
|
|
363
386
|
}
|
|
364
387
|
},
|
|
365
388
|
{
|
|
366
|
-
name: '
|
|
367
|
-
description: 'Get
|
|
389
|
+
name: 'get_document_status_counts',
|
|
390
|
+
description: 'Get document status counts',
|
|
368
391
|
inputSchema: {
|
|
369
392
|
type: 'object',
|
|
370
393
|
properties: {}
|
|
@@ -373,24 +396,14 @@ const tools = [
|
|
|
373
396
|
{
|
|
374
397
|
name: 'clear_cache',
|
|
375
398
|
description: 'Clear LightRAG internal cache',
|
|
376
|
-
inputSchema: {
|
|
377
|
-
type: 'object',
|
|
378
|
-
properties: {
|
|
379
|
-
cache_type: { type: 'string', description: 'Type of cache to clear' }
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
},
|
|
383
|
-
{
|
|
384
|
-
name: 'get_config',
|
|
385
|
-
description: 'Get current LightRAG server configuration',
|
|
386
399
|
inputSchema: {
|
|
387
400
|
type: 'object',
|
|
388
401
|
properties: {}
|
|
389
402
|
}
|
|
390
403
|
},
|
|
391
404
|
{
|
|
392
|
-
name: '
|
|
393
|
-
description: '
|
|
405
|
+
name: 'get_health',
|
|
406
|
+
description: 'Check LightRAG server health status',
|
|
394
407
|
inputSchema: {
|
|
395
408
|
type: 'object',
|
|
396
409
|
properties: {}
|
|
@@ -403,7 +416,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
403
416
|
return { tools };
|
|
404
417
|
});
|
|
405
418
|
|
|
406
|
-
// Call tool handler with all 30
|
|
419
|
+
// Call tool handler with all 30 implementations
|
|
407
420
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
408
421
|
const { name, arguments: args } = request.params;
|
|
409
422
|
|
|
@@ -415,27 +428,21 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
415
428
|
case 'insert_text':
|
|
416
429
|
response = await httpClient.post('/documents/text', {
|
|
417
430
|
text: args.text,
|
|
418
|
-
|
|
431
|
+
file_source: args.file_source || 'text_input.txt'
|
|
419
432
|
});
|
|
420
433
|
break;
|
|
421
434
|
|
|
422
435
|
case 'insert_texts':
|
|
436
|
+
const fileSources = args.file_sources || args.texts.map((_, i) => `text_input_${i + 1}.txt`);
|
|
423
437
|
response = await httpClient.post('/documents/texts', {
|
|
424
|
-
texts: args.texts
|
|
438
|
+
texts: args.texts,
|
|
439
|
+
file_sources: fileSources
|
|
425
440
|
});
|
|
426
441
|
break;
|
|
427
442
|
|
|
428
443
|
case 'upload_document':
|
|
429
444
|
response = await httpClient.post('/documents/upload', {
|
|
430
|
-
|
|
431
|
-
chunk_size: args.chunk_size,
|
|
432
|
-
chunk_overlap: args.chunk_overlap
|
|
433
|
-
});
|
|
434
|
-
break;
|
|
435
|
-
|
|
436
|
-
case 'upload_documents':
|
|
437
|
-
response = await httpClient.post('/documents/upload/batch', {
|
|
438
|
-
file_paths: args.file_paths
|
|
445
|
+
file: args.file
|
|
439
446
|
});
|
|
440
447
|
break;
|
|
441
448
|
|
|
@@ -448,25 +455,28 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
448
455
|
break;
|
|
449
456
|
|
|
450
457
|
case 'get_documents_paginated':
|
|
451
|
-
response = await httpClient.
|
|
452
|
-
|
|
458
|
+
response = await httpClient.post('/documents/paginated', {
|
|
459
|
+
page: args.page || 1,
|
|
460
|
+
page_size: args.page_size || 50
|
|
453
461
|
});
|
|
454
462
|
break;
|
|
455
463
|
|
|
456
464
|
case 'delete_document':
|
|
457
|
-
response = await httpClient.delete(
|
|
465
|
+
response = await httpClient.delete('/documents/delete_document', {
|
|
466
|
+
data: { doc_ids: args.doc_ids }
|
|
467
|
+
});
|
|
458
468
|
break;
|
|
459
469
|
|
|
460
470
|
case 'clear_documents':
|
|
461
471
|
response = await httpClient.delete('/documents');
|
|
462
472
|
break;
|
|
463
473
|
|
|
464
|
-
case '
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
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');
|
|
470
480
|
break;
|
|
471
481
|
|
|
472
482
|
// QUERY OPERATIONS
|
|
@@ -480,105 +490,126 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
480
490
|
break;
|
|
481
491
|
|
|
482
492
|
case 'query_text_stream':
|
|
483
|
-
response = await httpClient.post('/query', {
|
|
493
|
+
response = await httpClient.post('/query/stream', {
|
|
484
494
|
query: args.query,
|
|
485
495
|
mode: args.mode || 'hybrid',
|
|
486
496
|
stream: true
|
|
487
497
|
});
|
|
488
498
|
break;
|
|
489
499
|
|
|
490
|
-
case '
|
|
491
|
-
response = await httpClient.post('/query', {
|
|
500
|
+
case 'query_data':
|
|
501
|
+
response = await httpClient.post('/query/data', {
|
|
492
502
|
query: args.query,
|
|
493
|
-
mode: args.mode || 'hybrid'
|
|
494
|
-
with_citation: true
|
|
503
|
+
mode: args.mode || 'hybrid'
|
|
495
504
|
});
|
|
496
505
|
break;
|
|
497
506
|
|
|
498
507
|
// KNOWLEDGE GRAPH
|
|
499
508
|
case 'get_knowledge_graph':
|
|
500
|
-
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
|
+
});
|
|
501
516
|
break;
|
|
502
517
|
|
|
503
|
-
case '
|
|
504
|
-
response = await httpClient.get('/graph/
|
|
518
|
+
case 'get_graph_labels':
|
|
519
|
+
response = await httpClient.get('/graph/label/list');
|
|
505
520
|
break;
|
|
506
521
|
|
|
507
|
-
case '
|
|
508
|
-
response = await httpClient.get('/graph/
|
|
509
|
-
params:
|
|
522
|
+
case 'get_popular_labels':
|
|
523
|
+
response = await httpClient.get('/graph/label/popular', {
|
|
524
|
+
params: { limit: args.limit || 300 }
|
|
510
525
|
});
|
|
511
526
|
break;
|
|
512
527
|
|
|
513
|
-
case '
|
|
514
|
-
response = await httpClient.get('/graph/
|
|
515
|
-
params: args.
|
|
528
|
+
case 'search_labels':
|
|
529
|
+
response = await httpClient.get('/graph/label/search', {
|
|
530
|
+
params: { q: args.q, limit: args.limit || 50 }
|
|
516
531
|
});
|
|
517
532
|
break;
|
|
518
533
|
|
|
519
534
|
case 'check_entity_exists':
|
|
520
535
|
response = await httpClient.get('/graph/entity/exists', {
|
|
521
|
-
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
|
|
522
544
|
});
|
|
523
545
|
break;
|
|
524
546
|
|
|
525
547
|
case 'update_entity':
|
|
526
|
-
response = await httpClient.
|
|
527
|
-
|
|
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
|
|
528
553
|
});
|
|
529
554
|
break;
|
|
530
555
|
|
|
531
556
|
case 'delete_entity':
|
|
532
|
-
response = await httpClient.delete(
|
|
557
|
+
response = await httpClient.delete('/documents/delete_entity', {
|
|
558
|
+
data: { entity_name: args.entity_name }
|
|
559
|
+
});
|
|
533
560
|
break;
|
|
534
561
|
|
|
535
|
-
case '
|
|
536
|
-
response = await httpClient.
|
|
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
|
+
});
|
|
537
568
|
break;
|
|
538
569
|
|
|
539
|
-
case '
|
|
540
|
-
response = await httpClient.
|
|
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
|
+
});
|
|
541
576
|
break;
|
|
542
577
|
|
|
543
|
-
case '
|
|
544
|
-
response = await httpClient.
|
|
545
|
-
|
|
578
|
+
case 'delete_relation':
|
|
579
|
+
response = await httpClient.delete('/documents/delete_relation', {
|
|
580
|
+
data: {
|
|
581
|
+
source_entity: args.source_entity,
|
|
582
|
+
target_entity: args.target_entity
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
break;
|
|
586
|
+
|
|
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
|
|
546
591
|
});
|
|
547
592
|
break;
|
|
548
593
|
|
|
549
594
|
// SYSTEM MANAGEMENT
|
|
550
595
|
case 'get_pipeline_status':
|
|
551
|
-
response = await httpClient.get('/
|
|
596
|
+
response = await httpClient.get('/documents/pipeline_status');
|
|
552
597
|
break;
|
|
553
598
|
|
|
554
599
|
case 'get_track_status':
|
|
555
|
-
response = await httpClient.get(`/
|
|
600
|
+
response = await httpClient.get(`/documents/track_status/${args.track_id}`);
|
|
556
601
|
break;
|
|
557
602
|
|
|
558
603
|
case 'get_document_status_counts':
|
|
559
|
-
response = await httpClient.get('/documents/
|
|
560
|
-
break;
|
|
561
|
-
|
|
562
|
-
case 'get_health':
|
|
563
|
-
response = await httpClient.get('/health');
|
|
564
|
-
break;
|
|
565
|
-
|
|
566
|
-
case 'get_status':
|
|
567
|
-
response = await httpClient.get('/status');
|
|
604
|
+
response = await httpClient.get('/documents/status_counts');
|
|
568
605
|
break;
|
|
569
606
|
|
|
570
607
|
case 'clear_cache':
|
|
571
|
-
response = await httpClient.post('/
|
|
572
|
-
cache_type: args.cache_type || 'all'
|
|
573
|
-
});
|
|
608
|
+
response = await httpClient.post('/documents/clear_cache', {});
|
|
574
609
|
break;
|
|
575
610
|
|
|
576
|
-
case '
|
|
577
|
-
response = await httpClient.get('/
|
|
578
|
-
break;
|
|
579
|
-
|
|
580
|
-
case 'get_workspace_info':
|
|
581
|
-
response = await httpClient.get('/workspace/info');
|
|
611
|
+
case 'get_health':
|
|
612
|
+
response = await httpClient.get('/health');
|
|
582
613
|
break;
|
|
583
614
|
|
|
584
615
|
default:
|
|
@@ -610,13 +641,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
610
641
|
async function main() {
|
|
611
642
|
const transport = new StdioServerTransport();
|
|
612
643
|
await server.connect(transport);
|
|
613
|
-
console.error('
|
|
614
|
-
console.error('
|
|
615
|
-
console.error('
|
|
644
|
+
console.error('╔══════════════════════════════════════════════════════════╗');
|
|
645
|
+
console.error('║ LightRAG MCP Server v1.1.0 - Ready ║');
|
|
646
|
+
console.error('╚══════════════════════════════════════════════════════════╝');
|
|
616
647
|
console.error(`Server: ${LIGHTRAG_SERVER_URL}`);
|
|
617
|
-
console.error(`
|
|
618
|
-
console.error(
|
|
619
|
-
console.error('Ready for connections...\n');
|
|
648
|
+
console.error(`Tools: 30 fully working tools`);
|
|
649
|
+
console.error('All endpoints verified ✓\n');
|
|
620
650
|
}
|
|
621
651
|
|
|
622
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",
|