@berthojoris/mcp-mysql-server 1.17.0 → 1.18.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 +6 -0
- package/DOCUMENTATIONS.md +45 -756
- package/README.md +58 -37
- package/bin/mcp-mysql.js +57 -107
- package/dist/config/featureConfig.d.ts +2 -29
- package/dist/config/featureConfig.js +6 -211
- package/dist/index.d.ts +5 -12
- package/dist/index.js +3 -4
- package/dist/mcp-server.js +1 -8
- package/dist/security/securityLayer.js +2 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare class MySQLMCP {
|
|
|
37
37
|
private forecastingTools;
|
|
38
38
|
private security;
|
|
39
39
|
private featureConfig;
|
|
40
|
-
constructor(permissionsConfig?: string, categoriesConfig?: string
|
|
40
|
+
constructor(permissionsConfig?: string, categoriesConfig?: string);
|
|
41
41
|
private checkToolEnabled;
|
|
42
42
|
listDatabases(): Promise<{
|
|
43
43
|
status: string;
|
|
@@ -623,17 +623,12 @@ export declare class MySQLMCP {
|
|
|
623
623
|
status: string;
|
|
624
624
|
data: {
|
|
625
625
|
config: {
|
|
626
|
-
preset?: {
|
|
627
|
-
name: string;
|
|
628
|
-
description: string;
|
|
629
|
-
};
|
|
630
626
|
permissions: string;
|
|
631
627
|
categories: string;
|
|
632
628
|
filteringMode: string;
|
|
633
629
|
enabledLegacy: import("./config/featureConfig").ToolCategory[];
|
|
634
630
|
enabledDoc: import("./config/featureConfig").DocCategory[];
|
|
635
631
|
};
|
|
636
|
-
preset: import("./config/featureConfig").PermissionPreset | undefined;
|
|
637
632
|
filteringMode: string;
|
|
638
633
|
enabledCategories: import("./config/featureConfig").ToolCategory[];
|
|
639
634
|
categoryStatus: Record<import("./config/featureConfig").ToolCategory, boolean>;
|
|
@@ -647,13 +642,9 @@ export declare class MySQLMCP {
|
|
|
647
642
|
*/
|
|
648
643
|
isToolEnabled(toolName: string): boolean;
|
|
649
644
|
/**
|
|
650
|
-
* Expose resolved access profile (
|
|
645
|
+
* Expose resolved access profile (resolved permissions/categories)
|
|
651
646
|
*/
|
|
652
647
|
getAccessProfile(): {
|
|
653
|
-
preset?: {
|
|
654
|
-
name: string;
|
|
655
|
-
description: string;
|
|
656
|
-
};
|
|
657
648
|
permissions: string;
|
|
658
649
|
categories: string;
|
|
659
650
|
filteringMode: string;
|
|
@@ -1318,7 +1309,9 @@ export declare class MySQLMCP {
|
|
|
1318
1309
|
column_name: string;
|
|
1319
1310
|
pattern_type: string;
|
|
1320
1311
|
description: string;
|
|
1321
|
-
metrics
|
|
1312
|
+
metrics? /**
|
|
1313
|
+
* Get current schema version
|
|
1314
|
+
*/: Record<string, any>;
|
|
1322
1315
|
recommendations?: string[];
|
|
1323
1316
|
}>;
|
|
1324
1317
|
summary: {
|
package/dist/index.js
CHANGED
|
@@ -44,8 +44,8 @@ const featureConfig_1 = require("./config/featureConfig");
|
|
|
44
44
|
* A secure interface for AI models to interact with MySQL databases
|
|
45
45
|
*/
|
|
46
46
|
class MySQLMCP {
|
|
47
|
-
constructor(permissionsConfig, categoriesConfig
|
|
48
|
-
this.featureConfig = new featureConfig_1.FeatureConfig(permissionsConfig, categoriesConfig
|
|
47
|
+
constructor(permissionsConfig, categoriesConfig) {
|
|
48
|
+
this.featureConfig = new featureConfig_1.FeatureConfig(permissionsConfig, categoriesConfig);
|
|
49
49
|
this.security = new securityLayer_1.default(this.featureConfig);
|
|
50
50
|
this.dbTools = new databaseTools_1.DatabaseTools();
|
|
51
51
|
this.crudTools = new crudTools_1.CrudTools(this.security);
|
|
@@ -580,7 +580,6 @@ class MySQLMCP {
|
|
|
580
580
|
status: "success",
|
|
581
581
|
data: {
|
|
582
582
|
config: snapshot,
|
|
583
|
-
preset: this.featureConfig.getActivePreset(),
|
|
584
583
|
filteringMode: this.featureConfig.getFilteringMode(),
|
|
585
584
|
enabledCategories: this.featureConfig.getEnabledCategories(),
|
|
586
585
|
categoryStatus: this.featureConfig.getCategoryStatus(),
|
|
@@ -597,7 +596,7 @@ class MySQLMCP {
|
|
|
597
596
|
return this.featureConfig.isToolEnabled(toolName);
|
|
598
597
|
}
|
|
599
598
|
/**
|
|
600
|
-
* Expose resolved access profile (
|
|
599
|
+
* Expose resolved access profile (resolved permissions/categories)
|
|
601
600
|
*/
|
|
602
601
|
getAccessProfile() {
|
|
603
602
|
return this.featureConfig.getConfigSnapshot();
|
package/dist/mcp-server.js
CHANGED
|
@@ -10,7 +10,6 @@ const index_js_2 = require("./index.js");
|
|
|
10
10
|
// Layer 2 (Categories): MCP_CATEGORIES (optional, for fine-grained control)
|
|
11
11
|
const permissions = process.env.MCP_PERMISSIONS || process.env.MCP_CONFIG || "";
|
|
12
12
|
const categories = process.env.MCP_CATEGORIES || "";
|
|
13
|
-
const preset = process.env.MCP_PRESET || process.env.MCP_PERMISSION_PRESET || "";
|
|
14
13
|
// Declare the MySQL MCP instance (will be initialized in main())
|
|
15
14
|
let mysqlMCP;
|
|
16
15
|
// Define all available tools with their schemas
|
|
@@ -3888,15 +3887,9 @@ async function main() {
|
|
|
3888
3887
|
await server.connect(transport);
|
|
3889
3888
|
// Initialize the MySQL MCP instance AFTER transport is connected
|
|
3890
3889
|
// This ensures the database connection pool is created when the server is ready
|
|
3891
|
-
mysqlMCP = new index_js_2.MySQLMCP(permissions, categories
|
|
3890
|
+
mysqlMCP = new index_js_2.MySQLMCP(permissions, categories);
|
|
3892
3891
|
// Log the effective filtering configuration to stderr
|
|
3893
3892
|
const accessProfile = mysqlMCP.getAccessProfile();
|
|
3894
|
-
if (accessProfile.preset) {
|
|
3895
|
-
console.error(`Preset: ${accessProfile.preset.name} (${accessProfile.preset.description})`);
|
|
3896
|
-
}
|
|
3897
|
-
else if (preset) {
|
|
3898
|
-
console.error(`Preset requested but not recognized: ${preset}`);
|
|
3899
|
-
}
|
|
3900
3893
|
console.error(`Permissions (resolved): ${accessProfile.permissions}`);
|
|
3901
3894
|
if (accessProfile.categories) {
|
|
3902
3895
|
console.error(`Categories (resolved): ${accessProfile.categories}`);
|
|
@@ -11,9 +11,8 @@ class SecurityLayer {
|
|
|
11
11
|
constructor(featureConfig) {
|
|
12
12
|
this.ajv = new ajv_1.default();
|
|
13
13
|
this.featureConfig = featureConfig || new featureConfig_js_1.FeatureConfig();
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
this.masking = new maskingLayer_js_1.MaskingLayer(maskingProfile);
|
|
14
|
+
// Masking is intentionally not configurable via environment variables.
|
|
15
|
+
this.masking = new maskingLayer_js_1.MaskingLayer("none");
|
|
17
16
|
// Define dangerous SQL keywords that should ALWAYS be blocked (critical security threats)
|
|
18
17
|
// These are blocked even with 'execute' permission
|
|
19
18
|
// Note: Avoid blocking common table/column names like "user" or "password"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@berthojoris/mcp-mysql-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.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",
|