@berthojoris/mcp-mysql-server 1.6.3 β†’ 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,24 +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. [Transaction Management](#πŸ’°-transaction-management)
12
- 4. [Stored Procedures](#πŸ”§-stored-procedures)
13
- 5. [Views Management](#πŸ‘οΈ-views-management) - NEW!
14
- 6. [Triggers Management](#⚑-triggers-management) - NEW!
15
- 7. [Functions Management](#πŸ”’-functions-management) - NEW!
16
- 8. [Index Management](#πŸ“‡-index-management) - NEW!
17
- 9. [Constraint Management](#πŸ”—-constraint-management) - NEW!
18
- 10. [Table Maintenance](#πŸ”§-table-maintenance) - NEW!
19
- 11. [Process & Server Management](#πŸ“Š-process--server-management) - NEW!
20
- 12. [Usage Examples](#πŸ“‹-usage-examples)
21
- 13. [Query Logging & Automatic SQL Display](#πŸ“-query-logging--automatic-sql-display)
22
- 14. [Security Features](#πŸ”’-security-features)
23
- 15. [Query Result Caching](#πŸ’Ύ-query-result-caching)
24
- 16. [Query Optimization Hints](#🎯-query-optimization-hints)
25
- 17. [Bulk Operations](#πŸš€-bulk-operations)
26
- 18. [Troubleshooting](#πŸ› οΈ-troubleshooting)
27
- 19. [License](#πŸ“„-license)
28
- 20. [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)
29
32
 
30
33
  ---
31
34
 
@@ -248,6 +251,525 @@ Both tools support:
248
251
 
249
252
  ---
250
253
 
254
+ ## πŸ“₯ Data Import Tools
255
+
256
+ The MySQL MCP Server provides tools to import data from various formats into your database tables.
257
+
258
+ ### Data Import Tools Overview
259
+
260
+ | Tool | Description | Permission |
261
+ |------|-------------|------------|
262
+ | `import_from_csv` | Import data from CSV string | `create` |
263
+ | `import_from_json` | Import data from JSON array | `create` |
264
+
265
+ ### Import from CSV
266
+
267
+ Import data from a CSV string into a table with optional column mapping and error handling.
268
+
269
+ ```json
270
+ {
271
+ "tool": "import_from_csv",
272
+ "arguments": {
273
+ "table_name": "users",
274
+ "csv_data": "name,email,age\nJohn,john@example.com,30\nJane,jane@example.com,25",
275
+ "has_headers": true,
276
+ "skip_errors": false,
277
+ "batch_size": 100
278
+ }
279
+ }
280
+ ```
281
+
282
+ **With Column Mapping:**
283
+ ```json
284
+ {
285
+ "tool": "import_from_csv",
286
+ "arguments": {
287
+ "table_name": "users",
288
+ "csv_data": "full_name,mail\nJohn Doe,john@example.com",
289
+ "has_headers": true,
290
+ "column_mapping": {
291
+ "full_name": "name",
292
+ "mail": "email"
293
+ }
294
+ }
295
+ }
296
+ ```
297
+
298
+ ### Import from JSON
299
+
300
+ Import data from a JSON array string into a table.
301
+
302
+ ```json
303
+ {
304
+ "tool": "import_from_json",
305
+ "arguments": {
306
+ "table_name": "products",
307
+ "json_data": "[{\"name\":\"Widget\",\"price\":9.99},{\"name\":\"Gadget\",\"price\":19.99}]",
308
+ "skip_errors": false,
309
+ "batch_size": 100
310
+ }
311
+ }
312
+ ```
313
+
314
+ ### Import Response
315
+
316
+ ```json
317
+ {
318
+ "status": "success",
319
+ "data": {
320
+ "message": "Import completed successfully",
321
+ "rows_imported": 150,
322
+ "rows_failed": 0
323
+ }
324
+ }
325
+ ```
326
+
327
+ ### Import Best Practices
328
+
329
+ 1. **Validate data format** - Ensure CSV/JSON is well-formed before importing
330
+ 2. **Use batch_size** - Adjust batch size for optimal performance (default: 100)
331
+ 3. **Enable skip_errors** - For large imports, set `skip_errors: true` to continue on individual row failures
332
+ 4. **Column mapping** - Use when source column names don't match table columns
333
+
334
+ ---
335
+
336
+ ## πŸ’Ύ Database Backup & Restore
337
+
338
+ Enterprise-grade backup and restore functionality for MySQL databases.
339
+
340
+ ### Backup & Restore Tools Overview
341
+
342
+ | Tool | Description | Permission |
343
+ |------|-------------|------------|
344
+ | `backup_table` | Backup single table to SQL dump | `utility` |
345
+ | `backup_database` | Backup entire database to SQL dump | `utility` |
346
+ | `restore_from_sql` | Restore from SQL dump content | `ddl` |
347
+ | `get_create_table_statement` | Get CREATE TABLE statement | `list` |
348
+ | `get_database_schema` | Get complete database schema | `list` |
349
+
350
+ ### Backup Single Table
351
+
352
+ ```json
353
+ {
354
+ "tool": "backup_table",
355
+ "arguments": {
356
+ "table_name": "users",
357
+ "include_data": true,
358
+ "include_drop": true
359
+ }
360
+ }
361
+ ```
362
+
363
+ **Response:**
364
+ ```json
365
+ {
366
+ "status": "success",
367
+ "data": {
368
+ "table_name": "users",
369
+ "sql_dump": "-- MySQL Dump...\nDROP TABLE IF EXISTS `users`;\nCREATE TABLE...\nINSERT INTO...",
370
+ "row_count": 1500,
371
+ "include_data": true,
372
+ "include_drop": true
373
+ }
374
+ }
375
+ ```
376
+
377
+ ### Backup Entire Database
378
+
379
+ ```json
380
+ {
381
+ "tool": "backup_database",
382
+ "arguments": {
383
+ "include_data": true,
384
+ "include_drop": true
385
+ }
386
+ }
387
+ ```
388
+
389
+ **Backup Specific Tables:**
390
+ ```json
391
+ {
392
+ "tool": "backup_database",
393
+ "arguments": {
394
+ "tables": ["users", "orders", "products"],
395
+ "include_data": true
396
+ }
397
+ }
398
+ ```
399
+
400
+ ### Restore from SQL Dump
401
+
402
+ ```json
403
+ {
404
+ "tool": "restore_from_sql",
405
+ "arguments": {
406
+ "sql_dump": "DROP TABLE IF EXISTS `users`;\nCREATE TABLE `users` (...);",
407
+ "stop_on_error": true
408
+ }
409
+ }
410
+ ```
411
+
412
+ **Response:**
413
+ ```json
414
+ {
415
+ "status": "success",
416
+ "data": {
417
+ "message": "Restore completed successfully",
418
+ "statements_executed": 25,
419
+ "statements_failed": 0
420
+ }
421
+ }
422
+ ```
423
+
424
+ ### Get Database Schema
425
+
426
+ Get a complete overview of all database objects:
427
+
428
+ ```json
429
+ {
430
+ "tool": "get_database_schema",
431
+ "arguments": {
432
+ "include_views": true,
433
+ "include_procedures": true,
434
+ "include_functions": true,
435
+ "include_triggers": true
436
+ }
437
+ }
438
+ ```
439
+
440
+ ### Export to JSON Format
441
+
442
+ ```json
443
+ {
444
+ "tool": "export_table_to_json",
445
+ "arguments": {
446
+ "table_name": "users",
447
+ "pretty": true,
448
+ "filters": [
449
+ { "field": "status", "operator": "eq", "value": "active" }
450
+ ]
451
+ }
452
+ }
453
+ ```
454
+
455
+ ### Export to SQL INSERT Statements
456
+
457
+ ```json
458
+ {
459
+ "tool": "export_table_to_sql",
460
+ "arguments": {
461
+ "table_name": "products",
462
+ "include_create_table": true,
463
+ "batch_size": 100
464
+ }
465
+ }
466
+ ```
467
+
468
+ ### Backup Best Practices
469
+
470
+ 1. **Regular backups** - Schedule regular database backups
471
+ 2. **Test restores** - Periodically test your backup restoration process
472
+ 3. **Include structure** - Always include `include_drop: true` for clean restores
473
+ 4. **Schema-only backups** - Use `include_data: false` for structure-only backups
474
+ 5. **Selective backups** - Use `tables` array to backup only critical tables
475
+
476
+ ### Backup Safety Features
477
+
478
+ - **Transactional integrity** - Backups include transaction markers
479
+ - **Foreign key handling** - `SET FOREIGN_KEY_CHECKS=0` included in dumps
480
+ - **Binary data support** - Proper escaping for BLOB and binary columns
481
+ - **Character encoding** - UTF-8 encoding preserved in exports
482
+
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
+
251
773
  ## πŸ’° Transaction Management
252
774
 
253
775
  The MySQL MCP Server provides full ACID transaction support, allowing you to group multiple database operations into atomic units.
@@ -1860,12 +2382,12 @@ MIT License - see [LICENSE](LICENSE) file for details.
1860
2382
  - βœ… **Process Management** - Server processes, status, and query analysis - **COMPLETED!**
1861
2383
 
1862
2384
  ### Enterprise Features
1863
- - [ ] **Database backup and restore tools**
1864
- - [ ] **Data export/import utilities** (CSV, JSON, SQL dumps)
2385
+ - βœ… **Database backup and restore tools** - **COMPLETED!**
2386
+ - βœ… **Data export/import utilities** (CSV, JSON, SQL dumps) - **COMPLETED!**
2387
+ - βœ… **Data migration utilities** - **COMPLETED!**
1865
2388
  - [ ] **Performance monitoring and metrics**
1866
2389
  - [ ] **Connection pool monitoring**
1867
2390
  - [ ] **Audit logging and compliance**
1868
- - [ ] **Data migration utilities**
1869
2391
  - [ ] **Schema versioning and migrations**
1870
2392
 
1871
2393
  ### Database Adapters
@@ -1884,9 +2406,9 @@ MIT License - see [LICENSE](LICENSE) file for details.
1884
2406
  - [ ] **Database health checks** - Comprehensive system health monitoring
1885
2407
 
1886
2408
  #### **Phase 2: Data Management** πŸ“Š
1887
- - [ ] **Database backup and restore tools** - Essential for production data safety
1888
- - [ ] **Data migration utilities** - Move data between databases and environments
1889
- - [ ] **Enhanced export/import** - Support for JSON, XML, Excel formats
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!**
1890
2412
  - [ ] **Query history & analytics** - Track and analyze database usage patterns
1891
2413
 
1892
2414
  #### **Phase 3: Enterprise Features** 🏒
@@ -1914,10 +2436,11 @@ MIT License - see [LICENSE](LICENSE) file for details.
1914
2436
  | Table Maintenance | High | Low | 7 | βœ… COMPLETED |
1915
2437
  | Process Management | High | Medium | 8 | βœ… COMPLETED |
1916
2438
  | Query Optimization | Medium | Medium | 9 | βœ… COMPLETED |
1917
- | Database Backup/Restore | High | High | 10 | Pending |
1918
- | Performance Monitoring | High | Medium | 11 | Pending |
1919
- | Data Migration | High | High | 12 | Pending |
1920
- | PostgreSQL Adapter | High | High | 13 | Pending |
2439
+ | Database Backup/Restore | High | High | 10 | βœ… COMPLETED |
2440
+ | Data Export/Import (JSON, SQL) | High | Medium | 11 | βœ… COMPLETED |
2441
+ | Data Migration | High | High | 12 | βœ… COMPLETED |
2442
+ | Performance Monitoring | High | Medium | 13 | Pending |
2443
+ | PostgreSQL Adapter | High | High | 14 | Pending |
1921
2444
  | Audit Logging | Medium | Low | 14 | Pending |
1922
2445
  | Schema Versioning | Medium | Medium | 15 | Pending |
1923
2446