@berthojoris/mcp-mysql-server 1.1.0 → 1.2.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.
@@ -187,6 +187,152 @@ export declare const runQuerySchema: {
187
187
  };
188
188
  additionalProperties: boolean;
189
189
  };
190
+ export declare const executeSqlSchema: {
191
+ type: string;
192
+ required: string[];
193
+ properties: {
194
+ query: {
195
+ type: string;
196
+ };
197
+ params: {
198
+ type: string;
199
+ items: {};
200
+ nullable: boolean;
201
+ };
202
+ };
203
+ additionalProperties: boolean;
204
+ };
205
+ export declare const createTableSchema: {
206
+ type: string;
207
+ required: string[];
208
+ properties: {
209
+ table_name: {
210
+ type: string;
211
+ };
212
+ columns: {
213
+ type: string;
214
+ items: {
215
+ type: string;
216
+ required: string[];
217
+ properties: {
218
+ name: {
219
+ type: string;
220
+ };
221
+ type: {
222
+ type: string;
223
+ };
224
+ nullable: {
225
+ type: string;
226
+ };
227
+ primary_key: {
228
+ type: string;
229
+ };
230
+ auto_increment: {
231
+ type: string;
232
+ };
233
+ default: {
234
+ type: string;
235
+ };
236
+ };
237
+ };
238
+ };
239
+ indexes: {
240
+ type: string;
241
+ items: {
242
+ type: string;
243
+ properties: {
244
+ name: {
245
+ type: string;
246
+ };
247
+ columns: {
248
+ type: string;
249
+ items: {
250
+ type: string;
251
+ };
252
+ };
253
+ unique: {
254
+ type: string;
255
+ };
256
+ };
257
+ };
258
+ nullable: boolean;
259
+ };
260
+ };
261
+ additionalProperties: boolean;
262
+ };
263
+ export declare const alterTableSchema: {
264
+ type: string;
265
+ required: string[];
266
+ properties: {
267
+ table_name: {
268
+ type: string;
269
+ };
270
+ operations: {
271
+ type: string;
272
+ items: {
273
+ type: string;
274
+ required: string[];
275
+ properties: {
276
+ type: {
277
+ type: string;
278
+ enum: string[];
279
+ };
280
+ column_name: {
281
+ type: string;
282
+ };
283
+ new_column_name: {
284
+ type: string;
285
+ };
286
+ column_type: {
287
+ type: string;
288
+ };
289
+ nullable: {
290
+ type: string;
291
+ };
292
+ default: {
293
+ type: string;
294
+ };
295
+ index_name: {
296
+ type: string;
297
+ };
298
+ index_columns: {
299
+ type: string;
300
+ items: {
301
+ type: string;
302
+ };
303
+ };
304
+ unique: {
305
+ type: string;
306
+ };
307
+ };
308
+ };
309
+ };
310
+ };
311
+ additionalProperties: boolean;
312
+ };
313
+ export declare const dropTableSchema: {
314
+ type: string;
315
+ required: string[];
316
+ properties: {
317
+ table_name: {
318
+ type: string;
319
+ };
320
+ if_exists: {
321
+ type: string;
322
+ };
323
+ };
324
+ additionalProperties: boolean;
325
+ };
326
+ export declare const executeDdlSchema: {
327
+ type: string;
328
+ required: string[];
329
+ properties: {
330
+ query: {
331
+ type: string;
332
+ };
333
+ };
334
+ additionalProperties: boolean;
335
+ };
190
336
  export declare const getTableRelationshipsSchema: {
191
337
  type: string;
192
338
  required: string[];
@@ -384,10 +530,31 @@ export declare const validateUpdateRecord: import("ajv").ValidateFunction<{
384
530
  export declare const validateDeleteRecord: import("ajv").ValidateFunction<{
385
531
  [x: string]: {};
386
532
  }>;
533
+ export declare const validateBulkInsert: import("ajv").ValidateFunction<{
534
+ [x: string]: {};
535
+ }>;
536
+ export declare const validateBulkUpdate: import("ajv").ValidateFunction<{
537
+ [x: string]: {};
538
+ }>;
539
+ export declare const validateBulkDelete: import("ajv").ValidateFunction<{
540
+ [x: string]: {};
541
+ }>;
387
542
  export declare const validateRunQuery: import("ajv").ValidateFunction<{
388
543
  [x: string]: {};
389
544
  }>;
390
- export declare const validateGetTableRelationships: import("ajv").ValidateFunction<{
545
+ export declare const validateExecuteSql: import("ajv").ValidateFunction<{
546
+ [x: string]: {};
547
+ }>;
548
+ export declare const validateCreateTable: import("ajv").ValidateFunction<{
549
+ [x: string]: {};
550
+ }>;
551
+ export declare const validateAlterTable: import("ajv").ValidateFunction<{
552
+ [x: string]: {};
553
+ }>;
554
+ export declare const validateDropTable: import("ajv").ValidateFunction<{
555
+ [x: string]: {};
556
+ }>;
557
+ export declare const validateExecuteDdl: import("ajv").ValidateFunction<{
391
558
  [x: string]: {};
392
559
  }>;
393
560
  export declare const validateBeginTransaction: import("ajv").ValidateFunction<{
@@ -399,7 +566,6 @@ export declare const validateCommitTransaction: import("ajv").ValidateFunction<{
399
566
  export declare const validateRollbackTransaction: import("ajv").ValidateFunction<{
400
567
  [x: string]: {};
401
568
  }>;
402
- export declare const validateGetTransactionStatus: import("ajv").ValidateFunction<{} & {}>;
403
569
  export declare const validateExecuteInTransaction: import("ajv").ValidateFunction<{
404
570
  [x: string]: {};
405
571
  }>;
@@ -409,10 +575,10 @@ export declare const validateListStoredProcedures: import("ajv").ValidateFunctio
409
575
  export declare const validateGetStoredProcedureInfo: import("ajv").ValidateFunction<{
410
576
  [x: string]: {};
411
577
  }>;
412
- export declare const validateStoredProcedureExecution: import("ajv").ValidateFunction<{
578
+ export declare const validateExecuteStoredProcedure: import("ajv").ValidateFunction<{
413
579
  [x: string]: {};
414
580
  }>;
415
- export declare const validateStoredProcedureCreation: import("ajv").ValidateFunction<{
581
+ export declare const validateCreateStoredProcedure: import("ajv").ValidateFunction<{
416
582
  [x: string]: {};
417
583
  }>;
418
584
  export declare const validateDropStoredProcedure: import("ajv").ValidateFunction<{
@@ -421,3 +587,12 @@ export declare const validateDropStoredProcedure: import("ajv").ValidateFunction
421
587
  export declare const validateShowCreateProcedure: import("ajv").ValidateFunction<{
422
588
  [x: string]: {};
423
589
  }>;
590
+ export declare const validateStoredProcedureExecution: import("ajv").ValidateFunction<{
591
+ [x: string]: {};
592
+ }>;
593
+ export declare const validateStoredProcedureCreation: import("ajv").ValidateFunction<{
594
+ [x: string]: {};
595
+ }>;
596
+ export declare const validateGetTableRelationships: import("ajv").ValidateFunction<{
597
+ [x: string]: {};
598
+ }>;
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.validateShowCreateProcedure = exports.validateDropStoredProcedure = exports.validateStoredProcedureCreation = exports.validateStoredProcedureExecution = exports.validateGetStoredProcedureInfo = exports.validateListStoredProcedures = exports.validateExecuteInTransaction = exports.validateGetTransactionStatus = exports.validateRollbackTransaction = exports.validateCommitTransaction = exports.validateBeginTransaction = exports.validateGetTableRelationships = exports.validateRunQuery = exports.validateDeleteRecord = exports.validateUpdateRecord = exports.validateReadRecords = exports.validateCreateRecord = exports.validateReadTableSchema = exports.validateListTables = exports.showCreateProcedureSchema = exports.dropStoredProcedureSchema = exports.createStoredProcedureSchema = exports.executeStoredProcedureSchema = exports.getStoredProcedureInfoSchema = exports.listStoredProceduresSchema = exports.executeInTransactionSchema = exports.getTransactionStatusSchema = exports.rollbackTransactionSchema = exports.commitTransactionSchema = exports.beginTransactionSchema = exports.getTableRelationshipsSchema = exports.runQuerySchema = exports.deleteRecordSchema = exports.updateRecordSchema = exports.readRecordsSchema = exports.createRecordSchema = exports.readTableSchemaSchema = exports.listTablesSchema = void 0;
6
+ exports.validateStoredProcedureExecution = exports.validateShowCreateProcedure = exports.validateDropStoredProcedure = exports.validateCreateStoredProcedure = exports.validateExecuteStoredProcedure = exports.validateGetStoredProcedureInfo = exports.validateListStoredProcedures = exports.validateExecuteInTransaction = exports.validateRollbackTransaction = exports.validateCommitTransaction = exports.validateBeginTransaction = exports.validateExecuteDdl = exports.validateDropTable = exports.validateAlterTable = exports.validateCreateTable = exports.validateExecuteSql = exports.validateRunQuery = exports.validateBulkDelete = exports.validateBulkUpdate = exports.validateBulkInsert = exports.validateDeleteRecord = exports.validateUpdateRecord = exports.validateReadRecords = exports.validateCreateRecord = exports.validateReadTableSchema = exports.validateListTables = exports.showCreateProcedureSchema = exports.dropStoredProcedureSchema = exports.createStoredProcedureSchema = exports.executeStoredProcedureSchema = exports.getStoredProcedureInfoSchema = exports.listStoredProceduresSchema = exports.executeInTransactionSchema = exports.getTransactionStatusSchema = exports.rollbackTransactionSchema = exports.commitTransactionSchema = exports.beginTransactionSchema = exports.getTableRelationshipsSchema = exports.executeDdlSchema = exports.dropTableSchema = exports.alterTableSchema = exports.createTableSchema = exports.executeSqlSchema = exports.runQuerySchema = exports.deleteRecordSchema = exports.updateRecordSchema = exports.readRecordsSchema = exports.createRecordSchema = exports.readTableSchemaSchema = exports.listTablesSchema = void 0;
7
+ exports.validateGetTableRelationships = exports.validateStoredProcedureCreation = void 0;
7
8
  const ajv_1 = __importDefault(require("ajv"));
8
9
  const ajv = new ajv_1.default();
9
10
  // Schema definitions
@@ -126,6 +127,20 @@ exports.deleteRecordSchema = {
126
127
  },
127
128
  additionalProperties: false
128
129
  };
130
+ // Filter condition schema for reuse
131
+ const filterConditionSchema = {
132
+ type: 'object',
133
+ required: ['field', 'operator', 'value'],
134
+ properties: {
135
+ field: { type: 'string' },
136
+ operator: {
137
+ type: 'string',
138
+ enum: ['eq', 'neq', 'gt', 'gte', 'lt', 'lte', 'like', 'in']
139
+ },
140
+ value: {}
141
+ },
142
+ additionalProperties: false
143
+ };
129
144
  exports.runQuerySchema = {
130
145
  type: 'object',
131
146
  required: ['query'],
@@ -139,6 +154,102 @@ exports.runQuerySchema = {
139
154
  },
140
155
  additionalProperties: false
141
156
  };
157
+ // SQL execution schema
158
+ exports.executeSqlSchema = {
159
+ type: 'object',
160
+ required: ['query'],
161
+ properties: {
162
+ query: { type: 'string' },
163
+ params: {
164
+ type: 'array',
165
+ items: {},
166
+ nullable: true
167
+ }
168
+ },
169
+ additionalProperties: false
170
+ };
171
+ // DDL schemas
172
+ exports.createTableSchema = {
173
+ type: 'object',
174
+ required: ['table_name', 'columns'],
175
+ properties: {
176
+ table_name: { type: 'string' },
177
+ columns: {
178
+ type: 'array',
179
+ items: {
180
+ type: 'object',
181
+ required: ['name', 'type'],
182
+ properties: {
183
+ name: { type: 'string' },
184
+ type: { type: 'string' },
185
+ nullable: { type: 'boolean' },
186
+ primary_key: { type: 'boolean' },
187
+ auto_increment: { type: 'boolean' },
188
+ default: { type: 'string' }
189
+ }
190
+ }
191
+ },
192
+ indexes: {
193
+ type: 'array',
194
+ items: {
195
+ type: 'object',
196
+ properties: {
197
+ name: { type: 'string' },
198
+ columns: { type: 'array', items: { type: 'string' } },
199
+ unique: { type: 'boolean' }
200
+ }
201
+ },
202
+ nullable: true
203
+ }
204
+ },
205
+ additionalProperties: false
206
+ };
207
+ exports.alterTableSchema = {
208
+ type: 'object',
209
+ required: ['table_name', 'operations'],
210
+ properties: {
211
+ table_name: { type: 'string' },
212
+ operations: {
213
+ type: 'array',
214
+ items: {
215
+ type: 'object',
216
+ required: ['type'],
217
+ properties: {
218
+ type: {
219
+ type: 'string',
220
+ enum: ['add_column', 'drop_column', 'modify_column', 'rename_column', 'add_index', 'drop_index']
221
+ },
222
+ column_name: { type: 'string' },
223
+ new_column_name: { type: 'string' },
224
+ column_type: { type: 'string' },
225
+ nullable: { type: 'boolean' },
226
+ default: { type: 'string' },
227
+ index_name: { type: 'string' },
228
+ index_columns: { type: 'array', items: { type: 'string' } },
229
+ unique: { type: 'boolean' }
230
+ }
231
+ }
232
+ }
233
+ },
234
+ additionalProperties: false
235
+ };
236
+ exports.dropTableSchema = {
237
+ type: 'object',
238
+ required: ['table_name'],
239
+ properties: {
240
+ table_name: { type: 'string' },
241
+ if_exists: { type: 'boolean' }
242
+ },
243
+ additionalProperties: false
244
+ };
245
+ exports.executeDdlSchema = {
246
+ type: 'object',
247
+ required: ['query'],
248
+ properties: {
249
+ query: { type: 'string' }
250
+ },
251
+ additionalProperties: false
252
+ };
142
253
  exports.getTableRelationshipsSchema = {
143
254
  type: 'object',
144
255
  required: ['table_name'],
@@ -264,6 +375,73 @@ exports.showCreateProcedureSchema = {
264
375
  },
265
376
  additionalProperties: false
266
377
  };
378
+ // Bulk Insert Schema
379
+ const bulkInsertSchema = {
380
+ type: 'object',
381
+ properties: {
382
+ table_name: { type: 'string', minLength: 1 },
383
+ data: {
384
+ type: 'array',
385
+ minItems: 1,
386
+ items: {
387
+ type: 'object',
388
+ additionalProperties: true
389
+ }
390
+ },
391
+ batch_size: { type: 'number', minimum: 1, maximum: 10000 }
392
+ },
393
+ required: ['table_name', 'data'],
394
+ additionalProperties: false
395
+ };
396
+ // Bulk Update Schema
397
+ const bulkUpdateSchema = {
398
+ type: 'object',
399
+ properties: {
400
+ table_name: { type: 'string', minLength: 1 },
401
+ updates: {
402
+ type: 'array',
403
+ minItems: 1,
404
+ items: {
405
+ type: 'object',
406
+ properties: {
407
+ data: {
408
+ type: 'object',
409
+ additionalProperties: true
410
+ },
411
+ conditions: {
412
+ type: 'array',
413
+ minItems: 1,
414
+ items: filterConditionSchema
415
+ }
416
+ },
417
+ required: ['data', 'conditions'],
418
+ additionalProperties: false
419
+ }
420
+ },
421
+ batch_size: { type: 'number', minimum: 1, maximum: 1000 }
422
+ },
423
+ required: ['table_name', 'updates'],
424
+ additionalProperties: false
425
+ };
426
+ // Bulk Delete Schema
427
+ const bulkDeleteSchema = {
428
+ type: 'object',
429
+ properties: {
430
+ table_name: { type: 'string', minLength: 1 },
431
+ condition_sets: {
432
+ type: 'array',
433
+ minItems: 1,
434
+ items: {
435
+ type: 'array',
436
+ minItems: 1,
437
+ items: filterConditionSchema
438
+ }
439
+ },
440
+ batch_size: { type: 'number', minimum: 1, maximum: 1000 }
441
+ },
442
+ required: ['table_name', 'condition_sets'],
443
+ additionalProperties: false
444
+ };
267
445
  // Compile validators
268
446
  exports.validateListTables = ajv.compile(exports.listTablesSchema);
269
447
  exports.validateReadTableSchema = ajv.compile(exports.readTableSchemaSchema);
@@ -271,17 +449,25 @@ exports.validateCreateRecord = ajv.compile(exports.createRecordSchema);
271
449
  exports.validateReadRecords = ajv.compile(exports.readRecordsSchema);
272
450
  exports.validateUpdateRecord = ajv.compile(exports.updateRecordSchema);
273
451
  exports.validateDeleteRecord = ajv.compile(exports.deleteRecordSchema);
452
+ exports.validateBulkInsert = ajv.compile(bulkInsertSchema);
453
+ exports.validateBulkUpdate = ajv.compile(bulkUpdateSchema);
454
+ exports.validateBulkDelete = ajv.compile(bulkDeleteSchema);
274
455
  exports.validateRunQuery = ajv.compile(exports.runQuerySchema);
275
- exports.validateGetTableRelationships = ajv.compile(exports.getTableRelationshipsSchema);
456
+ exports.validateExecuteSql = ajv.compile(exports.executeSqlSchema);
457
+ exports.validateCreateTable = ajv.compile(exports.createTableSchema);
458
+ exports.validateAlterTable = ajv.compile(exports.alterTableSchema);
459
+ exports.validateDropTable = ajv.compile(exports.dropTableSchema);
460
+ exports.validateExecuteDdl = ajv.compile(exports.executeDdlSchema);
276
461
  exports.validateBeginTransaction = ajv.compile(exports.beginTransactionSchema);
277
462
  exports.validateCommitTransaction = ajv.compile(exports.commitTransactionSchema);
278
463
  exports.validateRollbackTransaction = ajv.compile(exports.rollbackTransactionSchema);
279
- exports.validateGetTransactionStatus = ajv.compile(exports.getTransactionStatusSchema);
280
464
  exports.validateExecuteInTransaction = ajv.compile(exports.executeInTransactionSchema);
281
- // Stored procedure validators
282
465
  exports.validateListStoredProcedures = ajv.compile(exports.listStoredProceduresSchema);
283
466
  exports.validateGetStoredProcedureInfo = ajv.compile(exports.getStoredProcedureInfoSchema);
284
- exports.validateStoredProcedureExecution = ajv.compile(exports.executeStoredProcedureSchema);
285
- exports.validateStoredProcedureCreation = ajv.compile(exports.createStoredProcedureSchema);
467
+ exports.validateExecuteStoredProcedure = ajv.compile(exports.executeStoredProcedureSchema);
468
+ exports.validateCreateStoredProcedure = ajv.compile(exports.createStoredProcedureSchema);
286
469
  exports.validateDropStoredProcedure = ajv.compile(exports.dropStoredProcedureSchema);
287
470
  exports.validateShowCreateProcedure = ajv.compile(exports.showCreateProcedureSchema);
471
+ exports.validateStoredProcedureExecution = ajv.compile(exports.executeStoredProcedureSchema);
472
+ exports.validateStoredProcedureCreation = ajv.compile(exports.createStoredProcedureSchema);
473
+ exports.validateGetTableRelationships = ajv.compile(exports.getTableRelationshipsSchema);