@berthojoris/mcp-mysql-server 1.7.0 β†’ 1.8.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/DOCUMENTATIONS.md CHANGED
@@ -8,26 +8,27 @@ This file contains detailed documentation for all features of the MySQL MCP Serv
8
8
 
9
9
  1. [DDL Operations](#πŸ—οΈ-ddl-operations)
10
10
  2. [Data Export Tools](#πŸ“€-data-export-tools)
11
- 3. [Data Import Tools](#πŸ“₯-data-import-tools) - NEW!
12
- 4. [Database Backup & Restore](#πŸ’Ύ-database-backup--restore) - NEW!
13
- 5. [Transaction Management](#πŸ’°-transaction-management)
14
- 6. [Stored Procedures](#πŸ”§-stored-procedures)
15
- 7. [Views Management](#πŸ‘οΈ-views-management)
16
- 8. [Triggers Management](#⚑-triggers-management)
17
- 9. [Functions Management](#πŸ”’-functions-management)
18
- 10. [Index Management](#πŸ“‡-index-management)
19
- 11. [Constraint Management](#πŸ”—-constraint-management)
20
- 12. [Table Maintenance](#πŸ”§-table-maintenance)
21
- 13. [Process & Server Management](#πŸ“Š-process--server-management)
22
- 14. [Usage Examples](#πŸ“‹-usage-examples)
23
- 15. [Query Logging & Automatic SQL Display](#πŸ“-query-logging--automatic-sql-display)
24
- 16. [Security Features](#πŸ”’-security-features)
25
- 17. [Query Result Caching](#πŸ’Ύ-query-result-caching)
26
- 18. [Query Optimization Hints](#🎯-query-optimization-hints)
27
- 19. [Bulk Operations](#πŸš€-bulk-operations)
28
- 20. [Troubleshooting](#πŸ› οΈ-troubleshooting)
29
- 21. [License](#πŸ“„-license)
30
- 22. [Roadmap](#πŸ—ΊοΈ-roadmap)
11
+ 3. [Data Import Tools](#πŸ“₯-data-import-tools)
12
+ 4. [Database Backup & Restore](#πŸ’Ύ-database-backup--restore)
13
+ 5. [Data Migration Tools](#πŸ”„-data-migration-tools) - NEW!
14
+ 6. [Transaction Management](#πŸ’°-transaction-management)
15
+ 7. [Stored Procedures](#πŸ”§-stored-procedures)
16
+ 8. [Views Management](#πŸ‘οΈ-views-management)
17
+ 9. [Triggers Management](#⚑-triggers-management)
18
+ 10. [Functions Management](#πŸ”’-functions-management)
19
+ 11. [Index Management](#πŸ“‡-index-management)
20
+ 12. [Constraint Management](#πŸ”—-constraint-management)
21
+ 13. [Table Maintenance](#πŸ”§-table-maintenance)
22
+ 14. [Process & Server Management](#πŸ“Š-process--server-management)
23
+ 15. [Usage Examples](#πŸ“‹-usage-examples)
24
+ 16. [Query Logging & Automatic SQL Display](#πŸ“-query-logging--automatic-sql-display)
25
+ 17. [Security Features](#πŸ”’-security-features)
26
+ 18. [Query Result Caching](#πŸ’Ύ-query-result-caching)
27
+ 19. [Query Optimization Hints](#🎯-query-optimization-hints)
28
+ 20. [Bulk Operations](#πŸš€-bulk-operations)
29
+ 21. [Troubleshooting](#πŸ› οΈ-troubleshooting)
30
+ 22. [License](#πŸ“„-license)
31
+ 23. [Roadmap](#πŸ—ΊοΈ-roadmap)
31
32
 
32
33
  ---
33
34
 
@@ -481,6 +482,294 @@ Get a complete overview of all database objects:
481
482
 
482
483
  ---
483
484
 
485
+ ## πŸ”„ Data Migration Tools
486
+
487
+ The MySQL MCP Server provides powerful data migration utilities for copying, moving, and synchronizing data between tables.
488
+
489
+ ### Data Migration Tools Overview
490
+
491
+ | Tool | Description | Permission |
492
+ |------|-------------|------------|
493
+ | `copy_table_data` | Copy data from one table to another | `create` |
494
+ | `move_table_data` | Move data (copy + delete from source) | `create`, `delete` |
495
+ | `clone_table` | Clone table structure with optional data | `ddl` |
496
+ | `compare_table_structure` | Compare structure of two tables | `list` |
497
+ | `sync_table_data` | Synchronize data between tables | `update` |
498
+
499
+ ### Copy Table Data
500
+
501
+ Copy data from one table to another with optional column mapping and filtering.
502
+
503
+ ```json
504
+ {
505
+ "tool": "copy_table_data",
506
+ "arguments": {
507
+ "source_table": "users",
508
+ "target_table": "users_backup",
509
+ "batch_size": 1000
510
+ }
511
+ }
512
+ ```
513
+
514
+ **With Column Mapping:**
515
+ ```json
516
+ {
517
+ "tool": "copy_table_data",
518
+ "arguments": {
519
+ "source_table": "old_customers",
520
+ "target_table": "customers",
521
+ "column_mapping": {
522
+ "customer_name": "name",
523
+ "customer_email": "email",
524
+ "customer_phone": "phone"
525
+ }
526
+ }
527
+ }
528
+ ```
529
+
530
+ **With Filters:**
531
+ ```json
532
+ {
533
+ "tool": "copy_table_data",
534
+ "arguments": {
535
+ "source_table": "orders",
536
+ "target_table": "archived_orders",
537
+ "filters": [
538
+ { "field": "status", "operator": "eq", "value": "completed" },
539
+ { "field": "created_at", "operator": "lt", "value": "2024-01-01" }
540
+ ]
541
+ }
542
+ }
543
+ ```
544
+
545
+ **Response:**
546
+ ```json
547
+ {
548
+ "status": "success",
549
+ "data": {
550
+ "message": "Data copied successfully",
551
+ "rows_copied": 5000,
552
+ "source_table": "orders",
553
+ "target_table": "archived_orders"
554
+ }
555
+ }
556
+ ```
557
+
558
+ ### Move Table Data
559
+
560
+ Move data from one table to another (copies data then deletes from source).
561
+
562
+ ```json
563
+ {
564
+ "tool": "move_table_data",
565
+ "arguments": {
566
+ "source_table": "active_sessions",
567
+ "target_table": "expired_sessions",
568
+ "filters": [
569
+ { "field": "expires_at", "operator": "lt", "value": "2024-01-01" }
570
+ ]
571
+ }
572
+ }
573
+ ```
574
+
575
+ **Response:**
576
+ ```json
577
+ {
578
+ "status": "success",
579
+ "data": {
580
+ "message": "Data moved successfully",
581
+ "rows_moved": 1500,
582
+ "source_table": "active_sessions",
583
+ "target_table": "expired_sessions"
584
+ }
585
+ }
586
+ ```
587
+
588
+ ### Clone Table
589
+
590
+ Clone a table structure with or without data.
591
+
592
+ ```json
593
+ {
594
+ "tool": "clone_table",
595
+ "arguments": {
596
+ "source_table": "products",
597
+ "new_table_name": "products_staging",
598
+ "include_data": false,
599
+ "include_indexes": true
600
+ }
601
+ }
602
+ ```
603
+
604
+ **Clone with Data:**
605
+ ```json
606
+ {
607
+ "tool": "clone_table",
608
+ "arguments": {
609
+ "source_table": "users",
610
+ "new_table_name": "users_test",
611
+ "include_data": true
612
+ }
613
+ }
614
+ ```
615
+
616
+ **Response:**
617
+ ```json
618
+ {
619
+ "status": "success",
620
+ "data": {
621
+ "message": "Table cloned successfully",
622
+ "source_table": "products",
623
+ "new_table": "products_staging",
624
+ "include_data": false,
625
+ "include_indexes": true
626
+ }
627
+ }
628
+ ```
629
+
630
+ ### Compare Table Structure
631
+
632
+ Compare the structure of two tables to identify differences.
633
+
634
+ ```json
635
+ {
636
+ "tool": "compare_table_structure",
637
+ "arguments": {
638
+ "table1": "users",
639
+ "table2": "users_backup"
640
+ }
641
+ }
642
+ ```
643
+
644
+ **Response:**
645
+ ```json
646
+ {
647
+ "status": "success",
648
+ "data": {
649
+ "table1": "users",
650
+ "table2": "users_backup",
651
+ "identical": false,
652
+ "differences": {
653
+ "columns_only_in_table1": ["last_login", "avatar_url"],
654
+ "columns_only_in_table2": [],
655
+ "column_type_differences": [
656
+ {
657
+ "column": "email",
658
+ "table1_type": "VARCHAR(255)",
659
+ "table2_type": "VARCHAR(100)"
660
+ }
661
+ ],
662
+ "index_differences": {
663
+ "only_in_table1": ["idx_last_login"],
664
+ "only_in_table2": []
665
+ }
666
+ }
667
+ }
668
+ }
669
+ ```
670
+
671
+ ### Sync Table Data
672
+
673
+ Synchronize data between two tables based on a key column. Supports three modes:
674
+ - **insert_only**: Only insert new records that don't exist in target
675
+ - **update_only**: Only update existing records in target
676
+ - **upsert**: Both insert new and update existing records (default)
677
+
678
+ ```json
679
+ {
680
+ "tool": "sync_table_data",
681
+ "arguments": {
682
+ "source_table": "products_master",
683
+ "target_table": "products_replica",
684
+ "key_column": "product_id",
685
+ "sync_mode": "upsert"
686
+ }
687
+ }
688
+ ```
689
+
690
+ **Sync Specific Columns:**
691
+ ```json
692
+ {
693
+ "tool": "sync_table_data",
694
+ "arguments": {
695
+ "source_table": "inventory_main",
696
+ "target_table": "inventory_cache",
697
+ "key_column": "sku",
698
+ "columns_to_sync": ["quantity", "price", "updated_at"],
699
+ "sync_mode": "update_only"
700
+ }
701
+ }
702
+ ```
703
+
704
+ **Response:**
705
+ ```json
706
+ {
707
+ "status": "success",
708
+ "data": {
709
+ "message": "Sync completed successfully",
710
+ "source_table": "products_master",
711
+ "target_table": "products_replica",
712
+ "rows_inserted": 150,
713
+ "rows_updated": 3200,
714
+ "sync_mode": "upsert"
715
+ }
716
+ }
717
+ ```
718
+
719
+ ### Migration Best Practices
720
+
721
+ 1. **Backup before migration** - Always backup target tables before large migrations
722
+ 2. **Use filters** - Migrate data in chunks using filters to avoid timeouts
723
+ 3. **Test with small batches** - Test migration logic with small datasets first
724
+ 4. **Verify data integrity** - Use `compare_table_structure` before migration
725
+ 5. **Monitor performance** - Adjust `batch_size` based on table size and server capacity
726
+
727
+ ### Common Migration Patterns
728
+
729
+ **Pattern 1: Archive Old Data**
730
+ ```json
731
+ // Move old orders to archive table
732
+ {
733
+ "tool": "move_table_data",
734
+ "arguments": {
735
+ "source_table": "orders",
736
+ "target_table": "orders_archive",
737
+ "filters": [
738
+ { "field": "created_at", "operator": "lt", "value": "2023-01-01" }
739
+ ]
740
+ }
741
+ }
742
+ ```
743
+
744
+ **Pattern 2: Create Staging Table**
745
+ ```json
746
+ // Clone structure for staging
747
+ {
748
+ "tool": "clone_table",
749
+ "arguments": {
750
+ "source_table": "products",
751
+ "new_table_name": "products_staging",
752
+ "include_data": false
753
+ }
754
+ }
755
+ ```
756
+
757
+ **Pattern 3: Replicate Data Across Tables**
758
+ ```json
759
+ // Keep replica in sync with master
760
+ {
761
+ "tool": "sync_table_data",
762
+ "arguments": {
763
+ "source_table": "users_master",
764
+ "target_table": "users_read_replica",
765
+ "key_column": "id",
766
+ "sync_mode": "upsert"
767
+ }
768
+ }
769
+ ```
770
+
771
+ ---
772
+
484
773
  ## πŸ’° Transaction Management
485
774
 
486
775
  The MySQL MCP Server provides full ACID transaction support, allowing you to group multiple database operations into atomic units.
@@ -2093,12 +2382,12 @@ MIT License - see [LICENSE](LICENSE) file for details.
2093
2382
  - βœ… **Process Management** - Server processes, status, and query analysis - **COMPLETED!**
2094
2383
 
2095
2384
  ### Enterprise Features
2096
- - [x] **Database backup and restore tools** - **COMPLETED!**
2097
- - [x] **Data export/import utilities** (CSV, JSON, SQL dumps) - **COMPLETED!**
2385
+ - βœ… **Database backup and restore tools** - **COMPLETED!**
2386
+ - βœ… **Data export/import utilities** (CSV, JSON, SQL dumps) - **COMPLETED!**
2387
+ - βœ… **Data migration utilities** - **COMPLETED!**
2098
2388
  - [ ] **Performance monitoring and metrics**
2099
2389
  - [ ] **Connection pool monitoring**
2100
2390
  - [ ] **Audit logging and compliance**
2101
- - [ ] **Data migration utilities**
2102
2391
  - [ ] **Schema versioning and migrations**
2103
2392
 
2104
2393
  ### Database Adapters
@@ -2117,9 +2406,9 @@ MIT License - see [LICENSE](LICENSE) file for details.
2117
2406
  - [ ] **Database health checks** - Comprehensive system health monitoring
2118
2407
 
2119
2408
  #### **Phase 2: Data Management** πŸ“Š
2120
- - [x] **Database backup and restore tools** - Essential for production data safety - **COMPLETED!**
2121
- - [ ] **Data migration utilities** - Move data between databases and environments
2122
- - [x] **Enhanced export/import** - Support for JSON, SQL dump formats - **COMPLETED!**
2409
+ - βœ… **Database backup and restore tools** - Essential for production data safety - **COMPLETED!**
2410
+ - βœ… **Data migration utilities** - Move data between databases and environments - **COMPLETED!**
2411
+ - βœ… **Enhanced export/import** - Support for JSON, SQL dump formats - **COMPLETED!**
2123
2412
  - [ ] **Query history & analytics** - Track and analyze database usage patterns
2124
2413
 
2125
2414
  #### **Phase 3: Enterprise Features** 🏒
@@ -2149,9 +2438,9 @@ MIT License - see [LICENSE](LICENSE) file for details.
2149
2438
  | Query Optimization | Medium | Medium | 9 | βœ… COMPLETED |
2150
2439
  | Database Backup/Restore | High | High | 10 | βœ… COMPLETED |
2151
2440
  | Data Export/Import (JSON, SQL) | High | Medium | 11 | βœ… COMPLETED |
2152
- | Performance Monitoring | High | Medium | 12 | Pending |
2153
- | Data Migration | High | High | 13 | Pending |
2154
- | PostgreSQL Adapter | High | High | 13 | Pending |
2441
+ | Data Migration | High | High | 12 | βœ… COMPLETED |
2442
+ | Performance Monitoring | High | Medium | 13 | Pending |
2443
+ | PostgreSQL Adapter | High | High | 14 | Pending |
2155
2444
  | Audit Logging | Medium | Low | 14 | Pending |
2156
2445
  | Schema Versioning | Medium | Medium | 15 | Pending |
2157
2446
 
package/README.md CHANGED
@@ -11,7 +11,7 @@ A fully-featured **Model Context Protocol (MCP)** server for MySQL database inte
11
11
 
12
12
  - βœ… **Full MCP Protocol Support** - Works with Claude Desktop, Cline, Windsurf, and any MCP-compatible AI agent
13
13
  - πŸ” **Secure by Default** - Parameterized queries, SQL injection protection, permission-based access control
14
- - πŸ› οΈ **95 Powerful Tools** - Complete database operations (CRUD, DDL, queries, schema inspection, transactions, stored procedures, bulk operations, backup/restore, import/export)
14
+ - πŸ› οΈ **100 Powerful Tools** - Complete database operations (CRUD, DDL, queries, schema inspection, transactions, stored procedures, bulk operations, backup/restore, import/export, data migration)
15
15
  - πŸŽ›οΈ **Dynamic Per-Project Permissions** - Each AI agent can have different access levels
16
16
  - πŸ—ƒοΈ **DDL Support** - Create, alter, and drop tables (when explicitly enabled)
17
17
  - πŸ’Ž **Transaction Support** - Full ACID transaction management (BEGIN, COMMIT, ROLLBACK)
@@ -347,123 +347,9 @@ You can have different databases with different permissions in the same AI agent
347
347
 
348
348
  ---
349
349
 
350
- ## 🚫 Permission Error Handling
351
-
352
- The MySQL MCP Server provides clear, user-friendly error messages when operations are attempted without proper permissions. This helps users understand exactly what permissions are needed and how to enable them.
353
-
354
- ### Error Message Format
355
-
356
- When a tool is called without the required permission, you'll receive a detailed error message like:
357
-
358
- ```
359
- ❌ Permission denied: Cannot use tool 'create_table'. This tool requires 'ddl' permission.
360
-
361
- Current permissions: list,read,utility
362
- To enable this tool, add 'ddl' to your permissions configuration.
363
-
364
- Example configuration:
365
- "args": ["mysql://user:pass@host:3306/db", "list,read,utility,ddl"]
366
-
367
- Tool description: Create new tables with columns and indexes
368
- ```
369
-
370
- ### Common Permission Error Examples
371
-
372
- #### Creating Tables Without DDL Permission
373
-
374
- **User prompt:** *"Create a new table called 'products'"*
375
-
376
- **Error response when DDL not enabled:**
377
- ```
378
- ❌ Permission denied: Cannot use tool 'create_table'. This tool requires 'ddl' permission.
379
-
380
- Current permissions: list,read,utility
381
- To enable this tool, add 'ddl' to your permissions configuration.
382
-
383
- Example configuration:
384
- "args": ["mysql://user:pass@host:3306/db", "list,read,utility,ddl"]
385
-
386
- Tool description: Create new tables with columns and indexes
387
- ```
388
-
389
- #### Inserting Data Without Create Permission
390
-
391
- **User prompt:** *"Add a new user to the users table"*
392
-
393
- **Error response when CREATE not enabled:**
394
- ```
395
- ❌ Permission denied: Cannot use tool 'create_record'. This tool requires 'create' permission.
396
-
397
- Current permissions: list,read,utility
398
- To enable this tool, add 'create' to your permissions configuration.
399
-
400
- Example configuration:
401
- "args": ["mysql://user:pass@host:3306/db", "list,read,utility,create"]
402
-
403
- Tool description: Insert new records with automatic SQL generation
404
- ```
405
-
406
- #### Updating Data Without Update Permission
407
-
408
- **User prompt:** *"Update the email for user ID 123"*
409
-
410
- **Error response when UPDATE not enabled:**
411
- ```
412
- ❌ Permission denied: Cannot use tool 'update_record'. This tool requires 'update' permission.
413
-
414
- Current permissions: list,read,utility
415
- To enable this tool, add 'update' to your permissions configuration.
416
-
417
- Example configuration:
418
- "args": ["mysql://user:pass@host:3306/db", "list,read,utility,update"]
419
-
420
- Tool description: Update existing records based on conditions
421
- ```
422
-
423
- ### Permission Error Benefits
424
-
425
- 1. **🎯 Clear Guidance** - Exact permission needed and how to add it
426
- 2. **πŸ“‹ Current State** - Shows what permissions are currently active
427
- 3. **πŸ’‘ Example Configuration** - Ready-to-use configuration example
428
- 4. **πŸ“– Tool Context** - Explains what the tool does
429
- 5. **πŸ” Security** - Prevents unauthorized operations while being helpful
430
-
431
- ### Troubleshooting Permission Errors
432
-
433
- If you encounter permission errors:
434
-
435
- 1. **Check your configuration** - Verify the permissions string in your MCP configuration
436
- 2. **Add required permission** - Add the missing permission to your configuration
437
- 3. **Restart your AI agent** - Changes require a restart to take effect
438
- 4. **Test with a simple operation** - Verify the permission is working
439
-
440
- **Example fix for DDL operations:**
441
-
442
- Before (DDL disabled):
443
- ```json
444
- {
445
- "args": [
446
- "mysql://user:pass@localhost:3306/db",
447
- "list,read,utility"
448
- ]
449
- }
450
- ```
451
-
452
- After (DDL enabled):
453
- ```json
454
- {
455
- "args": [
456
- "mysql://user:pass@localhost:3306/db",
457
- "list,read,utility,ddl"
458
- ]
459
- }
460
- ```
461
-
462
- ---
463
-
464
350
  ## πŸ› οΈ Available Tools
465
351
 
466
- The MCP server provides **95 powerful tools**:
352
+ The MCP server provides **100 powerful tools**:
467
353
 
468
354
  ### Database Discovery (4 tools)
469
355
 
@@ -645,7 +531,7 @@ The MCP server provides **95 powerful tools**:
645
531
  | `get_create_table_statement` | Get CREATE TABLE statement for a table | `list` permission |
646
532
  | `get_database_schema` | Get complete database schema (tables, views, procedures, functions, triggers) | `list` permission |
647
533
 
648
- ### Data Import/Export (5 tools) - NEW!
534
+ ### Data Import/Export (5 tools)
649
535
 
650
536
  | Tool | Description | Requires |
651
537
  |------|-------------|----------|
@@ -655,6 +541,16 @@ The MCP server provides **95 powerful tools**:
655
541
  | `import_from_csv` | Import data from CSV string into a table | `create` permission |
656
542
  | `import_from_json` | Import data from JSON array into a table | `create` permission |
657
543
 
544
+ ### Data Migration (5 tools) - NEW!
545
+
546
+ | Tool | Description | Requires |
547
+ |------|-------------|----------|
548
+ | `copy_table_data` | Copy data from one table to another with optional column mapping | `create` permission |
549
+ | `move_table_data` | Move data (copy + delete from source) | `create`, `delete` permission |
550
+ | `clone_table` | Clone table structure with optional data | `ddl` permission |
551
+ | `compare_table_structure` | Compare structure of two tables and identify differences | `list` permission |
552
+ | `sync_table_data` | Synchronize data between tables (insert_only, update_only, upsert) | `update` permission |
553
+
658
554
  ---
659
555
 
660
556
  ## πŸ“š Detailed Documentation
@@ -665,6 +561,7 @@ For comprehensive documentation on all features, please see **[DOCUMENTATIONS.md
665
561
  - πŸ“€ **Data Export Tools** - Export data to CSV, JSON, and SQL formats
666
562
  - πŸ“₯ **Data Import Tools** - Import data from CSV and JSON sources
667
563
  - πŸ’Ύ **Database Backup & Restore** - Full backup/restore with SQL dumps
564
+ - πŸ”„ **Data Migration Tools** - Copy, move, clone, compare, and sync table data
668
565
  - πŸ’Ž **Transaction Management** - ACID transactions with BEGIN, COMMIT, ROLLBACK
669
566
  - πŸ”§ **Stored Procedures** - Create and execute stored procedures with IN/OUT/INOUT parameters
670
567
  - πŸ“‹ **Usage Examples** - Real-world examples for all tools
@@ -141,6 +141,12 @@ exports.toolCategoryMap = {
141
141
  exportTableToSql: ToolCategory.UTILITY,
142
142
  importFromCSV: ToolCategory.CREATE,
143
143
  importFromJSON: ToolCategory.CREATE,
144
+ // Data migration tools
145
+ copyTableData: ToolCategory.CREATE,
146
+ moveTableData: ToolCategory.DELETE,
147
+ cloneTable: ToolCategory.DDL,
148
+ compareTableStructure: ToolCategory.LIST,
149
+ syncTableData: ToolCategory.UPDATE,
144
150
  };
145
151
  /**
146
152
  * Class to manage feature configuration based on runtime or environment variables
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ export declare class MySQLMCP {
19
19
  private maintenanceTools;
20
20
  private processTools;
21
21
  private backupRestoreTools;
22
+ private migrationTools;
22
23
  private security;
23
24
  private featureConfig;
24
25
  constructor(permissionsConfig?: string);
@@ -400,6 +401,68 @@ export declare class MySQLMCP {
400
401
  error?: string;
401
402
  queryLog?: string;
402
403
  }>;
404
+ copyTableData(params: {
405
+ source_table: string;
406
+ target_table: string;
407
+ column_mapping?: Record<string, string>;
408
+ filters?: any[];
409
+ batch_size?: number;
410
+ database?: string;
411
+ }): Promise<{
412
+ status: string;
413
+ data?: any;
414
+ error?: string;
415
+ queryLog?: string;
416
+ }>;
417
+ moveTableData(params: {
418
+ source_table: string;
419
+ target_table: string;
420
+ column_mapping?: Record<string, string>;
421
+ filters?: any[];
422
+ batch_size?: number;
423
+ database?: string;
424
+ }): Promise<{
425
+ status: string;
426
+ data?: any;
427
+ error?: string;
428
+ queryLog?: string;
429
+ }>;
430
+ cloneTable(params: {
431
+ source_table: string;
432
+ new_table_name: string;
433
+ include_data?: boolean;
434
+ include_indexes?: boolean;
435
+ database?: string;
436
+ }): Promise<{
437
+ status: string;
438
+ data?: any;
439
+ error?: string;
440
+ queryLog?: string;
441
+ }>;
442
+ compareTableStructure(params: {
443
+ table1: string;
444
+ table2: string;
445
+ database?: string;
446
+ }): Promise<{
447
+ status: string;
448
+ data?: any;
449
+ error?: string;
450
+ queryLog?: string;
451
+ }>;
452
+ syncTableData(params: {
453
+ source_table: string;
454
+ target_table: string;
455
+ key_column: string;
456
+ columns_to_sync?: string[];
457
+ sync_mode?: "insert_only" | "update_only" | "upsert";
458
+ batch_size?: number;
459
+ database?: string;
460
+ }): Promise<{
461
+ status: string;
462
+ data?: any;
463
+ error?: string;
464
+ queryLog?: string;
465
+ }>;
403
466
  getFeatureStatus(): {
404
467
  status: string;
405
468
  data: {
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ 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");
23
24
  const securityLayer_1 = __importDefault(require("./security/securityLayer"));
24
25
  const connection_1 = __importDefault(require("./db/connection"));
25
26
  const featureConfig_1 = require("./config/featureConfig");
@@ -47,6 +48,7 @@ class MySQLMCP {
47
48
  this.maintenanceTools = new maintenanceTools_1.MaintenanceTools(this.security);
48
49
  this.processTools = new processTools_1.ProcessTools(this.security);
49
50
  this.backupRestoreTools = new backupRestoreTools_1.BackupRestoreTools(this.security);
51
+ this.migrationTools = new migrationTools_1.MigrationTools(this.security);
50
52
  }
51
53
  // Helper method to check if tool is enabled
52
54
  checkToolEnabled(toolName) {
@@ -359,6 +361,42 @@ class MySQLMCP {
359
361
  }
360
362
  return await this.backupRestoreTools.getDatabaseSchema(params);
361
363
  }
364
+ // Data Migration Tools
365
+ async copyTableData(params) {
366
+ const check = this.checkToolEnabled("copyTableData");
367
+ if (!check.enabled) {
368
+ return { status: "error", error: check.error };
369
+ }
370
+ return await this.migrationTools.copyTableData(params);
371
+ }
372
+ async moveTableData(params) {
373
+ const check = this.checkToolEnabled("moveTableData");
374
+ if (!check.enabled) {
375
+ return { status: "error", error: check.error };
376
+ }
377
+ return await this.migrationTools.moveTableData(params);
378
+ }
379
+ async cloneTable(params) {
380
+ const check = this.checkToolEnabled("cloneTable");
381
+ if (!check.enabled) {
382
+ return { status: "error", error: check.error };
383
+ }
384
+ return await this.migrationTools.cloneTable(params);
385
+ }
386
+ async compareTableStructure(params) {
387
+ const check = this.checkToolEnabled("compareTableStructure");
388
+ if (!check.enabled) {
389
+ return { status: "error", error: check.error };
390
+ }
391
+ return await this.migrationTools.compareTableStructure(params);
392
+ }
393
+ async syncTableData(params) {
394
+ const check = this.checkToolEnabled("syncTableData");
395
+ if (!check.enabled) {
396
+ return { status: "error", error: check.error };
397
+ }
398
+ return await this.migrationTools.syncTableData(params);
399
+ }
362
400
  // Get feature configuration status
363
401
  getFeatureStatus() {
364
402
  return {