@neverinfamous/mysql-mcp 2.2.0 → 2.3.1
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/.github/workflows/codeql.yml +0 -8
- package/.github/workflows/docker-publish.yml +11 -10
- package/CHANGELOG.md +96 -0
- package/CODE_MODE.md +245 -0
- package/DOCKER_README.md +71 -254
- package/Dockerfile +5 -0
- package/README.md +102 -55
- package/VERSION +1 -1
- package/dist/adapters/mysql/MySQLAdapter.d.ts +4 -0
- package/dist/adapters/mysql/MySQLAdapter.d.ts.map +1 -1
- package/dist/adapters/mysql/MySQLAdapter.js +9 -0
- package/dist/adapters/mysql/MySQLAdapter.js.map +1 -1
- package/dist/adapters/mysql/prompts/index.d.ts +8 -1
- package/dist/adapters/mysql/prompts/index.d.ts.map +1 -1
- package/dist/adapters/mysql/prompts/index.js +8 -1
- package/dist/adapters/mysql/prompts/index.js.map +1 -1
- package/dist/adapters/mysql/prompts/routerSetup.d.ts.map +1 -1
- package/dist/adapters/mysql/prompts/routerSetup.js +5 -0
- package/dist/adapters/mysql/prompts/routerSetup.js.map +1 -1
- package/dist/adapters/mysql/resources/capabilities.d.ts.map +1 -1
- package/dist/adapters/mysql/resources/capabilities.js +6 -5
- package/dist/adapters/mysql/resources/capabilities.js.map +1 -1
- package/dist/adapters/mysql/resources/index.d.ts +9 -1
- package/dist/adapters/mysql/resources/index.d.ts.map +1 -1
- package/dist/adapters/mysql/resources/index.js +9 -1
- package/dist/adapters/mysql/resources/index.js.map +1 -1
- package/dist/adapters/mysql/tools/admin/backup.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/admin/backup.js +3 -3
- package/dist/adapters/mysql/tools/admin/backup.js.map +1 -1
- package/dist/adapters/mysql/tools/admin/maintenance.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/admin/maintenance.js +5 -5
- package/dist/adapters/mysql/tools/admin/maintenance.js.map +1 -1
- package/dist/adapters/mysql/tools/cluster/innodb-cluster.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/cluster/innodb-cluster.js +26 -5
- package/dist/adapters/mysql/tools/cluster/innodb-cluster.js.map +1 -1
- package/dist/adapters/mysql/tools/codemode/index.d.ts +38 -0
- package/dist/adapters/mysql/tools/codemode/index.d.ts.map +1 -0
- package/dist/adapters/mysql/tools/codemode/index.js +203 -0
- package/dist/adapters/mysql/tools/codemode/index.js.map +1 -0
- package/dist/adapters/mysql/tools/core.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/core.js +32 -20
- package/dist/adapters/mysql/tools/core.js.map +1 -1
- package/dist/adapters/mysql/tools/events.js +18 -6
- package/dist/adapters/mysql/tools/events.js.map +1 -1
- package/dist/adapters/mysql/tools/json/core.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/json/core.js +5 -5
- package/dist/adapters/mysql/tools/json/core.js.map +1 -1
- package/dist/adapters/mysql/tools/json/helpers.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/json/helpers.js +9 -3
- package/dist/adapters/mysql/tools/json/helpers.js.map +1 -1
- package/dist/adapters/mysql/tools/partitioning.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/partitioning.js +38 -6
- package/dist/adapters/mysql/tools/partitioning.js.map +1 -1
- package/dist/adapters/mysql/tools/performance/analysis.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/performance/analysis.js +67 -20
- package/dist/adapters/mysql/tools/performance/analysis.js.map +1 -1
- package/dist/adapters/mysql/tools/performance/optimization.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/performance/optimization.js +36 -6
- package/dist/adapters/mysql/tools/performance/optimization.js.map +1 -1
- package/dist/adapters/mysql/tools/security/data-protection.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/security/data-protection.js +9 -4
- package/dist/adapters/mysql/tools/security/data-protection.js.map +1 -1
- package/dist/adapters/mysql/tools/shell/common.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/shell/common.js +28 -2
- package/dist/adapters/mysql/tools/shell/common.js.map +1 -1
- package/dist/adapters/mysql/tools/shell/restore.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/shell/restore.js +54 -4
- package/dist/adapters/mysql/tools/shell/restore.js.map +1 -1
- package/dist/adapters/mysql/tools/spatial/operations.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/spatial/operations.js +10 -2
- package/dist/adapters/mysql/tools/spatial/operations.js.map +1 -1
- package/dist/adapters/mysql/tools/spatial/setup.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/spatial/setup.js +18 -0
- package/dist/adapters/mysql/tools/spatial/setup.js.map +1 -1
- package/dist/adapters/mysql/tools/sysschema/resources.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/sysschema/resources.js +5 -0
- package/dist/adapters/mysql/tools/sysschema/resources.js.map +1 -1
- package/dist/adapters/mysql/tools/text/fulltext.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/text/fulltext.js +6 -4
- package/dist/adapters/mysql/tools/text/fulltext.js.map +1 -1
- package/dist/adapters/mysql/tools/text/processing.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/text/processing.js +10 -45
- package/dist/adapters/mysql/tools/text/processing.js.map +1 -1
- package/dist/adapters/mysql/tools/transactions.d.ts.map +1 -1
- package/dist/adapters/mysql/tools/transactions.js +8 -8
- package/dist/adapters/mysql/tools/transactions.js.map +1 -1
- package/dist/adapters/mysql/types.d.ts +968 -78
- package/dist/adapters/mysql/types.d.ts.map +1 -1
- package/dist/adapters/mysql/types.js +1084 -78
- package/dist/adapters/mysql/types.js.map +1 -1
- package/dist/auth/scopes.d.ts.map +1 -1
- package/dist/auth/scopes.js +1 -0
- package/dist/auth/scopes.js.map +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +12 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/codemode/api.d.ts +69 -0
- package/dist/codemode/api.d.ts.map +1 -0
- package/dist/codemode/api.js +1035 -0
- package/dist/codemode/api.js.map +1 -0
- package/dist/codemode/index.d.ts +13 -0
- package/dist/codemode/index.d.ts.map +1 -0
- package/dist/codemode/index.js +17 -0
- package/dist/codemode/index.js.map +1 -0
- package/dist/codemode/sandbox-factory.d.ts +72 -0
- package/dist/codemode/sandbox-factory.d.ts.map +1 -0
- package/dist/codemode/sandbox-factory.js +88 -0
- package/dist/codemode/sandbox-factory.js.map +1 -0
- package/dist/codemode/sandbox.d.ts +96 -0
- package/dist/codemode/sandbox.d.ts.map +1 -0
- package/dist/codemode/sandbox.js +345 -0
- package/dist/codemode/sandbox.js.map +1 -0
- package/dist/codemode/security.d.ts +44 -0
- package/dist/codemode/security.d.ts.map +1 -0
- package/dist/codemode/security.js +149 -0
- package/dist/codemode/security.js.map +1 -0
- package/dist/codemode/types.d.ts +137 -0
- package/dist/codemode/types.d.ts.map +1 -0
- package/dist/codemode/types.js +46 -0
- package/dist/codemode/types.js.map +1 -0
- package/dist/codemode/worker-sandbox.d.ts +82 -0
- package/dist/codemode/worker-sandbox.d.ts.map +1 -0
- package/dist/codemode/worker-sandbox.js +244 -0
- package/dist/codemode/worker-sandbox.js.map +1 -0
- package/dist/codemode/worker-script.d.ts +8 -0
- package/dist/codemode/worker-script.d.ts.map +1 -0
- package/dist/codemode/worker-script.js +113 -0
- package/dist/codemode/worker-script.js.map +1 -0
- package/dist/constants/ServerInstructions.d.ts +1 -1
- package/dist/constants/ServerInstructions.d.ts.map +1 -1
- package/dist/constants/ServerInstructions.js +33 -9
- package/dist/constants/ServerInstructions.js.map +1 -1
- package/dist/filtering/ToolConstants.d.ts +11 -11
- package/dist/filtering/ToolConstants.d.ts.map +1 -1
- package/dist/filtering/ToolConstants.js +37 -19
- package/dist/filtering/ToolConstants.js.map +1 -1
- package/dist/filtering/ToolFilter.d.ts.map +1 -1
- package/dist/filtering/ToolFilter.js +12 -0
- package/dist/filtering/ToolFilter.js.map +1 -1
- package/dist/server/McpServer.js +1 -1
- package/dist/server/McpServer.js.map +1 -1
- package/dist/types/modules/server.d.ts +2 -0
- package/dist/types/modules/server.d.ts.map +1 -1
- package/dist/types/modules/tools.d.ts +1 -1
- package/dist/types/modules/tools.d.ts.map +1 -1
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js.map +1 -1
- package/package.json +12 -7
- package/releases/v2.2.0-release-notes.md +18 -18
- package/releases/v2.3.0-release-notes.md +191 -0
- package/releases/v2.3.1-release-notes.md +34 -0
- package/src/__tests__/perf.test.ts +12 -12
- package/src/adapters/mysql/MySQLAdapter.ts +10 -0
- package/src/adapters/mysql/__tests__/MySQLAdapter.test.ts +1 -1
- package/src/adapters/mysql/prompts/index.ts +8 -1
- package/src/adapters/mysql/prompts/routerSetup.ts +5 -0
- package/src/adapters/mysql/resources/__tests__/capabilities.test.ts +50 -1
- package/src/adapters/mysql/resources/capabilities.ts +6 -4
- package/src/adapters/mysql/resources/index.ts +9 -1
- package/src/adapters/mysql/tools/__tests__/core.test.ts +68 -0
- package/src/adapters/mysql/tools/__tests__/events.test.ts +56 -2
- package/src/adapters/mysql/tools/__tests__/json_core.test.ts +1 -1
- package/src/adapters/mysql/tools/__tests__/json_helpers.test.ts +46 -4
- package/src/adapters/mysql/tools/__tests__/replication.test.ts +144 -42
- package/src/adapters/mysql/tools/__tests__/security.test.ts +39 -0
- package/src/adapters/mysql/tools/__tests__/spatial.test.ts +39 -7
- package/src/adapters/mysql/tools/__tests__/spatial_handler.test.ts +35 -3
- package/src/adapters/mysql/tools/__tests__/transactions.test.ts +3 -5
- package/src/adapters/mysql/tools/admin/backup.ts +8 -3
- package/src/adapters/mysql/tools/admin/maintenance.ts +8 -4
- package/src/adapters/mysql/tools/cluster/__tests__/innodb-cluster.test.ts +35 -0
- package/src/adapters/mysql/tools/cluster/innodb-cluster.ts +26 -5
- package/src/adapters/mysql/tools/codemode/index.ts +249 -0
- package/src/adapters/mysql/tools/core.ts +44 -27
- package/src/adapters/mysql/tools/events.ts +23 -7
- package/src/adapters/mysql/tools/json/__tests__/helpers.test.ts +59 -14
- package/src/adapters/mysql/tools/json/core.ts +8 -4
- package/src/adapters/mysql/tools/json/helpers.ts +13 -3
- package/src/adapters/mysql/tools/partitioning.ts +53 -6
- package/src/adapters/mysql/tools/performance/__tests__/analysis.test.ts +227 -4
- package/src/adapters/mysql/tools/performance/__tests__/optimization.test.ts +35 -0
- package/src/adapters/mysql/tools/performance/analysis.ts +75 -21
- package/src/adapters/mysql/tools/performance/optimization.ts +44 -6
- package/src/adapters/mysql/tools/security/data-protection.ts +10 -4
- package/src/adapters/mysql/tools/shell/__tests__/common.test.ts +46 -0
- package/src/adapters/mysql/tools/shell/__tests__/restore.test.ts +28 -1
- package/src/adapters/mysql/tools/shell/common.ts +34 -2
- package/src/adapters/mysql/tools/shell/restore.ts +70 -7
- package/src/adapters/mysql/tools/spatial/__tests__/operations.test.ts +29 -0
- package/src/adapters/mysql/tools/spatial/operations.ts +13 -2
- package/src/adapters/mysql/tools/spatial/setup.ts +23 -0
- package/src/adapters/mysql/tools/sysschema/__tests__/resources.test.ts +21 -0
- package/src/adapters/mysql/tools/sysschema/resources.ts +5 -0
- package/src/adapters/mysql/tools/text/fulltext.ts +13 -5
- package/src/adapters/mysql/tools/text/processing.ts +20 -49
- package/src/adapters/mysql/tools/transactions.ts +11 -7
- package/src/adapters/mysql/types.ts +1241 -87
- package/src/auth/scopes.ts +1 -0
- package/src/cli/args.ts +14 -0
- package/src/codemode/api.ts +1224 -0
- package/src/codemode/index.ts +51 -0
- package/src/codemode/sandbox-factory.ts +146 -0
- package/src/codemode/sandbox.ts +450 -0
- package/src/codemode/security.ts +188 -0
- package/src/codemode/types.ts +194 -0
- package/src/codemode/worker-sandbox.ts +326 -0
- package/src/codemode/worker-script.ts +144 -0
- package/src/constants/ServerInstructions.ts +33 -9
- package/src/filtering/ToolConstants.ts +37 -19
- package/src/filtering/ToolFilter.ts +15 -0
- package/src/filtering/__tests__/ToolFilter.test.ts +65 -38
- package/src/server/McpServer.ts +1 -1
- package/src/types/modules/server.ts +3 -0
- package/src/types/modules/tools.ts +2 -1
- package/src/utils/logger.ts +2 -1
package/DOCKER_README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MySQL MCP Server
|
|
2
2
|
|
|
3
|
-
**Last Updated
|
|
3
|
+
**Last Updated February 18, 2026**
|
|
4
4
|
|
|
5
5
|
[](https://github.com/neverinfamous/mysql-mcp)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
[](https://hub.docker.com/r/writenotenow/mysql-mcp)
|
|
10
10
|
[](SECURITY.md)
|
|
11
11
|

|
|
12
|
-

|
|
13
|
+

|
|
14
14
|
|
|
15
15
|
**[📚 Full Documentation (Wiki)](https://github.com/neverinfamous/mysql-mcp/wiki)** • **[Changelog](https://github.com/neverinfamous/mysql-mcp/blob/master/CHANGELOG.md)** • **[Security](https://github.com/neverinfamous/mysql-mcp/blob/master/SECURITY.md)** • **[Release Article](https://adamic.tech/articles/mysql-mcp-server)**
|
|
16
16
|
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
|
|
23
23
|
| Feature | Description |
|
|
24
24
|
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
25
|
-
| **
|
|
25
|
+
| **193 Specialized Tools** | The largest MySQL tool collection for MCP — from core CRUD and native JSON functions (MySQL 5.7+) to advanced spatial/GIS, document store, and cluster management |
|
|
26
26
|
| **18 Observability Resources** | Real-time schema, performance metrics, process lists, status variables, replication status, and InnoDB diagnostics |
|
|
27
27
|
| **19 AI-Powered Prompts** | Guided workflows for query building, schema design, performance tuning, and infrastructure setup |
|
|
28
28
|
| **OAuth 2.1 + Access Control** | Enterprise-ready security with RFC 9728/8414 compliance, granular scopes (`read`, `write`, `admin`, `full`, `db:*`, `table:*:*`), and Keycloak integration |
|
|
29
|
-
| **Smart Tool Filtering** |
|
|
29
|
+
| **Smart Tool Filtering** | 25 tool groups + 11 shortcuts let you stay within IDE limits while exposing exactly what you need |
|
|
30
30
|
| **HTTP Streaming Transport** | SSE-based streaming with `/sse`, `/messages`, and `/health` endpoints for remote deployments |
|
|
31
31
|
| **High-Performance Pooling** | Built-in connection pooling for efficient, concurrent database access |
|
|
32
32
|
| **Ecosystem Integrations** | First-class support for **MySQL Router**, **ProxySQL**, and **MySQL Shell** utilities |
|
|
33
33
|
| **Advanced Encryption** | Full TLS/SSL support for secure connections, plus tools for managing data masking, encryption monitoring, and compliance |
|
|
34
34
|
| **Production-Ready Security** | SQL injection protection, parameterized queries, input validation, and audit capabilities |
|
|
35
|
-
| **Strict TypeScript** | 100% type-safe codebase with
|
|
35
|
+
| **Strict TypeScript** | 100% type-safe codebase with 1833 tests and 86% coverage |
|
|
36
36
|
| **MCP 2025-11-25 Compliant** | Full protocol support with tool safety hints, resource priorities, and progress notifications |
|
|
37
37
|
|
|
38
38
|
---
|
|
@@ -50,13 +50,18 @@
|
|
|
50
50
|
#### NPM (Recommended)
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
# Install globally
|
|
54
53
|
npm install -g @neverinfamous/mysql-mcp
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Run the server:
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
```bash
|
|
57
59
|
mysql-mcp --transport stdio --mysql mysql://user:password@localhost:3306/database
|
|
60
|
+
```
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
Or use npx without installing:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
60
65
|
npx @neverinfamous/mysql-mcp --transport stdio --mysql mysql://user:password@localhost:3306/database
|
|
61
66
|
```
|
|
62
67
|
|
|
@@ -116,14 +121,19 @@ mysql-mcp --mysql mysql://root:pass@localhost/db \
|
|
|
116
121
|
|
|
117
122
|
**Start the HTTP server:**
|
|
118
123
|
|
|
124
|
+
Local installation:
|
|
125
|
+
|
|
119
126
|
```bash
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
node dist/cli.js --transport http --port 3000 --server-host 0.0.0.0 --mysql mysql://user:password@localhost:3306/database
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Docker (expose port 3000):
|
|
122
131
|
|
|
123
|
-
|
|
132
|
+
```bash
|
|
124
133
|
docker run -p 3000:3000 writenotenow/mysql-mcp \
|
|
125
134
|
--transport http \
|
|
126
135
|
--port 3000 \
|
|
136
|
+
--server-host 0.0.0.0 \
|
|
127
137
|
--mysql mysql://user:password@host.docker.internal:3306/database
|
|
128
138
|
```
|
|
129
139
|
|
|
@@ -190,51 +200,30 @@ docker run -p 3000:3000 writenotenow/mysql-mcp \
|
|
|
190
200
|
| **MySQL in Docker** | Container name or network | `mysql://user:pass@mysql-container:3306/db` |
|
|
191
201
|
| **Remote/Cloud MySQL** | Hostname or IP | `mysql://user:pass@db.example.com:3306/db` |
|
|
192
202
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
If MySQL is installed directly on your computer (via installer, Homebrew, etc.):
|
|
196
|
-
|
|
197
|
-
```json
|
|
198
|
-
"--mysql", "mysql://user:password@host.docker.internal:3306/database"
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### MySQL in Another Docker Container
|
|
202
|
-
|
|
203
|
-
Add both containers to the same Docker network, then use the container name:
|
|
204
|
-
|
|
205
|
-
```bash
|
|
206
|
-
# Create network and run MySQL
|
|
207
|
-
docker network create mynet
|
|
208
|
-
docker run -d --name mysql-db --network mynet -e MYSQL_ROOT_PASSWORD=pass mysql:8
|
|
209
|
-
# Run MCP server on same network
|
|
210
|
-
docker run -i --rm --network mynet writenotenow/mysql-mcp:latest \
|
|
211
|
-
--transport stdio --mysql mysql://root:pass@mysql-db:3306/mysql
|
|
212
|
-
```
|
|
203
|
+
> **Tip:** For remote connections, ensure your MySQL server allows connections from Docker's IP range and that firewalls/security groups permit port 3306.
|
|
213
204
|
|
|
214
|
-
|
|
205
|
+
---
|
|
215
206
|
|
|
216
|
-
|
|
207
|
+
## Code Mode: Maximum Efficiency
|
|
217
208
|
|
|
218
|
-
|
|
219
|
-
"--mysql", "mysql://user:password@your-instance.region.rds.amazonaws.com:3306/database"
|
|
220
|
-
```
|
|
209
|
+
Code Mode (`mysql_execute_code`) dramatically reduces token usage (70–90%) and is included by default in all presets.
|
|
221
210
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
| DigitalOcean | `your-cluster-do-user-xxx.db.ondigitalocean.com` |
|
|
211
|
+
> [!TIP]
|
|
212
|
+
> **Maximize Token Savings:** For the best results, instruct your AI agent to prefer Code Mode over individual tool calls. Add a rule like this to your agent's prompt or system configuration:
|
|
213
|
+
>
|
|
214
|
+
> _"When using mysql-mcp, prefer `mysql_execute_code` (Code Mode) for multi-step database operations to minimize token usage."_
|
|
215
|
+
>
|
|
216
|
+
> This ensures the agent batches operations into single calls instead of making many individual tool calls. See the [Code Mode wiki](https://github.com/neverinfamous/mysql-mcp/wiki/Code-Mode) for full API documentation.
|
|
229
217
|
|
|
230
|
-
>
|
|
218
|
+
> [!NOTE]
|
|
219
|
+
> **AntiGravity Users:** Server instructions are automatically sent to MCP clients during initialization. However, AntiGravity does not currently support MCP server instructions. For optimal Code Mode usage in AntiGravity, manually provide the contents of [`src/constants/ServerInstructions.ts`](https://github.com/neverinfamous/mysql-mcp/blob/master/src/constants/ServerInstructions.ts) to the agent in your prompt or user rules.
|
|
231
220
|
|
|
232
221
|
---
|
|
233
222
|
|
|
234
223
|
## 🛠️ Tool Filtering
|
|
235
224
|
|
|
236
225
|
> [!IMPORTANT]
|
|
237
|
-
> **AI IDEs like Cursor have tool limits (typically 40-50 tools).** With
|
|
226
|
+
> **AI IDEs like Cursor have tool limits (typically 40-50 tools).** With 193 tools available, you MUST use tool filtering to stay within your IDE's limits. We recommend `starter` (39 tools) as a starting point. Code Mode is included in all presets by default for 70-90% token savings on multi-step operations.
|
|
238
227
|
|
|
239
228
|
### What Can You Filter?
|
|
240
229
|
|
|
@@ -242,28 +231,28 @@ The `--tool-filter` argument accepts **shortcuts**, **groups**, or **tool names*
|
|
|
242
231
|
|
|
243
232
|
| Filter Pattern | Example | Tools | Description |
|
|
244
233
|
| ---------------- | --------------------------- | ----- | ------------------------- |
|
|
245
|
-
| Shortcut only | `starter` |
|
|
234
|
+
| Shortcut only | `starter` | 39 | Use a predefined bundle |
|
|
246
235
|
| Groups only | `core,json,transactions` | 32 | Combine individual groups |
|
|
247
|
-
| Shortcut + Group | `starter,spatial` |
|
|
248
|
-
| Shortcut - Tool | `starter,-mysql_drop_table` |
|
|
236
|
+
| Shortcut + Group | `starter,spatial` | 51 | Extend a shortcut |
|
|
237
|
+
| Shortcut - Tool | `starter,-mysql_drop_table` | 38 | Remove specific tools |
|
|
249
238
|
|
|
250
239
|
### Shortcuts (Predefined Bundles)
|
|
251
240
|
|
|
252
|
-
| Shortcut | Tools | Use Case | What's Included
|
|
253
|
-
| --------------- | ------ | ------------------ |
|
|
254
|
-
| `starter` | **
|
|
255
|
-
| `essential` |
|
|
256
|
-
| `dev-power` |
|
|
257
|
-
| `ai-data` |
|
|
258
|
-
| `ai-spatial` |
|
|
259
|
-
| `dba-monitor` |
|
|
260
|
-
| `dba-manage` |
|
|
261
|
-
| `dba-secure` |
|
|
262
|
-
| `base-core` |
|
|
263
|
-
| `base-advanced` |
|
|
264
|
-
| `ecosystem` |
|
|
265
|
-
|
|
266
|
-
### Tool Groups (
|
|
241
|
+
| Shortcut | Tools | Use Case | What's Included |
|
|
242
|
+
| --------------- | ------ | ------------------ | ------------------------------------------------------------------ |
|
|
243
|
+
| `starter` | **39** | 🌟 **Recommended** | core, json, transactions, text, codemode |
|
|
244
|
+
| `essential` | 16 | Minimal footprint | core, transactions, codemode |
|
|
245
|
+
| `dev-power` | 47 | Power Developer | core, schema, performance, stats, fulltext, transactions, codemode |
|
|
246
|
+
| `ai-data` | 46 | AI Data Analyst | core, json, docstore, text, fulltext, codemode |
|
|
247
|
+
| `ai-spatial` | 44 | AI Spatial Analyst | core, spatial, stats, performance, transactions, codemode |
|
|
248
|
+
| `dba-monitor` | 36 | DBA Monitoring | core, monitoring, performance, sysschema, optimization, codemode |
|
|
249
|
+
| `dba-manage` | 34 | DBA Management | core, admin, backup, replication, partitioning, events, codemode |
|
|
250
|
+
| `dba-secure` | 33 | DBA Security | core, security, roles, transactions, codemode |
|
|
251
|
+
| `base-core` | 49 | Base Ops | core, json, transactions, text, schema, codemode |
|
|
252
|
+
| `base-advanced` | 41 | Advanced Features | docstore, spatial, stats, fulltext, events, codemode |
|
|
253
|
+
| `ecosystem` | 42 | External Tools | cluster, proxysql, router, shell, codemode |
|
|
254
|
+
|
|
255
|
+
### Tool Groups (25 Available)
|
|
267
256
|
|
|
268
257
|
| Group | Tools | Description |
|
|
269
258
|
| -------------- | ----- | ---------------------------------------- |
|
|
@@ -291,131 +280,11 @@ The `--tool-filter` argument accepts **shortcuts**, **groups**, or **tool names*
|
|
|
291
280
|
| `cluster` | 10 | Group Replication, InnoDB Cluster |
|
|
292
281
|
| `proxysql` | 12 | ProxySQL management |
|
|
293
282
|
| `router` | 9 | MySQL Router REST API |
|
|
283
|
+
| `codemode` | 1 | Sandboxed code execution |
|
|
294
284
|
|
|
295
285
|
---
|
|
296
286
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
Add one of these configurations to your IDE's MCP settings file (e.g., `cline_mcp_settings.json`, `.cursorrules`, or equivalent):
|
|
300
|
-
|
|
301
|
-
#### Option 1: Starter (38 Essential Tools)
|
|
302
|
-
|
|
303
|
-
**Best for:** General MySQL database work - CRUD operations, schema management, and monitoring.
|
|
304
|
-
|
|
305
|
-
```json
|
|
306
|
-
{
|
|
307
|
-
"mcpServers": {
|
|
308
|
-
"mysql-mcp": {
|
|
309
|
-
"command": "node",
|
|
310
|
-
"args": [
|
|
311
|
-
"/path/to/mysql-mcp/dist/cli.js",
|
|
312
|
-
"--transport",
|
|
313
|
-
"stdio",
|
|
314
|
-
"--tool-filter",
|
|
315
|
-
"starter"
|
|
316
|
-
],
|
|
317
|
-
"env": {
|
|
318
|
-
"MYSQL_HOST": "localhost",
|
|
319
|
-
"MYSQL_PORT": "3306",
|
|
320
|
-
"MYSQL_USER": "your_username",
|
|
321
|
-
"MYSQL_PASSWORD": "your_password",
|
|
322
|
-
"MYSQL_DATABASE": "your_database"
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
#### Option 2: Cluster (10 Tools for InnoDB Cluster Monitoring)
|
|
330
|
-
|
|
331
|
-
**Best for:** Monitoring InnoDB Cluster, Group Replication status, and cluster topology.
|
|
332
|
-
|
|
333
|
-
> **⚠️ Prerequisites:**
|
|
334
|
-
>
|
|
335
|
-
> - **InnoDB Cluster** must be configured and running with Group Replication enabled
|
|
336
|
-
> - Connect to a cluster node directly (e.g., `localhost:3307`) — NOT a standalone MySQL instance
|
|
337
|
-
> - Use `cluster_admin` or `root` user with appropriate privileges
|
|
338
|
-
> - See [MySQL Ecosystem Setup Guide](https://github.com/neverinfamous/mysql-mcp/wiki/MySQL-Ecosystem-Setup) for cluster setup instructions
|
|
339
|
-
|
|
340
|
-
```json
|
|
341
|
-
{
|
|
342
|
-
"mcpServers": {
|
|
343
|
-
"mysql-mcp-cluster": {
|
|
344
|
-
"command": "node",
|
|
345
|
-
"args": [
|
|
346
|
-
"/path/to/mysql-mcp/dist/cli.js",
|
|
347
|
-
"--transport",
|
|
348
|
-
"stdio",
|
|
349
|
-
"--tool-filter",
|
|
350
|
-
"cluster"
|
|
351
|
-
],
|
|
352
|
-
"env": {
|
|
353
|
-
"MYSQL_HOST": "localhost",
|
|
354
|
-
"MYSQL_PORT": "3307",
|
|
355
|
-
"MYSQL_USER": "cluster_admin",
|
|
356
|
-
"MYSQL_PASSWORD": "cluster_password",
|
|
357
|
-
"MYSQL_DATABASE": "mysql"
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
#### Option 3: Ecosystem (41 Tools for InnoDB Cluster Deployments)
|
|
365
|
-
|
|
366
|
-
**Best for:** MySQL Router, ProxySQL, MySQL Shell, and InnoDB Cluster deployments.
|
|
367
|
-
|
|
368
|
-
> **⚠️ Prerequisites:**
|
|
369
|
-
>
|
|
370
|
-
> - **InnoDB Cluster** with MySQL Router requires the cluster to be running for Router REST API authentication (uses `metadata_cache` backend)
|
|
371
|
-
> - Router REST API uses HTTPS with self-signed certificates by default — set `MYSQL_ROUTER_INSECURE=true` to bypass certificate verification
|
|
372
|
-
> - **X Protocol:** InnoDB Cluster includes the MySQL X Plugin by default. Set `MYSQL_XPORT` to the Router's X Protocol port (e.g., `6448`) for `mysqlsh_import_json` and `docstore` tools
|
|
373
|
-
> - See [MySQL Ecosystem Setup Guide](https://github.com/neverinfamous/mysql-mcp/wiki/MySQL-Ecosystem-Setup) for detailed instructions
|
|
374
|
-
|
|
375
|
-
```json
|
|
376
|
-
{
|
|
377
|
-
"mcpServers": {
|
|
378
|
-
"mysql-mcp-ecosystem": {
|
|
379
|
-
"command": "node",
|
|
380
|
-
"args": [
|
|
381
|
-
"/path/to/mysql-mcp/dist/cli.js",
|
|
382
|
-
"--transport",
|
|
383
|
-
"stdio",
|
|
384
|
-
"--tool-filter",
|
|
385
|
-
"ecosystem"
|
|
386
|
-
],
|
|
387
|
-
"env": {
|
|
388
|
-
"MYSQL_HOST": "localhost",
|
|
389
|
-
"MYSQL_PORT": "3307",
|
|
390
|
-
"MYSQL_XPORT": "6448",
|
|
391
|
-
"MYSQL_USER": "cluster_admin",
|
|
392
|
-
"MYSQL_PASSWORD": "cluster_password",
|
|
393
|
-
"MYSQL_DATABASE": "testdb",
|
|
394
|
-
"MYSQL_ROUTER_URL": "https://localhost:8443",
|
|
395
|
-
"MYSQL_ROUTER_USER": "rest_api",
|
|
396
|
-
"MYSQL_ROUTER_PASSWORD": "router_password",
|
|
397
|
-
"MYSQL_ROUTER_INSECURE": "true",
|
|
398
|
-
"PROXYSQL_HOST": "localhost",
|
|
399
|
-
"PROXYSQL_PORT": "6032",
|
|
400
|
-
"PROXYSQL_USER": "radmin",
|
|
401
|
-
"PROXYSQL_PASSWORD": "radmin",
|
|
402
|
-
"MYSQLSH_PATH": "/usr/local/bin/mysqlsh"
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
**Customization Notes:**
|
|
410
|
-
|
|
411
|
-
- Replace `/path/to/mysql-mcp/` with your actual installation path
|
|
412
|
-
- Update credentials with your actual values
|
|
413
|
-
- For Windows: Use forward slashes (e.g., `C:/mysql-mcp/dist/cli.js`) or escape backslashes
|
|
414
|
-
- For Windows MySQL Shell: `"MYSQLSH_PATH": "C:\\Program Files\\MySQL\\MySQL Shell 9.5\\bin\\mysqlsh.exe"`
|
|
415
|
-
- **Router Authentication:** Router REST API authenticates against the InnoDB Cluster metadata. The cluster must be running for authentication to work.
|
|
416
|
-
- **Cluster Resource:** The `mysql://cluster` resource is only available when connected to an InnoDB Cluster node
|
|
417
|
-
|
|
418
|
-
> **📖 See the [Tool Filtering Wiki](https://github.com/neverinfamous/mysql-mcp/wiki/Tool-Filtering)** for advanced examples.
|
|
287
|
+
> **📖 See the [Tool Filtering Wiki](https://github.com/neverinfamous/mysql-mcp/wiki/Tool-Filtering)** for IDE configuration examples and advanced usage.
|
|
419
288
|
|
|
420
289
|
---
|
|
421
290
|
|
|
@@ -430,56 +299,13 @@ For debugging or manual reference, see the source: [`src/constants/ServerInstruc
|
|
|
430
299
|
|
|
431
300
|
## 🤖 AI-Powered Prompts
|
|
432
301
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
| Prompt | Description |
|
|
436
|
-
| ----------------------------- | ------------------------------------------------------ |
|
|
437
|
-
| `mysql_query_builder` | Construct SQL queries with security best practices |
|
|
438
|
-
| `mysql_schema_design` | Design table schemas with indexes and relationships |
|
|
439
|
-
| `mysql_performance_analysis` | Analyze slow queries with optimization recommendations |
|
|
440
|
-
| `mysql_migration` | Generate migration scripts with rollback options |
|
|
441
|
-
| `mysql_database_health_check` | Comprehensive database health assessment |
|
|
442
|
-
| `mysql_backup_strategy` | Enterprise backup planning with RTO/RPO |
|
|
443
|
-
| `mysql_index_tuning` | Index analysis and optimization workflow |
|
|
444
|
-
| `mysql_setup_router` | MySQL Router configuration guide |
|
|
445
|
-
| `mysql_setup_proxysql` | ProxySQL configuration guide |
|
|
446
|
-
| `mysql_setup_replication` | Replication setup guide |
|
|
447
|
-
| `mysql_setup_shell` | MySQL Shell usage guide |
|
|
448
|
-
| `mysql_tool_index` | Complete tool index with categories |
|
|
449
|
-
| `mysql_quick_query` | Quick query execution shortcut |
|
|
450
|
-
| `mysql_quick_schema` | Quick schema exploration |
|
|
451
|
-
| **`mysql_setup_events`** | Event Scheduler setup guide |
|
|
452
|
-
| **`mysql_sys_schema_guide`** | sys schema usage and diagnostics |
|
|
453
|
-
| **`mysql_setup_spatial`** | Spatial/GIS data setup guide |
|
|
454
|
-
| **`mysql_setup_cluster`** | InnoDB Cluster/Group Replication guide |
|
|
455
|
-
| **`mysql_setup_docstore`** | Document Store / X DevAPI guide |
|
|
302
|
+
**19 intelligent prompts** for guided workflows including query building, schema design, performance analysis, migration planning, backup strategy, index tuning, and ecosystem setup (Router, ProxySQL, Replication, Shell, Cluster, Spatial, Events, Document Store).
|
|
456
303
|
|
|
457
304
|
---
|
|
458
305
|
|
|
459
306
|
## 📊 Resources
|
|
460
307
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
| Resource | Description |
|
|
464
|
-
| ----------------------- | ------------------------------------------- |
|
|
465
|
-
| `mysql://schema` | Full database schema |
|
|
466
|
-
| `mysql://tables` | Table listing with metadata |
|
|
467
|
-
| `mysql://variables` | Server configuration variables |
|
|
468
|
-
| `mysql://status` | Server status metrics |
|
|
469
|
-
| `mysql://processlist` | Active connections and queries |
|
|
470
|
-
| `mysql://pool` | Connection pool statistics |
|
|
471
|
-
| `mysql://capabilities` | Server version, features, tool categories |
|
|
472
|
-
| `mysql://health` | Comprehensive health status |
|
|
473
|
-
| `mysql://performance` | Query performance metrics |
|
|
474
|
-
| `mysql://indexes` | Index usage and statistics |
|
|
475
|
-
| `mysql://replication` | Replication status and lag |
|
|
476
|
-
| `mysql://innodb` | InnoDB buffer pool and engine metrics |
|
|
477
|
-
| **`mysql://events`** | Event Scheduler status and scheduled events |
|
|
478
|
-
| **`mysql://sysschema`** | sys schema diagnostics summary |
|
|
479
|
-
| **`mysql://locks`** | InnoDB lock contention detection |
|
|
480
|
-
| **`mysql://cluster`** | Group Replication/InnoDB Cluster status |
|
|
481
|
-
| **`mysql://spatial`** | Spatial columns and indexes |
|
|
482
|
-
| **`mysql://docstore`** | Document Store collections |
|
|
308
|
+
**18 real-time resources** for database observability: schema, tables, variables, status, processlist, connection pool, capabilities, health, performance, indexes, replication, InnoDB metrics, events, sys schema, locks, cluster status, spatial metadata, and document store collections.
|
|
483
309
|
|
|
484
310
|
---
|
|
485
311
|
|
|
@@ -497,6 +323,8 @@ For specialized setups, see these Wiki pages:
|
|
|
497
323
|
|
|
498
324
|
## ⚡ Performance Tuning
|
|
499
325
|
|
|
326
|
+
Schema metadata is cached to reduce repeated queries during tool/resource invocations.
|
|
327
|
+
|
|
500
328
|
| Variable | Default | Description |
|
|
501
329
|
| ----------------------- | ------- | -------------------------------------------------- |
|
|
502
330
|
| `METADATA_CACHE_TTL_MS` | `30000` | Cache TTL for schema metadata (milliseconds) |
|
|
@@ -504,17 +332,20 @@ For specialized setups, see these Wiki pages:
|
|
|
504
332
|
|
|
505
333
|
> **Tip:** Lower `METADATA_CACHE_TTL_MS` for development (e.g., `5000`), or increase it for production with stable schemas (e.g., `300000` = 5 min).
|
|
506
334
|
|
|
335
|
+
> **Built-in payload optimization:** Many tools support optional `summary: true` for condensed responses and `limit` parameters to cap result sizes. These are particularly useful for cluster status, monitoring, and sys schema tools where full responses can be large. See [`ServerInstructions.ts`](https://github.com/neverinfamous/mysql-mcp/blob/master/src/constants/ServerInstructions.ts) for per-tool details.
|
|
336
|
+
|
|
507
337
|
---
|
|
508
338
|
|
|
509
339
|
### CLI Options
|
|
510
340
|
|
|
511
|
-
| Option | Environment Variable | Description
|
|
512
|
-
| ------------------------- | ----------------------- |
|
|
513
|
-
| `--
|
|
514
|
-
| `--oauth-
|
|
515
|
-
| `--oauth-
|
|
516
|
-
| `--oauth-
|
|
517
|
-
| `--oauth-
|
|
341
|
+
| Option | Environment Variable | Description |
|
|
342
|
+
| ------------------------- | ----------------------- | --------------------------------------------------- |
|
|
343
|
+
| `--server-host` | `MCP_HOST` | Host to bind HTTP transport to (default: localhost) |
|
|
344
|
+
| `--oauth-enabled` | `OAUTH_ENABLED` | Enable OAuth authentication |
|
|
345
|
+
| `--oauth-issuer` | `OAUTH_ISSUER` | Authorization server URL |
|
|
346
|
+
| `--oauth-audience` | `OAUTH_AUDIENCE` | Expected token audience |
|
|
347
|
+
| `--oauth-jwks-uri` | `OAUTH_JWKS_URI` | JWKS URI (auto-discovered) |
|
|
348
|
+
| `--oauth-clock-tolerance` | `OAUTH_CLOCK_TOLERANCE` | Clock tolerance in seconds |
|
|
518
349
|
|
|
519
350
|
### Scopes
|
|
520
351
|
|
|
@@ -529,20 +360,6 @@ For specialized setups, see these Wiki pages:
|
|
|
529
360
|
|
|
530
361
|
---
|
|
531
362
|
|
|
532
|
-
## Contributing
|
|
533
|
-
|
|
534
|
-
Contributions are welcome! Please read our [Contributing Guidelines](CONTRIBUTING.md) before submitting a pull request.
|
|
535
|
-
|
|
536
|
-
## Security
|
|
537
|
-
|
|
538
|
-
For security concerns, please see our [Security Policy](SECURITY.md).
|
|
539
|
-
|
|
540
|
-
> **⚠️ Never commit credentials** - Store secrets in `.env` (gitignored)
|
|
541
|
-
|
|
542
|
-
## License
|
|
543
|
-
|
|
544
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
545
|
-
|
|
546
|
-
## Code of Conduct
|
|
363
|
+
## Contributing & Security
|
|
547
364
|
|
|
548
|
-
|
|
365
|
+
[Contributing Guidelines](CONTRIBUTING.md) • [Security Policy](SECURITY.md) • [MIT License](LICENSE) • [Code of Conduct](CODE_OF_CONDUCT.md)
|
package/Dockerfile
CHANGED
|
@@ -48,7 +48,12 @@ RUN apk upgrade --no-cache
|
|
|
48
48
|
# - CVE-2024-21538: cross-spawn < 7.0.5
|
|
49
49
|
# - CVE-2025-64756: glob < 10.5.0
|
|
50
50
|
# - CVE-2025-5889: brace-expansion <= 2.0.1
|
|
51
|
+
# - CVE-2026-26960: tar < 7.5.8 (patch npm's bundled copy)
|
|
51
52
|
RUN npm install -g npm@latest && \
|
|
53
|
+
npm install -g tar@latest && \
|
|
54
|
+
rm -rf /usr/local/lib/node_modules/npm/node_modules/tar && \
|
|
55
|
+
cp -r /usr/local/lib/node_modules/tar /usr/local/lib/node_modules/npm/node_modules/tar && \
|
|
56
|
+
npm uninstall -g tar && \
|
|
52
57
|
npm cache clean --force
|
|
53
58
|
|
|
54
59
|
# Create non-root user for security
|