@cainli/mcp-server-mysql 2.0.13 → 2.0.16
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/dist/index.js +7 -1
- package/package.json +1 -5
package/dist/index.js
CHANGED
|
@@ -172,13 +172,19 @@ export default function createMcpServer({ sessionId, config, }) {
|
|
|
172
172
|
}
|
|
173
173
|
let columnsQuery = "SELECT column_name, data_type FROM information_schema.columns WHERE table_name = ?";
|
|
174
174
|
let queryParams = [tableName];
|
|
175
|
-
|
|
175
|
+
let schemaName = dbName;
|
|
176
|
+
if (!schemaName && !isMultiDbMode && mcpConfig.mysql.database) {
|
|
177
|
+
schemaName = mcpConfig.mysql.database;
|
|
178
|
+
}
|
|
176
179
|
if (!/^[a-zA-Z0-9_]+$/.test(tableName)) {
|
|
177
180
|
throw new Error(`Invalid table name: ${tableName}`);
|
|
178
181
|
}
|
|
179
182
|
if (schemaName && !/^[a-zA-Z0-9_]+$/.test(schemaName)) {
|
|
180
183
|
throw new Error(`Invalid schema name: ${schemaName}`);
|
|
181
184
|
}
|
|
185
|
+
if (!isMultiDbMode && !schemaName) {
|
|
186
|
+
throw new Error(`In single-DB mode, a schema/database must be specified. Configured database: ${mcpConfig.mysql.database || 'none'}`);
|
|
187
|
+
}
|
|
182
188
|
if (schemaName) {
|
|
183
189
|
columnsQuery += " AND table_schema = ?";
|
|
184
190
|
queryParams.push(schemaName);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cainli/mcp-server-mysql",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.16",
|
|
4
4
|
"description": "MCP server for interacting with MySQL databases with write operations support",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "cainli (https://github.com/cainli)",
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
"@ai-sdk/openai": "^1.3.22",
|
|
46
46
|
"@modelcontextprotocol/sdk": "1.15.1",
|
|
47
47
|
"dotenv": "^16.5.0",
|
|
48
|
-
"esbuild": "^0.23.0",
|
|
49
48
|
"express": "^5.1.0",
|
|
50
49
|
"mcp-evals": "^1.0.18",
|
|
51
50
|
"mysql2": "^3.14.1",
|
|
@@ -67,9 +66,6 @@
|
|
|
67
66
|
"typescript": "^5.8.3",
|
|
68
67
|
"vitest": "^1.6.1"
|
|
69
68
|
},
|
|
70
|
-
"overrides": {
|
|
71
|
-
"esbuild": "^0.23.0"
|
|
72
|
-
},
|
|
73
69
|
"publishConfig": {
|
|
74
70
|
"access": "public"
|
|
75
71
|
},
|