@berthojoris/mcp-mysql-server 1.37.0 → 1.39.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/CHANGELOG.md +47 -0
- package/DOCUMENTATIONS.md +2 -13
- package/README.md +3 -4
- package/dist/config/featureConfig.d.ts +1 -2
- package/dist/config/featureConfig.js +6 -20
- package/dist/index.d.ts +0 -108
- package/dist/index.js +0 -95
- package/dist/mcp-server.js +0 -218
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,53 @@ All notable changes to the MySQL MCP Server will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.39.0] - 2026-03-06
|
|
9
|
+
|
|
10
|
+
### Removed
|
|
11
|
+
- **Schema Migrations Category**: Removed entire `schema_migrations` category and all 9 migration tools to reduce bundle size and simplify the codebase
|
|
12
|
+
- `init_migrations_table` - Initialize migrations tracking table
|
|
13
|
+
- `create_migration` - Create a new migration
|
|
14
|
+
- `apply_migrations` - Apply pending migrations
|
|
15
|
+
- `rollback_migration` - Rollback a specific migration
|
|
16
|
+
- `get_migration_status` - Get migration status
|
|
17
|
+
- `get_schema_version` - Get current schema version
|
|
18
|
+
- `validate_migrations` - Validate migration files
|
|
19
|
+
- `reset_failed_migration` - Reset a failed migration
|
|
20
|
+
- `generate_migration_from_diff` - Generate migration from schema diff
|
|
21
|
+
- **Schema Migrations Tools Module**: Removed `src/tools/schemaVersioningTools.ts` (1,231 lines)
|
|
22
|
+
- **Documentation Category**: Removed `SCHEMA_MIGRATIONS` from `DocCategory` enum in `featureConfig.ts`
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- Updated tool count: 106 → 97 tools (-9 tools)
|
|
26
|
+
- Updated category count: 21 → 20 categories (removed `schema_migrations`)
|
|
27
|
+
- Updated `mcp-server.ts` to remove tool registrations and routing for all migration tools
|
|
28
|
+
- Updated `index.ts` to remove MySQLMCP methods and SchemaVersioningTools import
|
|
29
|
+
- Updated `featureConfig.ts` to remove all schema migrations tool mappings
|
|
30
|
+
- Updated README.md and DOCUMENTATIONS.md to reflect tool/category count changes
|
|
31
|
+
- Simplified package description to remove "schema migration" reference
|
|
32
|
+
- Bumped package version to `1.39.0`
|
|
33
|
+
|
|
34
|
+
### Rationale
|
|
35
|
+
- These tools were rarely used by AI agents
|
|
36
|
+
- Added significant complexity to the codebase
|
|
37
|
+
- Most users prefer external migration tools (Flyway, Liquibase, etc.)
|
|
38
|
+
- Removal reduces bundle size by ~40KB
|
|
39
|
+
|
|
40
|
+
## [1.38.0] - 2026-03-06
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
- **Missing Tool Mapping**: Added `repairQuery` to `toolDocCategoryMap` in `featureConfig.ts` (QUERY_OPTIMIZATION category)
|
|
44
|
+
- **Deprecated Tool Cleanup**: Removed deprecated tools from category mappings:
|
|
45
|
+
- Removed `getTableRelationships` (replaced by `get_all_tables_relationships`)
|
|
46
|
+
- Removed `cloneTable`, `compareTableStructure`, `syncTableData` (previously removed in v1.36.0, now cleaned from mappings)
|
|
47
|
+
- Removed `safe_export_table` (previously removed, now cleaned from mappings)
|
|
48
|
+
- **Backup Tools Mapping**: Added missing backup/restore tools to `toolCategoryMap`: `backupDatabase`, `restoreFromSql`, `getCreateTableStatement`, `getDatabaseSchema`
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
- Updated `featureConfig.ts` to ensure all 106 tools have proper category mappings
|
|
52
|
+
- Maintained consistency between code implementation and documentation (106 tools, 21 categories)
|
|
53
|
+
- Bumped package version to `1.38.0`
|
|
54
|
+
|
|
8
55
|
## [1.37.0] - 2026-03-06
|
|
9
56
|
|
|
10
57
|
### Removed
|
package/DOCUMENTATIONS.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# MySQL MCP Server - Documentation
|
|
2
2
|
|
|
3
3
|
**Last Updated:** 2026-03-06 00:00:00
|
|
4
|
-
**Version:** 1.
|
|
5
|
-
**Total Tools:**
|
|
4
|
+
**Version:** 1.39.0
|
|
5
|
+
**Total Tools:** 97
|
|
6
6
|
|
|
7
7
|
Comprehensive documentation for the MySQL MCP Server. For quick start, see [README.md](README.md).
|
|
8
8
|
|
|
@@ -227,17 +227,6 @@ Tool enabled = (Has Permission) AND (Has Category OR No categories specified)
|
|
|
227
227
|
- `read_changelog` - Read changelog
|
|
228
228
|
- `invalidate_table_cache` - Clear table cache
|
|
229
229
|
|
|
230
|
-
### 19. Schema Migrations (9 tools)
|
|
231
|
-
- `init_migrations_table` - Initialize migrations tracking table
|
|
232
|
-
- `create_migration` - Create a new migration
|
|
233
|
-
- `apply_migrations` - Apply pending migrations
|
|
234
|
-
- `rollback_migration` - Rollback a specific migration
|
|
235
|
-
- `get_migration_status` - Get migration status
|
|
236
|
-
- `get_schema_version` - Get current schema version
|
|
237
|
-
- `validate_migrations` - Validate migration files
|
|
238
|
-
- `reset_failed_migration` - Reset a failed migration
|
|
239
|
-
- `generate_migration_from_diff` - Generate migration from schema diff
|
|
240
|
-
|
|
241
230
|
---
|
|
242
231
|
|
|
243
232
|
## Core Operations
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**A production-ready Model Context Protocol (MCP) server for MySQL database integration with AI agents**
|
|
6
6
|
|
|
7
|
-
**Last Updated:** 2026-03-06
|
|
7
|
+
**Last Updated:** 2026-03-06 14:30:00
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/@berthojoris/mcp-mysql-server)
|
|
10
10
|
[](https://www.npmjs.com/package/@berthojoris/mcp-mysql-server)
|
|
@@ -264,14 +264,13 @@ Use documentation categories to fine-tune which tools are exposed (Layer 2):
|
|
|
264
264
|
| `cache_management` | Manage query cache and optimization | `clear_cache, configure_cache_settings, get_cache_config, get_cache_stats, invalidate_cache_for_table` |
|
|
265
265
|
| `query_optimization` | Analyze and optimize SQL queries | `analyze_query, get_optimization_hints` |
|
|
266
266
|
| `backup_restore` | Create backups and restore databases | `backup_database, backup_table, get_create_table_statement, get_database_schema, restore_from_sql` |
|
|
267
|
-
| `schema_migrations` | Version control for database schema changes | `apply_migrations, create_migration, generate_migration_from_diff, get_migration_status, get_schema_version, init_migrations_table, reset_failed_migration, rollback_migration, validate_migrations` |
|
|
268
267
|
| `analysis` | Data analysis and reporting tools | `get_column_statistics, get_database_summary, get_schema_erd, get_schema_rag_context` |
|
|
269
268
|
|
|
270
269
|
<details>
|
|
271
270
|
<summary>Copy/paste list (comma-separated, no spaces)</summary>
|
|
272
271
|
|
|
273
272
|
```text
|
|
274
|
-
database_discovery,crud_operations,bulk_operations,custom_queries,schema_management,utilities,transaction_management,stored_procedures,views_management,triggers_management,functions_management,index_management,constraint_management,table_maintenance,server_management,performance_monitoring,cache_management,query_optimization,backup_restore,
|
|
273
|
+
database_discovery,crud_operations,bulk_operations,custom_queries,schema_management,utilities,transaction_management,stored_procedures,views_management,triggers_management,functions_management,index_management,constraint_management,table_maintenance,server_management,performance_monitoring,cache_management,query_optimization,backup_restore,analysis
|
|
275
274
|
```
|
|
276
275
|
|
|
277
276
|
</details>
|
|
@@ -282,7 +281,7 @@ Full category → tool mapping (and examples) lives in **[DOCUMENTATIONS.md →
|
|
|
282
281
|
|
|
283
282
|
## Available Tools
|
|
284
283
|
|
|
285
|
-
The server exposes **
|
|
284
|
+
The server exposes **97 tools** organized into categories (CRUD, schema, and perf/monitoring).
|
|
286
285
|
|
|
287
286
|
- Complete list of tools: **[DOCUMENTATIONS.md → Complete Tools Reference](DOCUMENTATIONS.md#🔧-complete-tools-reference)**
|
|
288
287
|
|
|
@@ -14,7 +14,7 @@ export declare enum ToolCategory {
|
|
|
14
14
|
PROCEDURE = "procedure"
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Documentation categories from README (
|
|
17
|
+
* Documentation categories from README (18 categories)
|
|
18
18
|
* More intuitive and matches user mental model
|
|
19
19
|
*/
|
|
20
20
|
export declare enum DocCategory {
|
|
@@ -37,7 +37,6 @@ export declare enum DocCategory {
|
|
|
37
37
|
CACHE_MANAGEMENT = "cache_management",
|
|
38
38
|
QUERY_OPTIMIZATION = "query_optimization",
|
|
39
39
|
BACKUP_RESTORE = "backup_restore",
|
|
40
|
-
SCHEMA_MIGRATIONS = "schema_migrations",
|
|
41
40
|
ANALYSIS = "analysis"
|
|
42
41
|
}
|
|
43
42
|
/**
|
|
@@ -24,7 +24,7 @@ var ToolCategory;
|
|
|
24
24
|
ToolCategory["PROCEDURE"] = "procedure";
|
|
25
25
|
})(ToolCategory || (exports.ToolCategory = ToolCategory = {}));
|
|
26
26
|
/**
|
|
27
|
-
* Documentation categories from README (
|
|
27
|
+
* Documentation categories from README (18 categories)
|
|
28
28
|
* More intuitive and matches user mental model
|
|
29
29
|
*/
|
|
30
30
|
var DocCategory;
|
|
@@ -48,7 +48,6 @@ var DocCategory;
|
|
|
48
48
|
DocCategory["CACHE_MANAGEMENT"] = "cache_management";
|
|
49
49
|
DocCategory["QUERY_OPTIMIZATION"] = "query_optimization";
|
|
50
50
|
DocCategory["BACKUP_RESTORE"] = "backup_restore";
|
|
51
|
-
DocCategory["SCHEMA_MIGRATIONS"] = "schema_migrations";
|
|
52
51
|
DocCategory["ANALYSIS"] = "analysis";
|
|
53
52
|
})(DocCategory || (exports.DocCategory = DocCategory = {}));
|
|
54
53
|
/**
|
|
@@ -86,11 +85,9 @@ exports.toolCategoryMap = {
|
|
|
86
85
|
// Utility tools
|
|
87
86
|
describeConnection: ToolCategory.UTILITY,
|
|
88
87
|
testConnection: ToolCategory.UTILITY,
|
|
89
|
-
getTableRelationships: ToolCategory.UTILITY,
|
|
90
88
|
getAllTablesRelationships: ToolCategory.UTILITY,
|
|
91
89
|
exportTableToCSV: ToolCategory.UTILITY,
|
|
92
90
|
exportQueryToCSV: ToolCategory.UTILITY,
|
|
93
|
-
safe_export_table: ToolCategory.UTILITY,
|
|
94
91
|
read_changelog: ToolCategory.UTILITY,
|
|
95
92
|
// Transaction tools
|
|
96
93
|
beginTransaction: ToolCategory.TRANSACTION,
|
|
@@ -169,9 +166,10 @@ exports.toolCategoryMap = {
|
|
|
169
166
|
showReplicationStatus: ToolCategory.LIST,
|
|
170
167
|
// Backup and restore tools
|
|
171
168
|
backupTable: ToolCategory.UTILITY,
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
169
|
+
backupDatabase: ToolCategory.UTILITY,
|
|
170
|
+
restoreFromSql: ToolCategory.UTILITY,
|
|
171
|
+
getCreateTableStatement: ToolCategory.UTILITY,
|
|
172
|
+
getDatabaseSchema: ToolCategory.UTILITY,
|
|
175
173
|
// Schema versioning and migrations tools
|
|
176
174
|
initMigrationsTable: ToolCategory.DDL,
|
|
177
175
|
createMigration: ToolCategory.DDL,
|
|
@@ -211,7 +209,6 @@ exports.toolDocCategoryMap = {
|
|
|
211
209
|
listDatabases: DocCategory.DATABASE_DISCOVERY,
|
|
212
210
|
listTables: DocCategory.DATABASE_DISCOVERY,
|
|
213
211
|
readTableSchema: DocCategory.DATABASE_DISCOVERY,
|
|
214
|
-
getTableRelationships: DocCategory.DATABASE_DISCOVERY,
|
|
215
212
|
getAllTablesRelationships: DocCategory.DATABASE_DISCOVERY,
|
|
216
213
|
// CRUD Operations
|
|
217
214
|
createRecord: DocCategory.CRUD_OPERATIONS,
|
|
@@ -323,22 +320,13 @@ exports.toolDocCategoryMap = {
|
|
|
323
320
|
// Query Optimization
|
|
324
321
|
analyzeQuery: DocCategory.QUERY_OPTIMIZATION,
|
|
325
322
|
getOptimizationHints: DocCategory.QUERY_OPTIMIZATION,
|
|
323
|
+
repairQuery: DocCategory.QUERY_OPTIMIZATION,
|
|
326
324
|
// Backup & Restore
|
|
327
325
|
backupTable: DocCategory.BACKUP_RESTORE,
|
|
328
326
|
backupDatabase: DocCategory.BACKUP_RESTORE,
|
|
329
327
|
restoreFromSql: DocCategory.BACKUP_RESTORE,
|
|
330
328
|
getCreateTableStatement: DocCategory.BACKUP_RESTORE,
|
|
331
329
|
getDatabaseSchema: DocCategory.BACKUP_RESTORE,
|
|
332
|
-
// Schema Migrations
|
|
333
|
-
initMigrationsTable: DocCategory.SCHEMA_MIGRATIONS,
|
|
334
|
-
createMigration: DocCategory.SCHEMA_MIGRATIONS,
|
|
335
|
-
applyMigrations: DocCategory.SCHEMA_MIGRATIONS,
|
|
336
|
-
rollbackMigration: DocCategory.SCHEMA_MIGRATIONS,
|
|
337
|
-
getMigrationStatus: DocCategory.SCHEMA_MIGRATIONS,
|
|
338
|
-
getSchemaVersion: DocCategory.SCHEMA_MIGRATIONS,
|
|
339
|
-
validateMigrations: DocCategory.SCHEMA_MIGRATIONS,
|
|
340
|
-
resetFailedMigration: DocCategory.SCHEMA_MIGRATIONS,
|
|
341
|
-
generateMigrationFromDiff: DocCategory.SCHEMA_MIGRATIONS,
|
|
342
330
|
// Analysis
|
|
343
331
|
getDatabaseSummary: DocCategory.ANALYSIS,
|
|
344
332
|
getSchemaERD: DocCategory.ANALYSIS,
|
|
@@ -367,7 +355,6 @@ const legacyToDocCategoryMap = {
|
|
|
367
355
|
DocCategory.CONSTRAINT_MANAGEMENT,
|
|
368
356
|
DocCategory.TABLE_MAINTENANCE,
|
|
369
357
|
DocCategory.SERVER_MANAGEMENT,
|
|
370
|
-
DocCategory.SCHEMA_MIGRATIONS,
|
|
371
358
|
DocCategory.ANALYSIS,
|
|
372
359
|
DocCategory.UTILITIES,
|
|
373
360
|
],
|
|
@@ -393,7 +380,6 @@ const legacyToDocCategoryMap = {
|
|
|
393
380
|
DocCategory.CONSTRAINT_MANAGEMENT,
|
|
394
381
|
DocCategory.TABLE_MAINTENANCE,
|
|
395
382
|
DocCategory.BACKUP_RESTORE,
|
|
396
|
-
DocCategory.SCHEMA_MIGRATIONS,
|
|
397
383
|
],
|
|
398
384
|
utility: [
|
|
399
385
|
DocCategory.UTILITIES,
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ export declare class MySQLMCP {
|
|
|
20
20
|
private processTools;
|
|
21
21
|
private backupRestoreTools;
|
|
22
22
|
private migrationTools;
|
|
23
|
-
private schemaVersioningTools;
|
|
24
23
|
private performanceTools;
|
|
25
24
|
private analysisTools;
|
|
26
25
|
private aiTools;
|
|
@@ -321,113 +320,6 @@ export declare class MySQLMCP {
|
|
|
321
320
|
data?: any;
|
|
322
321
|
error?: string;
|
|
323
322
|
}>;
|
|
324
|
-
/**
|
|
325
|
-
* Initialize the migrations tracking table
|
|
326
|
-
*/
|
|
327
|
-
initMigrationsTable(params: {
|
|
328
|
-
database?: string;
|
|
329
|
-
}): Promise<{
|
|
330
|
-
status: string;
|
|
331
|
-
data?: any;
|
|
332
|
-
error?: string;
|
|
333
|
-
}>;
|
|
334
|
-
/**
|
|
335
|
-
* Create a new migration
|
|
336
|
-
*/
|
|
337
|
-
createMigration(params: {
|
|
338
|
-
name: string;
|
|
339
|
-
up_sql: string;
|
|
340
|
-
down_sql?: string;
|
|
341
|
-
description?: string;
|
|
342
|
-
version?: string;
|
|
343
|
-
database?: string;
|
|
344
|
-
}): Promise<{
|
|
345
|
-
status: string;
|
|
346
|
-
data?: any;
|
|
347
|
-
error?: string;
|
|
348
|
-
}>;
|
|
349
|
-
/**
|
|
350
|
-
* Apply pending migrations
|
|
351
|
-
*/
|
|
352
|
-
applyMigrations(params: {
|
|
353
|
-
target_version?: string;
|
|
354
|
-
dry_run?: boolean;
|
|
355
|
-
database?: string;
|
|
356
|
-
}): Promise<{
|
|
357
|
-
status: string;
|
|
358
|
-
data?: any;
|
|
359
|
-
error?: string;
|
|
360
|
-
}>;
|
|
361
|
-
/**
|
|
362
|
-
* Rollback migrations
|
|
363
|
-
*/
|
|
364
|
-
rollbackMigration(params: {
|
|
365
|
-
target_version?: string;
|
|
366
|
-
steps?: number;
|
|
367
|
-
dry_run?: boolean;
|
|
368
|
-
database?: string;
|
|
369
|
-
}): Promise<{
|
|
370
|
-
status: string;
|
|
371
|
-
data?: any;
|
|
372
|
-
error?: string;
|
|
373
|
-
}>;
|
|
374
|
-
/**
|
|
375
|
-
* Get migration status and history
|
|
376
|
-
*/
|
|
377
|
-
getMigrationStatus(params: {
|
|
378
|
-
version?: string;
|
|
379
|
-
status?: "pending" | "applied" | "failed" | "rolled_back";
|
|
380
|
-
limit?: number;
|
|
381
|
-
database?: string;
|
|
382
|
-
}): Promise<{
|
|
383
|
-
status: string;
|
|
384
|
-
data?: any;
|
|
385
|
-
error?: string;
|
|
386
|
-
}>;
|
|
387
|
-
/**
|
|
388
|
-
* Get current schema version
|
|
389
|
-
*/
|
|
390
|
-
getSchemaVersion(params: {
|
|
391
|
-
database?: string;
|
|
392
|
-
}): Promise<{
|
|
393
|
-
status: string;
|
|
394
|
-
data?: any;
|
|
395
|
-
error?: string;
|
|
396
|
-
}>;
|
|
397
|
-
/**
|
|
398
|
-
* Validate migrations for issues
|
|
399
|
-
*/
|
|
400
|
-
validateMigrations(params: {
|
|
401
|
-
database?: string;
|
|
402
|
-
}): Promise<{
|
|
403
|
-
status: string;
|
|
404
|
-
data?: any;
|
|
405
|
-
error?: string;
|
|
406
|
-
}>;
|
|
407
|
-
/**
|
|
408
|
-
* Reset a failed migration to pending status
|
|
409
|
-
*/
|
|
410
|
-
resetFailedMigration(params: {
|
|
411
|
-
version: string;
|
|
412
|
-
database?: string;
|
|
413
|
-
}): Promise<{
|
|
414
|
-
status: string;
|
|
415
|
-
data?: any;
|
|
416
|
-
error?: string;
|
|
417
|
-
}>;
|
|
418
|
-
/**
|
|
419
|
-
* Generate a migration from table structure differences
|
|
420
|
-
*/
|
|
421
|
-
generateMigrationFromDiff(params: {
|
|
422
|
-
table1: string;
|
|
423
|
-
table2: string;
|
|
424
|
-
migration_name: string;
|
|
425
|
-
database?: string;
|
|
426
|
-
}): Promise<{
|
|
427
|
-
status: string;
|
|
428
|
-
data?: any;
|
|
429
|
-
error?: string;
|
|
430
|
-
}>;
|
|
431
323
|
repairQuery(params: {
|
|
432
324
|
query: string;
|
|
433
325
|
error_message?: string;
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,6 @@ const maintenanceTools_1 = require("./tools/maintenanceTools");
|
|
|
21
21
|
const processTools_1 = require("./tools/processTools");
|
|
22
22
|
const backupRestoreTools_1 = require("./tools/backupRestoreTools");
|
|
23
23
|
const migrationTools_1 = require("./tools/migrationTools");
|
|
24
|
-
const schemaVersioningTools_1 = require("./tools/schemaVersioningTools");
|
|
25
24
|
const performanceTools_1 = require("./tools/performanceTools");
|
|
26
25
|
const analysisTools_1 = require("./tools/analysisTools");
|
|
27
26
|
const aiTools_1 = require("./tools/aiTools");
|
|
@@ -56,7 +55,6 @@ class MySQLMCP {
|
|
|
56
55
|
this.processTools = new processTools_1.ProcessTools(this.security);
|
|
57
56
|
this.backupRestoreTools = new backupRestoreTools_1.BackupRestoreTools(this.security);
|
|
58
57
|
this.migrationTools = new migrationTools_1.MigrationTools(this.security);
|
|
59
|
-
this.schemaVersioningTools = new schemaVersioningTools_1.SchemaVersioningTools(this.security);
|
|
60
58
|
this.performanceTools = new performanceTools_1.PerformanceTools(this.security);
|
|
61
59
|
this.analysisTools = new analysisTools_1.AnalysisTools(this.security);
|
|
62
60
|
this.analysisTools = new analysisTools_1.AnalysisTools(this.security);
|
|
@@ -346,99 +344,6 @@ class MySQLMCP {
|
|
|
346
344
|
}
|
|
347
345
|
return await this.dataExportTools.exportTableToCSV(params);
|
|
348
346
|
}
|
|
349
|
-
// ==========================================
|
|
350
|
-
// Schema Versioning and Migrations Tools
|
|
351
|
-
// ==========================================
|
|
352
|
-
/**
|
|
353
|
-
* Initialize the migrations tracking table
|
|
354
|
-
*/
|
|
355
|
-
async initMigrationsTable(params) {
|
|
356
|
-
const check = this.checkToolEnabled("initMigrationsTable");
|
|
357
|
-
if (!check.enabled) {
|
|
358
|
-
return { status: "error", error: check.error };
|
|
359
|
-
}
|
|
360
|
-
return await this.schemaVersioningTools.initMigrationsTable(params);
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* Create a new migration
|
|
364
|
-
*/
|
|
365
|
-
async createMigration(params) {
|
|
366
|
-
const check = this.checkToolEnabled("createMigration");
|
|
367
|
-
if (!check.enabled) {
|
|
368
|
-
return { status: "error", error: check.error };
|
|
369
|
-
}
|
|
370
|
-
return await this.schemaVersioningTools.createMigration(params);
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Apply pending migrations
|
|
374
|
-
*/
|
|
375
|
-
async applyMigrations(params) {
|
|
376
|
-
const check = this.checkToolEnabled("applyMigrations");
|
|
377
|
-
if (!check.enabled) {
|
|
378
|
-
return { status: "error", error: check.error };
|
|
379
|
-
}
|
|
380
|
-
return await this.schemaVersioningTools.applyMigrations(params);
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Rollback migrations
|
|
384
|
-
*/
|
|
385
|
-
async rollbackMigration(params) {
|
|
386
|
-
const check = this.checkToolEnabled("rollbackMigration");
|
|
387
|
-
if (!check.enabled) {
|
|
388
|
-
return { status: "error", error: check.error };
|
|
389
|
-
}
|
|
390
|
-
return await this.schemaVersioningTools.rollbackMigration(params);
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Get migration status and history
|
|
394
|
-
*/
|
|
395
|
-
async getMigrationStatus(params) {
|
|
396
|
-
const check = this.checkToolEnabled("getMigrationStatus");
|
|
397
|
-
if (!check.enabled) {
|
|
398
|
-
return { status: "error", error: check.error };
|
|
399
|
-
}
|
|
400
|
-
return await this.schemaVersioningTools.getMigrationStatus(params);
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Get current schema version
|
|
404
|
-
*/
|
|
405
|
-
async getSchemaVersion(params) {
|
|
406
|
-
const check = this.checkToolEnabled("getSchemaVersion");
|
|
407
|
-
if (!check.enabled) {
|
|
408
|
-
return { status: "error", error: check.error };
|
|
409
|
-
}
|
|
410
|
-
return await this.schemaVersioningTools.getSchemaVersion(params);
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* Validate migrations for issues
|
|
414
|
-
*/
|
|
415
|
-
async validateMigrations(params) {
|
|
416
|
-
const check = this.checkToolEnabled("validateMigrations");
|
|
417
|
-
if (!check.enabled) {
|
|
418
|
-
return { status: "error", error: check.error };
|
|
419
|
-
}
|
|
420
|
-
return await this.schemaVersioningTools.validateMigrations(params);
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* Reset a failed migration to pending status
|
|
424
|
-
*/
|
|
425
|
-
async resetFailedMigration(params) {
|
|
426
|
-
const check = this.checkToolEnabled("resetFailedMigration");
|
|
427
|
-
if (!check.enabled) {
|
|
428
|
-
return { status: "error", error: check.error };
|
|
429
|
-
}
|
|
430
|
-
return await this.schemaVersioningTools.resetFailedMigration(params);
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* Generate a migration from table structure differences
|
|
434
|
-
*/
|
|
435
|
-
async generateMigrationFromDiff(params) {
|
|
436
|
-
const check = this.checkToolEnabled("generateMigrationFromDiff");
|
|
437
|
-
if (!check.enabled) {
|
|
438
|
-
return { status: "error", error: check.error };
|
|
439
|
-
}
|
|
440
|
-
return await this.schemaVersioningTools.generateMigrationFromDiff(params);
|
|
441
|
-
}
|
|
442
347
|
// AI Productivity Tools
|
|
443
348
|
async repairQuery(params) {
|
|
444
349
|
const check = this.checkToolEnabled("repairQuery");
|
package/dist/mcp-server.js
CHANGED
|
@@ -2118,196 +2118,6 @@ const TOOLS = [
|
|
|
2118
2118
|
},
|
|
2119
2119
|
},
|
|
2120
2120
|
},
|
|
2121
|
-
// Schema Versioning and Migrations Tools
|
|
2122
|
-
{
|
|
2123
|
-
name: "init_migrations_table",
|
|
2124
|
-
description: "Initialize the migrations tracking table (_schema_migrations) for schema versioning. Creates the table if it doesn't exist.",
|
|
2125
|
-
inputSchema: {
|
|
2126
|
-
type: "object",
|
|
2127
|
-
properties: {
|
|
2128
|
-
database: {
|
|
2129
|
-
type: "string",
|
|
2130
|
-
description: "Optional: specific database name",
|
|
2131
|
-
},
|
|
2132
|
-
},
|
|
2133
|
-
},
|
|
2134
|
-
},
|
|
2135
|
-
{
|
|
2136
|
-
name: "create_migration",
|
|
2137
|
-
description: "Create a new migration entry with up and down SQL. The migration will be stored as pending until applied. Requires 'ddl' permission.",
|
|
2138
|
-
inputSchema: {
|
|
2139
|
-
type: "object",
|
|
2140
|
-
properties: {
|
|
2141
|
-
name: {
|
|
2142
|
-
type: "string",
|
|
2143
|
-
description: "Name of the migration (e.g., 'add_users_table', 'add_email_column')",
|
|
2144
|
-
},
|
|
2145
|
-
up_sql: {
|
|
2146
|
-
type: "string",
|
|
2147
|
-
description: "SQL statements to apply the migration (can contain multiple statements separated by semicolons)",
|
|
2148
|
-
},
|
|
2149
|
-
down_sql: {
|
|
2150
|
-
type: "string",
|
|
2151
|
-
description: "SQL statements to rollback the migration (optional but recommended)",
|
|
2152
|
-
},
|
|
2153
|
-
description: {
|
|
2154
|
-
type: "string",
|
|
2155
|
-
description: "Optional description of what this migration does",
|
|
2156
|
-
},
|
|
2157
|
-
version: {
|
|
2158
|
-
type: "string",
|
|
2159
|
-
description: "Optional: custom version string (14 chars, e.g., '20240115120000'). Auto-generated if not provided.",
|
|
2160
|
-
},
|
|
2161
|
-
database: {
|
|
2162
|
-
type: "string",
|
|
2163
|
-
description: "Optional: specific database name",
|
|
2164
|
-
},
|
|
2165
|
-
},
|
|
2166
|
-
required: ["name", "up_sql"],
|
|
2167
|
-
},
|
|
2168
|
-
},
|
|
2169
|
-
{
|
|
2170
|
-
name: "apply_migrations",
|
|
2171
|
-
description: "Apply all pending migrations or up to a specific version. Executes migrations in version order. Requires 'ddl' permission.",
|
|
2172
|
-
inputSchema: {
|
|
2173
|
-
type: "object",
|
|
2174
|
-
properties: {
|
|
2175
|
-
target_version: {
|
|
2176
|
-
type: "string",
|
|
2177
|
-
description: "Optional: apply migrations up to this version (inclusive)",
|
|
2178
|
-
},
|
|
2179
|
-
dry_run: {
|
|
2180
|
-
type: "boolean",
|
|
2181
|
-
description: "If true, show what would be applied without executing (default: false)",
|
|
2182
|
-
},
|
|
2183
|
-
database: {
|
|
2184
|
-
type: "string",
|
|
2185
|
-
description: "Optional: specific database name",
|
|
2186
|
-
},
|
|
2187
|
-
},
|
|
2188
|
-
},
|
|
2189
|
-
},
|
|
2190
|
-
{
|
|
2191
|
-
name: "rollback_migration",
|
|
2192
|
-
description: "Rollback applied migrations. Can rollback by steps or to a specific version. Requires 'ddl' permission.",
|
|
2193
|
-
inputSchema: {
|
|
2194
|
-
type: "object",
|
|
2195
|
-
properties: {
|
|
2196
|
-
target_version: {
|
|
2197
|
-
type: "string",
|
|
2198
|
-
description: "Optional: rollback to this version (exclusive - this version will remain applied)",
|
|
2199
|
-
},
|
|
2200
|
-
steps: {
|
|
2201
|
-
type: "number",
|
|
2202
|
-
description: "Number of migrations to rollback (default: 1). Ignored if target_version is specified.",
|
|
2203
|
-
},
|
|
2204
|
-
dry_run: {
|
|
2205
|
-
type: "boolean",
|
|
2206
|
-
description: "If true, show what would be rolled back without executing (default: false)",
|
|
2207
|
-
},
|
|
2208
|
-
database: {
|
|
2209
|
-
type: "string",
|
|
2210
|
-
description: "Optional: specific database name",
|
|
2211
|
-
},
|
|
2212
|
-
},
|
|
2213
|
-
},
|
|
2214
|
-
},
|
|
2215
|
-
{
|
|
2216
|
-
name: "get_migration_status",
|
|
2217
|
-
description: "Get migration history and status. Shows all migrations with their current status, execution times, and any errors.",
|
|
2218
|
-
inputSchema: {
|
|
2219
|
-
type: "object",
|
|
2220
|
-
properties: {
|
|
2221
|
-
version: {
|
|
2222
|
-
type: "string",
|
|
2223
|
-
description: "Optional: get status of a specific version",
|
|
2224
|
-
},
|
|
2225
|
-
status: {
|
|
2226
|
-
type: "string",
|
|
2227
|
-
enum: ["pending", "applied", "failed", "rolled_back"],
|
|
2228
|
-
description: "Optional: filter by status",
|
|
2229
|
-
},
|
|
2230
|
-
limit: {
|
|
2231
|
-
type: "number",
|
|
2232
|
-
description: "Maximum number of migrations to return (default: 50)",
|
|
2233
|
-
},
|
|
2234
|
-
database: {
|
|
2235
|
-
type: "string",
|
|
2236
|
-
description: "Optional: specific database name",
|
|
2237
|
-
},
|
|
2238
|
-
},
|
|
2239
|
-
},
|
|
2240
|
-
},
|
|
2241
|
-
{
|
|
2242
|
-
name: "get_schema_version",
|
|
2243
|
-
description: "Get the current schema version (the last successfully applied migration).",
|
|
2244
|
-
inputSchema: {
|
|
2245
|
-
type: "object",
|
|
2246
|
-
properties: {
|
|
2247
|
-
database: {
|
|
2248
|
-
type: "string",
|
|
2249
|
-
description: "Optional: specific database name",
|
|
2250
|
-
},
|
|
2251
|
-
},
|
|
2252
|
-
},
|
|
2253
|
-
},
|
|
2254
|
-
{
|
|
2255
|
-
name: "validate_migrations",
|
|
2256
|
-
description: "Validate all migrations for issues such as duplicate versions, missing down_sql, checksum mismatches, or blocked migrations.",
|
|
2257
|
-
inputSchema: {
|
|
2258
|
-
type: "object",
|
|
2259
|
-
properties: {
|
|
2260
|
-
database: {
|
|
2261
|
-
type: "string",
|
|
2262
|
-
description: "Optional: specific database name",
|
|
2263
|
-
},
|
|
2264
|
-
},
|
|
2265
|
-
},
|
|
2266
|
-
},
|
|
2267
|
-
{
|
|
2268
|
-
name: "reset_failed_migration",
|
|
2269
|
-
description: "Reset a failed migration back to pending status so it can be retried. Only works for migrations in 'failed' status.",
|
|
2270
|
-
inputSchema: {
|
|
2271
|
-
type: "object",
|
|
2272
|
-
properties: {
|
|
2273
|
-
version: {
|
|
2274
|
-
type: "string",
|
|
2275
|
-
description: "Version of the failed migration to reset",
|
|
2276
|
-
},
|
|
2277
|
-
database: {
|
|
2278
|
-
type: "string",
|
|
2279
|
-
description: "Optional: specific database name",
|
|
2280
|
-
},
|
|
2281
|
-
},
|
|
2282
|
-
required: ["version"],
|
|
2283
|
-
},
|
|
2284
|
-
},
|
|
2285
|
-
{
|
|
2286
|
-
name: "generate_migration_from_diff",
|
|
2287
|
-
description: "Generate a migration by comparing two table structures. Creates up_sql to transform table2 to match table1, and down_sql to revert. Requires 'ddl' permission.",
|
|
2288
|
-
inputSchema: {
|
|
2289
|
-
type: "object",
|
|
2290
|
-
properties: {
|
|
2291
|
-
table1: {
|
|
2292
|
-
type: "string",
|
|
2293
|
-
description: "Source table (the structure to match)",
|
|
2294
|
-
},
|
|
2295
|
-
table2: {
|
|
2296
|
-
type: "string",
|
|
2297
|
-
description: "Target table (the table to be modified)",
|
|
2298
|
-
},
|
|
2299
|
-
migration_name: {
|
|
2300
|
-
type: "string",
|
|
2301
|
-
description: "Name for the generated migration",
|
|
2302
|
-
},
|
|
2303
|
-
database: {
|
|
2304
|
-
type: "string",
|
|
2305
|
-
description: "Optional: specific database name",
|
|
2306
|
-
},
|
|
2307
|
-
},
|
|
2308
|
-
required: ["table1", "table2", "migration_name"],
|
|
2309
|
-
},
|
|
2310
|
-
},
|
|
2311
2121
|
// Performance Monitoring Tools
|
|
2312
2122
|
{
|
|
2313
2123
|
name: "get_performance_metrics",
|
|
@@ -2923,34 +2733,6 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
|
2923
2733
|
case "explain_query":
|
|
2924
2734
|
result = await mysqlMCP.explainQuery((args || {}));
|
|
2925
2735
|
break;
|
|
2926
|
-
// Schema Versioning and Migrations Tools
|
|
2927
|
-
case "init_migrations_table":
|
|
2928
|
-
result = await mysqlMCP.initMigrationsTable((args || {}));
|
|
2929
|
-
break;
|
|
2930
|
-
case "create_migration":
|
|
2931
|
-
result = await mysqlMCP.createMigration((args || {}));
|
|
2932
|
-
break;
|
|
2933
|
-
case "apply_migrations":
|
|
2934
|
-
result = await mysqlMCP.applyMigrations((args || {}));
|
|
2935
|
-
break;
|
|
2936
|
-
case "rollback_migration":
|
|
2937
|
-
result = await mysqlMCP.rollbackMigration((args || {}));
|
|
2938
|
-
break;
|
|
2939
|
-
case "get_migration_status":
|
|
2940
|
-
result = await mysqlMCP.getMigrationStatus((args || {}));
|
|
2941
|
-
break;
|
|
2942
|
-
case "get_schema_version":
|
|
2943
|
-
result = await mysqlMCP.getSchemaVersion((args || {}));
|
|
2944
|
-
break;
|
|
2945
|
-
case "validate_migrations":
|
|
2946
|
-
result = await mysqlMCP.validateMigrations((args || {}));
|
|
2947
|
-
break;
|
|
2948
|
-
case "reset_failed_migration":
|
|
2949
|
-
result = await mysqlMCP.resetFailedMigration((args || {}));
|
|
2950
|
-
break;
|
|
2951
|
-
case "generate_migration_from_diff":
|
|
2952
|
-
result = await mysqlMCP.generateMigrationFromDiff((args || {}));
|
|
2953
|
-
break;
|
|
2954
2736
|
// Performance Monitoring Tools
|
|
2955
2737
|
case "get_performance_metrics":
|
|
2956
2738
|
result = await mysqlMCP.getPerformanceMetrics();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@berthojoris/mcp-mysql-server",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Model Context Protocol server for MySQL database integration with dynamic per-project permissions, backup/restore
|
|
3
|
+
"version": "1.39.0",
|
|
4
|
+
"description": "Model Context Protocol server for MySQL database integration with dynamic per-project permissions, backup/restore capabilities",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "commonjs",
|