@berthojoris/mcp-mysql-server 1.40.5 → 1.40.6
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 +10 -0
- package/DOCUMENTATIONS.md +33 -4
- package/README.md +29 -3
- package/dist/config/featureConfig.js +4 -0
- package/dist/mcp-server.js +101 -1
- package/manifest.json +13 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ 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.40.6] - 2026-05-04
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Added `cursor_execute_request`, a no-argument compatibility bridge for Cursor MCP wrappers that cannot send tool `arguments`.
|
|
12
|
+
- The bridge reads `.cursor/mysql-mcp-request.json` or `MYSQL_MCP_CURSOR_REQUEST_FILE` and dispatches to existing MCP tools or auto-routes SQL to SELECT, write, or DDL execution.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- Updated tool totals in documentation to include the Cursor bridge.
|
|
16
|
+
- Synchronized version metadata to `1.40.6`.
|
|
17
|
+
|
|
8
18
|
## [1.40.5] - 2026-04-08
|
|
9
19
|
|
|
10
20
|
### Fixed
|
package/DOCUMENTATIONS.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# MySQL MCP Server - Documentation
|
|
2
2
|
|
|
3
|
-
**Last Updated:** 2026-04
|
|
4
|
-
**Version:** 1.40.
|
|
5
|
-
**Total Tools:**
|
|
3
|
+
**Last Updated:** 2026-05-04 18:07:52
|
|
4
|
+
**Version:** 1.40.6
|
|
5
|
+
**Total Tools:** 79
|
|
6
6
|
|
|
7
7
|
Comprehensive documentation for the MySQL MCP Server. For quick start, see [README.md](README.md).
|
|
8
8
|
|
|
@@ -65,6 +65,34 @@ Configure MySQL MCP with two access-control layers:
|
|
|
65
65
|
|
|
66
66
|
---
|
|
67
67
|
|
|
68
|
+
### Cursor Compatibility Bridge
|
|
69
|
+
|
|
70
|
+
Some Cursor MCP wrappers can call a tool by name but cannot pass `arguments`. For that flow, write a request file at `.cursor/mysql-mcp-request.json` and call the no-argument `cursor_execute_request` tool.
|
|
71
|
+
|
|
72
|
+
Execute any existing MCP tool:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"tool": "execute_ddl",
|
|
77
|
+
"arguments": {
|
|
78
|
+
"query": "DROP TABLE IF EXISTS spark_processes;"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Or execute SQL directly with automatic routing:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"query": "DROP TABLE IF EXISTS spark_processes;",
|
|
88
|
+
"mode": "auto"
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Supported `mode` values are `auto`, `select`, `write`, and `ddl`. Set `MYSQL_MCP_CURSOR_REQUEST_FILE` to override the request file path.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
68
96
|
## Permission System
|
|
69
97
|
|
|
70
98
|
### Available Permissions
|
|
@@ -191,11 +219,12 @@ Tool enabled = (Has Permission) AND (Has Category OR No categories specified)
|
|
|
191
219
|
- `get_optimization_hints` - Get optimizer hints
|
|
192
220
|
- `repair_query` - Repair broken SQL queries
|
|
193
221
|
|
|
194
|
-
### 14. Utilities (
|
|
222
|
+
### 14. Utilities (5 tools)
|
|
195
223
|
- `test_connection` - Test connectivity
|
|
196
224
|
- `describe_connection` - Connection info
|
|
197
225
|
- `read_changelog` - Read changelog
|
|
198
226
|
- `invalidate_table_cache` - Clear table cache
|
|
227
|
+
- `cursor_execute_request` - Execute a file-backed request for clients that cannot send MCP arguments
|
|
199
228
|
|
|
200
229
|
---
|
|
201
230
|
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**A production-ready Model Context Protocol (MCP) server for MySQL database integration with AI agents**
|
|
6
6
|
|
|
7
|
-
**Last Updated:** 2026-04
|
|
7
|
+
**Last Updated:** 2026-05-04 18:07:52
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/@berthojoris/mcp-mysql-server)
|
|
10
10
|
[](https://www.npmjs.com/package/@berthojoris/mcp-mysql-server)
|
|
@@ -211,6 +211,32 @@ For more client-specific config snippets, see **[DOCUMENTATIONS.md → Setup & C
|
|
|
211
211
|
|
|
212
212
|
---
|
|
213
213
|
|
|
214
|
+
### Cursor Compatibility Bridge
|
|
215
|
+
|
|
216
|
+
If a Cursor MCP wrapper can call tools but cannot send `arguments`, use the no-argument `cursor_execute_request` bridge. Create `.cursor/mysql-mcp-request.json` in the workspace, then call `cursor_execute_request`:
|
|
217
|
+
|
|
218
|
+
```json
|
|
219
|
+
{
|
|
220
|
+
"tool": "execute_ddl",
|
|
221
|
+
"arguments": {
|
|
222
|
+
"query": "DROP TABLE IF EXISTS spark_processes;"
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
For direct SQL, the bridge can infer the right SQL tool:
|
|
228
|
+
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"query": "DROP TABLE IF EXISTS spark_processes;",
|
|
232
|
+
"mode": "auto"
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Set `MYSQL_MCP_CURSOR_REQUEST_FILE` to override the request file path.
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
214
240
|
## Permission System
|
|
215
241
|
|
|
216
242
|
Control database access with a **dual-layer filtering system** that provides both broad and fine-grained control:
|
|
@@ -250,7 +276,7 @@ Use documentation categories to fine-tune which tools are exposed (Layer 2):
|
|
|
250
276
|
| `bulk_operations` | High-performance batch processing operations | `bulk_delete, bulk_insert, bulk_update` |
|
|
251
277
|
| `custom_queries` | Execute custom SQL queries and advanced operations | `execute_write_query, run_select_query` |
|
|
252
278
|
| `schema_management` | Manage database schema, tables, and structure | `alter_table, create_table, drop_table, execute_ddl` |
|
|
253
|
-
| `utilities` | Database utilities, diagnostics, and helper functions | `describe_connection, export_query_to_csv, export_table_to_csv, list_all_tools, read_changelog, test_connection` |
|
|
279
|
+
| `utilities` | Database utilities, diagnostics, and helper functions | `cursor_execute_request, describe_connection, export_query_to_csv, export_table_to_csv, list_all_tools, read_changelog, test_connection` |
|
|
254
280
|
| `transaction_management` | Handle ACID transactions and rollback operations | `begin_transaction, commit_transaction, execute_in_transaction, get_transaction_status, rollback_transaction` |
|
|
255
281
|
| `stored_procedures` | Create, execute, and manage stored procedures | `create_stored_procedure, drop_stored_procedure, execute_stored_procedure, get_stored_procedure_info, list_stored_procedures, show_create_procedure` |
|
|
256
282
|
| `views_management` | Create and manage database views | `alter_view, create_view, drop_view, get_view_info, list_views, show_create_view` |
|
|
@@ -276,7 +302,7 @@ Full category → tool mapping (and examples) lives in **[DOCUMENTATIONS.md →
|
|
|
276
302
|
|
|
277
303
|
## Available Tools
|
|
278
304
|
|
|
279
|
-
The server exposes **
|
|
305
|
+
The server exposes **79 tools** organized into categories (CRUD, schema, and utilities).
|
|
280
306
|
|
|
281
307
|
- Complete list of tools: **[DOCUMENTATIONS.md → Complete Tools Reference](DOCUMENTATIONS.md#🔧-complete-tools-reference)**
|
|
282
308
|
|
|
@@ -81,6 +81,8 @@ exports.toolCategoryMap = {
|
|
|
81
81
|
executeDdl: ToolCategory.DDL,
|
|
82
82
|
// Utility tools
|
|
83
83
|
describeConnection: ToolCategory.UTILITY,
|
|
84
|
+
cursorExecuteRequest: ToolCategory.UTILITY,
|
|
85
|
+
cursor_execute_request: ToolCategory.UTILITY,
|
|
84
86
|
testConnection: ToolCategory.UTILITY,
|
|
85
87
|
getAllTablesRelationships: ToolCategory.UTILITY,
|
|
86
88
|
exportTableToCSV: ToolCategory.UTILITY,
|
|
@@ -183,6 +185,8 @@ exports.toolDocCategoryMap = {
|
|
|
183
185
|
// Utilities
|
|
184
186
|
testConnection: DocCategory.UTILITIES,
|
|
185
187
|
describeConnection: DocCategory.UTILITIES,
|
|
188
|
+
cursorExecuteRequest: DocCategory.UTILITIES,
|
|
189
|
+
cursor_execute_request: DocCategory.UTILITIES,
|
|
186
190
|
exportTableToCSV: DocCategory.UTILITIES,
|
|
187
191
|
exportTableToCsv: DocCategory.UTILITIES,
|
|
188
192
|
export_table_to_csv: DocCategory.UTILITIES,
|
package/dist/mcp-server.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
4
9
|
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
5
10
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
6
11
|
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
@@ -641,6 +646,14 @@ const TOOLS = [
|
|
|
641
646
|
properties: {},
|
|
642
647
|
},
|
|
643
648
|
},
|
|
649
|
+
{
|
|
650
|
+
name: "cursor_execute_request",
|
|
651
|
+
description: "Cursor compatibility bridge for clients that can call MCP tools but cannot send arguments. Reads .cursor/mysql-mcp-request.json (or MYSQL_MCP_CURSOR_REQUEST_FILE) and dispatches to the requested MySQL MCP tool. The request file supports {\"tool\":\"execute_ddl\",\"arguments\":{\"query\":\"DROP TABLE IF EXISTS t;\"}} or direct SQL with {\"query\":\"...\",\"mode\":\"auto\"}.",
|
|
652
|
+
inputSchema: {
|
|
653
|
+
type: "object",
|
|
654
|
+
properties: {},
|
|
655
|
+
},
|
|
656
|
+
},
|
|
644
657
|
{
|
|
645
658
|
name: "read_changelog",
|
|
646
659
|
description: "Reads the MySQL MCP Server changelog to see version history, new features, bug fixes, and breaking changes. Useful for understanding tool capabilities and recent updates.",
|
|
@@ -1850,7 +1863,7 @@ const TOOLS = [
|
|
|
1850
1863
|
// Create the MCP server
|
|
1851
1864
|
const server = new index_js_1.Server({
|
|
1852
1865
|
name: "mysql-mcp-server",
|
|
1853
|
-
version: "1.40.
|
|
1866
|
+
version: "1.40.6",
|
|
1854
1867
|
}, {
|
|
1855
1868
|
capabilities: {
|
|
1856
1869
|
tools: {},
|
|
@@ -1865,6 +1878,90 @@ server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
|
|
|
1865
1878
|
tools: enabledTools,
|
|
1866
1879
|
};
|
|
1867
1880
|
});
|
|
1881
|
+
const TOOL_METHOD_OVERRIDES = {
|
|
1882
|
+
get_schema_erd: "getSchemaERD",
|
|
1883
|
+
export_table_to_csv: "exportTableToCSV",
|
|
1884
|
+
export_query_to_csv: "exportQueryToCSV",
|
|
1885
|
+
};
|
|
1886
|
+
const toCamelCase = (value) => value.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
1887
|
+
const getCursorRequestFilePath = () => {
|
|
1888
|
+
const configuredPath = process.env.MYSQL_MCP_CURSOR_REQUEST_FILE ||
|
|
1889
|
+
process.env.MCP_MYSQL_REQUEST_FILE ||
|
|
1890
|
+
".cursor/mysql-mcp-request.json";
|
|
1891
|
+
return path_1.default.isAbsolute(configuredPath)
|
|
1892
|
+
? configuredPath
|
|
1893
|
+
: path_1.default.resolve(process.cwd(), configuredPath);
|
|
1894
|
+
};
|
|
1895
|
+
const inferSqlToolName = (query, mode = "auto") => {
|
|
1896
|
+
const upperQuery = query.trim().toUpperCase();
|
|
1897
|
+
if (mode === "select")
|
|
1898
|
+
return "run_select_query";
|
|
1899
|
+
if (mode === "write")
|
|
1900
|
+
return "execute_write_query";
|
|
1901
|
+
if (mode === "ddl")
|
|
1902
|
+
return "execute_ddl";
|
|
1903
|
+
if (/^(CREATE|ALTER|DROP|TRUNCATE|RENAME)\b/.test(upperQuery)) {
|
|
1904
|
+
return "execute_ddl";
|
|
1905
|
+
}
|
|
1906
|
+
if (/^(INSERT|UPDATE|DELETE|REPLACE)\b/.test(upperQuery)) {
|
|
1907
|
+
return "execute_write_query";
|
|
1908
|
+
}
|
|
1909
|
+
if (/^(SELECT|WITH)\b/.test(upperQuery)) {
|
|
1910
|
+
return "run_select_query";
|
|
1911
|
+
}
|
|
1912
|
+
throw new Error("Unable to infer SQL tool. Set mode to one of: select, write, ddl.");
|
|
1913
|
+
};
|
|
1914
|
+
const executeToolByName = async (toolName, args = {}) => {
|
|
1915
|
+
const knownToolNames = new Set(TOOLS.map((tool) => tool.name));
|
|
1916
|
+
if (!knownToolNames.has(toolName)) {
|
|
1917
|
+
throw new Error(`Unknown tool for Cursor bridge: ${toolName}`);
|
|
1918
|
+
}
|
|
1919
|
+
if (toolName === "cursor_execute_request") {
|
|
1920
|
+
throw new Error("cursor_execute_request cannot dispatch to itself");
|
|
1921
|
+
}
|
|
1922
|
+
const methodName = TOOL_METHOD_OVERRIDES[toolName] || toCamelCase(toolName);
|
|
1923
|
+
const method = mysqlMCP[methodName];
|
|
1924
|
+
if (typeof method !== "function") {
|
|
1925
|
+
throw new Error(`No handler method found for Cursor bridge tool: ${toolName}`);
|
|
1926
|
+
}
|
|
1927
|
+
return await method.call(mysqlMCP, args);
|
|
1928
|
+
};
|
|
1929
|
+
const executeCursorRequest = async () => {
|
|
1930
|
+
const requestFilePath = getCursorRequestFilePath();
|
|
1931
|
+
if (!fs_1.default.existsSync(requestFilePath)) {
|
|
1932
|
+
return {
|
|
1933
|
+
status: "error",
|
|
1934
|
+
error: `Cursor request file not found: ${requestFilePath}. ` +
|
|
1935
|
+
'Create it with JSON like {"tool":"execute_ddl","arguments":{"query":"DROP TABLE IF EXISTS spark_processes;"}}',
|
|
1936
|
+
};
|
|
1937
|
+
}
|
|
1938
|
+
let request;
|
|
1939
|
+
try {
|
|
1940
|
+
request = JSON.parse(fs_1.default.readFileSync(requestFilePath, "utf8"));
|
|
1941
|
+
}
|
|
1942
|
+
catch (error) {
|
|
1943
|
+
return {
|
|
1944
|
+
status: "error",
|
|
1945
|
+
error: `Failed to read Cursor request file: ${error.message}`,
|
|
1946
|
+
};
|
|
1947
|
+
}
|
|
1948
|
+
const requestedTool = request.tool || request.toolName || request.name;
|
|
1949
|
+
if (requestedTool) {
|
|
1950
|
+
return await executeToolByName(requestedTool, request.arguments || request.args || {});
|
|
1951
|
+
}
|
|
1952
|
+
if (request.query) {
|
|
1953
|
+
const inferredTool = inferSqlToolName(request.query, request.mode || "auto");
|
|
1954
|
+
return await executeToolByName(inferredTool, {
|
|
1955
|
+
query: request.query,
|
|
1956
|
+
params: request.params,
|
|
1957
|
+
dry_run: request.dry_run,
|
|
1958
|
+
});
|
|
1959
|
+
}
|
|
1960
|
+
return {
|
|
1961
|
+
status: "error",
|
|
1962
|
+
error: "Cursor request must contain either tool/toolName/name with arguments, or query with optional mode.",
|
|
1963
|
+
};
|
|
1964
|
+
};
|
|
1868
1965
|
// Handle tool call requests
|
|
1869
1966
|
server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
1870
1967
|
const { name, arguments: args } = request.params;
|
|
@@ -1951,6 +2048,9 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
|
1951
2048
|
case "describe_connection":
|
|
1952
2049
|
result = await mysqlMCP.describeConnection();
|
|
1953
2050
|
break;
|
|
2051
|
+
case "cursor_execute_request":
|
|
2052
|
+
result = await executeCursorRequest();
|
|
2053
|
+
break;
|
|
1954
2054
|
case "test_connection":
|
|
1955
2055
|
result = await mysqlMCP.testConnection();
|
|
1956
2056
|
break;
|
package/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mysql-mcp",
|
|
3
3
|
"description": "A Model Context Protocol for MySQL database interaction",
|
|
4
|
-
"version": "1.40.
|
|
4
|
+
"version": "1.40.6",
|
|
5
5
|
"tools": [
|
|
6
6
|
{
|
|
7
7
|
"name": "list_databases",
|
|
@@ -348,6 +348,17 @@
|
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
},
|
|
351
|
+
{
|
|
352
|
+
"name": "cursor_execute_request",
|
|
353
|
+
"description": "Cursor compatibility bridge for clients that cannot send MCP tool arguments. Reads .cursor/mysql-mcp-request.json or MYSQL_MCP_CURSOR_REQUEST_FILE and dispatches to an existing MySQL MCP tool.",
|
|
354
|
+
"input_schema": {
|
|
355
|
+
"type": "object",
|
|
356
|
+
"properties": {}
|
|
357
|
+
},
|
|
358
|
+
"output_schema": {
|
|
359
|
+
"type": "object"
|
|
360
|
+
}
|
|
361
|
+
},
|
|
351
362
|
{
|
|
352
363
|
"name": "list_all_tools",
|
|
353
364
|
"description": "Lists all available MCP tools with their definitions and server metadata.",
|
|
@@ -730,4 +741,4 @@
|
|
|
730
741
|
}
|
|
731
742
|
}
|
|
732
743
|
]
|
|
733
|
-
}
|
|
744
|
+
}
|
package/package.json
CHANGED