@influxdata/influxdb3-mcp-server 1.3.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/CHANGELOG.md +194 -0
- package/Dockerfile +22 -0
- package/LICENSE +6 -0
- package/LICENSE-APACHE.txt +201 -0
- package/LICENSE-MIT.txt +25 -0
- package/README.md +318 -0
- package/build/config.js +85 -0
- package/build/helpers/enums/influx-product-types.enum.js +8 -0
- package/build/index.js +33 -0
- package/build/prompts/index.js +98 -0
- package/build/resources/index.js +223 -0
- package/build/server/index.js +104 -0
- package/build/services/base-connection.service.js +318 -0
- package/build/services/cloud-token-management.service.js +179 -0
- package/build/services/context-file.service.js +97 -0
- package/build/services/database-management.service.js +549 -0
- package/build/services/help.service.js +241 -0
- package/build/services/http-client.service.js +109 -0
- package/build/services/influxdb-master.service.js +117 -0
- package/build/services/query.service.js +499 -0
- package/build/services/serverless-schema-management.service.js +266 -0
- package/build/services/token-management.service.js +215 -0
- package/build/services/write.service.js +153 -0
- package/build/tools/categories/cloud-token.tools.js +321 -0
- package/build/tools/categories/database.tools.js +299 -0
- package/build/tools/categories/health.tools.js +75 -0
- package/build/tools/categories/help.tools.js +104 -0
- package/build/tools/categories/query.tools.js +180 -0
- package/build/tools/categories/schema.tools.js +308 -0
- package/build/tools/categories/token.tools.js +378 -0
- package/build/tools/categories/write.tools.js +104 -0
- package/build/tools/index.js +27 -0
- package/env.example +17 -0
- package/example-cloud-dedicated.mcp.json +15 -0
- package/example-cloud-serverless.mcp.json +13 -0
- package/example-clustered.mcp.json +14 -0
- package/example-docker.mcp.json +25 -0
- package/example-local.mcp.json +13 -0
- package/example-npx.mcp.json +13 -0
- package/package.json +78 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token Management Tools (Core/Enterprise)
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
export function createTokenTools(influxService) {
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
name: "create_admin_token",
|
|
9
|
+
description: "Create a new InfluxDB named admin token with full administrative permissions (Core/Enterprise only). Named admin tokens can manage databases, users, and resource tokens, but cannot manage other admin tokens.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
name: {
|
|
14
|
+
type: "string",
|
|
15
|
+
description: 'Optional name for the admin token (e.g., "backup-admin-token"). If not provided, a unique name will be generated.',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
additionalProperties: false,
|
|
19
|
+
},
|
|
20
|
+
zodSchema: z.object({
|
|
21
|
+
name: z
|
|
22
|
+
.string()
|
|
23
|
+
.optional()
|
|
24
|
+
.describe("Optional name for the admin token"),
|
|
25
|
+
}),
|
|
26
|
+
handler: async (args) => {
|
|
27
|
+
try {
|
|
28
|
+
const tokenService = influxService.getTokenManagementService();
|
|
29
|
+
const result = await tokenService.createAdminToken(args.name);
|
|
30
|
+
return {
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: "text",
|
|
34
|
+
text: `Admin token created successfully:\nToken ID: ${result.id}\nToken: ${result.token}\n\n⚠️ Store this token securely - it won't be shown again!`,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
return {
|
|
41
|
+
content: [
|
|
42
|
+
{
|
|
43
|
+
type: "text",
|
|
44
|
+
text: `Error: ${error.message}`,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
isError: true,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "list_admin_tokens",
|
|
54
|
+
description: "List all admin tokens (operator and named admin tokens) with optional filtering by token name (Core/Enterprise only). Named admin tokens have full administrative access including resource token management.",
|
|
55
|
+
inputSchema: {
|
|
56
|
+
type: "object",
|
|
57
|
+
properties: {
|
|
58
|
+
tokenName: {
|
|
59
|
+
type: "string",
|
|
60
|
+
description: "Optional filter to search for tokens with names containing this text (case-insensitive partial match)",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
additionalProperties: false,
|
|
64
|
+
},
|
|
65
|
+
zodSchema: z.object({
|
|
66
|
+
tokenName: z
|
|
67
|
+
.string()
|
|
68
|
+
.optional()
|
|
69
|
+
.describe("Optional filter for token name (partial match)"),
|
|
70
|
+
}),
|
|
71
|
+
handler: async (args) => {
|
|
72
|
+
try {
|
|
73
|
+
const tokenService = influxService.getTokenManagementService();
|
|
74
|
+
const filters = {};
|
|
75
|
+
if (args.tokenName) {
|
|
76
|
+
filters.tokenName = args.tokenName;
|
|
77
|
+
}
|
|
78
|
+
const result = await tokenService.listAdminTokens(Object.keys(filters).length > 0 ? filters : undefined);
|
|
79
|
+
const resultText = `Admin tokens retrieved successfully:\n${JSON.stringify(result, null, 2)}`;
|
|
80
|
+
return {
|
|
81
|
+
content: [
|
|
82
|
+
{
|
|
83
|
+
type: "text",
|
|
84
|
+
text: resultText,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
return {
|
|
91
|
+
content: [
|
|
92
|
+
{
|
|
93
|
+
type: "text",
|
|
94
|
+
text: `Error: ${error.message}`,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
isError: true,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "list_resource_tokens",
|
|
104
|
+
description: "List all resource tokens with optional filtering by database name and/or token name, and ordering (Core/Enterprise only).",
|
|
105
|
+
inputSchema: {
|
|
106
|
+
type: "object",
|
|
107
|
+
properties: {
|
|
108
|
+
databaseName: {
|
|
109
|
+
type: "string",
|
|
110
|
+
description: "Optional filter to show only tokens that have access to this database (partial match)",
|
|
111
|
+
},
|
|
112
|
+
tokenName: {
|
|
113
|
+
type: "string",
|
|
114
|
+
description: "Optional filter to search for tokens with names containing this text (case-insensitive partial match)",
|
|
115
|
+
},
|
|
116
|
+
orderBy: {
|
|
117
|
+
type: "string",
|
|
118
|
+
enum: ["created_at", "token_id", "name"],
|
|
119
|
+
description: "Optional field to order results by",
|
|
120
|
+
},
|
|
121
|
+
orderDirection: {
|
|
122
|
+
type: "string",
|
|
123
|
+
enum: ["ASC", "DESC"],
|
|
124
|
+
description: "Optional direction for ordering (ASC or DESC). Defaults to ASC.",
|
|
125
|
+
default: "ASC",
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
additionalProperties: false,
|
|
129
|
+
},
|
|
130
|
+
zodSchema: z.object({
|
|
131
|
+
databaseName: z
|
|
132
|
+
.string()
|
|
133
|
+
.optional()
|
|
134
|
+
.describe("Optional filter for database name (partial match)"),
|
|
135
|
+
tokenName: z
|
|
136
|
+
.string()
|
|
137
|
+
.optional()
|
|
138
|
+
.describe("Optional filter for token name (partial match)"),
|
|
139
|
+
orderBy: z
|
|
140
|
+
.enum(["created_at", "token_id", "name"])
|
|
141
|
+
.optional()
|
|
142
|
+
.describe("Field to order results by"),
|
|
143
|
+
orderDirection: z
|
|
144
|
+
.enum(["ASC", "DESC"])
|
|
145
|
+
.optional()
|
|
146
|
+
.default("ASC")
|
|
147
|
+
.describe("Ordering direction"),
|
|
148
|
+
}),
|
|
149
|
+
handler: async (args) => {
|
|
150
|
+
try {
|
|
151
|
+
const tokenService = influxService.getTokenManagementService();
|
|
152
|
+
const filters = {};
|
|
153
|
+
if (args.databaseName) {
|
|
154
|
+
filters.databaseName = args.databaseName;
|
|
155
|
+
}
|
|
156
|
+
if (args.tokenName) {
|
|
157
|
+
filters.tokenName = args.tokenName;
|
|
158
|
+
}
|
|
159
|
+
if (args.orderBy) {
|
|
160
|
+
filters.order = {
|
|
161
|
+
field: args.orderBy,
|
|
162
|
+
direction: args.orderDirection || "ASC",
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const result = await tokenService.listResourceTokens(Object.keys(filters).length > 0 ? filters : undefined);
|
|
166
|
+
const resultText = `Resource tokens retrieved successfully:\n${JSON.stringify(result, null, 2)}`;
|
|
167
|
+
return {
|
|
168
|
+
content: [
|
|
169
|
+
{
|
|
170
|
+
type: "text",
|
|
171
|
+
text: resultText,
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
return {
|
|
178
|
+
content: [
|
|
179
|
+
{
|
|
180
|
+
type: "text",
|
|
181
|
+
text: `Error: ${error.message}`,
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
isError: true,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: "regenerate_operator_token",
|
|
191
|
+
description: "Regenerate the InfluxDB operator token (Core/Enterprise only). Returns the new token value. ⚠️ This action invalidates current operator token and is irreversible. Receive the explicit user confirmation before proceeding.",
|
|
192
|
+
inputSchema: {
|
|
193
|
+
type: "object",
|
|
194
|
+
properties: {},
|
|
195
|
+
additionalProperties: false,
|
|
196
|
+
},
|
|
197
|
+
zodSchema: z.object({}),
|
|
198
|
+
handler: async () => {
|
|
199
|
+
try {
|
|
200
|
+
const tokenService = influxService.getTokenManagementService();
|
|
201
|
+
const result = await tokenService.regenerateOperatorToken();
|
|
202
|
+
return {
|
|
203
|
+
content: [
|
|
204
|
+
{
|
|
205
|
+
type: "text",
|
|
206
|
+
text: `Operator token regenerated successfully:\nToken ID: ${result.id}\nToken: ${result.token}\n\n⚠️ Store this token securely - it won't be shown again!\n⚠️ The old operator token is now invalid.`,
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
return {
|
|
213
|
+
content: [
|
|
214
|
+
{
|
|
215
|
+
type: "text",
|
|
216
|
+
text: `Error: ${error.message}`,
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
isError: true,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: "create_resource_token",
|
|
226
|
+
description: 'Create a new InfluxDB resource token with specific database permissions (Core/Enterprise only). Example: databases=["mydb", "testdb"], actions=["read", "write"]',
|
|
227
|
+
inputSchema: {
|
|
228
|
+
type: "object",
|
|
229
|
+
properties: {
|
|
230
|
+
description: {
|
|
231
|
+
type: "string",
|
|
232
|
+
description: 'Description/name for the resource token (e.g., "My App Token")',
|
|
233
|
+
},
|
|
234
|
+
databases: {
|
|
235
|
+
type: "array",
|
|
236
|
+
items: { type: "string" },
|
|
237
|
+
description: 'Array of database names this token can access. Example: ["database1", "database2"]. Use exact database names from your InfluxDB instance.',
|
|
238
|
+
minItems: 1,
|
|
239
|
+
},
|
|
240
|
+
actions: {
|
|
241
|
+
type: "array",
|
|
242
|
+
items: { type: "string", enum: ["read", "write"] },
|
|
243
|
+
description: 'Array of permissions for the databases. Example: ["read"] for read-only, ["read", "write"] for full access, or ["write"] for write-only.',
|
|
244
|
+
minItems: 1,
|
|
245
|
+
},
|
|
246
|
+
expiry_secs: {
|
|
247
|
+
type: "number",
|
|
248
|
+
description: "Optional expiration time in seconds (e.g., 3600 for 1 hour, 86400 for 1 day, 604800 for 1 week). If not specified, token never expires.",
|
|
249
|
+
minimum: 1,
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
required: ["description", "databases", "actions"],
|
|
253
|
+
additionalProperties: false,
|
|
254
|
+
},
|
|
255
|
+
zodSchema: z.object({
|
|
256
|
+
description: z
|
|
257
|
+
.string()
|
|
258
|
+
.describe('Description/name for the resource token (e.g., "My App Token")'),
|
|
259
|
+
databases: z
|
|
260
|
+
.array(z.string())
|
|
261
|
+
.min(1)
|
|
262
|
+
.describe('Array of database names this token can access. Example: ["database1", "database2"]'),
|
|
263
|
+
actions: z
|
|
264
|
+
.array(z.enum(["read", "write"]))
|
|
265
|
+
.min(1)
|
|
266
|
+
.describe('Array of permissions: ["read"], ["write"], or ["read", "write"]'),
|
|
267
|
+
expiry_secs: z
|
|
268
|
+
.number()
|
|
269
|
+
.min(1)
|
|
270
|
+
.optional()
|
|
271
|
+
.describe("Optional expiration time in seconds (e.g., 3600, 86400, 604800)"),
|
|
272
|
+
}),
|
|
273
|
+
handler: async (args) => {
|
|
274
|
+
try {
|
|
275
|
+
const tokenService = influxService.getTokenManagementService();
|
|
276
|
+
const permissions = [
|
|
277
|
+
{
|
|
278
|
+
resource_type: "db",
|
|
279
|
+
resource_names: args.databases,
|
|
280
|
+
actions: args.actions,
|
|
281
|
+
},
|
|
282
|
+
];
|
|
283
|
+
const expiry_secs = args.expiry_secs;
|
|
284
|
+
const result = await tokenService.createResourceToken(args.description, permissions, expiry_secs);
|
|
285
|
+
let expiryInfo = "\nExpires: Never";
|
|
286
|
+
if (args.expiry_secs) {
|
|
287
|
+
const hours = Math.floor(args.expiry_secs / 3600);
|
|
288
|
+
const days = Math.floor(hours / 24);
|
|
289
|
+
if (days > 0) {
|
|
290
|
+
expiryInfo = `\nExpires: In ${days} day${days !== 1 ? "s" : ""} (${args.expiry_secs} seconds)`;
|
|
291
|
+
}
|
|
292
|
+
else if (hours > 0) {
|
|
293
|
+
expiryInfo = `\nExpires: In ${hours} hour${hours !== 1 ? "s" : ""} (${args.expiry_secs} seconds)`;
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
expiryInfo = `\nExpires: In ${args.expiry_secs} seconds`;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return {
|
|
300
|
+
content: [
|
|
301
|
+
{
|
|
302
|
+
type: "text",
|
|
303
|
+
text: `Resource token created successfully:\nToken ID: ${result.id}\nToken: ${result.token}\nDatabases: ${args.databases.join(", ")}\nActions: ${args.actions.join(", ")}${expiryInfo}\n\n⚠️ Store this token securely - it won't be shown again!`,
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
return {
|
|
310
|
+
content: [
|
|
311
|
+
{
|
|
312
|
+
type: "text",
|
|
313
|
+
text: `Error: ${error.message}`,
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
isError: true,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
name: "delete_token",
|
|
323
|
+
description: "Delete an InfluxDB token by name (Core/Enterprise only).",
|
|
324
|
+
inputSchema: {
|
|
325
|
+
type: "object",
|
|
326
|
+
properties: {
|
|
327
|
+
token_name: {
|
|
328
|
+
type: "string",
|
|
329
|
+
description: "Name of the token to delete (required)",
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
required: ["token_name"],
|
|
333
|
+
additionalProperties: false,
|
|
334
|
+
},
|
|
335
|
+
zodSchema: z.object({
|
|
336
|
+
token_name: z.string().describe("Name of the token to delete"),
|
|
337
|
+
}),
|
|
338
|
+
handler: async (args) => {
|
|
339
|
+
try {
|
|
340
|
+
const tokenService = influxService.getTokenManagementService();
|
|
341
|
+
const result = await tokenService.deleteToken(args.token_name);
|
|
342
|
+
if (result) {
|
|
343
|
+
return {
|
|
344
|
+
content: [
|
|
345
|
+
{
|
|
346
|
+
type: "text",
|
|
347
|
+
text: `Token '${args.token_name}' deleted successfully.`,
|
|
348
|
+
},
|
|
349
|
+
],
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
return {
|
|
354
|
+
content: [
|
|
355
|
+
{
|
|
356
|
+
type: "text",
|
|
357
|
+
text: `Failed to delete token '${args.token_name}'.`,
|
|
358
|
+
},
|
|
359
|
+
],
|
|
360
|
+
isError: true,
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
catch (error) {
|
|
365
|
+
return {
|
|
366
|
+
content: [
|
|
367
|
+
{
|
|
368
|
+
type: "text",
|
|
369
|
+
text: `Error: ${error.message}`,
|
|
370
|
+
},
|
|
371
|
+
],
|
|
372
|
+
isError: true,
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
];
|
|
378
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data Writing Tools
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
export function createWriteTools(influxService) {
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
name: "write_line_protocol",
|
|
9
|
+
description: `Write data to InfluxDB using line protocol format (all versions). Supports single records or batches.
|
|
10
|
+
|
|
11
|
+
Line Protocol Syntax:
|
|
12
|
+
measurement,tag1=value1,tag2=value2 field1=value1,field2=value2 timestamp
|
|
13
|
+
|
|
14
|
+
Components:
|
|
15
|
+
- measurement: table/measurement name (required)
|
|
16
|
+
- tags: indexed metadata (optional) - comma-separated key=value pairs
|
|
17
|
+
- fields: actual data (required) - space-separated from tags, comma-separated key=value pairs
|
|
18
|
+
- timestamp: optional timestamp (precision must be specified in tool parameters)
|
|
19
|
+
|
|
20
|
+
Field Value Types:
|
|
21
|
+
- Strings: "quoted string"
|
|
22
|
+
- Floats: 123.45
|
|
23
|
+
- Integers: 123i (note the 'i' suffix)
|
|
24
|
+
- Booleans: t or f
|
|
25
|
+
|
|
26
|
+
Examples:
|
|
27
|
+
Single record: temperature,location=office,building=main value=23.5,humidity=45i 1640995200
|
|
28
|
+
Batch (separate with newlines):
|
|
29
|
+
temperature,location=office value=23.5 1640995200
|
|
30
|
+
humidity,location=office value=45i 1640995201
|
|
31
|
+
|
|
32
|
+
Important: Always specify correct precision parameter to match your timestamp format. Use any precision if writing data with no timestamp. Escaping required for special characters in tags/fields.`,
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: "object",
|
|
35
|
+
properties: {
|
|
36
|
+
database: {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: "Name of the database/bucket to write to",
|
|
39
|
+
},
|
|
40
|
+
data: {
|
|
41
|
+
type: "string",
|
|
42
|
+
description: "Line protocol formatted data. For multiple records, separate each line with \\n",
|
|
43
|
+
},
|
|
44
|
+
precision: {
|
|
45
|
+
type: "string",
|
|
46
|
+
enum: ["nanosecond", "microsecond", "millisecond", "second"],
|
|
47
|
+
description: "Precision of timestamps",
|
|
48
|
+
},
|
|
49
|
+
acceptPartial: {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
description: "Accept partial writes",
|
|
52
|
+
default: true,
|
|
53
|
+
},
|
|
54
|
+
noSync: {
|
|
55
|
+
type: "boolean",
|
|
56
|
+
description: "Acknowledge without waiting for WAL persistence",
|
|
57
|
+
default: false,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
required: ["database", "data", "precision"],
|
|
61
|
+
additionalProperties: false,
|
|
62
|
+
},
|
|
63
|
+
zodSchema: z.object({
|
|
64
|
+
database: z
|
|
65
|
+
.string()
|
|
66
|
+
.describe("Name of the database/bucket to write to"),
|
|
67
|
+
data: z.string().describe("Line protocol formatted data"),
|
|
68
|
+
precision: z
|
|
69
|
+
.enum(["nanosecond", "microsecond", "millisecond", "second"])
|
|
70
|
+
.describe("Precision of timestamps"),
|
|
71
|
+
acceptPartial: z.boolean().optional().default(true),
|
|
72
|
+
noSync: z.boolean().optional().default(false),
|
|
73
|
+
}),
|
|
74
|
+
handler: async (args) => {
|
|
75
|
+
try {
|
|
76
|
+
await influxService.write.writeLineProtocol(args.data, args.database, {
|
|
77
|
+
precision: args.precision,
|
|
78
|
+
acceptPartial: args.acceptPartial,
|
|
79
|
+
noSync: args.noSync,
|
|
80
|
+
});
|
|
81
|
+
return {
|
|
82
|
+
content: [
|
|
83
|
+
{
|
|
84
|
+
type: "text",
|
|
85
|
+
text: `Data written successfully to database/bucket '${args.database}'`,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
return {
|
|
92
|
+
content: [
|
|
93
|
+
{
|
|
94
|
+
type: "text",
|
|
95
|
+
text: `Error: ${error.message}`,
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
isError: true,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tools Definitions
|
|
3
|
+
*
|
|
4
|
+
* Defines all the tools available through the MCP server
|
|
5
|
+
*/
|
|
6
|
+
import { createHelpTools } from "./categories/help.tools.js";
|
|
7
|
+
import { createWriteTools } from "./categories/write.tools.js";
|
|
8
|
+
import { createDatabaseTools } from "./categories/database.tools.js";
|
|
9
|
+
import { createQueryTools } from "./categories/query.tools.js";
|
|
10
|
+
import { createTokenTools } from "./categories/token.tools.js";
|
|
11
|
+
import { createCloudTokenTools } from "./categories/cloud-token.tools.js";
|
|
12
|
+
import { createHealthTools } from "./categories/health.tools.js";
|
|
13
|
+
/**
|
|
14
|
+
* Creates all MCP tools by aggregating them from organized categories
|
|
15
|
+
*/
|
|
16
|
+
export function createTools(influxService) {
|
|
17
|
+
return [
|
|
18
|
+
...createHelpTools(influxService),
|
|
19
|
+
...createWriteTools(influxService),
|
|
20
|
+
...createDatabaseTools(influxService),
|
|
21
|
+
...createQueryTools(influxService),
|
|
22
|
+
...createTokenTools(influxService),
|
|
23
|
+
...createCloudTokenTools(influxService),
|
|
24
|
+
// ...createSchemaTools(influxService),
|
|
25
|
+
...createHealthTools(influxService),
|
|
26
|
+
];
|
|
27
|
+
}
|
package/env.example
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# InfluxDB MCP Server Configuration - Core/Enterprise
|
|
2
|
+
# Copy this file to .env and update with your InfluxDB details
|
|
3
|
+
# For Cloud Dedicated setup, see env.cloud-dedicated.example
|
|
4
|
+
# For Cloud Serverless setup, see env.cloud-serverless.example
|
|
5
|
+
|
|
6
|
+
# InfluxDB Instance Configuration
|
|
7
|
+
# For local InfluxDB (Docker with port mapping): http://localhost:8181/
|
|
8
|
+
# For remote InfluxDB: http://your-influx-host:port/
|
|
9
|
+
INFLUX_DB_INSTANCE_URL=http://localhost:8181/
|
|
10
|
+
|
|
11
|
+
# Your InfluxDB operator/admin/resource token
|
|
12
|
+
INFLUX_DB_TOKEN=your_influxdb_token_here
|
|
13
|
+
|
|
14
|
+
# InfluxDB Product Type: core, enterprise, cloud-dedicated, or cloud-serverless
|
|
15
|
+
# For cloud-dedicated, see env.cloud-dedicated.example
|
|
16
|
+
# For cloud-serverless, see env.cloud-serverless.example
|
|
17
|
+
INFLUX_DB_PRODUCT_TYPE=core
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"influxdb": {
|
|
4
|
+
"command": "npx",
|
|
5
|
+
"args": ["-y", "@influx/influx-mcp-server@latest"],
|
|
6
|
+
"env": {
|
|
7
|
+
"INFLUX_DB_PRODUCT_TYPE": "cloud-dedicated",
|
|
8
|
+
"INFLUX_DB_CLUSTER_ID": "your_cluster_id_here",
|
|
9
|
+
"INFLUX_DB_ACCOUNT_ID": "your_account_id_here",
|
|
10
|
+
"INFLUX_DB_TOKEN": "your_database_token_here",
|
|
11
|
+
"INFLUX_DB_MANAGEMENT_TOKEN": "your_management_token_here"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"influxdb": {
|
|
4
|
+
"command": "node",
|
|
5
|
+
"args": ["/path/to/influx-mcp-standalone/build/index.js"],
|
|
6
|
+
"env": {
|
|
7
|
+
"INFLUX_DB_PRODUCT_TYPE": "cloud-serverless",
|
|
8
|
+
"INFLUX_DB_INSTANCE_URL": "https://your-region.aws.cloud2.influxdata.com",
|
|
9
|
+
"INFLUX_DB_TOKEN": "your_database_token_here"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"influxdb": {
|
|
4
|
+
"command": "node",
|
|
5
|
+
"args": ["/path/to/influx-mcp-standalone/build/index.js"],
|
|
6
|
+
"env": {
|
|
7
|
+
"INFLUX_DB_PRODUCT_TYPE": "clustered",
|
|
8
|
+
"INFLUX_DB_INSTANCE_URL": "https://your-cluster.example.com",
|
|
9
|
+
"INFLUX_DB_TOKEN": "your_database_token_here",
|
|
10
|
+
"INFLUX_DB_MANAGEMENT_TOKEN": "your_management_token_here"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"influxdb": {
|
|
4
|
+
"command": "docker",
|
|
5
|
+
"args": [
|
|
6
|
+
"run",
|
|
7
|
+
"--rm",
|
|
8
|
+
"-i",
|
|
9
|
+
"--add-host=host.docker.internal:host-gateway",
|
|
10
|
+
"-e",
|
|
11
|
+
"INFLUX_DB_INSTANCE_URL",
|
|
12
|
+
"-e",
|
|
13
|
+
"INFLUX_DB_TOKEN",
|
|
14
|
+
"-e",
|
|
15
|
+
"INFLUX_DB_PRODUCT_TYPE",
|
|
16
|
+
"influxdb-mcp-server"
|
|
17
|
+
],
|
|
18
|
+
"env": {
|
|
19
|
+
"INFLUX_DB_INSTANCE_URL": "http://host.docker.internal:8086/",
|
|
20
|
+
"INFLUX_DB_TOKEN": "<YOUR_INFLUXDB_OPERATOR_TOKEN>",
|
|
21
|
+
"INFLUX_DB_PRODUCT_TYPE": "core"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"influxdb": {
|
|
4
|
+
"command": "node",
|
|
5
|
+
"args": ["/path/to/influx-mcp-standalone/build/index.js"],
|
|
6
|
+
"env": {
|
|
7
|
+
"INFLUX_DB_INSTANCE_URL": "http://localhost:8086/",
|
|
8
|
+
"INFLUX_DB_TOKEN": "<YOUR_INFLUXDB_OPERATOR_TOKEN>",
|
|
9
|
+
"INFLUX_DB_PRODUCT_TYPE": "core"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"influxdb": {
|
|
4
|
+
"command": "npx",
|
|
5
|
+
"args": ["-y", "@influxdata/influxdb3-mcp-server"],
|
|
6
|
+
"env": {
|
|
7
|
+
"INFLUX_DB_INSTANCE_URL": "http://localhost:8086/",
|
|
8
|
+
"INFLUX_DB_TOKEN": "<YOUR_INFLUXDB_OPERATOR_TOKEN>",
|
|
9
|
+
"INFLUX_DB_PRODUCT_TYPE": "core"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|