@berthojoris/mcp-mysql-server 1.6.1 → 1.6.3

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 CHANGED
@@ -5,6 +5,35 @@ 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.6.3] - 2025-11-23
9
+
10
+ ### Fixed
11
+ - **Missing tools in toolCategoryMap** - Added 42 missing tools to the permission system
12
+ - View tools: listViews, getViewInfo, createView, alterView, dropView, showCreateView
13
+ - Trigger tools: listTriggers, getTriggerInfo, createTrigger, dropTrigger, showCreateTrigger
14
+ - Function tools: listFunctions, getFunctionInfo, createFunction, dropFunction, showCreateFunction, executeFunction
15
+ - Index tools: listIndexes, getIndexInfo, createIndex, dropIndex, analyzeIndex
16
+ - Constraint tools: listForeignKeys, listConstraints, addForeignKey, dropForeignKey, addUniqueConstraint, dropConstraint, addCheckConstraint
17
+ - Maintenance tools: analyzeTable, optimizeTable, checkTable, repairTable, truncateTable, getTableStatus, flushTable, getTableSize
18
+ - Server tools: showProcessList, killProcess, showStatus, showVariables, explainQuery, showEngineStatus, getServerInfo, showBinaryLogs, showReplicationStatus
19
+
20
+ - **Security keyword false positives in run_query** - Refined dangerous keywords to avoid blocking common table/column names
21
+ - Removed generic keywords: `USER`, `PASSWORD`, `MYSQL`, `SYS` that blocked legitimate queries
22
+ - Added specific security patterns: `MYSQL.USER`, `MYSQL.DB`, `CREATE USER`, `DROP USER`, `ALTER USER`, `SET PASSWORD`, `LOAD_FILE`, `INFORMATION_SCHEMA.USER_PRIVILEGES`
23
+ - Queries like `SELECT * FROM users` or `SELECT user, password FROM accounts` now work correctly
24
+
25
+ ## [1.6.2] - 2025-11-22
26
+
27
+ ### Fixed
28
+ - **Security keyword false positive bug** - Fixed issue where `run_query` rejected valid SELECT queries containing table names like "users"
29
+ - The dangerous keyword check was using substring matching (`includes()`) which caused "USER" to match "USERS"
30
+ - Changed to word boundary regex matching (`\bKEYWORD\b`) to only match whole words
31
+ - `SELECT * FROM users` now works correctly while `SELECT USER()` is still blocked as intended
32
+
33
+ ### Changed
34
+ - **Updated tool count in README.md** - Corrected tool count from 30/73 to 85 powerful tools
35
+ - Accurate count of all available MCP tools across all categories
36
+
8
37
  ## [1.4.16] - 2025-11-22
9
38
 
10
39
  ### Added
package/README.md CHANGED
@@ -11,7 +11,7 @@ A fully-featured **Model Context Protocol (MCP)** server for MySQL database inte
11
11
 
12
12
  - ✅ **Full MCP Protocol Support** - Works with Claude Desktop, Cline, Windsurf, and any MCP-compatible AI agent
13
13
  - 🔐 **Secure by Default** - Parameterized queries, SQL injection protection, permission-based access control
14
- - 🛠️ **30 Powerful Tools** - Complete database operations (CRUD, DDL, queries, schema inspection, transactions, stored procedures, bulk operations)
14
+ - 🛠️ **85 Powerful Tools** - Complete database operations (CRUD, DDL, queries, schema inspection, transactions, stored procedures, bulk operations)
15
15
  - 🎛️ **Dynamic Per-Project Permissions** - Each AI agent can have different access levels
16
16
  - 🗃️ **DDL Support** - Create, alter, and drop tables (when explicitly enabled)
17
17
  - 💎 **Transaction Support** - Full ACID transaction management (BEGIN, COMMIT, ROLLBACK)
@@ -463,7 +463,7 @@ After (DDL enabled):
463
463
 
464
464
  ## 🛠️ Available Tools
465
465
 
466
- The MCP server provides **73 powerful tools**:
466
+ The MCP server provides **85 powerful tools**:
467
467
 
468
468
  ### Database Discovery (4 tools)
469
469
 
@@ -76,6 +76,59 @@ exports.toolCategoryMap = {
76
76
  // Query optimization tools
77
77
  analyzeQuery: ToolCategory.UTILITY,
78
78
  getOptimizationHints: ToolCategory.UTILITY,
79
+ // View tools
80
+ listViews: ToolCategory.LIST,
81
+ getViewInfo: ToolCategory.LIST,
82
+ createView: ToolCategory.DDL,
83
+ alterView: ToolCategory.DDL,
84
+ dropView: ToolCategory.DDL,
85
+ showCreateView: ToolCategory.LIST,
86
+ // Trigger tools
87
+ listTriggers: ToolCategory.LIST,
88
+ getTriggerInfo: ToolCategory.LIST,
89
+ createTrigger: ToolCategory.DDL,
90
+ dropTrigger: ToolCategory.DDL,
91
+ showCreateTrigger: ToolCategory.LIST,
92
+ // Function tools
93
+ listFunctions: ToolCategory.LIST,
94
+ getFunctionInfo: ToolCategory.LIST,
95
+ createFunction: ToolCategory.PROCEDURE,
96
+ dropFunction: ToolCategory.PROCEDURE,
97
+ showCreateFunction: ToolCategory.LIST,
98
+ executeFunction: ToolCategory.PROCEDURE,
99
+ // Index tools
100
+ listIndexes: ToolCategory.LIST,
101
+ getIndexInfo: ToolCategory.LIST,
102
+ createIndex: ToolCategory.DDL,
103
+ dropIndex: ToolCategory.DDL,
104
+ analyzeIndex: ToolCategory.UTILITY,
105
+ // Constraint tools
106
+ listForeignKeys: ToolCategory.LIST,
107
+ listConstraints: ToolCategory.LIST,
108
+ addForeignKey: ToolCategory.DDL,
109
+ dropForeignKey: ToolCategory.DDL,
110
+ addUniqueConstraint: ToolCategory.DDL,
111
+ dropConstraint: ToolCategory.DDL,
112
+ addCheckConstraint: ToolCategory.DDL,
113
+ // Table maintenance tools
114
+ analyzeTable: ToolCategory.UTILITY,
115
+ optimizeTable: ToolCategory.UTILITY,
116
+ checkTable: ToolCategory.UTILITY,
117
+ repairTable: ToolCategory.UTILITY,
118
+ truncateTable: ToolCategory.DDL,
119
+ getTableStatus: ToolCategory.LIST,
120
+ flushTable: ToolCategory.UTILITY,
121
+ getTableSize: ToolCategory.LIST,
122
+ // Process and server management tools
123
+ showProcessList: ToolCategory.LIST,
124
+ killProcess: ToolCategory.EXECUTE,
125
+ showStatus: ToolCategory.LIST,
126
+ showVariables: ToolCategory.LIST,
127
+ explainQuery: ToolCategory.UTILITY,
128
+ showEngineStatus: ToolCategory.LIST,
129
+ getServerInfo: ToolCategory.LIST,
130
+ showBinaryLogs: ToolCategory.LIST,
131
+ showReplicationStatus: ToolCategory.LIST,
79
132
  };
80
133
  /**
81
134
  * Class to manage feature configuration based on runtime or environment variables
@@ -12,17 +12,22 @@ class SecurityLayer {
12
12
  this.featureConfig = featureConfig || new featureConfig_js_1.FeatureConfig();
13
13
  // Define dangerous SQL keywords that should ALWAYS be blocked (critical security threats)
14
14
  // These are blocked even with 'execute' permission
15
+ // Note: Avoid blocking common table/column names like "user" or "password"
15
16
  this.dangerousKeywords = [
16
17
  "GRANT",
17
18
  "REVOKE",
18
19
  "INTO OUTFILE",
19
20
  "INTO DUMPFILE",
20
21
  "LOAD DATA",
21
- "MYSQL",
22
+ "LOAD_FILE",
23
+ "INFORMATION_SCHEMA.USER_PRIVILEGES",
24
+ "MYSQL.USER",
25
+ "MYSQL.DB",
22
26
  "PERFORMANCE_SCHEMA",
23
- "SYS",
24
- "USER",
25
- "PASSWORD",
27
+ "CREATE USER",
28
+ "DROP USER",
29
+ "ALTER USER",
30
+ "SET PASSWORD",
26
31
  ];
27
32
  // Define basic allowed SQL operations
28
33
  this.allowedOperations = ["SELECT", "INSERT", "UPDATE", "DELETE"];
@@ -160,7 +165,9 @@ class SecurityLayer {
160
165
  // When bypassDangerousCheck is true (user has 'execute' permission), skip this check
161
166
  if (!bypassDangerousCheck) {
162
167
  for (const keyword of this.dangerousKeywords) {
163
- if (cleanQuery.includes(keyword)) {
168
+ // Use word boundary regex to avoid false positives (e.g., "USER" matching "USERS")
169
+ const keywordRegex = new RegExp(`\\b${keyword}\\b`, "i");
170
+ if (keywordRegex.test(cleanQuery)) {
164
171
  return {
165
172
  valid: false,
166
173
  error: `Dangerous keyword detected: ${keyword}. This requires 'execute' permission.`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@berthojoris/mcp-mysql-server",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "Model Context Protocol server for MySQL database integration with dynamic per-project permissions and data export capabilities",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",