@berthojoris/mcp-mysql-server 1.14.1 → 1.16.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.
@@ -27,4 +27,15 @@ export declare class UtilityTools {
27
27
  data?: any;
28
28
  error?: string;
29
29
  }>;
30
+ /**
31
+ * Reads the CHANGELOG.md file from the project root
32
+ */
33
+ readChangelog(params?: {
34
+ version?: string;
35
+ limit?: number;
36
+ }): Promise<{
37
+ status: string;
38
+ data?: any;
39
+ error?: string;
40
+ }>;
30
41
  }
@@ -7,6 +7,8 @@ exports.UtilityTools = void 0;
7
7
  const connection_1 = __importDefault(require("../db/connection"));
8
8
  const config_1 = require("../config/config");
9
9
  const schemas_1 = require("../validation/schemas");
10
+ const fs_1 = __importDefault(require("fs"));
11
+ const path_1 = __importDefault(require("path"));
10
12
  class UtilityTools {
11
13
  constructor() {
12
14
  this.db = connection_1.default.getInstance();
@@ -208,5 +210,74 @@ class UtilityTools {
208
210
  };
209
211
  }
210
212
  }
213
+ /**
214
+ * Reads the CHANGELOG.md file from the project root
215
+ */
216
+ async readChangelog(params) {
217
+ try {
218
+ // Resolve path relative to the built file (dist/tools/utilityTools.js -> ../../CHANGELOG.md)
219
+ // or source file (src/tools/utilityTools.ts -> ../../CHANGELOG.md)
220
+ const changelogPath = path_1.default.resolve(__dirname, "..", "..", "CHANGELOG.md");
221
+ if (!fs_1.default.existsSync(changelogPath)) {
222
+ return {
223
+ status: "error",
224
+ error: "CHANGELOG.md not found in the project root.",
225
+ };
226
+ }
227
+ const content = fs_1.default.readFileSync(changelogPath, "utf-8");
228
+ // If version specified, try to parse and find it
229
+ if (params?.version) {
230
+ // Simple parsing - look for headers like "## [1.2.3]"
231
+ const versionHeader = `## [${params.version}]`;
232
+ const lines = content.split("\n");
233
+ let found = false;
234
+ let versionContent = "";
235
+ for (const line of lines) {
236
+ if (line.startsWith(versionHeader)) {
237
+ found = true;
238
+ versionContent += line + "\n";
239
+ continue;
240
+ }
241
+ if (found) {
242
+ if (line.startsWith("## ["))
243
+ break; // Next version starts
244
+ versionContent += line + "\n";
245
+ }
246
+ }
247
+ if (!found) {
248
+ return {
249
+ status: "error",
250
+ error: `Version ${params.version} not found in CHANGELOG.md`,
251
+ };
252
+ }
253
+ return {
254
+ status: "success",
255
+ data: {
256
+ version: params.version,
257
+ content: versionContent.trim(),
258
+ },
259
+ };
260
+ }
261
+ // If no version, return the whole file or top N characters/lines?
262
+ // For now, let's return the most recent versions.
263
+ // Limit default to 3000 chars to avoid overflowing context
264
+ const maxLength = params?.limit || 5000;
265
+ const truncated = content.length > maxLength
266
+ ? content.substring(0, maxLength) + "\n... (truncated)"
267
+ : content;
268
+ return {
269
+ status: "success",
270
+ data: {
271
+ content: truncated,
272
+ },
273
+ };
274
+ }
275
+ catch (error) {
276
+ return {
277
+ status: "error",
278
+ error: `Failed to read changelog: ${error.message}`,
279
+ };
280
+ }
281
+ }
211
282
  }
212
283
  exports.UtilityTools = UtilityTools;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@berthojoris/mcp-mysql-server",
3
- "version": "1.14.1",
3
+ "version": "1.16.0",
4
4
  "description": "Model Context Protocol server for MySQL database integration with dynamic per-project permissions, backup/restore, data import/export, and data migration capabilities",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -86,4 +86,4 @@
86
86
  "ts-node": "^10.9.1",
87
87
  "typescript": "^5.2.2"
88
88
  }
89
- }
89
+ }