@berthojoris/mcp-mysql-server 1.16.4 → 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 +22 -0
- package/DOCUMENTATIONS.md +109 -548
- package/README.md +85 -486
- package/bin/mcp-mysql.js +57 -107
- package/dist/config/featureConfig.d.ts +2 -29
- package/dist/config/featureConfig.js +18 -211
- package/dist/index.d.ts +59 -12
- package/dist/index.js +44 -4
- package/dist/mcp-server.js +155 -9
- package/dist/security/securityLayer.js +2 -3
- package/dist/tools/forecastingTools.d.ts +36 -0
- package/dist/tools/forecastingTools.js +256 -0
- package/dist/tools/queryVisualizationTools.d.ts +22 -0
- package/dist/tools/queryVisualizationTools.js +155 -0
- package/dist/tools/schemaPatternTools.d.ts +19 -0
- package/dist/tools/schemaPatternTools.js +253 -0
- package/dist/tools/testDataTools.d.ts +26 -0
- package/dist/tools/testDataTools.js +325 -0
- package/manifest.json +109 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
|
|
19
19
|
## TL;DR - Quick Setup
|
|
20
20
|
|
|
21
|
+
Run directly with `npx`:
|
|
22
|
+
|
|
21
23
|
```bash
|
|
22
|
-
# Run directly with npx (no installation needed)
|
|
23
24
|
npx @berthojoris/mysql-mcp mysql://user:pass@localhost:3306/mydb "list,read,utility"
|
|
24
25
|
```
|
|
25
26
|
|
|
@@ -30,33 +31,18 @@ Add to your AI agent config (`.mcp.json`, `.cursor/mcp.json`, etc.):
|
|
|
30
31
|
"mcpServers": {
|
|
31
32
|
"mysql": {
|
|
32
33
|
"command": "npx",
|
|
33
|
-
"args": [
|
|
34
|
+
"args": [
|
|
35
|
+
"-y",
|
|
36
|
+
"@berthojoris/mysql-mcp",
|
|
37
|
+
"mysql://user:pass@localhost:3306/mydb",
|
|
38
|
+
"list,read,utility"
|
|
39
|
+
]
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
}
|
|
37
43
|
```
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## Table of Contents
|
|
42
|
-
|
|
43
|
-
- [Installation](#installation)
|
|
44
|
-
- [Quick Start](#quick-start)
|
|
45
|
-
- [AI Agent Configuration](#ai-agent-configuration)
|
|
46
|
-
- [Standard JSON Config](#standard-json-configuration)
|
|
47
|
-
- [OpenAI Codex (TOML)](#openai-codex-cli--vs-code-extension)
|
|
48
|
-
- [Zed IDE](#zed-ide)
|
|
49
|
-
- [Environment Variables](#environment-variables-configuration)
|
|
50
|
-
- [Local Development](#local-path-configuration)
|
|
51
|
-
- [Permission System](#permission-system)
|
|
52
|
-
- [Available Tools (145 total)](#available-tools)
|
|
53
|
-
- [Documentation](DOCUMENTATIONS.md)
|
|
54
|
-
- [Comparison: MCP vs Manual Access](#mysql-mcp-vs-manual-database-access)
|
|
55
|
-
- [License](#license)
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
| **Data Masking** | Protect PII/Secrets in responses with configurable profiles (soft/partial/strict) |
|
|
59
|
-
| **TypeScript** | Fully typed with TypeScript definitions |
|
|
45
|
+
For agent-specific examples (Codex TOML, Zed, local path, multi-DB), see **[DOCUMENTATIONS.md → Setup & Configuration](DOCUMENTATIONS.md#setup--configuration-extended)**.
|
|
60
46
|
|
|
61
47
|
---
|
|
62
48
|
|
|
@@ -92,7 +78,6 @@ DB_USER=root
|
|
|
92
78
|
DB_PASSWORD=yourpassword
|
|
93
79
|
DB_NAME=yourdatabase
|
|
94
80
|
MCP_CONFIG=list,read,utility
|
|
95
|
-
MCP_MASKING_PROFILE=partial
|
|
96
81
|
```
|
|
97
82
|
|
|
98
83
|
### 2. Build Project (If Cloned Locally)
|
|
@@ -125,20 +110,9 @@ Try asking your AI:
|
|
|
125
110
|
|
|
126
111
|
### Standard JSON Configuration
|
|
127
112
|
|
|
128
|
-
Most AI agents use a similar JSON configuration format
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|----------|---------------------|
|
|
132
|
-
| **Claude Code** | `.mcp.json` (project root) or `~/.mcp.json` (global) |
|
|
133
|
-
| **Cursor** | `.cursor/mcp.json` |
|
|
134
|
-
| **Windsurf** | `~/.codeium/windsurf/mcp_config.json` |
|
|
135
|
-
| **Cline** | VS Code settings or Cline config file |
|
|
136
|
-
| **Gemini CLI** | `~/.gemini/settings.json` |
|
|
137
|
-
| **Kilo Code** | VS Code MCP settings |
|
|
138
|
-
| **Roo Code** | VS Code MCP settings |
|
|
139
|
-
| **Trae AI** | MCP configuration in settings |
|
|
140
|
-
| **Qwen Code** | MCP configuration in settings |
|
|
141
|
-
| **Droid CLI** | MCP configuration in settings |
|
|
113
|
+
Most AI agents use a similar JSON configuration format (the file location varies by tool).
|
|
114
|
+
|
|
115
|
+
If you want ready-to-copy snippets per client (Claude Code/Cursor/Windsurf/Cline/Codex/Zed), see **[DOCUMENTATIONS.md → Agent Configuration Examples](DOCUMENTATIONS.md#agent-configuration-examples)**.
|
|
142
116
|
|
|
143
117
|
**Universal Configuration Template:**
|
|
144
118
|
|
|
@@ -152,7 +126,7 @@ Most AI agents use a similar JSON configuration format. Use the appropriate conf
|
|
|
152
126
|
"-y",
|
|
153
127
|
"@berthojoris/mysql-mcp",
|
|
154
128
|
"mysql://user:password@localhost:3306/database",
|
|
155
|
-
"list,read,utility,create,update,ddl"
|
|
129
|
+
"list,read,utility,create,update,ddl"
|
|
156
130
|
]
|
|
157
131
|
}
|
|
158
132
|
}
|
|
@@ -179,141 +153,6 @@ Most AI agents use a similar JSON configuration format. Use the appropriate conf
|
|
|
179
153
|
|
|
180
154
|
> **💡 Tip:** The dual-layer approach provides granular control. The 4th argument (permissions) controls broad access levels, while the 5th argument (categories) fine-tunes which specific tools are available.
|
|
181
155
|
|
|
182
|
-
<details>
|
|
183
|
-
<summary><strong>Multiple Database Configuration</strong></summary>
|
|
184
|
-
|
|
185
|
-
```json
|
|
186
|
-
{
|
|
187
|
-
"mcpServers": {
|
|
188
|
-
"mysql-prod": {
|
|
189
|
-
"command": "npx",
|
|
190
|
-
"args": [
|
|
191
|
-
"-y",
|
|
192
|
-
"@berthojoris/mysql-mcp",
|
|
193
|
-
"mysql://reader:pass@prod-server:3306/prod_db",
|
|
194
|
-
"list,read,utility"
|
|
195
|
-
]
|
|
196
|
-
},
|
|
197
|
-
"mysql-dev": {
|
|
198
|
-
"command": "npx",
|
|
199
|
-
"args": [
|
|
200
|
-
"-y",
|
|
201
|
-
"@berthojoris/mysql-mcp",
|
|
202
|
-
"mysql://root:pass@localhost:3306/dev_db",
|
|
203
|
-
"list,read,create,update,delete,execute,ddl,utility"
|
|
204
|
-
]
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
</details>
|
|
211
|
-
|
|
212
|
-
---
|
|
213
|
-
|
|
214
|
-
### OpenAI Codex CLI & VS Code Extension
|
|
215
|
-
|
|
216
|
-
OpenAI Codex uses TOML format in `~/.codex/config.toml`.
|
|
217
|
-
|
|
218
|
-
**Quick setup via CLI:**
|
|
219
|
-
|
|
220
|
-
```bash
|
|
221
|
-
codex mcp add mysql -- npx -y @berthojoris/mysql-mcp mysql://user:pass@localhost:3306/db list,read,utility
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
**Manual TOML configuration:**
|
|
225
|
-
|
|
226
|
-
```toml
|
|
227
|
-
[mcp_servers.mysql]
|
|
228
|
-
command = "npx"
|
|
229
|
-
args = ["-y", "@berthojoris/mysql-mcp", "mysql://user:pass@localhost:3306/db", "list,read,utility"]
|
|
230
|
-
startup_timeout_sec = 20
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
<details>
|
|
234
|
-
<summary><strong>Advanced Codex Configuration</strong></summary>
|
|
235
|
-
|
|
236
|
-
**With environment variables:**
|
|
237
|
-
|
|
238
|
-
```toml
|
|
239
|
-
[mcp_servers.mysql]
|
|
240
|
-
command = "npx"
|
|
241
|
-
args = ["-y", "@berthojoris/mysql-mcp"]
|
|
242
|
-
|
|
243
|
-
[mcp_servers.mysql.env]
|
|
244
|
-
DB_HOST = "localhost"
|
|
245
|
-
DB_PORT = "3306"
|
|
246
|
-
DB_USER = "root"
|
|
247
|
-
DB_PASSWORD = "your_password"
|
|
248
|
-
DB_NAME = "your_database"
|
|
249
|
-
MCP_PERMISSIONS = "list,read,utility"
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
**Multiple databases:**
|
|
253
|
-
|
|
254
|
-
```toml
|
|
255
|
-
# Production - Read Only
|
|
256
|
-
[mcp_servers.mysql-prod]
|
|
257
|
-
command = "npx"
|
|
258
|
-
args = ["-y", "@berthojoris/mysql-mcp", "mysql://reader:pass@prod:3306/prod_db", "list,read,utility"]
|
|
259
|
-
startup_timeout_sec = 30
|
|
260
|
-
|
|
261
|
-
# Development - Full Access
|
|
262
|
-
[mcp_servers.mysql-dev]
|
|
263
|
-
command = "npx"
|
|
264
|
-
args = ["-y", "@berthojoris/mysql-mcp", "mysql://root:pass@localhost:3306/dev_db", "list,read,create,update,delete,execute,ddl,utility"]
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
**Advanced options:**
|
|
268
|
-
|
|
269
|
-
```toml
|
|
270
|
-
[mcp_servers.mysql]
|
|
271
|
-
command = "npx"
|
|
272
|
-
args = ["-y", "@berthojoris/mysql-mcp", "mysql://user:pass@localhost:3306/db", "list,read,utility"]
|
|
273
|
-
startup_timeout_sec = 20 # Server startup timeout (default: 10)
|
|
274
|
-
tool_timeout_sec = 120 # Per-tool execution timeout (default: 60)
|
|
275
|
-
enabled = true # Set false to disable without deleting
|
|
276
|
-
# enabled_tools = ["list_tables", "read_records"] # Optional: limit exposed tools
|
|
277
|
-
# disabled_tools = ["drop_table", "delete_record"] # Optional: hide specific tools
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
**Codex management commands:**
|
|
281
|
-
|
|
282
|
-
```bash
|
|
283
|
-
codex mcp list # List all configured MCP servers
|
|
284
|
-
codex mcp list --json # List with JSON output
|
|
285
|
-
codex mcp remove mysql # Remove an MCP server
|
|
286
|
-
codex mcp get mysql # Get details about a specific server
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
</details>
|
|
290
|
-
|
|
291
|
-
---
|
|
292
|
-
|
|
293
|
-
### Zed IDE
|
|
294
|
-
|
|
295
|
-
Zed IDE uses a different structure in `~/.config/zed/settings.json`:
|
|
296
|
-
|
|
297
|
-
```json
|
|
298
|
-
{
|
|
299
|
-
"context_servers": {
|
|
300
|
-
"mysql": {
|
|
301
|
-
"command": {
|
|
302
|
-
"path": "npx",
|
|
303
|
-
"args": [
|
|
304
|
-
"-y",
|
|
305
|
-
"@berthojoris/mysql-mcp",
|
|
306
|
-
"mysql://user:password@localhost:3306/database",
|
|
307
|
-
"list,read,utility"
|
|
308
|
-
]
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
---
|
|
316
|
-
|
|
317
156
|
### Environment Variables Configuration
|
|
318
157
|
|
|
319
158
|
Alternative approach using environment variables instead of connection string:
|
|
@@ -354,107 +193,14 @@ Alternative approach using environment variables instead of connection string:
|
|
|
354
193
|
"DB_PASSWORD": "your_password",
|
|
355
194
|
"DB_NAME": "your_database",
|
|
356
195
|
"MCP_PERMISSIONS": "list,read,utility",
|
|
357
|
-
"MCP_CATEGORIES": "database_discovery,performance_monitoring"
|
|
358
|
-
"MCP_MASKING_PROFILE": "partial"
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
**Option 3: Adaptive Preset (Merges with Overrides)**
|
|
366
|
-
|
|
367
|
-
```json
|
|
368
|
-
{
|
|
369
|
-
"mcpServers": {
|
|
370
|
-
"mysql": {
|
|
371
|
-
"command": "npx",
|
|
372
|
-
"args": ["-y", "@berthojoris/mysql-mcp"],
|
|
373
|
-
"env": {
|
|
374
|
-
"DB_HOST": "localhost",
|
|
375
|
-
"DB_PORT": "3306",
|
|
376
|
-
"DB_USER": "root",
|
|
377
|
-
"DB_PASSWORD": "your_password",
|
|
378
|
-
"DB_NAME": "your_database",
|
|
379
|
-
"MCP_PRESET": "readonly",
|
|
380
|
-
"MCP_PERMISSIONS": "list,read,utility",
|
|
381
|
-
"MCP_CATEGORIES": "performance_monitoring"
|
|
196
|
+
"MCP_CATEGORIES": "database_discovery,performance_monitoring"
|
|
382
197
|
}
|
|
383
198
|
}
|
|
384
199
|
}
|
|
385
200
|
}
|
|
386
201
|
```
|
|
387
202
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
#### Connection Profiles (dev/stage/prod)
|
|
391
|
-
New presets are available for environment-specific control:
|
|
392
|
-
- `dev`: Full access to all tools (explicitly allows everything).
|
|
393
|
-
- `stage`: Allows data modification but blocks destructive DDL (drop/truncate).
|
|
394
|
-
- `prod`: Strict read-only mode, explicitly denying keys modification keys.
|
|
395
|
-
|
|
396
|
-
---
|
|
397
|
-
|
|
398
|
-
### Local Path Configuration
|
|
399
|
-
|
|
400
|
-
For development or when you need full control over the source code:
|
|
401
|
-
|
|
402
|
-
```json
|
|
403
|
-
{
|
|
404
|
-
"mcpServers": {
|
|
405
|
-
"mysql": {
|
|
406
|
-
"command": "node",
|
|
407
|
-
"args": [
|
|
408
|
-
"/path/to/mcp_mysql/bin/mcp-mysql.js",
|
|
409
|
-
"mysql://user:password@localhost:3306/database",
|
|
410
|
-
"list,read,utility"
|
|
411
|
-
]
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
<details>
|
|
418
|
-
<summary><strong>When to Use Local Path</strong></summary>
|
|
419
|
-
|
|
420
|
-
Use local path configuration when you:
|
|
421
|
-
|
|
422
|
-
- Want full control over the version and source code
|
|
423
|
-
- Need offline access without internet dependency
|
|
424
|
-
- Want to modify the source for custom functionality
|
|
425
|
-
- Need faster startup without package download
|
|
426
|
-
- Are developing/debugging the MCP server
|
|
427
|
-
- Have network restrictions or security policies
|
|
428
|
-
|
|
429
|
-
| Feature | Local Path | NPX |
|
|
430
|
-
|---------|------------|-----|
|
|
431
|
-
| **Control** | Full control over code | Depends on npm registry |
|
|
432
|
-
| **Offline** | Works completely offline | Requires internet |
|
|
433
|
-
| **Speed** | Instant startup | Download time |
|
|
434
|
-
| **Customization** | Can modify source | Limited to published version |
|
|
435
|
-
| **Updates** | Manual updates | Automatic updates |
|
|
436
|
-
| **Setup** | Requires building | Zero setup |
|
|
437
|
-
|
|
438
|
-
**Setup requirements:**
|
|
439
|
-
|
|
440
|
-
```bash
|
|
441
|
-
cd /path/to/mcp_mysql
|
|
442
|
-
npm install
|
|
443
|
-
npm run build
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
**Available binaries:**
|
|
447
|
-
|
|
448
|
-
- `bin/mcp-mysql.js` - CLI wrapper with argument parsing
|
|
449
|
-
- `dist/mcp-server.js` - Direct server executable
|
|
450
|
-
|
|
451
|
-
**Path tips:**
|
|
452
|
-
|
|
453
|
-
- Windows: Use double backslashes `\\` in JSON
|
|
454
|
-
- Cross-platform: Use forward slashes `/` if supported
|
|
455
|
-
- Always use absolute paths for reliability
|
|
456
|
-
|
|
457
|
-
</details>
|
|
203
|
+
For more client-specific config snippets, see **[DOCUMENTATIONS.md → Setup & Configuration](DOCUMENTATIONS.md#setup--configuration-extended)**.
|
|
458
204
|
|
|
459
205
|
---
|
|
460
206
|
|
|
@@ -469,34 +215,67 @@ Control database access with a **dual-layer filtering system** that provides bot
|
|
|
469
215
|
|
|
470
216
|
### Documentation Categories (Recommended)
|
|
471
217
|
|
|
472
|
-
Use
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
218
|
+
Use documentation categories to fine-tune which tools are exposed (Layer 2):
|
|
219
|
+
|
|
220
|
+
<table>
|
|
221
|
+
<thead>
|
|
222
|
+
<tr>
|
|
223
|
+
<th align="left">Category A</th>
|
|
224
|
+
<th align="left">Category B</th>
|
|
225
|
+
<th align="left">Category C</th>
|
|
226
|
+
<th align="left">Category D</th>
|
|
227
|
+
</tr>
|
|
228
|
+
</thead>
|
|
229
|
+
<tbody>
|
|
230
|
+
<tr>
|
|
231
|
+
<td><code>database_discovery</code></td>
|
|
232
|
+
<td><code>crud_operations</code></td>
|
|
233
|
+
<td><code>bulk_operations</code></td>
|
|
234
|
+
<td><code>custom_queries</code></td>
|
|
235
|
+
</tr>
|
|
236
|
+
<tr>
|
|
237
|
+
<td><code>schema_management</code></td>
|
|
238
|
+
<td><code>utilities</code></td>
|
|
239
|
+
<td><code>transaction_management</code></td>
|
|
240
|
+
<td><code>stored_procedures</code></td>
|
|
241
|
+
</tr>
|
|
242
|
+
<tr>
|
|
243
|
+
<td><code>views_management</code></td>
|
|
244
|
+
<td><code>triggers_management</code></td>
|
|
245
|
+
<td><code>functions_management</code></td>
|
|
246
|
+
<td><code>index_management</code></td>
|
|
247
|
+
</tr>
|
|
248
|
+
<tr>
|
|
249
|
+
<td><code>constraint_management</code></td>
|
|
250
|
+
<td><code>table_maintenance</code></td>
|
|
251
|
+
<td><code>server_management</code></td>
|
|
252
|
+
<td><code>performance_monitoring</code></td>
|
|
253
|
+
</tr>
|
|
254
|
+
<tr>
|
|
255
|
+
<td><code>cache_management</code></td>
|
|
256
|
+
<td><code>query_optimization</code></td>
|
|
257
|
+
<td><code>backup_restore</code></td>
|
|
258
|
+
<td><code>import_export</code></td>
|
|
259
|
+
</tr>
|
|
260
|
+
<tr>
|
|
261
|
+
<td><code>data_migration</code></td>
|
|
262
|
+
<td><code>schema_migrations</code></td>
|
|
263
|
+
<td><code>analysis</code></td>
|
|
264
|
+
<td><code>ai_enhancement</code></td>
|
|
265
|
+
</tr>
|
|
266
|
+
</tbody>
|
|
267
|
+
</table>
|
|
268
|
+
|
|
269
|
+
<details>
|
|
270
|
+
<summary>Copy/paste list (comma-separated, no spaces)</summary>
|
|
271
|
+
|
|
272
|
+
```text
|
|
273
|
+
database_discovery,crud_operations,bulk_operations,custom_queries,schema_management,utilities,transaction_management,stored_procedures,views_management,triggers_management,functions_management,index_management,constraint_management,table_maintenance,server_management,performance_monitoring,cache_management,query_optimization,backup_restore,import_export,data_migration,schema_migrations,analysis,ai_enhancement
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
</details>
|
|
277
|
+
|
|
278
|
+
Full category → tool mapping (and examples) lives in **[DOCUMENTATIONS.md → Category Filtering System](DOCUMENTATIONS.md#🆕-category-filtering-system)**.
|
|
500
279
|
|
|
501
280
|
### Legacy Categories (Backward Compatible)
|
|
502
281
|
|
|
@@ -513,200 +292,20 @@ Use these categories for fine-grained control that matches the tool organization
|
|
|
513
292
|
| `transaction` | BEGIN, COMMIT, ROLLBACK | ACID operations |
|
|
514
293
|
| `utility` | Connection testing, diagnostics | Troubleshooting |
|
|
515
294
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
#### Using Documentation Categories (Recommended)
|
|
519
|
-
|
|
520
|
-
| Environment | Categories | Description |
|
|
521
|
-
|-------------|------------|-------------|
|
|
522
|
-
| **Production Read-Only** | `database_discovery,utilities` | Safe exploration only |
|
|
523
|
-
| **Analytics & Reporting** | `database_discovery,crud_operations,custom_queries,performance_monitoring` | Read and analyze |
|
|
524
|
-
| **Data Entry** | `database_discovery,crud_operations,utilities` | Basic CRUD operations |
|
|
525
|
-
| **Data Management** | `database_discovery,crud_operations,bulk_operations,utilities` | CRUD + bulk operations |
|
|
526
|
-
| **Application Backend** | `database_discovery,crud_operations,bulk_operations,custom_queries,transaction_management` | Full app support |
|
|
527
|
-
| **Development & Testing** | `database_discovery,crud_operations,bulk_operations,custom_queries,schema_management,utilities,transaction_management` | Development access |
|
|
528
|
-
| **DBA & DevOps** | `database_discovery,schema_management,table_maintenance,backup_restore,schema_migrations,performance_monitoring` | Admin tasks |
|
|
529
|
-
| **Full Access** | *(leave empty)* | All 145 tools enabled |
|
|
530
|
-
|
|
531
|
-
#### Using Legacy Categories (Backward Compatible)
|
|
532
|
-
|
|
533
|
-
| Environment | Permissions | Description |
|
|
534
|
-
|-------------|-------------|-------------|
|
|
535
|
-
| **Production (Safe)** | `list,read,utility` | Read-only access |
|
|
536
|
-
| **Data Entry** | `list,read,create,utility` | Can add records |
|
|
537
|
-
| **Full Data Access** | `list,read,create,update,delete,utility` | All CRUD operations |
|
|
538
|
-
| **With Transactions** | `list,read,create,update,delete,transaction,utility` | CRUD + ACID |
|
|
539
|
-
| **Development** | `list,read,create,update,delete,execute,ddl,transaction,utility` | Full access |
|
|
540
|
-
| **DBA Tasks** | `list,ddl,utility` | Schema management only |
|
|
541
|
-
|
|
542
|
-
### Adaptive Permission Presets (ReadOnly/Analyst/DBA Lite)
|
|
543
|
-
|
|
544
|
-
Use presets to bootstrap safe defaults. They **merge** with any explicit permissions/categories you pass via CLI args or env vars.
|
|
545
|
-
|
|
546
|
-
| Preset | Permissions | Categories | Ideal for |
|
|
547
|
-
|--------|-------------|------------|-----------|
|
|
548
|
-
| `readonly` | `list,read,utility` | `database_discovery,crud_operations,custom_queries,utilities,import_export,performance_monitoring,analysis` | Safe read-only data access + exports |
|
|
549
|
-
| `analyst` | `list,read,utility` | `database_discovery,crud_operations,custom_queries,utilities,import_export,performance_monitoring,analysis,query_optimization,cache_management,server_management` | Analytics with plan insights and cache/perf visibility |
|
|
550
|
-
| `dba-lite` | `list,read,utility,ddl,transaction,procedure` | `database_discovery,custom_queries,utilities,server_management,schema_management,table_maintenance,index_management,constraint_management,backup_restore,schema_migrations,performance_monitoring,views_management,triggers_management,functions_management,stored_procedures` | Admin-lite schema care, migrations, and maintenance |
|
|
551
|
-
|
|
552
|
-
**Usage**
|
|
553
|
-
|
|
554
|
-
- CLI: `mcp-mysql mysql://user:pass@host:3306/db --preset readonly`
|
|
555
|
-
- CLI with overrides: `mcp-mysql mysql://... --preset analyst "list,read,utility" "performance_monitoring"`
|
|
556
|
-
- Env: `MCP_PRESET=analyst` (or `MCP_PERMISSION_PRESET=analyst`) plus optional `MCP_PERMISSIONS` / `MCP_CATEGORIES` to extend
|
|
295
|
+
Common configuration examples are documented in **[DOCUMENTATIONS.md → Category Filtering System](DOCUMENTATIONS.md#🆕-category-filtering-system)**.
|
|
557
296
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
### Per-Project Configuration
|
|
561
|
-
|
|
562
|
-
#### Single-Layer: Permissions Only (Backward Compatible)
|
|
563
|
-
|
|
564
|
-
Use only the 2nd argument for broad permission-based filtering:
|
|
565
|
-
|
|
566
|
-
```json
|
|
567
|
-
{
|
|
568
|
-
"mcpServers": {
|
|
569
|
-
"mysql": {
|
|
570
|
-
"command": "node",
|
|
571
|
-
"args": [
|
|
572
|
-
"/path/to/bin/mcp-mysql.js",
|
|
573
|
-
"mysql://user:password@localhost:3306/db",
|
|
574
|
-
"list,read,utility"
|
|
575
|
-
]
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
```
|
|
580
|
-
|
|
581
|
-
**Result**: All tools within `list`, `read`, and `utility` permissions are enabled.
|
|
582
|
-
|
|
583
|
-
#### Dual-Layer: Permissions + Categories (Recommended for Fine Control)
|
|
584
|
-
|
|
585
|
-
Use both 2nd argument (permissions) and 3rd argument (categories):
|
|
586
|
-
|
|
587
|
-
```json
|
|
588
|
-
{
|
|
589
|
-
"mcpServers": {
|
|
590
|
-
"mysql-prod": {
|
|
591
|
-
"command": "node",
|
|
592
|
-
"args": [
|
|
593
|
-
"/path/to/bin/mcp-mysql.js",
|
|
594
|
-
"mysql://readonly:pass@prod:3306/app_db",
|
|
595
|
-
"list,read,utility",
|
|
596
|
-
"database_discovery,performance_monitoring"
|
|
597
|
-
]
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
```
|
|
602
|
-
|
|
603
|
-
**Result**: Only tools that have BOTH:
|
|
604
|
-
- Permission: `list`, `read`, OR `utility` AND
|
|
605
|
-
- Category: `database_discovery` OR `performance_monitoring`
|
|
606
|
-
|
|
607
|
-
**Enabled**: `list_databases`, `list_tables`, `read_table_schema`, `get_table_relationships`, `get_performance_metrics`, `get_slow_queries`, etc.
|
|
608
|
-
|
|
609
|
-
**Disabled**: `test_connection` (has `utility` permission but not in allowed categories), `read_records` (has `read` permission but category is `crud_operations`), etc.
|
|
297
|
+
---
|
|
610
298
|
|
|
611
|
-
|
|
299
|
+
## Available Tools
|
|
612
300
|
|
|
613
|
-
|
|
614
|
-
{
|
|
615
|
-
"mcpServers": {
|
|
616
|
-
"mysql-prod-readonly": {
|
|
617
|
-
"command": "node",
|
|
618
|
-
"args": [
|
|
619
|
-
"/path/to/bin/mcp-mysql.js",
|
|
620
|
-
"mysql://readonly:pass@prod:3306/app_db",
|
|
621
|
-
"list,read,utility",
|
|
622
|
-
"database_discovery,performance_monitoring"
|
|
623
|
-
]
|
|
624
|
-
},
|
|
625
|
-
"mysql-dev-full": {
|
|
626
|
-
"command": "node",
|
|
627
|
-
"args": [
|
|
628
|
-
"/path/to/bin/mcp-mysql.js",
|
|
629
|
-
"mysql://dev:pass@localhost:3306/dev_db",
|
|
630
|
-
"list,read,create,update,delete,ddl,transaction,utility"
|
|
631
|
-
]
|
|
632
|
-
},
|
|
633
|
-
"mysql-dba": {
|
|
634
|
-
"command": "node",
|
|
635
|
-
"args": [
|
|
636
|
-
"/path/to/bin/mcp-mysql.js",
|
|
637
|
-
"mysql://dba:pass@server:3306/app_db",
|
|
638
|
-
"list,ddl,utility",
|
|
639
|
-
"database_discovery,schema_management,table_maintenance,backup_restore,index_management"
|
|
640
|
-
]
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
```
|
|
301
|
+
The server exposes **150 tools** organized into categories (CRUD, schema, backups, migrations, perf/monitoring, and AI enhancement).
|
|
645
302
|
|
|
646
|
-
|
|
303
|
+
- Complete list of tools: **[DOCUMENTATIONS.md → Complete Tools Reference](DOCUMENTATIONS.md#🔧-complete-tools-reference)**
|
|
304
|
+
- AI enhancement tools overview: **[DOCUMENTATIONS.md → AI Enhancement Tools](DOCUMENTATIONS.md#🤖-ai-enhancement-tools)**
|
|
647
305
|
|
|
648
|
-
|
|
306
|
+
### 🤖 AI Enhancement Tools
|
|
649
307
|
|
|
650
|
-
The
|
|
651
|
-
|
|
652
|
-
### Quick Reference
|
|
653
|
-
|
|
654
|
-
**145 Tools Available** - Organized into 23 categories
|
|
655
|
-
|
|
656
|
-
| Category | Count | Key Tools |
|
|
657
|
-
|----------|-------|-----------|
|
|
658
|
-
| Database Discovery | 4 | `list_databases`, `list_tables`, `read_table_schema` |
|
|
659
|
-
| CRUD Operations | 4 | `create_record`, `read_records`, `update_record`, `delete_record` |
|
|
660
|
-
| Bulk Operations | 3 | `bulk_insert`, `bulk_update`, `bulk_delete` |
|
|
661
|
-
| Custom Queries | 2 | `run_query`, `execute_sql` |
|
|
662
|
-
| Schema Management | 4 | `create_table`, `alter_table`, `drop_table` |
|
|
663
|
-
| Transactions | 5 | `begin_transaction`, `commit_transaction`, `rollback_transaction` |
|
|
664
|
-
| Stored Procedures | 6 | `create_stored_procedure`, `execute_stored_procedure` |
|
|
665
|
-
| Views | 6 | `create_view`, `alter_view`, `drop_view` |
|
|
666
|
-
| Triggers | 5 | `create_trigger`, `drop_trigger` |
|
|
667
|
-
| Functions | 6 | `create_function`, `execute_function` |
|
|
668
|
-
| Indexes | 5 | `create_index`, `drop_index`, `analyze_index` |
|
|
669
|
-
| Constraints | 7 | `add_foreign_key`, `add_unique_constraint` |
|
|
670
|
-
| Table Maintenance | 8 | `analyze_table`, `optimize_table`, `repair_table` |
|
|
671
|
-
| Server Management | 9 | `show_process_list`, `explain_query` |
|
|
672
|
-
| Performance Monitoring | 10 | `get_performance_metrics`, `get_database_health_check` |
|
|
673
|
-
| Cache | 5 | `get_cache_stats`, `clear_cache` |
|
|
674
|
-
| Query Optimization | 3 | `analyze_query`, `get_optimization_hints`, `repair_query` |
|
|
675
|
-
| Backup & Restore | 5 | `backup_database`, `restore_from_sql` |
|
|
676
|
-
| Import/Export | 6 | `safe_export_table`, `export_table_to_json`, `import_from_csv` |
|
|
677
|
-
| Data Migration | 5 | `copy_table_data`, `sync_table_data` |
|
|
678
|
-
| Schema Migrations | 9 | `create_migration`, `apply_migrations` |
|
|
679
|
-
| Utilities | 4 | `test_connection`, `export_table_to_csv` |
|
|
680
|
-
| Analysis | 4 | `get_column_statistics`, `get_database_summary`, `get_schema_erd` |
|
|
681
|
-
| **AI Enhancement** | 11 | `build_query_from_intent`, `suggest_query_improvements`, `smart_search`, `find_similar_columns`, `discover_data_patterns`, `generate_documentation`, `generate_data_dictionary`, `generate_business_glossary`, `design_schema_from_requirements`, `audit_database_security`, `recommend_indexes` |
|
|
682
|
-
|
|
683
|
-
### 🤖 AI Enhancement Tools (Phase 1-2 - Implemented)
|
|
684
|
-
|
|
685
|
-
The MySQL MCP server includes advanced AI-powered productivity tools:
|
|
686
|
-
|
|
687
|
-
#### **Intelligent Query Assistant**
|
|
688
|
-
- **`build_query_from_intent`** - Converts natural language to optimized SQL queries
|
|
689
|
-
- **`suggest_query_improvements`** - AI-powered query optimization suggestions
|
|
690
|
-
- *Use case: "Show me active users from last month" → Automatically generates SQL*
|
|
691
|
-
|
|
692
|
-
#### **Smart Data Discovery Agent**
|
|
693
|
-
- **`smart_search`** - Semantic search for tables, columns, and data patterns
|
|
694
|
-
- **`find_similar_columns`** - Discover columns with similar names or data patterns
|
|
695
|
-
- **`discover_data_patterns`** - Automatic identification of data patterns and relationships
|
|
696
|
-
- *Use case: Find all customer-related columns across hundreds of tables*
|
|
697
|
-
|
|
698
|
-
#### **AI-Powered Documentation Generator**
|
|
699
|
-
- **`generate_documentation`** - Automatic database documentation with business glossary
|
|
700
|
-
- **`generate_data_dictionary`** - Interactive data dictionaries with examples
|
|
701
|
-
- **`generate_business_glossary`** - Business terminology mapping to technical fields
|
|
702
|
-
- *Use case: Generate complete documentation for a new database in seconds*
|
|
703
|
-
|
|
704
|
-
#### **Schema + Security + Indexing (Phase 2)**
|
|
705
|
-
- **`design_schema_from_requirements`** - Generate proposed tables, relationships, and DDL from business requirements
|
|
706
|
-
- **`audit_database_security`** - Best-effort MySQL security audit with prioritized findings
|
|
707
|
-
- **`recommend_indexes`** - Concrete index recommendations from observed query patterns (performance_schema)
|
|
708
|
-
|
|
709
|
-
> **📖 For detailed tool descriptions, parameters, and examples, see [DOCUMENTATIONS.md](DOCUMENTATIONS.md#🔧-complete-tools-reference)**
|
|
308
|
+
The full **Phase 1–3 (implemented)** overview, examples, and per-tool documentation lives in **[DOCUMENTATIONS.md](DOCUMENTATIONS.md#🤖-ai-enhancement-tools)**.
|
|
710
309
|
|
|
711
310
|
---
|
|
712
311
|
|
|
@@ -722,7 +321,7 @@ For comprehensive documentation, see **[DOCUMENTATIONS.md](DOCUMENTATIONS.md)**:
|
|
|
722
321
|
- **Schema Versioning** - Version control for database schema changes
|
|
723
322
|
- **Transaction Management** - ACID transactions
|
|
724
323
|
- **Stored Procedures** - Create and execute with IN/OUT/INOUT parameters
|
|
725
|
-
- **🤖 AI Enhancement** - Natural language to SQL, smart data discovery, schema design, security audit,
|
|
324
|
+
- **🤖 AI Enhancement** - Natural language to SQL, smart data discovery, schema design, security audit, index recommendations, data generation, visualization, and forecasting (Phase 1-3)
|
|
726
325
|
- **Query Logging** - See all SQL queries executed automatically
|
|
727
326
|
- **Security Features** - Built-in security and best practices
|
|
728
327
|
- **Bulk Operations** - High-performance batch processing
|