@berthojoris/mcp-mysql-server 1.7.0 → 1.9.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/dist/index.d.ts CHANGED
@@ -19,6 +19,8 @@ export declare class MySQLMCP {
19
19
  private maintenanceTools;
20
20
  private processTools;
21
21
  private backupRestoreTools;
22
+ private migrationTools;
23
+ private schemaVersioningTools;
22
24
  private security;
23
25
  private featureConfig;
24
26
  constructor(permissionsConfig?: string);
@@ -400,6 +402,184 @@ export declare class MySQLMCP {
400
402
  error?: string;
401
403
  queryLog?: string;
402
404
  }>;
405
+ copyTableData(params: {
406
+ source_table: string;
407
+ target_table: string;
408
+ column_mapping?: Record<string, string>;
409
+ filters?: any[];
410
+ batch_size?: number;
411
+ database?: string;
412
+ }): Promise<{
413
+ status: string;
414
+ data?: any;
415
+ error?: string;
416
+ queryLog?: string;
417
+ }>;
418
+ moveTableData(params: {
419
+ source_table: string;
420
+ target_table: string;
421
+ column_mapping?: Record<string, string>;
422
+ filters?: any[];
423
+ batch_size?: number;
424
+ database?: string;
425
+ }): Promise<{
426
+ status: string;
427
+ data?: any;
428
+ error?: string;
429
+ queryLog?: string;
430
+ }>;
431
+ cloneTable(params: {
432
+ source_table: string;
433
+ new_table_name: string;
434
+ include_data?: boolean;
435
+ include_indexes?: boolean;
436
+ database?: string;
437
+ }): Promise<{
438
+ status: string;
439
+ data?: any;
440
+ error?: string;
441
+ queryLog?: string;
442
+ }>;
443
+ compareTableStructure(params: {
444
+ table1: string;
445
+ table2: string;
446
+ database?: string;
447
+ }): Promise<{
448
+ status: string;
449
+ data?: any;
450
+ error?: string;
451
+ queryLog?: string;
452
+ }>;
453
+ syncTableData(params: {
454
+ source_table: string;
455
+ target_table: string;
456
+ key_column: string;
457
+ columns_to_sync?: string[];
458
+ sync_mode?: "insert_only" | "update_only" | "upsert";
459
+ batch_size?: number;
460
+ database?: string;
461
+ }): Promise<{
462
+ status: string;
463
+ data?: any;
464
+ error?: string;
465
+ queryLog?: string;
466
+ }>;
467
+ /**
468
+ * Initialize the migrations tracking table
469
+ */
470
+ initMigrationsTable(params: {
471
+ database?: string;
472
+ }): Promise<{
473
+ status: string;
474
+ data?: any;
475
+ error?: string;
476
+ queryLog?: string;
477
+ }>;
478
+ /**
479
+ * Create a new migration
480
+ */
481
+ createMigration(params: {
482
+ name: string;
483
+ up_sql: string;
484
+ down_sql?: string;
485
+ description?: string;
486
+ version?: string;
487
+ database?: string;
488
+ }): Promise<{
489
+ status: string;
490
+ data?: any;
491
+ error?: string;
492
+ queryLog?: string;
493
+ }>;
494
+ /**
495
+ * Apply pending migrations
496
+ */
497
+ applyMigrations(params: {
498
+ target_version?: string;
499
+ dry_run?: boolean;
500
+ database?: string;
501
+ }): Promise<{
502
+ status: string;
503
+ data?: any;
504
+ error?: string;
505
+ queryLog?: string;
506
+ }>;
507
+ /**
508
+ * Rollback migrations
509
+ */
510
+ rollbackMigration(params: {
511
+ target_version?: string;
512
+ steps?: number;
513
+ dry_run?: boolean;
514
+ database?: string;
515
+ }): Promise<{
516
+ status: string;
517
+ data?: any;
518
+ error?: string;
519
+ queryLog?: string;
520
+ }>;
521
+ /**
522
+ * Get migration status and history
523
+ */
524
+ getMigrationStatus(params: {
525
+ version?: string;
526
+ status?: "pending" | "applied" | "failed" | "rolled_back";
527
+ limit?: number;
528
+ database?: string;
529
+ }): Promise<{
530
+ status: string;
531
+ data?: any;
532
+ error?: string;
533
+ queryLog?: string;
534
+ }>;
535
+ /**
536
+ * Get current schema version
537
+ */
538
+ getSchemaVersion(params: {
539
+ database?: string;
540
+ }): Promise<{
541
+ status: string;
542
+ data?: any;
543
+ error?: string;
544
+ queryLog?: string;
545
+ }>;
546
+ /**
547
+ * Validate migrations for issues
548
+ */
549
+ validateMigrations(params: {
550
+ database?: string;
551
+ }): Promise<{
552
+ status: string;
553
+ data?: any;
554
+ error?: string;
555
+ queryLog?: string;
556
+ }>;
557
+ /**
558
+ * Reset a failed migration to pending status
559
+ */
560
+ resetFailedMigration(params: {
561
+ version: string;
562
+ database?: string;
563
+ }): Promise<{
564
+ status: string;
565
+ data?: any;
566
+ error?: string;
567
+ queryLog?: string;
568
+ }>;
569
+ /**
570
+ * Generate a migration from table structure differences
571
+ */
572
+ generateMigrationFromDiff(params: {
573
+ table1: string;
574
+ table2: string;
575
+ migration_name: string;
576
+ database?: string;
577
+ }): Promise<{
578
+ status: string;
579
+ data?: any;
580
+ error?: string;
581
+ queryLog?: string;
582
+ }>;
403
583
  getFeatureStatus(): {
404
584
  status: string;
405
585
  data: {
package/dist/index.js CHANGED
@@ -20,6 +20,8 @@ const constraintTools_1 = require("./tools/constraintTools");
20
20
  const maintenanceTools_1 = require("./tools/maintenanceTools");
21
21
  const processTools_1 = require("./tools/processTools");
22
22
  const backupRestoreTools_1 = require("./tools/backupRestoreTools");
23
+ const migrationTools_1 = require("./tools/migrationTools");
24
+ const schemaVersioningTools_1 = require("./tools/schemaVersioningTools");
23
25
  const securityLayer_1 = __importDefault(require("./security/securityLayer"));
24
26
  const connection_1 = __importDefault(require("./db/connection"));
25
27
  const featureConfig_1 = require("./config/featureConfig");
@@ -47,6 +49,8 @@ class MySQLMCP {
47
49
  this.maintenanceTools = new maintenanceTools_1.MaintenanceTools(this.security);
48
50
  this.processTools = new processTools_1.ProcessTools(this.security);
49
51
  this.backupRestoreTools = new backupRestoreTools_1.BackupRestoreTools(this.security);
52
+ this.migrationTools = new migrationTools_1.MigrationTools(this.security);
53
+ this.schemaVersioningTools = new schemaVersioningTools_1.SchemaVersioningTools(this.security);
50
54
  }
51
55
  // Helper method to check if tool is enabled
52
56
  checkToolEnabled(toolName) {
@@ -359,6 +363,135 @@ class MySQLMCP {
359
363
  }
360
364
  return await this.backupRestoreTools.getDatabaseSchema(params);
361
365
  }
366
+ // Data Migration Tools
367
+ async copyTableData(params) {
368
+ const check = this.checkToolEnabled("copyTableData");
369
+ if (!check.enabled) {
370
+ return { status: "error", error: check.error };
371
+ }
372
+ return await this.migrationTools.copyTableData(params);
373
+ }
374
+ async moveTableData(params) {
375
+ const check = this.checkToolEnabled("moveTableData");
376
+ if (!check.enabled) {
377
+ return { status: "error", error: check.error };
378
+ }
379
+ return await this.migrationTools.moveTableData(params);
380
+ }
381
+ async cloneTable(params) {
382
+ const check = this.checkToolEnabled("cloneTable");
383
+ if (!check.enabled) {
384
+ return { status: "error", error: check.error };
385
+ }
386
+ return await this.migrationTools.cloneTable(params);
387
+ }
388
+ async compareTableStructure(params) {
389
+ const check = this.checkToolEnabled("compareTableStructure");
390
+ if (!check.enabled) {
391
+ return { status: "error", error: check.error };
392
+ }
393
+ return await this.migrationTools.compareTableStructure(params);
394
+ }
395
+ async syncTableData(params) {
396
+ const check = this.checkToolEnabled("syncTableData");
397
+ if (!check.enabled) {
398
+ return { status: "error", error: check.error };
399
+ }
400
+ return await this.migrationTools.syncTableData(params);
401
+ }
402
+ // ==========================================
403
+ // Schema Versioning and Migrations Tools
404
+ // ==========================================
405
+ /**
406
+ * Initialize the migrations tracking table
407
+ */
408
+ async initMigrationsTable(params) {
409
+ const check = this.checkToolEnabled("initMigrationsTable");
410
+ if (!check.enabled) {
411
+ return { status: "error", error: check.error };
412
+ }
413
+ return await this.schemaVersioningTools.initMigrationsTable(params);
414
+ }
415
+ /**
416
+ * Create a new migration
417
+ */
418
+ async createMigration(params) {
419
+ const check = this.checkToolEnabled("createMigration");
420
+ if (!check.enabled) {
421
+ return { status: "error", error: check.error };
422
+ }
423
+ return await this.schemaVersioningTools.createMigration(params);
424
+ }
425
+ /**
426
+ * Apply pending migrations
427
+ */
428
+ async applyMigrations(params) {
429
+ const check = this.checkToolEnabled("applyMigrations");
430
+ if (!check.enabled) {
431
+ return { status: "error", error: check.error };
432
+ }
433
+ return await this.schemaVersioningTools.applyMigrations(params);
434
+ }
435
+ /**
436
+ * Rollback migrations
437
+ */
438
+ async rollbackMigration(params) {
439
+ const check = this.checkToolEnabled("rollbackMigration");
440
+ if (!check.enabled) {
441
+ return { status: "error", error: check.error };
442
+ }
443
+ return await this.schemaVersioningTools.rollbackMigration(params);
444
+ }
445
+ /**
446
+ * Get migration status and history
447
+ */
448
+ async getMigrationStatus(params) {
449
+ const check = this.checkToolEnabled("getMigrationStatus");
450
+ if (!check.enabled) {
451
+ return { status: "error", error: check.error };
452
+ }
453
+ return await this.schemaVersioningTools.getMigrationStatus(params);
454
+ }
455
+ /**
456
+ * Get current schema version
457
+ */
458
+ async getSchemaVersion(params) {
459
+ const check = this.checkToolEnabled("getSchemaVersion");
460
+ if (!check.enabled) {
461
+ return { status: "error", error: check.error };
462
+ }
463
+ return await this.schemaVersioningTools.getSchemaVersion(params);
464
+ }
465
+ /**
466
+ * Validate migrations for issues
467
+ */
468
+ async validateMigrations(params) {
469
+ const check = this.checkToolEnabled("validateMigrations");
470
+ if (!check.enabled) {
471
+ return { status: "error", error: check.error };
472
+ }
473
+ return await this.schemaVersioningTools.validateMigrations(params);
474
+ }
475
+ /**
476
+ * Reset a failed migration to pending status
477
+ */
478
+ async resetFailedMigration(params) {
479
+ const check = this.checkToolEnabled("resetFailedMigration");
480
+ if (!check.enabled) {
481
+ return { status: "error", error: check.error };
482
+ }
483
+ return await this.schemaVersioningTools.resetFailedMigration(params);
484
+ }
485
+ /**
486
+ * Generate a migration from table structure differences
487
+ */
488
+ async generateMigrationFromDiff(params) {
489
+ const check = this.checkToolEnabled("generateMigrationFromDiff");
490
+ if (!check.enabled) {
491
+ return { status: "error", error: check.error };
492
+ }
493
+ return await this.schemaVersioningTools.generateMigrationFromDiff(params);
494
+ }
362
495
  // Get feature configuration status
363
496
  getFeatureStatus() {
364
497
  return {