@tocharianou/mcp-server-kibana 0.6.1

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.
Files changed (48) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +530 -0
  3. package/dist/index.d.ts +4 -0
  4. package/dist/index.js +417 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/kibana-openapi-source.yaml +52597 -0
  7. package/dist/src/analysis-tools.d.ts +6 -0
  8. package/dist/src/analysis-tools.js +134 -0
  9. package/dist/src/analysis-tools.js.map +1 -0
  10. package/dist/src/base-tools.d.ts +2 -0
  11. package/dist/src/base-tools.js +349 -0
  12. package/dist/src/base-tools.js.map +1 -0
  13. package/dist/src/dependency-analyzer.d.ts +65 -0
  14. package/dist/src/dependency-analyzer.js +233 -0
  15. package/dist/src/dependency-analyzer.js.map +1 -0
  16. package/dist/src/health-analyzer.d.ts +60 -0
  17. package/dist/src/health-analyzer.js +301 -0
  18. package/dist/src/health-analyzer.js.map +1 -0
  19. package/dist/src/kibana-openapi-source.yaml +52597 -0
  20. package/dist/src/openapi-simplifier.d.ts +33 -0
  21. package/dist/src/openapi-simplifier.js +122 -0
  22. package/dist/src/openapi-simplifier.js.map +1 -0
  23. package/dist/src/prompts.d.ts +2 -0
  24. package/dist/src/prompts.js +91 -0
  25. package/dist/src/prompts.js.map +1 -0
  26. package/dist/src/resources.d.ts +2 -0
  27. package/dist/src/resources.js +125 -0
  28. package/dist/src/resources.js.map +1 -0
  29. package/dist/src/types.d.ts +150 -0
  30. package/dist/src/types.js +38 -0
  31. package/dist/src/types.js.map +1 -0
  32. package/dist/src/vl_create_tools.d.ts +5 -0
  33. package/dist/src/vl_create_tools.js +264 -0
  34. package/dist/src/vl_create_tools.js.map +1 -0
  35. package/dist/src/vl_delete_tools.d.ts +5 -0
  36. package/dist/src/vl_delete_tools.js +158 -0
  37. package/dist/src/vl_delete_tools.js.map +1 -0
  38. package/dist/src/vl_get_tools.d.ts +5 -0
  39. package/dist/src/vl_get_tools.js +201 -0
  40. package/dist/src/vl_get_tools.js.map +1 -0
  41. package/dist/src/vl_search_tools.d.ts +9 -0
  42. package/dist/src/vl_search_tools.js +290 -0
  43. package/dist/src/vl_search_tools.js.map +1 -0
  44. package/dist/src/vl_update_tools.d.ts +5 -0
  45. package/dist/src/vl_update_tools.js +372 -0
  46. package/dist/src/vl_update_tools.js.map +1 -0
  47. package/kibana-openapi-source.yaml +52597 -0
  48. package/package.json +95 -0
@@ -0,0 +1,372 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Implementation function for updating a single Kibana saved object.
4
+ *
5
+ * @param kibanaClient - The Kibana client instance
6
+ * @param type - The saved object type
7
+ * @param id - The saved object ID
8
+ * @param attributes - The attributes to update (partial update)
9
+ * @param references - Optional: array of references to other saved objects
10
+ * @param version - Optional: version for optimistic concurrency control
11
+ * @param upsert - Optional: attributes to use if object doesn't exist (create if not found)
12
+ * @param space - The Kibana space (optional)
13
+ * @returns Promise<ToolResponse> - The tool response containing the updated object data
14
+ */
15
+ async function vl_update_saved_object_impl(kibanaClient, type, id, attributes, references, version, upsert, space) {
16
+ try {
17
+ // Validate required parameters
18
+ if (!type) {
19
+ return {
20
+ content: [
21
+ {
22
+ type: "text",
23
+ text: "Error: 'type' parameter is required. Please specify the saved object type."
24
+ }
25
+ ],
26
+ isError: true
27
+ };
28
+ }
29
+ if (!id) {
30
+ return {
31
+ content: [
32
+ {
33
+ type: "text",
34
+ text: "Error: 'id' parameter is required. Please specify the saved object ID to update."
35
+ }
36
+ ],
37
+ isError: true
38
+ };
39
+ }
40
+ if (!attributes || typeof attributes !== 'object') {
41
+ return {
42
+ content: [
43
+ {
44
+ type: "text",
45
+ text: "Error: 'attributes' parameter is required and must be an object containing the properties to update."
46
+ }
47
+ ],
48
+ isError: true
49
+ };
50
+ }
51
+ // Prepare request body
52
+ const requestBody = {
53
+ attributes
54
+ };
55
+ if (references && references.length > 0) {
56
+ requestBody.references = references;
57
+ }
58
+ if (version) {
59
+ requestBody.version = version;
60
+ }
61
+ if (upsert) {
62
+ requestBody.upsert = upsert;
63
+ }
64
+ // Make the API call
65
+ const url = `/api/saved_objects/${encodeURIComponent(type)}/${encodeURIComponent(id)}`;
66
+ const response = await kibanaClient.put(url, requestBody, { space });
67
+ // Format the response
68
+ const result = {
69
+ id: response.id,
70
+ type: response.type,
71
+ version: response.version,
72
+ updated_at: response.updated_at,
73
+ namespaces: response.namespaces || [],
74
+ };
75
+ // Add attributes information
76
+ if (response.attributes) {
77
+ result.attributes = response.attributes;
78
+ // Add common fields for easier access
79
+ if (response.attributes.title) {
80
+ result.title = response.attributes.title;
81
+ }
82
+ if (response.attributes.description) {
83
+ result.description = response.attributes.description;
84
+ }
85
+ }
86
+ // Add references if present
87
+ if (response.references && response.references.length > 0) {
88
+ result.references = response.references;
89
+ }
90
+ return {
91
+ content: [
92
+ {
93
+ type: "text",
94
+ text: `Successfully updated ${type} saved object '${id}':\n\n${JSON.stringify(result, null, 2)}`
95
+ }
96
+ ]
97
+ };
98
+ }
99
+ catch (error) {
100
+ const errorMessage = error instanceof Error ? error.message : String(error);
101
+ // Handle common error cases
102
+ if (errorMessage.includes('404') || errorMessage.includes('Not Found')) {
103
+ return {
104
+ content: [
105
+ {
106
+ type: "text",
107
+ text: `Object not found: No saved object with type '${type}' and id '${id}' exists. Please verify the type and ID are correct, or use the create tool to create a new object.`
108
+ }
109
+ ],
110
+ isError: true
111
+ };
112
+ }
113
+ if (errorMessage.includes('409') || errorMessage.includes('conflict')) {
114
+ return {
115
+ content: [
116
+ {
117
+ type: "text",
118
+ text: `Version conflict: The object '${id}' has been modified by another process. Please retrieve the latest version and retry with the current version number.`
119
+ }
120
+ ],
121
+ isError: true
122
+ };
123
+ }
124
+ if (errorMessage.includes('400')) {
125
+ return {
126
+ content: [
127
+ {
128
+ type: "text",
129
+ text: `Bad request error: ${errorMessage}\n\nPossible causes:\n- Invalid attributes structure\n- Invalid references format\n- Invalid version format`
130
+ }
131
+ ],
132
+ isError: true
133
+ };
134
+ }
135
+ return {
136
+ content: [
137
+ {
138
+ type: "text",
139
+ text: `Failed to update saved object: ${errorMessage}`
140
+ }
141
+ ],
142
+ isError: true
143
+ };
144
+ }
145
+ }
146
+ /**
147
+ * Implementation function for bulk updating multiple Kibana saved objects.
148
+ *
149
+ * @param kibanaClient - The Kibana client instance
150
+ * @param objects - Array of objects to update
151
+ * @param space - The Kibana space (optional)
152
+ * @returns Promise<ToolResponse> - The tool response containing the bulk update results
153
+ */
154
+ async function vl_bulk_update_saved_objects_impl(kibanaClient, objects, space) {
155
+ try {
156
+ // Validate input
157
+ if (!objects || objects.length === 0) {
158
+ return {
159
+ content: [
160
+ {
161
+ type: "text",
162
+ text: "Error: No objects specified for update. Please provide at least one object with type, id, and attributes."
163
+ }
164
+ ],
165
+ isError: true
166
+ };
167
+ }
168
+ // Validate each object has required fields
169
+ for (let i = 0; i < objects.length; i++) {
170
+ const obj = objects[i];
171
+ if (!obj.type || !obj.id) {
172
+ return {
173
+ content: [
174
+ {
175
+ type: "text",
176
+ text: `Error: Object at index ${i} is missing required 'type' or 'id' field. Each object must have type, id, and attributes.`
177
+ }
178
+ ],
179
+ isError: true
180
+ };
181
+ }
182
+ if (!obj.attributes || typeof obj.attributes !== 'object') {
183
+ return {
184
+ content: [
185
+ {
186
+ type: "text",
187
+ text: `Error: Object at index ${i} is missing required 'attributes' field or it's not an object.`
188
+ }
189
+ ],
190
+ isError: true
191
+ };
192
+ }
193
+ }
194
+ // Apply type transformation to each object
195
+ const processedObjects = objects.map(obj => {
196
+ let processedType = obj.type;
197
+ // Apply the same type transformation as other tools
198
+ if (Array.isArray(obj.type)) {
199
+ processedType = obj.type[0]; // Take first type
200
+ }
201
+ else if (typeof obj.type === 'string') {
202
+ try {
203
+ const parsed = JSON.parse(obj.type);
204
+ processedType = Array.isArray(parsed) ? parsed[0] : parsed;
205
+ }
206
+ catch {
207
+ const types = obj.type.split(',').map(s => s.trim()).filter(s => s);
208
+ processedType = types[0]; // Take first type
209
+ }
210
+ }
211
+ return {
212
+ ...obj,
213
+ type: processedType
214
+ };
215
+ });
216
+ // Make the API call
217
+ const url = `/api/saved_objects/_bulk_update`;
218
+ const response = await kibanaClient.post(url, processedObjects, { space });
219
+ // Process the response
220
+ const savedObjects = response.saved_objects || [];
221
+ // Count results
222
+ const successCount = savedObjects.filter((obj) => !obj.error).length;
223
+ const errorCount = savedObjects.filter((obj) => obj.error).length;
224
+ // Format detailed results
225
+ const results = savedObjects.map((savedObject) => {
226
+ if (savedObject.error) {
227
+ return {
228
+ type: savedObject.type,
229
+ id: savedObject.id,
230
+ success: false,
231
+ error: {
232
+ statusCode: savedObject.error.statusCode,
233
+ error: savedObject.error.error,
234
+ message: savedObject.error.message
235
+ }
236
+ };
237
+ }
238
+ const result = {
239
+ type: savedObject.type,
240
+ id: savedObject.id,
241
+ version: savedObject.version,
242
+ updated_at: savedObject.updated_at,
243
+ success: true,
244
+ namespaces: savedObject.namespaces || []
245
+ };
246
+ // Add attributes information
247
+ if (savedObject.attributes) {
248
+ if (savedObject.attributes.title) {
249
+ result.title = savedObject.attributes.title;
250
+ }
251
+ if (savedObject.attributes.description) {
252
+ result.description = savedObject.attributes.description;
253
+ }
254
+ result.attributes = savedObject.attributes;
255
+ }
256
+ // Add references if present
257
+ if (savedObject.references && savedObject.references.length > 0) {
258
+ result.references = savedObject.references;
259
+ }
260
+ return result;
261
+ });
262
+ // Create summary
263
+ const summary = `Bulk update operation completed. ${successCount} objects updated successfully, ${errorCount} errors occurred.`;
264
+ const responseText = [
265
+ summary,
266
+ '',
267
+ 'Detailed Results:',
268
+ JSON.stringify(results, null, 2)
269
+ ].join('\n');
270
+ return {
271
+ content: [
272
+ {
273
+ type: "text",
274
+ text: responseText
275
+ }
276
+ ],
277
+ isError: errorCount > 0
278
+ };
279
+ }
280
+ catch (error) {
281
+ const errorMessage = error instanceof Error ? error.message : String(error);
282
+ // Handle common error cases
283
+ if (errorMessage.includes('400')) {
284
+ return {
285
+ content: [
286
+ {
287
+ type: "text",
288
+ text: `Bad request error during bulk update: ${errorMessage}\n\nPossible causes:\n- Invalid object type or ID format\n- Invalid attributes structure\n- Invalid references format\n- Missing required parameters`
289
+ }
290
+ ],
291
+ isError: true
292
+ };
293
+ }
294
+ return {
295
+ content: [
296
+ {
297
+ type: "text",
298
+ text: `Failed to bulk update saved objects: ${errorMessage}`
299
+ }
300
+ ],
301
+ isError: true
302
+ };
303
+ }
304
+ }
305
+ /**
306
+ * Register VL (Visualization Layer) update tools with the MCP server
307
+ */
308
+ export function registerVLUpdateTools(server, kibanaClient) {
309
+ // Tool: Update a single Kibana saved object
310
+ server.tool("vl_update_saved_object", "Update a single Kibana saved object by type and ID. This performs a partial update - only the specified attributes will be changed, other attributes remain unchanged. Supports all saved object types (dashboard, visualization, index-pattern, search, config, lens, map, tag, canvas-workpad, canvas-element, etc.). IMPORTANT: Use version parameter for optimistic concurrency control to prevent conflicts.", z.object({
311
+ type: z.union([z.string(), z.array(z.string())]).transform(val => {
312
+ if (Array.isArray(val))
313
+ return val[0]; // Take first type for single object update
314
+ if (typeof val === 'string') {
315
+ try {
316
+ const parsed = JSON.parse(val);
317
+ return Array.isArray(parsed) ? parsed[0] : parsed;
318
+ }
319
+ catch {
320
+ const types = val.split(',').map(s => s.trim()).filter(s => s);
321
+ return types[0]; // Take first type
322
+ }
323
+ }
324
+ return val;
325
+ }).describe("REQUIRED: The saved object type. Common types: 'dashboard', 'visualization', 'index-pattern', 'search', 'config', 'lens', 'map', 'tag', 'canvas-workpad', 'canvas-element'. Supports multiple formats but will use first type for single object update."),
326
+ id: z.string().describe("REQUIRED: The saved object ID. This is the unique identifier for the object you want to update."),
327
+ attributes: z.record(z.any()).describe("REQUIRED: Object containing the attributes to update. Only specified attributes will be changed (partial update). Common fields: 'title', 'description'. Type-specific fields: Dashboard: 'panelsJSON', 'timeRestore'. Visualization: 'visState', 'uiStateJSON'. All JSON fields should be strings."),
328
+ references: z.array(z.object({
329
+ id: z.string().describe("ID of the referenced object"),
330
+ type: z.string().describe("Type of the referenced object"),
331
+ name: z.string().describe("Reference name used in the object")
332
+ })).optional().describe("OPTIONAL: Array of references to other saved objects. Updates the object's references. Each reference needs id, type, and name."),
333
+ version: z.string().optional().describe("OPTIONAL: Version string for optimistic concurrency control. Use this to prevent conflicts when multiple processes update the same object. Get the version from a previous get/search operation."),
334
+ upsert: z.record(z.any()).optional().describe("OPTIONAL: Attributes to use if the object doesn't exist (will create object if not found). Useful for create-or-update scenarios."),
335
+ space: z.string().optional().describe("Target Kibana space (optional, defaults to configured space)")
336
+ }), async (params) => {
337
+ return await vl_update_saved_object_impl(kibanaClient, params.type, params.id, params.attributes, params.references, params.version, params.upsert, params.space);
338
+ });
339
+ // Tool: Bulk update multiple Kibana saved objects
340
+ server.tool("vl_bulk_update_saved_objects", "Update multiple Kibana saved objects in a single operation. Each object can be of different types and will be partially updated (only specified attributes changed). Supports all saved object types (dashboard, visualization, index-pattern, search, config, lens, map, tag, canvas-workpad, canvas-element, etc.). PERFORMANCE: More efficient than multiple single updates. Each object can have individual version control.", z.object({
341
+ objects: z.array(z.object({
342
+ type: z.union([z.string(), z.array(z.string())]).transform(val => {
343
+ if (Array.isArray(val))
344
+ return val[0]; // Take first type for single object update
345
+ if (typeof val === 'string') {
346
+ try {
347
+ const parsed = JSON.parse(val);
348
+ return Array.isArray(parsed) ? parsed[0] : parsed;
349
+ }
350
+ catch {
351
+ const types = val.split(',').map(s => s.trim()).filter(s => s);
352
+ return types[0]; // Take first type
353
+ }
354
+ }
355
+ return val;
356
+ }).describe("REQUIRED: The saved object type. Common types: 'dashboard', 'visualization', 'index-pattern', 'search', 'config', 'lens', 'map', 'tag', 'canvas-workpad', 'canvas-element'. Supports multiple formats but will use first type."),
357
+ id: z.string().describe("REQUIRED: The saved object ID. This is the unique identifier for the object you want to update."),
358
+ attributes: z.record(z.any()).describe("REQUIRED: Object containing the attributes to update. Only specified attributes will be changed (partial update)."),
359
+ references: z.array(z.object({
360
+ id: z.string().describe("ID of the referenced object"),
361
+ type: z.string().describe("Type of the referenced object"),
362
+ name: z.string().describe("Reference name used in the object")
363
+ })).optional().describe("OPTIONAL: Array of references to other saved objects for this specific object."),
364
+ version: z.string().optional().describe("OPTIONAL: Version string for optimistic concurrency control for this specific object."),
365
+ namespace: z.string().optional().describe("OPTIONAL: Specific namespace for this object (overrides space parameter).")
366
+ })).min(1).describe("REQUIRED: Array of objects to update. Each object must have 'type', 'id', and 'attributes' fields. Minimum 1 object required."),
367
+ space: z.string().optional().describe("Target Kibana space (optional, defaults to configured space)")
368
+ }), async (params) => {
369
+ return await vl_bulk_update_saved_objects_impl(kibanaClient, params.objects, params.space);
370
+ });
371
+ }
372
+ //# sourceMappingURL=vl_update_tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vl_update_tools.js","sourceRoot":"","sources":["../../src/vl_update_tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;;;GAYG;AACH,KAAK,UAAU,2BAA2B,CACxC,YAA0B,EAC1B,IAAY,EACZ,EAAU,EACV,UAA+B,EAC/B,UAA8D,EAC9D,OAAgB,EAChB,MAA4B,EAC5B,KAAc;IAEd,IAAI,CAAC;QACH,+BAA+B;QAC/B,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,4EAA4E;qBACnF;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,kFAAkF;qBACzF;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CA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