@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.
@@ -944,6 +944,928 @@ const TOOLS = [
944
944
  required: ["goal"],
945
945
  },
946
946
  },
947
+ // View Tools
948
+ {
949
+ name: "list_views",
950
+ description: "Lists all views in the connected database.",
951
+ inputSchema: {
952
+ type: "object",
953
+ properties: {
954
+ database: {
955
+ type: "string",
956
+ description: "Optional: specific database name",
957
+ },
958
+ },
959
+ },
960
+ },
961
+ {
962
+ name: "get_view_info",
963
+ description: "Gets detailed information about a specific view including columns and definition.",
964
+ inputSchema: {
965
+ type: "object",
966
+ properties: {
967
+ view_name: { type: "string", description: "Name of the view" },
968
+ database: {
969
+ type: "string",
970
+ description: "Optional: specific database name",
971
+ },
972
+ },
973
+ required: ["view_name"],
974
+ },
975
+ },
976
+ {
977
+ name: "create_view",
978
+ description: "Creates a new view with the specified SELECT definition. Requires 'ddl' permission.",
979
+ inputSchema: {
980
+ type: "object",
981
+ properties: {
982
+ view_name: {
983
+ type: "string",
984
+ description: "Name of the view to create",
985
+ },
986
+ definition: {
987
+ type: "string",
988
+ description: "SELECT statement that defines the view",
989
+ },
990
+ or_replace: {
991
+ type: "boolean",
992
+ description: "If true, replaces existing view",
993
+ },
994
+ algorithm: {
995
+ type: "string",
996
+ enum: ["UNDEFINED", "MERGE", "TEMPTABLE"],
997
+ description: "View algorithm",
998
+ },
999
+ security: {
1000
+ type: "string",
1001
+ enum: ["DEFINER", "INVOKER"],
1002
+ description: "Security context",
1003
+ },
1004
+ check_option: {
1005
+ type: "string",
1006
+ enum: ["CASCADED", "LOCAL"],
1007
+ description: "Check option for updatable views",
1008
+ },
1009
+ database: {
1010
+ type: "string",
1011
+ description: "Optional: specific database name",
1012
+ },
1013
+ },
1014
+ required: ["view_name", "definition"],
1015
+ },
1016
+ },
1017
+ {
1018
+ name: "alter_view",
1019
+ description: "Alters an existing view definition. Requires 'ddl' permission.",
1020
+ inputSchema: {
1021
+ type: "object",
1022
+ properties: {
1023
+ view_name: { type: "string", description: "Name of the view to alter" },
1024
+ definition: {
1025
+ type: "string",
1026
+ description: "New SELECT statement that defines the view",
1027
+ },
1028
+ algorithm: {
1029
+ type: "string",
1030
+ enum: ["UNDEFINED", "MERGE", "TEMPTABLE"],
1031
+ description: "View algorithm",
1032
+ },
1033
+ security: {
1034
+ type: "string",
1035
+ enum: ["DEFINER", "INVOKER"],
1036
+ description: "Security context",
1037
+ },
1038
+ check_option: {
1039
+ type: "string",
1040
+ enum: ["CASCADED", "LOCAL"],
1041
+ description: "Check option",
1042
+ },
1043
+ database: {
1044
+ type: "string",
1045
+ description: "Optional: specific database name",
1046
+ },
1047
+ },
1048
+ required: ["view_name", "definition"],
1049
+ },
1050
+ },
1051
+ {
1052
+ name: "drop_view",
1053
+ description: "Drops a view. Requires 'ddl' permission. WARNING: This is irreversible!",
1054
+ inputSchema: {
1055
+ type: "object",
1056
+ properties: {
1057
+ view_name: { type: "string", description: "Name of the view to drop" },
1058
+ if_exists: {
1059
+ type: "boolean",
1060
+ description: "If true, will not error if view does not exist",
1061
+ },
1062
+ database: {
1063
+ type: "string",
1064
+ description: "Optional: specific database name",
1065
+ },
1066
+ },
1067
+ required: ["view_name"],
1068
+ },
1069
+ },
1070
+ {
1071
+ name: "show_create_view",
1072
+ description: "Shows the CREATE statement for a view.",
1073
+ inputSchema: {
1074
+ type: "object",
1075
+ properties: {
1076
+ view_name: { type: "string", description: "Name of the view" },
1077
+ database: {
1078
+ type: "string",
1079
+ description: "Optional: specific database name",
1080
+ },
1081
+ },
1082
+ required: ["view_name"],
1083
+ },
1084
+ },
1085
+ // Trigger Tools
1086
+ {
1087
+ name: "list_triggers",
1088
+ description: "Lists all triggers in the database, optionally filtered by table.",
1089
+ inputSchema: {
1090
+ type: "object",
1091
+ properties: {
1092
+ database: {
1093
+ type: "string",
1094
+ description: "Optional: specific database name",
1095
+ },
1096
+ table_name: {
1097
+ type: "string",
1098
+ description: "Optional: filter triggers for specific table",
1099
+ },
1100
+ },
1101
+ },
1102
+ },
1103
+ {
1104
+ name: "get_trigger_info",
1105
+ description: "Gets detailed information about a specific trigger.",
1106
+ inputSchema: {
1107
+ type: "object",
1108
+ properties: {
1109
+ trigger_name: { type: "string", description: "Name of the trigger" },
1110
+ database: {
1111
+ type: "string",
1112
+ description: "Optional: specific database name",
1113
+ },
1114
+ },
1115
+ required: ["trigger_name"],
1116
+ },
1117
+ },
1118
+ {
1119
+ name: "create_trigger",
1120
+ description: "Creates a new trigger on a table. Requires 'ddl' permission.",
1121
+ inputSchema: {
1122
+ type: "object",
1123
+ properties: {
1124
+ trigger_name: { type: "string", description: "Name of the trigger" },
1125
+ table_name: {
1126
+ type: "string",
1127
+ description: "Table the trigger is associated with",
1128
+ },
1129
+ timing: {
1130
+ type: "string",
1131
+ enum: ["BEFORE", "AFTER"],
1132
+ description: "When the trigger fires",
1133
+ },
1134
+ event: {
1135
+ type: "string",
1136
+ enum: ["INSERT", "UPDATE", "DELETE"],
1137
+ description: "Event that fires the trigger",
1138
+ },
1139
+ body: { type: "string", description: "SQL statements to execute" },
1140
+ definer: {
1141
+ type: "string",
1142
+ description: "Optional: user who owns the trigger",
1143
+ },
1144
+ database: {
1145
+ type: "string",
1146
+ description: "Optional: specific database name",
1147
+ },
1148
+ },
1149
+ required: ["trigger_name", "table_name", "timing", "event", "body"],
1150
+ },
1151
+ },
1152
+ {
1153
+ name: "drop_trigger",
1154
+ description: "Drops a trigger. Requires 'ddl' permission. WARNING: This is irreversible!",
1155
+ inputSchema: {
1156
+ type: "object",
1157
+ properties: {
1158
+ trigger_name: {
1159
+ type: "string",
1160
+ description: "Name of the trigger to drop",
1161
+ },
1162
+ if_exists: {
1163
+ type: "boolean",
1164
+ description: "If true, will not error if trigger does not exist",
1165
+ },
1166
+ database: {
1167
+ type: "string",
1168
+ description: "Optional: specific database name",
1169
+ },
1170
+ },
1171
+ required: ["trigger_name"],
1172
+ },
1173
+ },
1174
+ {
1175
+ name: "show_create_trigger",
1176
+ description: "Shows the CREATE statement for a trigger.",
1177
+ inputSchema: {
1178
+ type: "object",
1179
+ properties: {
1180
+ trigger_name: { type: "string", description: "Name of the trigger" },
1181
+ database: {
1182
+ type: "string",
1183
+ description: "Optional: specific database name",
1184
+ },
1185
+ },
1186
+ required: ["trigger_name"],
1187
+ },
1188
+ },
1189
+ // Function Tools
1190
+ {
1191
+ name: "list_functions",
1192
+ description: "Lists all user-defined functions in the database.",
1193
+ inputSchema: {
1194
+ type: "object",
1195
+ properties: {
1196
+ database: {
1197
+ type: "string",
1198
+ description: "Optional: specific database name",
1199
+ },
1200
+ },
1201
+ },
1202
+ },
1203
+ {
1204
+ name: "get_function_info",
1205
+ description: "Gets detailed information about a specific function including parameters.",
1206
+ inputSchema: {
1207
+ type: "object",
1208
+ properties: {
1209
+ function_name: { type: "string", description: "Name of the function" },
1210
+ database: {
1211
+ type: "string",
1212
+ description: "Optional: specific database name",
1213
+ },
1214
+ },
1215
+ required: ["function_name"],
1216
+ },
1217
+ },
1218
+ {
1219
+ name: "create_function",
1220
+ description: "Creates a new user-defined function. Requires 'ddl' permission.",
1221
+ inputSchema: {
1222
+ type: "object",
1223
+ properties: {
1224
+ function_name: { type: "string", description: "Name of the function" },
1225
+ parameters: {
1226
+ type: "array",
1227
+ description: "Array of parameter definitions",
1228
+ items: {
1229
+ type: "object",
1230
+ properties: {
1231
+ name: { type: "string" },
1232
+ data_type: { type: "string" },
1233
+ },
1234
+ required: ["name", "data_type"],
1235
+ },
1236
+ },
1237
+ returns: { type: "string", description: "Return data type" },
1238
+ body: { type: "string", description: "Function body (SQL statements)" },
1239
+ deterministic: {
1240
+ type: "boolean",
1241
+ description: "Whether function always returns same result for same input",
1242
+ },
1243
+ data_access: {
1244
+ type: "string",
1245
+ enum: [
1246
+ "CONTAINS SQL",
1247
+ "NO SQL",
1248
+ "READS SQL DATA",
1249
+ "MODIFIES SQL DATA",
1250
+ ],
1251
+ },
1252
+ security: { type: "string", enum: ["DEFINER", "INVOKER"] },
1253
+ comment: { type: "string", description: "Optional comment" },
1254
+ database: {
1255
+ type: "string",
1256
+ description: "Optional: specific database name",
1257
+ },
1258
+ },
1259
+ required: ["function_name", "returns", "body"],
1260
+ },
1261
+ },
1262
+ {
1263
+ name: "drop_function",
1264
+ description: "Drops a user-defined function. Requires 'ddl' permission.",
1265
+ inputSchema: {
1266
+ type: "object",
1267
+ properties: {
1268
+ function_name: {
1269
+ type: "string",
1270
+ description: "Name of the function to drop",
1271
+ },
1272
+ if_exists: {
1273
+ type: "boolean",
1274
+ description: "If true, will not error if function does not exist",
1275
+ },
1276
+ database: {
1277
+ type: "string",
1278
+ description: "Optional: specific database name",
1279
+ },
1280
+ },
1281
+ required: ["function_name"],
1282
+ },
1283
+ },
1284
+ {
1285
+ name: "show_create_function",
1286
+ description: "Shows the CREATE statement for a function.",
1287
+ inputSchema: {
1288
+ type: "object",
1289
+ properties: {
1290
+ function_name: { type: "string", description: "Name of the function" },
1291
+ database: {
1292
+ type: "string",
1293
+ description: "Optional: specific database name",
1294
+ },
1295
+ },
1296
+ required: ["function_name"],
1297
+ },
1298
+ },
1299
+ {
1300
+ name: "execute_function",
1301
+ description: "Executes a user-defined function and returns its result.",
1302
+ inputSchema: {
1303
+ type: "object",
1304
+ properties: {
1305
+ function_name: {
1306
+ type: "string",
1307
+ description: "Name of the function to execute",
1308
+ },
1309
+ parameters: {
1310
+ type: "array",
1311
+ description: "Array of parameter values",
1312
+ items: {},
1313
+ },
1314
+ database: {
1315
+ type: "string",
1316
+ description: "Optional: specific database name",
1317
+ },
1318
+ },
1319
+ required: ["function_name"],
1320
+ },
1321
+ },
1322
+ // Index Tools
1323
+ {
1324
+ name: "list_indexes",
1325
+ description: "Lists all indexes for a specific table.",
1326
+ inputSchema: {
1327
+ type: "object",
1328
+ properties: {
1329
+ table_name: { type: "string", description: "Name of the table" },
1330
+ database: {
1331
+ type: "string",
1332
+ description: "Optional: specific database name",
1333
+ },
1334
+ },
1335
+ required: ["table_name"],
1336
+ },
1337
+ },
1338
+ {
1339
+ name: "get_index_info",
1340
+ description: "Gets detailed information about a specific index.",
1341
+ inputSchema: {
1342
+ type: "object",
1343
+ properties: {
1344
+ table_name: { type: "string", description: "Name of the table" },
1345
+ index_name: { type: "string", description: "Name of the index" },
1346
+ database: {
1347
+ type: "string",
1348
+ description: "Optional: specific database name",
1349
+ },
1350
+ },
1351
+ required: ["table_name", "index_name"],
1352
+ },
1353
+ },
1354
+ {
1355
+ name: "create_index",
1356
+ description: "Creates a new index on a table. Requires 'ddl' permission.",
1357
+ inputSchema: {
1358
+ type: "object",
1359
+ properties: {
1360
+ table_name: { type: "string", description: "Name of the table" },
1361
+ index_name: { type: "string", description: "Name of the index" },
1362
+ columns: {
1363
+ type: "array",
1364
+ description: "Columns to index (string or object with column, length, order)",
1365
+ items: {},
1366
+ },
1367
+ unique: { type: "boolean", description: "Whether index is unique" },
1368
+ index_type: {
1369
+ type: "string",
1370
+ enum: ["BTREE", "HASH", "FULLTEXT", "SPATIAL"],
1371
+ description: "Index type",
1372
+ },
1373
+ comment: { type: "string", description: "Optional comment" },
1374
+ database: {
1375
+ type: "string",
1376
+ description: "Optional: specific database name",
1377
+ },
1378
+ },
1379
+ required: ["table_name", "index_name", "columns"],
1380
+ },
1381
+ },
1382
+ {
1383
+ name: "drop_index",
1384
+ description: "Drops an index from a table. Requires 'ddl' permission.",
1385
+ inputSchema: {
1386
+ type: "object",
1387
+ properties: {
1388
+ table_name: { type: "string", description: "Name of the table" },
1389
+ index_name: {
1390
+ type: "string",
1391
+ description: "Name of the index to drop",
1392
+ },
1393
+ database: {
1394
+ type: "string",
1395
+ description: "Optional: specific database name",
1396
+ },
1397
+ },
1398
+ required: ["table_name", "index_name"],
1399
+ },
1400
+ },
1401
+ {
1402
+ name: "analyze_index",
1403
+ description: "Analyzes a table to update index statistics.",
1404
+ inputSchema: {
1405
+ type: "object",
1406
+ properties: {
1407
+ table_name: {
1408
+ type: "string",
1409
+ description: "Name of the table to analyze",
1410
+ },
1411
+ database: {
1412
+ type: "string",
1413
+ description: "Optional: specific database name",
1414
+ },
1415
+ },
1416
+ required: ["table_name"],
1417
+ },
1418
+ },
1419
+ // Constraint Tools
1420
+ {
1421
+ name: "list_foreign_keys",
1422
+ description: "Lists all foreign key constraints for a table.",
1423
+ inputSchema: {
1424
+ type: "object",
1425
+ properties: {
1426
+ table_name: { type: "string", description: "Name of the table" },
1427
+ database: {
1428
+ type: "string",
1429
+ description: "Optional: specific database name",
1430
+ },
1431
+ },
1432
+ required: ["table_name"],
1433
+ },
1434
+ },
1435
+ {
1436
+ name: "list_constraints",
1437
+ description: "Lists all constraints (PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK) for a table.",
1438
+ inputSchema: {
1439
+ type: "object",
1440
+ properties: {
1441
+ table_name: { type: "string", description: "Name of the table" },
1442
+ database: {
1443
+ type: "string",
1444
+ description: "Optional: specific database name",
1445
+ },
1446
+ },
1447
+ required: ["table_name"],
1448
+ },
1449
+ },
1450
+ {
1451
+ name: "add_foreign_key",
1452
+ description: "Adds a foreign key constraint to a table. Requires 'ddl' permission.",
1453
+ inputSchema: {
1454
+ type: "object",
1455
+ properties: {
1456
+ table_name: { type: "string", description: "Name of the table" },
1457
+ constraint_name: {
1458
+ type: "string",
1459
+ description: "Name of the constraint",
1460
+ },
1461
+ columns: {
1462
+ type: "array",
1463
+ items: { type: "string" },
1464
+ description: "Columns in the foreign key",
1465
+ },
1466
+ referenced_table: {
1467
+ type: "string",
1468
+ description: "Referenced table name",
1469
+ },
1470
+ referenced_columns: {
1471
+ type: "array",
1472
+ items: { type: "string" },
1473
+ description: "Referenced columns",
1474
+ },
1475
+ on_delete: {
1476
+ type: "string",
1477
+ enum: ["CASCADE", "SET NULL", "RESTRICT", "NO ACTION", "SET DEFAULT"],
1478
+ },
1479
+ on_update: {
1480
+ type: "string",
1481
+ enum: ["CASCADE", "SET NULL", "RESTRICT", "NO ACTION", "SET DEFAULT"],
1482
+ },
1483
+ database: {
1484
+ type: "string",
1485
+ description: "Optional: specific database name",
1486
+ },
1487
+ },
1488
+ required: [
1489
+ "table_name",
1490
+ "constraint_name",
1491
+ "columns",
1492
+ "referenced_table",
1493
+ "referenced_columns",
1494
+ ],
1495
+ },
1496
+ },
1497
+ {
1498
+ name: "drop_foreign_key",
1499
+ description: "Drops a foreign key constraint. Requires 'ddl' permission.",
1500
+ inputSchema: {
1501
+ type: "object",
1502
+ properties: {
1503
+ table_name: { type: "string", description: "Name of the table" },
1504
+ constraint_name: {
1505
+ type: "string",
1506
+ description: "Name of the constraint to drop",
1507
+ },
1508
+ database: {
1509
+ type: "string",
1510
+ description: "Optional: specific database name",
1511
+ },
1512
+ },
1513
+ required: ["table_name", "constraint_name"],
1514
+ },
1515
+ },
1516
+ {
1517
+ name: "add_unique_constraint",
1518
+ description: "Adds a unique constraint to a table. Requires 'ddl' permission.",
1519
+ inputSchema: {
1520
+ type: "object",
1521
+ properties: {
1522
+ table_name: { type: "string", description: "Name of the table" },
1523
+ constraint_name: {
1524
+ type: "string",
1525
+ description: "Name of the constraint",
1526
+ },
1527
+ columns: {
1528
+ type: "array",
1529
+ items: { type: "string" },
1530
+ description: "Columns in the unique constraint",
1531
+ },
1532
+ database: {
1533
+ type: "string",
1534
+ description: "Optional: specific database name",
1535
+ },
1536
+ },
1537
+ required: ["table_name", "constraint_name", "columns"],
1538
+ },
1539
+ },
1540
+ {
1541
+ name: "drop_constraint",
1542
+ description: "Drops a UNIQUE or CHECK constraint. Requires 'ddl' permission.",
1543
+ inputSchema: {
1544
+ type: "object",
1545
+ properties: {
1546
+ table_name: { type: "string", description: "Name of the table" },
1547
+ constraint_name: {
1548
+ type: "string",
1549
+ description: "Name of the constraint",
1550
+ },
1551
+ constraint_type: {
1552
+ type: "string",
1553
+ enum: ["UNIQUE", "CHECK"],
1554
+ description: "Type of constraint",
1555
+ },
1556
+ database: {
1557
+ type: "string",
1558
+ description: "Optional: specific database name",
1559
+ },
1560
+ },
1561
+ required: ["table_name", "constraint_name", "constraint_type"],
1562
+ },
1563
+ },
1564
+ {
1565
+ name: "add_check_constraint",
1566
+ description: "Adds a CHECK constraint to a table (MySQL 8.0.16+). Requires 'ddl' permission.",
1567
+ inputSchema: {
1568
+ type: "object",
1569
+ properties: {
1570
+ table_name: { type: "string", description: "Name of the table" },
1571
+ constraint_name: {
1572
+ type: "string",
1573
+ description: "Name of the constraint",
1574
+ },
1575
+ expression: {
1576
+ type: "string",
1577
+ description: "Check expression (e.g., 'age >= 18')",
1578
+ },
1579
+ enforced: {
1580
+ type: "boolean",
1581
+ description: "Whether constraint is enforced (default: true)",
1582
+ },
1583
+ database: {
1584
+ type: "string",
1585
+ description: "Optional: specific database name",
1586
+ },
1587
+ },
1588
+ required: ["table_name", "constraint_name", "expression"],
1589
+ },
1590
+ },
1591
+ // Table Maintenance Tools
1592
+ {
1593
+ name: "analyze_table",
1594
+ description: "Analyzes a table to update index statistics for the query optimizer.",
1595
+ inputSchema: {
1596
+ type: "object",
1597
+ properties: {
1598
+ table_name: {
1599
+ type: "string",
1600
+ description: "Name of the table to analyze",
1601
+ },
1602
+ database: {
1603
+ type: "string",
1604
+ description: "Optional: specific database name",
1605
+ },
1606
+ },
1607
+ required: ["table_name"],
1608
+ },
1609
+ },
1610
+ {
1611
+ name: "optimize_table",
1612
+ description: "Optimizes a table to reclaim unused space and defragment data.",
1613
+ inputSchema: {
1614
+ type: "object",
1615
+ properties: {
1616
+ table_name: {
1617
+ type: "string",
1618
+ description: "Name of the table to optimize",
1619
+ },
1620
+ database: {
1621
+ type: "string",
1622
+ description: "Optional: specific database name",
1623
+ },
1624
+ },
1625
+ required: ["table_name"],
1626
+ },
1627
+ },
1628
+ {
1629
+ name: "check_table",
1630
+ description: "Checks a table for errors.",
1631
+ inputSchema: {
1632
+ type: "object",
1633
+ properties: {
1634
+ table_name: {
1635
+ type: "string",
1636
+ description: "Name of the table to check",
1637
+ },
1638
+ check_type: {
1639
+ type: "string",
1640
+ enum: ["QUICK", "FAST", "MEDIUM", "EXTENDED", "CHANGED"],
1641
+ description: "Type of check",
1642
+ },
1643
+ database: {
1644
+ type: "string",
1645
+ description: "Optional: specific database name",
1646
+ },
1647
+ },
1648
+ required: ["table_name"],
1649
+ },
1650
+ },
1651
+ {
1652
+ name: "repair_table",
1653
+ description: "Repairs a corrupted table (MyISAM, ARCHIVE, CSV only).",
1654
+ inputSchema: {
1655
+ type: "object",
1656
+ properties: {
1657
+ table_name: {
1658
+ type: "string",
1659
+ description: "Name of the table to repair",
1660
+ },
1661
+ quick: { type: "boolean", description: "Quick repair" },
1662
+ extended: { type: "boolean", description: "Extended repair" },
1663
+ use_frm: { type: "boolean", description: "Use .frm file to repair" },
1664
+ database: {
1665
+ type: "string",
1666
+ description: "Optional: specific database name",
1667
+ },
1668
+ },
1669
+ required: ["table_name"],
1670
+ },
1671
+ },
1672
+ {
1673
+ name: "truncate_table",
1674
+ description: "Truncates a table (removes all rows quickly). Requires 'ddl' permission. WARNING: This is irreversible!",
1675
+ inputSchema: {
1676
+ type: "object",
1677
+ properties: {
1678
+ table_name: {
1679
+ type: "string",
1680
+ description: "Name of the table to truncate",
1681
+ },
1682
+ database: {
1683
+ type: "string",
1684
+ description: "Optional: specific database name",
1685
+ },
1686
+ },
1687
+ required: ["table_name"],
1688
+ },
1689
+ },
1690
+ {
1691
+ name: "get_table_status",
1692
+ description: "Gets detailed status and statistics for one or all tables.",
1693
+ inputSchema: {
1694
+ type: "object",
1695
+ properties: {
1696
+ table_name: {
1697
+ type: "string",
1698
+ description: "Optional: specific table name (omit for all tables)",
1699
+ },
1700
+ database: {
1701
+ type: "string",
1702
+ description: "Optional: specific database name",
1703
+ },
1704
+ },
1705
+ },
1706
+ },
1707
+ {
1708
+ name: "flush_table",
1709
+ description: "Flushes table(s) - closes and reopens them.",
1710
+ inputSchema: {
1711
+ type: "object",
1712
+ properties: {
1713
+ table_name: {
1714
+ type: "string",
1715
+ description: "Optional: specific table (omit for all tables)",
1716
+ },
1717
+ with_read_lock: {
1718
+ type: "boolean",
1719
+ description: "Acquire read lock after flushing",
1720
+ },
1721
+ database: {
1722
+ type: "string",
1723
+ description: "Optional: specific database name",
1724
+ },
1725
+ },
1726
+ },
1727
+ },
1728
+ {
1729
+ name: "get_table_size",
1730
+ description: "Gets size information for one or all tables including data and index sizes.",
1731
+ inputSchema: {
1732
+ type: "object",
1733
+ properties: {
1734
+ table_name: {
1735
+ type: "string",
1736
+ description: "Optional: specific table name (omit for all tables)",
1737
+ },
1738
+ database: {
1739
+ type: "string",
1740
+ description: "Optional: specific database name",
1741
+ },
1742
+ },
1743
+ },
1744
+ },
1745
+ // Process Management Tools
1746
+ {
1747
+ name: "show_process_list",
1748
+ description: "Shows all running MySQL processes/connections.",
1749
+ inputSchema: {
1750
+ type: "object",
1751
+ properties: {
1752
+ full: { type: "boolean", description: "Show full query text" },
1753
+ },
1754
+ },
1755
+ },
1756
+ {
1757
+ name: "kill_process",
1758
+ description: "Kills a MySQL process/connection by ID.",
1759
+ inputSchema: {
1760
+ type: "object",
1761
+ properties: {
1762
+ process_id: { type: "number", description: "Process ID to kill" },
1763
+ type: {
1764
+ type: "string",
1765
+ enum: ["CONNECTION", "QUERY"],
1766
+ description: "Kill connection or just query",
1767
+ },
1768
+ },
1769
+ required: ["process_id"],
1770
+ },
1771
+ },
1772
+ {
1773
+ name: "show_status",
1774
+ description: "Shows MySQL server status variables.",
1775
+ inputSchema: {
1776
+ type: "object",
1777
+ properties: {
1778
+ like: {
1779
+ type: "string",
1780
+ description: "Optional: filter pattern (e.g., 'Thread%')",
1781
+ },
1782
+ global: {
1783
+ type: "boolean",
1784
+ description: "Show global status instead of session",
1785
+ },
1786
+ },
1787
+ },
1788
+ },
1789
+ {
1790
+ name: "show_variables",
1791
+ description: "Shows MySQL server configuration variables.",
1792
+ inputSchema: {
1793
+ type: "object",
1794
+ properties: {
1795
+ like: {
1796
+ type: "string",
1797
+ description: "Optional: filter pattern (e.g., 'max_%')",
1798
+ },
1799
+ global: {
1800
+ type: "boolean",
1801
+ description: "Show global variables instead of session",
1802
+ },
1803
+ },
1804
+ },
1805
+ },
1806
+ {
1807
+ name: "explain_query",
1808
+ description: "Shows the execution plan for a query (EXPLAIN).",
1809
+ inputSchema: {
1810
+ type: "object",
1811
+ properties: {
1812
+ query: { type: "string", description: "SQL query to explain" },
1813
+ format: {
1814
+ type: "string",
1815
+ enum: ["TRADITIONAL", "JSON", "TREE"],
1816
+ description: "Output format",
1817
+ },
1818
+ analyze: {
1819
+ type: "boolean",
1820
+ description: "Actually execute the query and show real statistics",
1821
+ },
1822
+ },
1823
+ required: ["query"],
1824
+ },
1825
+ },
1826
+ {
1827
+ name: "show_engine_status",
1828
+ description: "Shows storage engine status (InnoDB by default).",
1829
+ inputSchema: {
1830
+ type: "object",
1831
+ properties: {
1832
+ engine: {
1833
+ type: "string",
1834
+ description: "Engine name (INNODB, PERFORMANCE_SCHEMA, etc.)",
1835
+ },
1836
+ },
1837
+ },
1838
+ },
1839
+ {
1840
+ name: "get_server_info",
1841
+ description: "Gets comprehensive MySQL server information including version, uptime, and statistics.",
1842
+ inputSchema: {
1843
+ type: "object",
1844
+ properties: {},
1845
+ },
1846
+ },
1847
+ {
1848
+ name: "show_binary_logs",
1849
+ description: "Shows binary log files on the server.",
1850
+ inputSchema: {
1851
+ type: "object",
1852
+ properties: {},
1853
+ },
1854
+ },
1855
+ {
1856
+ name: "show_replication_status",
1857
+ description: "Shows replication status (master or replica).",
1858
+ inputSchema: {
1859
+ type: "object",
1860
+ properties: {
1861
+ type: {
1862
+ type: "string",
1863
+ enum: ["MASTER", "REPLICA", "SLAVE"],
1864
+ description: "Which status to show",
1865
+ },
1866
+ },
1867
+ },
1868
+ },
947
1869
  ];
948
1870
  // Create the MCP server
949
1871
  const server = new index_js_1.Server({
@@ -1088,6 +2010,151 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
1088
2010
  case "get_optimization_hints":
1089
2011
  result = mysqlMCP.getOptimizationHints((args || {}));
1090
2012
  break;
2013
+ // View Tools
2014
+ case "list_views":
2015
+ result = await mysqlMCP.listViews((args || {}));
2016
+ break;
2017
+ case "get_view_info":
2018
+ result = await mysqlMCP.getViewInfo((args || {}));
2019
+ break;
2020
+ case "create_view":
2021
+ result = await mysqlMCP.createView((args || {}));
2022
+ break;
2023
+ case "alter_view":
2024
+ result = await mysqlMCP.alterView((args || {}));
2025
+ break;
2026
+ case "drop_view":
2027
+ result = await mysqlMCP.dropView((args || {}));
2028
+ break;
2029
+ case "show_create_view":
2030
+ result = await mysqlMCP.showCreateView((args || {}));
2031
+ break;
2032
+ // Trigger Tools
2033
+ case "list_triggers":
2034
+ result = await mysqlMCP.listTriggers((args || {}));
2035
+ break;
2036
+ case "get_trigger_info":
2037
+ result = await mysqlMCP.getTriggerInfo((args || {}));
2038
+ break;
2039
+ case "create_trigger":
2040
+ result = await mysqlMCP.createTrigger((args || {}));
2041
+ break;
2042
+ case "drop_trigger":
2043
+ result = await mysqlMCP.dropTrigger((args || {}));
2044
+ break;
2045
+ case "show_create_trigger":
2046
+ result = await mysqlMCP.showCreateTrigger((args || {}));
2047
+ break;
2048
+ // Function Tools
2049
+ case "list_functions":
2050
+ result = await mysqlMCP.listFunctions((args || {}));
2051
+ break;
2052
+ case "get_function_info":
2053
+ result = await mysqlMCP.getFunctionInfo((args || {}));
2054
+ break;
2055
+ case "create_function":
2056
+ result = await mysqlMCP.createFunction((args || {}));
2057
+ break;
2058
+ case "drop_function":
2059
+ result = await mysqlMCP.dropFunction((args || {}));
2060
+ break;
2061
+ case "show_create_function":
2062
+ result = await mysqlMCP.showCreateFunction((args || {}));
2063
+ break;
2064
+ case "execute_function":
2065
+ result = await mysqlMCP.executeFunction((args || {}));
2066
+ break;
2067
+ // Index Tools
2068
+ case "list_indexes":
2069
+ result = await mysqlMCP.listIndexes((args || {}));
2070
+ break;
2071
+ case "get_index_info":
2072
+ result = await mysqlMCP.getIndexInfo((args || {}));
2073
+ break;
2074
+ case "create_index":
2075
+ result = await mysqlMCP.createIndex((args || {}));
2076
+ break;
2077
+ case "drop_index":
2078
+ result = await mysqlMCP.dropIndex((args || {}));
2079
+ break;
2080
+ case "analyze_index":
2081
+ result = await mysqlMCP.analyzeIndex((args || {}));
2082
+ break;
2083
+ // Constraint Tools
2084
+ case "list_foreign_keys":
2085
+ result = await mysqlMCP.listForeignKeys((args || {}));
2086
+ break;
2087
+ case "list_constraints":
2088
+ result = await mysqlMCP.listConstraints((args || {}));
2089
+ break;
2090
+ case "add_foreign_key":
2091
+ result = await mysqlMCP.addForeignKey((args || {}));
2092
+ break;
2093
+ case "drop_foreign_key":
2094
+ result = await mysqlMCP.dropForeignKey((args || {}));
2095
+ break;
2096
+ case "add_unique_constraint":
2097
+ result = await mysqlMCP.addUniqueConstraint((args || {}));
2098
+ break;
2099
+ case "drop_constraint":
2100
+ result = await mysqlMCP.dropConstraint((args || {}));
2101
+ break;
2102
+ case "add_check_constraint":
2103
+ result = await mysqlMCP.addCheckConstraint((args || {}));
2104
+ break;
2105
+ // Table Maintenance Tools
2106
+ case "analyze_table":
2107
+ result = await mysqlMCP.analyzeTable((args || {}));
2108
+ break;
2109
+ case "optimize_table":
2110
+ result = await mysqlMCP.optimizeTable((args || {}));
2111
+ break;
2112
+ case "check_table":
2113
+ result = await mysqlMCP.checkTable((args || {}));
2114
+ break;
2115
+ case "repair_table":
2116
+ result = await mysqlMCP.repairTable((args || {}));
2117
+ break;
2118
+ case "truncate_table":
2119
+ result = await mysqlMCP.truncateTable((args || {}));
2120
+ break;
2121
+ case "get_table_status":
2122
+ result = await mysqlMCP.getTableStatus((args || {}));
2123
+ break;
2124
+ case "flush_table":
2125
+ result = await mysqlMCP.flushTable((args || {}));
2126
+ break;
2127
+ case "get_table_size":
2128
+ result = await mysqlMCP.getTableSize((args || {}));
2129
+ break;
2130
+ // Process Management Tools
2131
+ case "show_process_list":
2132
+ result = await mysqlMCP.showProcessList((args || {}));
2133
+ break;
2134
+ case "kill_process":
2135
+ result = await mysqlMCP.killProcess((args || {}));
2136
+ break;
2137
+ case "show_status":
2138
+ result = await mysqlMCP.showStatus((args || {}));
2139
+ break;
2140
+ case "show_variables":
2141
+ result = await mysqlMCP.showVariables((args || {}));
2142
+ break;
2143
+ case "explain_query":
2144
+ result = await mysqlMCP.explainQuery((args || {}));
2145
+ break;
2146
+ case "show_engine_status":
2147
+ result = await mysqlMCP.showEngineStatus((args || {}));
2148
+ break;
2149
+ case "get_server_info":
2150
+ result = await mysqlMCP.getServerInfo();
2151
+ break;
2152
+ case "show_binary_logs":
2153
+ result = await mysqlMCP.showBinaryLogs();
2154
+ break;
2155
+ case "show_replication_status":
2156
+ result = await mysqlMCP.showReplicationStatus((args || {}));
2157
+ break;
1091
2158
  default:
1092
2159
  throw new Error(`Unknown tool: ${name}`);
1093
2160
  }