@berthojoris/mcp-mysql-server 1.5.0 → 1.6.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 +477 -17
- package/README.md +102 -5
- package/dist/index.d.ts +401 -0
- package/dist/index.js +311 -0
- package/dist/mcp-server.js +1067 -0
- package/dist/tools/constraintTools.d.ts +108 -0
- package/dist/tools/constraintTools.js +405 -0
- package/dist/tools/functionTools.d.ts +93 -0
- package/dist/tools/functionTools.js +351 -0
- package/dist/tools/indexTools.d.ts +81 -0
- package/dist/tools/indexTools.js +345 -0
- package/dist/tools/maintenanceTools.d.ts +111 -0
- package/dist/tools/maintenanceTools.js +371 -0
- package/dist/tools/processTools.d.ts +106 -0
- package/dist/tools/processTools.js +305 -0
- package/dist/tools/triggerTools.d.ts +76 -0
- package/dist/tools/triggerTools.js +294 -0
- package/dist/tools/viewTools.d.ts +91 -0
- package/dist/tools/viewTools.js +330 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12,6 +12,13 @@ const ddlTools_1 = require("./tools/ddlTools");
|
|
|
12
12
|
const transactionTools_1 = require("./tools/transactionTools");
|
|
13
13
|
const storedProcedureTools_1 = require("./tools/storedProcedureTools");
|
|
14
14
|
const dataExportTools_1 = require("./tools/dataExportTools");
|
|
15
|
+
const viewTools_1 = require("./tools/viewTools");
|
|
16
|
+
const triggerTools_1 = require("./tools/triggerTools");
|
|
17
|
+
const functionTools_1 = require("./tools/functionTools");
|
|
18
|
+
const indexTools_1 = require("./tools/indexTools");
|
|
19
|
+
const constraintTools_1 = require("./tools/constraintTools");
|
|
20
|
+
const maintenanceTools_1 = require("./tools/maintenanceTools");
|
|
21
|
+
const processTools_1 = require("./tools/processTools");
|
|
15
22
|
const securityLayer_1 = __importDefault(require("./security/securityLayer"));
|
|
16
23
|
const connection_1 = __importDefault(require("./db/connection"));
|
|
17
24
|
const featureConfig_1 = require("./config/featureConfig");
|
|
@@ -31,6 +38,13 @@ class MySQLMCP {
|
|
|
31
38
|
this.transactionTools = new transactionTools_1.TransactionTools();
|
|
32
39
|
this.storedProcedureTools = new storedProcedureTools_1.StoredProcedureTools(this.security);
|
|
33
40
|
this.dataExportTools = new dataExportTools_1.DataExportTools(this.security);
|
|
41
|
+
this.viewTools = new viewTools_1.ViewTools(this.security);
|
|
42
|
+
this.triggerTools = new triggerTools_1.TriggerTools(this.security);
|
|
43
|
+
this.functionTools = new functionTools_1.FunctionTools(this.security);
|
|
44
|
+
this.indexTools = new indexTools_1.IndexTools(this.security);
|
|
45
|
+
this.constraintTools = new constraintTools_1.ConstraintTools(this.security);
|
|
46
|
+
this.maintenanceTools = new maintenanceTools_1.MaintenanceTools(this.security);
|
|
47
|
+
this.processTools = new processTools_1.ProcessTools(this.security);
|
|
34
48
|
}
|
|
35
49
|
// Helper method to check if tool is enabled
|
|
36
50
|
checkToolEnabled(toolName) {
|
|
@@ -397,6 +411,303 @@ class MySQLMCP {
|
|
|
397
411
|
},
|
|
398
412
|
};
|
|
399
413
|
}
|
|
414
|
+
// ==========================================
|
|
415
|
+
// View Tools
|
|
416
|
+
// ==========================================
|
|
417
|
+
async listViews(params) {
|
|
418
|
+
const check = this.checkToolEnabled("listViews");
|
|
419
|
+
if (!check.enabled)
|
|
420
|
+
return { status: "error", error: check.error };
|
|
421
|
+
return await this.viewTools.listViews(params);
|
|
422
|
+
}
|
|
423
|
+
async getViewInfo(params) {
|
|
424
|
+
const check = this.checkToolEnabled("getViewInfo");
|
|
425
|
+
if (!check.enabled)
|
|
426
|
+
return { status: "error", error: check.error };
|
|
427
|
+
return await this.viewTools.getViewInfo(params);
|
|
428
|
+
}
|
|
429
|
+
async createView(params) {
|
|
430
|
+
const check = this.checkToolEnabled("createView");
|
|
431
|
+
if (!check.enabled)
|
|
432
|
+
return { status: "error", error: check.error };
|
|
433
|
+
return await this.viewTools.createView(params);
|
|
434
|
+
}
|
|
435
|
+
async alterView(params) {
|
|
436
|
+
const check = this.checkToolEnabled("alterView");
|
|
437
|
+
if (!check.enabled)
|
|
438
|
+
return { status: "error", error: check.error };
|
|
439
|
+
return await this.viewTools.alterView(params);
|
|
440
|
+
}
|
|
441
|
+
async dropView(params) {
|
|
442
|
+
const check = this.checkToolEnabled("dropView");
|
|
443
|
+
if (!check.enabled)
|
|
444
|
+
return { status: "error", error: check.error };
|
|
445
|
+
return await this.viewTools.dropView(params);
|
|
446
|
+
}
|
|
447
|
+
async showCreateView(params) {
|
|
448
|
+
const check = this.checkToolEnabled("showCreateView");
|
|
449
|
+
if (!check.enabled)
|
|
450
|
+
return { status: "error", error: check.error };
|
|
451
|
+
return await this.viewTools.showCreateView(params);
|
|
452
|
+
}
|
|
453
|
+
// ==========================================
|
|
454
|
+
// Trigger Tools
|
|
455
|
+
// ==========================================
|
|
456
|
+
async listTriggers(params) {
|
|
457
|
+
const check = this.checkToolEnabled("listTriggers");
|
|
458
|
+
if (!check.enabled)
|
|
459
|
+
return { status: "error", error: check.error };
|
|
460
|
+
return await this.triggerTools.listTriggers(params);
|
|
461
|
+
}
|
|
462
|
+
async getTriggerInfo(params) {
|
|
463
|
+
const check = this.checkToolEnabled("getTriggerInfo");
|
|
464
|
+
if (!check.enabled)
|
|
465
|
+
return { status: "error", error: check.error };
|
|
466
|
+
return await this.triggerTools.getTriggerInfo(params);
|
|
467
|
+
}
|
|
468
|
+
async createTrigger(params) {
|
|
469
|
+
const check = this.checkToolEnabled("createTrigger");
|
|
470
|
+
if (!check.enabled)
|
|
471
|
+
return { status: "error", error: check.error };
|
|
472
|
+
return await this.triggerTools.createTrigger(params);
|
|
473
|
+
}
|
|
474
|
+
async dropTrigger(params) {
|
|
475
|
+
const check = this.checkToolEnabled("dropTrigger");
|
|
476
|
+
if (!check.enabled)
|
|
477
|
+
return { status: "error", error: check.error };
|
|
478
|
+
return await this.triggerTools.dropTrigger(params);
|
|
479
|
+
}
|
|
480
|
+
async showCreateTrigger(params) {
|
|
481
|
+
const check = this.checkToolEnabled("showCreateTrigger");
|
|
482
|
+
if (!check.enabled)
|
|
483
|
+
return { status: "error", error: check.error };
|
|
484
|
+
return await this.triggerTools.showCreateTrigger(params);
|
|
485
|
+
}
|
|
486
|
+
// ==========================================
|
|
487
|
+
// Function Tools
|
|
488
|
+
// ==========================================
|
|
489
|
+
async listFunctions(params) {
|
|
490
|
+
const check = this.checkToolEnabled("listFunctions");
|
|
491
|
+
if (!check.enabled)
|
|
492
|
+
return { status: "error", error: check.error };
|
|
493
|
+
return await this.functionTools.listFunctions(params);
|
|
494
|
+
}
|
|
495
|
+
async getFunctionInfo(params) {
|
|
496
|
+
const check = this.checkToolEnabled("getFunctionInfo");
|
|
497
|
+
if (!check.enabled)
|
|
498
|
+
return { status: "error", error: check.error };
|
|
499
|
+
return await this.functionTools.getFunctionInfo(params);
|
|
500
|
+
}
|
|
501
|
+
async createFunction(params) {
|
|
502
|
+
const check = this.checkToolEnabled("createFunction");
|
|
503
|
+
if (!check.enabled)
|
|
504
|
+
return { status: "error", error: check.error };
|
|
505
|
+
return await this.functionTools.createFunction(params);
|
|
506
|
+
}
|
|
507
|
+
async dropFunction(params) {
|
|
508
|
+
const check = this.checkToolEnabled("dropFunction");
|
|
509
|
+
if (!check.enabled)
|
|
510
|
+
return { status: "error", error: check.error };
|
|
511
|
+
return await this.functionTools.dropFunction(params);
|
|
512
|
+
}
|
|
513
|
+
async showCreateFunction(params) {
|
|
514
|
+
const check = this.checkToolEnabled("showCreateFunction");
|
|
515
|
+
if (!check.enabled)
|
|
516
|
+
return { status: "error", error: check.error };
|
|
517
|
+
return await this.functionTools.showCreateFunction(params);
|
|
518
|
+
}
|
|
519
|
+
async executeFunction(params) {
|
|
520
|
+
const check = this.checkToolEnabled("executeFunction");
|
|
521
|
+
if (!check.enabled)
|
|
522
|
+
return { status: "error", error: check.error };
|
|
523
|
+
return await this.functionTools.executeFunction(params);
|
|
524
|
+
}
|
|
525
|
+
// ==========================================
|
|
526
|
+
// Index Tools
|
|
527
|
+
// ==========================================
|
|
528
|
+
async listIndexes(params) {
|
|
529
|
+
const check = this.checkToolEnabled("listIndexes");
|
|
530
|
+
if (!check.enabled)
|
|
531
|
+
return { status: "error", error: check.error };
|
|
532
|
+
return await this.indexTools.listIndexes(params);
|
|
533
|
+
}
|
|
534
|
+
async getIndexInfo(params) {
|
|
535
|
+
const check = this.checkToolEnabled("getIndexInfo");
|
|
536
|
+
if (!check.enabled)
|
|
537
|
+
return { status: "error", error: check.error };
|
|
538
|
+
return await this.indexTools.getIndexInfo(params);
|
|
539
|
+
}
|
|
540
|
+
async createIndex(params) {
|
|
541
|
+
const check = this.checkToolEnabled("createIndex");
|
|
542
|
+
if (!check.enabled)
|
|
543
|
+
return { status: "error", error: check.error };
|
|
544
|
+
return await this.indexTools.createIndex(params);
|
|
545
|
+
}
|
|
546
|
+
async dropIndex(params) {
|
|
547
|
+
const check = this.checkToolEnabled("dropIndex");
|
|
548
|
+
if (!check.enabled)
|
|
549
|
+
return { status: "error", error: check.error };
|
|
550
|
+
return await this.indexTools.dropIndex(params);
|
|
551
|
+
}
|
|
552
|
+
async analyzeIndex(params) {
|
|
553
|
+
const check = this.checkToolEnabled("analyzeIndex");
|
|
554
|
+
if (!check.enabled)
|
|
555
|
+
return { status: "error", error: check.error };
|
|
556
|
+
return await this.indexTools.analyzeIndex(params);
|
|
557
|
+
}
|
|
558
|
+
// ==========================================
|
|
559
|
+
// Constraint Tools
|
|
560
|
+
// ==========================================
|
|
561
|
+
async listForeignKeys(params) {
|
|
562
|
+
const check = this.checkToolEnabled("listForeignKeys");
|
|
563
|
+
if (!check.enabled)
|
|
564
|
+
return { status: "error", error: check.error };
|
|
565
|
+
return await this.constraintTools.listForeignKeys(params);
|
|
566
|
+
}
|
|
567
|
+
async listConstraints(params) {
|
|
568
|
+
const check = this.checkToolEnabled("listConstraints");
|
|
569
|
+
if (!check.enabled)
|
|
570
|
+
return { status: "error", error: check.error };
|
|
571
|
+
return await this.constraintTools.listConstraints(params);
|
|
572
|
+
}
|
|
573
|
+
async addForeignKey(params) {
|
|
574
|
+
const check = this.checkToolEnabled("addForeignKey");
|
|
575
|
+
if (!check.enabled)
|
|
576
|
+
return { status: "error", error: check.error };
|
|
577
|
+
return await this.constraintTools.addForeignKey(params);
|
|
578
|
+
}
|
|
579
|
+
async dropForeignKey(params) {
|
|
580
|
+
const check = this.checkToolEnabled("dropForeignKey");
|
|
581
|
+
if (!check.enabled)
|
|
582
|
+
return { status: "error", error: check.error };
|
|
583
|
+
return await this.constraintTools.dropForeignKey(params);
|
|
584
|
+
}
|
|
585
|
+
async addUniqueConstraint(params) {
|
|
586
|
+
const check = this.checkToolEnabled("addUniqueConstraint");
|
|
587
|
+
if (!check.enabled)
|
|
588
|
+
return { status: "error", error: check.error };
|
|
589
|
+
return await this.constraintTools.addUniqueConstraint(params);
|
|
590
|
+
}
|
|
591
|
+
async dropConstraint(params) {
|
|
592
|
+
const check = this.checkToolEnabled("dropConstraint");
|
|
593
|
+
if (!check.enabled)
|
|
594
|
+
return { status: "error", error: check.error };
|
|
595
|
+
return await this.constraintTools.dropConstraint(params);
|
|
596
|
+
}
|
|
597
|
+
async addCheckConstraint(params) {
|
|
598
|
+
const check = this.checkToolEnabled("addCheckConstraint");
|
|
599
|
+
if (!check.enabled)
|
|
600
|
+
return { status: "error", error: check.error };
|
|
601
|
+
return await this.constraintTools.addCheckConstraint(params);
|
|
602
|
+
}
|
|
603
|
+
// ==========================================
|
|
604
|
+
// Table Maintenance Tools
|
|
605
|
+
// ==========================================
|
|
606
|
+
async analyzeTable(params) {
|
|
607
|
+
const check = this.checkToolEnabled("analyzeTable");
|
|
608
|
+
if (!check.enabled)
|
|
609
|
+
return { status: "error", error: check.error };
|
|
610
|
+
return await this.maintenanceTools.analyzeTable(params);
|
|
611
|
+
}
|
|
612
|
+
async optimizeTable(params) {
|
|
613
|
+
const check = this.checkToolEnabled("optimizeTable");
|
|
614
|
+
if (!check.enabled)
|
|
615
|
+
return { status: "error", error: check.error };
|
|
616
|
+
return await this.maintenanceTools.optimizeTable(params);
|
|
617
|
+
}
|
|
618
|
+
async checkTable(params) {
|
|
619
|
+
const check = this.checkToolEnabled("checkTable");
|
|
620
|
+
if (!check.enabled)
|
|
621
|
+
return { status: "error", error: check.error };
|
|
622
|
+
return await this.maintenanceTools.checkTable(params);
|
|
623
|
+
}
|
|
624
|
+
async repairTable(params) {
|
|
625
|
+
const check = this.checkToolEnabled("repairTable");
|
|
626
|
+
if (!check.enabled)
|
|
627
|
+
return { status: "error", error: check.error };
|
|
628
|
+
return await this.maintenanceTools.repairTable(params);
|
|
629
|
+
}
|
|
630
|
+
async truncateTable(params) {
|
|
631
|
+
const check = this.checkToolEnabled("truncateTable");
|
|
632
|
+
if (!check.enabled)
|
|
633
|
+
return { status: "error", error: check.error };
|
|
634
|
+
return await this.maintenanceTools.truncateTable(params);
|
|
635
|
+
}
|
|
636
|
+
async getTableStatus(params) {
|
|
637
|
+
const check = this.checkToolEnabled("getTableStatus");
|
|
638
|
+
if (!check.enabled)
|
|
639
|
+
return { status: "error", error: check.error };
|
|
640
|
+
return await this.maintenanceTools.getTableStatus(params);
|
|
641
|
+
}
|
|
642
|
+
async flushTable(params) {
|
|
643
|
+
const check = this.checkToolEnabled("flushTable");
|
|
644
|
+
if (!check.enabled)
|
|
645
|
+
return { status: "error", error: check.error };
|
|
646
|
+
return await this.maintenanceTools.flushTable(params);
|
|
647
|
+
}
|
|
648
|
+
async getTableSize(params) {
|
|
649
|
+
const check = this.checkToolEnabled("getTableSize");
|
|
650
|
+
if (!check.enabled)
|
|
651
|
+
return { status: "error", error: check.error };
|
|
652
|
+
return await this.maintenanceTools.getTableSize(params);
|
|
653
|
+
}
|
|
654
|
+
// ==========================================
|
|
655
|
+
// Process Management Tools
|
|
656
|
+
// ==========================================
|
|
657
|
+
async showProcessList(params) {
|
|
658
|
+
const check = this.checkToolEnabled("showProcessList");
|
|
659
|
+
if (!check.enabled)
|
|
660
|
+
return { status: "error", error: check.error };
|
|
661
|
+
return await this.processTools.showProcessList(params);
|
|
662
|
+
}
|
|
663
|
+
async killProcess(params) {
|
|
664
|
+
const check = this.checkToolEnabled("killProcess");
|
|
665
|
+
if (!check.enabled)
|
|
666
|
+
return { status: "error", error: check.error };
|
|
667
|
+
return await this.processTools.killProcess(params);
|
|
668
|
+
}
|
|
669
|
+
async showStatus(params) {
|
|
670
|
+
const check = this.checkToolEnabled("showStatus");
|
|
671
|
+
if (!check.enabled)
|
|
672
|
+
return { status: "error", error: check.error };
|
|
673
|
+
return await this.processTools.showStatus(params);
|
|
674
|
+
}
|
|
675
|
+
async showVariables(params) {
|
|
676
|
+
const check = this.checkToolEnabled("showVariables");
|
|
677
|
+
if (!check.enabled)
|
|
678
|
+
return { status: "error", error: check.error };
|
|
679
|
+
return await this.processTools.showVariables(params);
|
|
680
|
+
}
|
|
681
|
+
async explainQuery(params) {
|
|
682
|
+
const check = this.checkToolEnabled("explainQuery");
|
|
683
|
+
if (!check.enabled)
|
|
684
|
+
return { status: "error", error: check.error };
|
|
685
|
+
return await this.processTools.explainQuery(params);
|
|
686
|
+
}
|
|
687
|
+
async showEngineStatus(params) {
|
|
688
|
+
const check = this.checkToolEnabled("showEngineStatus");
|
|
689
|
+
if (!check.enabled)
|
|
690
|
+
return { status: "error", error: check.error };
|
|
691
|
+
return await this.processTools.showEngineStatus(params);
|
|
692
|
+
}
|
|
693
|
+
async getServerInfo() {
|
|
694
|
+
const check = this.checkToolEnabled("getServerInfo");
|
|
695
|
+
if (!check.enabled)
|
|
696
|
+
return { status: "error", error: check.error };
|
|
697
|
+
return await this.processTools.getServerInfo();
|
|
698
|
+
}
|
|
699
|
+
async showBinaryLogs() {
|
|
700
|
+
const check = this.checkToolEnabled("showBinaryLogs");
|
|
701
|
+
if (!check.enabled)
|
|
702
|
+
return { status: "error", error: check.error };
|
|
703
|
+
return await this.processTools.showBinaryLogs();
|
|
704
|
+
}
|
|
705
|
+
async showReplicationStatus(params) {
|
|
706
|
+
const check = this.checkToolEnabled("showReplicationStatus");
|
|
707
|
+
if (!check.enabled)
|
|
708
|
+
return { status: "error", error: check.error };
|
|
709
|
+
return await this.processTools.showReplicationStatus(params);
|
|
710
|
+
}
|
|
400
711
|
}
|
|
401
712
|
exports.MySQLMCP = MySQLMCP;
|
|
402
713
|
exports.default = MySQLMCP;
|