@berthojoris/mcp-mysql-server 1.33.6 → 1.36.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 +39 -0
- package/DOCUMENTATIONS.md +13 -56
- package/README.md +3 -10
- package/dist/config/featureConfig.d.ts +1 -2
- package/dist/config/featureConfig.js +0 -39
- package/dist/index.d.ts +0 -571
- package/dist/index.js +0 -263
- package/dist/mcp-server.js +0 -612
- package/dist/tools/backupRestoreTools.d.ts +0 -68
- package/dist/tools/backupRestoreTools.js +0 -516
- package/dist/tools/dataExportTools.d.ts +0 -38
- package/dist/tools/dataExportTools.js +0 -248
- package/dist/tools/migrationTools.d.ts +0 -73
- package/dist/tools/migrationTools.js +0 -508
- package/dist/tools/performanceTools.d.ts +0 -25
- package/dist/tools/performanceTools.js +0 -129
- package/dist/tools/processTools.d.ts +0 -36
- package/dist/tools/processTools.js +0 -122
- package/manifest.json +732 -877
- package/package.json +80 -95
|
@@ -58,40 +58,4 @@ export declare class ProcessTools {
|
|
|
58
58
|
data?: any;
|
|
59
59
|
error?: string;
|
|
60
60
|
}>;
|
|
61
|
-
/**
|
|
62
|
-
* Show engine status (InnoDB, etc.)
|
|
63
|
-
*/
|
|
64
|
-
showEngineStatus(params?: {
|
|
65
|
-
engine?: string;
|
|
66
|
-
}): Promise<{
|
|
67
|
-
status: string;
|
|
68
|
-
data?: any;
|
|
69
|
-
error?: string;
|
|
70
|
-
}>;
|
|
71
|
-
/**
|
|
72
|
-
* Get server information
|
|
73
|
-
*/
|
|
74
|
-
getServerInfo(): Promise<{
|
|
75
|
-
status: string;
|
|
76
|
-
data?: any;
|
|
77
|
-
error?: string;
|
|
78
|
-
}>;
|
|
79
|
-
/**
|
|
80
|
-
* Show binary logs
|
|
81
|
-
*/
|
|
82
|
-
showBinaryLogs(): Promise<{
|
|
83
|
-
status: string;
|
|
84
|
-
data?: any[];
|
|
85
|
-
error?: string;
|
|
86
|
-
}>;
|
|
87
|
-
/**
|
|
88
|
-
* Show master/replica status
|
|
89
|
-
*/
|
|
90
|
-
showReplicationStatus(params?: {
|
|
91
|
-
type?: "MASTER" | "REPLICA" | "SLAVE";
|
|
92
|
-
}): Promise<{
|
|
93
|
-
status: string;
|
|
94
|
-
data?: any;
|
|
95
|
-
error?: string;
|
|
96
|
-
}>;
|
|
97
61
|
}
|
|
@@ -177,127 +177,5 @@ class ProcessTools {
|
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
/**
|
|
181
|
-
* Show engine status (InnoDB, etc.)
|
|
182
|
-
*/
|
|
183
|
-
async showEngineStatus(params) {
|
|
184
|
-
try {
|
|
185
|
-
const engine = params?.engine || "INNODB";
|
|
186
|
-
// Validate engine name
|
|
187
|
-
const validEngines = [
|
|
188
|
-
"INNODB",
|
|
189
|
-
"PERFORMANCE_SCHEMA",
|
|
190
|
-
"NDB",
|
|
191
|
-
"NDBCLUSTER",
|
|
192
|
-
];
|
|
193
|
-
if (!validEngines.includes(engine.toUpperCase())) {
|
|
194
|
-
return {
|
|
195
|
-
status: "error",
|
|
196
|
-
error: `Invalid engine. Supported: ${validEngines.join(", ")}`,
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
const query = `SHOW ENGINE ${engine.toUpperCase()} STATUS`;
|
|
200
|
-
const results = await this.db.query(query);
|
|
201
|
-
return {
|
|
202
|
-
status: "success",
|
|
203
|
-
data: results,
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
catch (error) {
|
|
207
|
-
return {
|
|
208
|
-
status: "error",
|
|
209
|
-
error: error.message,
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Get server information
|
|
215
|
-
*/
|
|
216
|
-
async getServerInfo() {
|
|
217
|
-
try {
|
|
218
|
-
// Get various server info
|
|
219
|
-
const queries = [
|
|
220
|
-
{ key: "version", query: "SELECT VERSION() as value" },
|
|
221
|
-
{ key: "connection_id", query: "SELECT CONNECTION_ID() as value" },
|
|
222
|
-
{ key: "current_user", query: "SELECT CURRENT_USER() as value" },
|
|
223
|
-
{ key: "database", query: "SELECT DATABASE() as value" },
|
|
224
|
-
];
|
|
225
|
-
const info = {};
|
|
226
|
-
for (const q of queries) {
|
|
227
|
-
const result = await this.db.query(q.query);
|
|
228
|
-
info[q.key] = result[0]?.value;
|
|
229
|
-
}
|
|
230
|
-
// Get uptime and other status
|
|
231
|
-
const statusQuery = `SHOW GLOBAL STATUS WHERE Variable_name IN ('Uptime', 'Threads_connected', 'Threads_running', 'Questions', 'Slow_queries', 'Opens', 'Flush_commands', 'Open_tables', 'Queries')`;
|
|
232
|
-
const statusResult = await this.db.query(statusQuery);
|
|
233
|
-
for (const row of statusResult) {
|
|
234
|
-
info[row.Variable_name.toLowerCase()] = row.Value;
|
|
235
|
-
}
|
|
236
|
-
// Format uptime
|
|
237
|
-
if (info.uptime) {
|
|
238
|
-
const uptimeSec = parseInt(info.uptime);
|
|
239
|
-
const days = Math.floor(uptimeSec / 86400);
|
|
240
|
-
const hours = Math.floor((uptimeSec % 86400) / 3600);
|
|
241
|
-
const minutes = Math.floor((uptimeSec % 3600) / 60);
|
|
242
|
-
info.uptime_formatted = `${days}d ${hours}h ${minutes}m`;
|
|
243
|
-
}
|
|
244
|
-
return {
|
|
245
|
-
status: "success",
|
|
246
|
-
data: info,
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
catch (error) {
|
|
250
|
-
return {
|
|
251
|
-
status: "error",
|
|
252
|
-
error: error.message,
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Show binary logs
|
|
258
|
-
*/
|
|
259
|
-
async showBinaryLogs() {
|
|
260
|
-
try {
|
|
261
|
-
const query = "SHOW BINARY LOGS";
|
|
262
|
-
const results = await this.db.query(query);
|
|
263
|
-
return {
|
|
264
|
-
status: "success",
|
|
265
|
-
data: results,
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
catch (error) {
|
|
269
|
-
return {
|
|
270
|
-
status: "error",
|
|
271
|
-
error: error.message,
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Show master/replica status
|
|
277
|
-
*/
|
|
278
|
-
async showReplicationStatus(params) {
|
|
279
|
-
try {
|
|
280
|
-
const type = params?.type || "REPLICA";
|
|
281
|
-
let query;
|
|
282
|
-
if (type === "MASTER") {
|
|
283
|
-
query = "SHOW MASTER STATUS";
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
// MySQL 8.0.22+ uses REPLICA, older versions use SLAVE
|
|
287
|
-
query = type === "SLAVE" ? "SHOW SLAVE STATUS" : "SHOW REPLICA STATUS";
|
|
288
|
-
}
|
|
289
|
-
const results = await this.db.query(query);
|
|
290
|
-
return {
|
|
291
|
-
status: "success",
|
|
292
|
-
data: results.length > 0 ? results[0] : null,
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
catch (error) {
|
|
296
|
-
return {
|
|
297
|
-
status: "error",
|
|
298
|
-
error: error.message,
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
180
|
}
|
|
303
181
|
exports.ProcessTools = ProcessTools;
|