@berthojoris/mcp-mysql-server 1.16.4 → 1.17.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 +16 -0
- package/DOCUMENTATIONS.md +296 -24
- package/README.md +36 -458
- package/dist/config/featureConfig.js +12 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +41 -0
- package/dist/mcp-server.js +154 -1
- 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
|
|
|
@@ -125,20 +111,9 @@ Try asking your AI:
|
|
|
125
111
|
|
|
126
112
|
### Standard JSON Configuration
|
|
127
113
|
|
|
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 |
|
|
114
|
+
Most AI agents use a similar JSON configuration format (the file location varies by tool).
|
|
115
|
+
|
|
116
|
+
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
117
|
|
|
143
118
|
**Universal Configuration Template:**
|
|
144
119
|
|
|
@@ -152,7 +127,7 @@ Most AI agents use a similar JSON configuration format. Use the appropriate conf
|
|
|
152
127
|
"-y",
|
|
153
128
|
"@berthojoris/mysql-mcp",
|
|
154
129
|
"mysql://user:password@localhost:3306/database",
|
|
155
|
-
"list,read,utility,create,update,ddl"
|
|
130
|
+
"list,read,utility,create,update,ddl"
|
|
156
131
|
]
|
|
157
132
|
}
|
|
158
133
|
}
|
|
@@ -179,141 +154,6 @@ Most AI agents use a similar JSON configuration format. Use the appropriate conf
|
|
|
179
154
|
|
|
180
155
|
> **💡 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
156
|
|
|
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
157
|
### Environment Variables Configuration
|
|
318
158
|
|
|
319
159
|
Alternative approach using environment variables instead of connection string:
|
|
@@ -387,74 +227,7 @@ Alternative approach using environment variables instead of connection string:
|
|
|
387
227
|
|
|
388
228
|
Add `MCP_PRESET` for the base bundle and optionally layer on `MCP_PERMISSIONS` / `MCP_CATEGORIES` for project-specific overrides.
|
|
389
229
|
|
|
390
|
-
|
|
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>
|
|
230
|
+
For more environment-variable patterns (presets/profiles, client-specific env blocks), see **[DOCUMENTATIONS.md → Setup & Configuration](DOCUMENTATIONS.md#setup--configuration-extended)**.
|
|
458
231
|
|
|
459
232
|
---
|
|
460
233
|
|
|
@@ -469,34 +242,19 @@ Control database access with a **dual-layer filtering system** that provides bot
|
|
|
469
242
|
|
|
470
243
|
### Documentation Categories (Recommended)
|
|
471
244
|
|
|
472
|
-
Use
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
| `triggers_management` | 5 | Create, drop triggers |
|
|
486
|
-
| `functions_management` | 6 | Create, execute functions |
|
|
487
|
-
| `index_management` | 5 | Create, drop, analyze indexes |
|
|
488
|
-
| `constraint_management` | 7 | Foreign keys, unique, check constraints |
|
|
489
|
-
| `table_maintenance` | 8 | Analyze, optimize, repair tables |
|
|
490
|
-
| `server_management` | 9 | Process list, explain queries, server info |
|
|
491
|
-
| `performance_monitoring` | 10 | Metrics, slow queries, health checks |
|
|
492
|
-
| `cache_management` | 5 | Query cache stats and configuration |
|
|
493
|
-
| `query_optimization` | 3 | Analyze queries, get optimization hints |
|
|
494
|
-
| `backup_restore` | 5 | Backup/restore database and tables |
|
|
495
|
-
| `import_export` | 5 | Import/export JSON, CSV, SQL |
|
|
496
|
-
| `data_migration` | 5 | Copy, move, clone, sync table data |
|
|
497
|
-
| `schema_migrations` | 9 | Version control for database schema |
|
|
498
|
-
| `analysis` | 4 | AI context optimization and data analysis |
|
|
499
|
-
| `ai_enhancement` | 11 | AI-powered query building, smart discovery, documentation, schema design, security audit, and index recommendations |
|
|
245
|
+
Use documentation categories to fine-tune which tools are exposed (Layer 2):
|
|
246
|
+
|
|
247
|
+
```text
|
|
248
|
+
database_discovery,crud_operations,bulk_operations,custom_queries,
|
|
249
|
+
schema_management,utilities,transaction_management,stored_procedures,
|
|
250
|
+
views_management,triggers_management,functions_management,index_management,
|
|
251
|
+
constraint_management,table_maintenance,server_management,
|
|
252
|
+
performance_monitoring,cache_management,query_optimization,
|
|
253
|
+
backup_restore,import_export,data_migration,schema_migrations,
|
|
254
|
+
analysis,ai_enhancement
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Full category → tool mapping (and examples) lives in **[DOCUMENTATIONS.md → Category Filtering System](DOCUMENTATIONS.md#🆕-category-filtering-system)**.
|
|
500
258
|
|
|
501
259
|
### Legacy Categories (Backward Compatible)
|
|
502
260
|
|
|
@@ -513,200 +271,20 @@ Use these categories for fine-grained control that matches the tool organization
|
|
|
513
271
|
| `transaction` | BEGIN, COMMIT, ROLLBACK | ACID operations |
|
|
514
272
|
| `utility` | Connection testing, diagnostics | Troubleshooting |
|
|
515
273
|
|
|
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.
|
|
274
|
+
Common presets, environment bundles, and multi-environment examples are documented in **[DOCUMENTATIONS.md → Category Filtering System](DOCUMENTATIONS.md#🆕-category-filtering-system)**.
|
|
545
275
|
|
|
546
|
-
|
|
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
|
|
557
|
-
|
|
558
|
-
If an unknown preset is requested without overrides, the server falls back to a safe read-only baseline instead of enabling everything.
|
|
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.
|
|
276
|
+
---
|
|
610
277
|
|
|
611
|
-
|
|
278
|
+
## Available Tools
|
|
612
279
|
|
|
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
|
-
```
|
|
280
|
+
The server exposes **150 tools** organized into categories (CRUD, schema, backups, migrations, perf/monitoring, and AI enhancement).
|
|
645
281
|
|
|
646
|
-
|
|
282
|
+
- Complete list of tools: **[DOCUMENTATIONS.md → Complete Tools Reference](DOCUMENTATIONS.md#🔧-complete-tools-reference)**
|
|
283
|
+
- AI enhancement tools overview: **[DOCUMENTATIONS.md → AI Enhancement Tools](DOCUMENTATIONS.md#🤖-ai-enhancement-tools)**
|
|
647
284
|
|
|
648
|
-
|
|
285
|
+
### 🤖 AI Enhancement Tools
|
|
649
286
|
|
|
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)**
|
|
287
|
+
The full **Phase 1–3 (implemented)** overview, examples, and per-tool documentation lives in **[DOCUMENTATIONS.md](DOCUMENTATIONS.md#🤖-ai-enhancement-tools)**.
|
|
710
288
|
|
|
711
289
|
---
|
|
712
290
|
|
|
@@ -722,7 +300,7 @@ For comprehensive documentation, see **[DOCUMENTATIONS.md](DOCUMENTATIONS.md)**:
|
|
|
722
300
|
- **Schema Versioning** - Version control for database schema changes
|
|
723
301
|
- **Transaction Management** - ACID transactions
|
|
724
302
|
- **Stored Procedures** - Create and execute with IN/OUT/INOUT parameters
|
|
725
|
-
- **🤖 AI Enhancement** - Natural language to SQL, smart data discovery, schema design, security audit,
|
|
303
|
+
- **🤖 AI Enhancement** - Natural language to SQL, smart data discovery, schema design, security audit, index recommendations, data generation, visualization, and forecasting (Phase 1-3)
|
|
726
304
|
- **Query Logging** - See all SQL queries executed automatically
|
|
727
305
|
- **Security Features** - Built-in security and best practices
|
|
728
306
|
- **Bulk Operations** - High-performance batch processing
|
|
@@ -325,6 +325,12 @@ exports.toolCategoryMap = {
|
|
|
325
325
|
designSchemaFromRequirements: ToolCategory.UTILITY,
|
|
326
326
|
auditDatabaseSecurity: ToolCategory.UTILITY,
|
|
327
327
|
recommendIndexes: ToolCategory.UTILITY,
|
|
328
|
+
// Phase 3: AI Enhancement Tools
|
|
329
|
+
generateTestData: ToolCategory.UTILITY,
|
|
330
|
+
analyzeSchemaPatterns: ToolCategory.UTILITY,
|
|
331
|
+
visualizeQuery: ToolCategory.UTILITY,
|
|
332
|
+
predictQueryPerformance: ToolCategory.UTILITY,
|
|
333
|
+
forecastDatabaseGrowth: ToolCategory.UTILITY,
|
|
328
334
|
};
|
|
329
335
|
/**
|
|
330
336
|
* Map of tool names to their documentation categories (New Enhanced System)
|
|
@@ -491,6 +497,12 @@ exports.toolDocCategoryMap = {
|
|
|
491
497
|
designSchemaFromRequirements: DocCategory.AI_ENHANCEMENT,
|
|
492
498
|
auditDatabaseSecurity: DocCategory.AI_ENHANCEMENT,
|
|
493
499
|
recommendIndexes: DocCategory.AI_ENHANCEMENT,
|
|
500
|
+
// Phase 3: AI Enhancement
|
|
501
|
+
generateTestData: DocCategory.AI_ENHANCEMENT,
|
|
502
|
+
analyzeSchemaPatterns: DocCategory.AI_ENHANCEMENT,
|
|
503
|
+
visualizeQuery: DocCategory.AI_ENHANCEMENT,
|
|
504
|
+
predictQueryPerformance: DocCategory.AI_ENHANCEMENT,
|
|
505
|
+
forecastDatabaseGrowth: DocCategory.AI_ENHANCEMENT,
|
|
494
506
|
};
|
|
495
507
|
/**
|
|
496
508
|
* Mapping between legacy categories and documentation categories
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,10 @@ export declare class MySQLMCP {
|
|
|
31
31
|
private schemaDesignTools;
|
|
32
32
|
private securityAuditTools;
|
|
33
33
|
private indexRecommendationTools;
|
|
34
|
+
private testDataTools;
|
|
35
|
+
private schemaPatternTools;
|
|
36
|
+
private queryVisualizationTools;
|
|
37
|
+
private forecastingTools;
|
|
34
38
|
private security;
|
|
35
39
|
private featureConfig;
|
|
36
40
|
constructor(permissionsConfig?: string, categoriesConfig?: string, presetName?: string);
|
|
@@ -1512,5 +1516,55 @@ export declare class MySQLMCP {
|
|
|
1512
1516
|
};
|
|
1513
1517
|
error?: string;
|
|
1514
1518
|
}>;
|
|
1519
|
+
generateTestData(params: {
|
|
1520
|
+
table_name: string;
|
|
1521
|
+
row_count: number;
|
|
1522
|
+
batch_size?: number;
|
|
1523
|
+
include_nulls?: boolean;
|
|
1524
|
+
database?: string;
|
|
1525
|
+
}): Promise<{
|
|
1526
|
+
status: string;
|
|
1527
|
+
data?: any;
|
|
1528
|
+
error?: string;
|
|
1529
|
+
}>;
|
|
1530
|
+
analyzeSchemaPatterns(params?: {
|
|
1531
|
+
scope?: "database" | "table";
|
|
1532
|
+
table_name?: string;
|
|
1533
|
+
database?: string;
|
|
1534
|
+
}): Promise<{
|
|
1535
|
+
status: string;
|
|
1536
|
+
data?: any;
|
|
1537
|
+
error?: string;
|
|
1538
|
+
}>;
|
|
1539
|
+
visualizeQuery(params: {
|
|
1540
|
+
query: string;
|
|
1541
|
+
include_explain_json?: boolean;
|
|
1542
|
+
format?: "mermaid" | "json" | "both";
|
|
1543
|
+
}): Promise<{
|
|
1544
|
+
status: string;
|
|
1545
|
+
data?: any;
|
|
1546
|
+
error?: string;
|
|
1547
|
+
}>;
|
|
1548
|
+
predictQueryPerformance(params: {
|
|
1549
|
+
query: string;
|
|
1550
|
+
row_growth_multiplier?: number;
|
|
1551
|
+
per_table_row_growth?: Record<string, number>;
|
|
1552
|
+
include_explain_json?: boolean;
|
|
1553
|
+
}): Promise<{
|
|
1554
|
+
status: string;
|
|
1555
|
+
data?: any;
|
|
1556
|
+
error?: string;
|
|
1557
|
+
}>;
|
|
1558
|
+
forecastDatabaseGrowth(params?: {
|
|
1559
|
+
horizon_days?: number;
|
|
1560
|
+
growth_rate_percent_per_day?: number;
|
|
1561
|
+
growth_rate_percent_per_month?: number;
|
|
1562
|
+
per_table_growth_rate_percent_per_day?: Record<string, number>;
|
|
1563
|
+
database?: string;
|
|
1564
|
+
}): Promise<{
|
|
1565
|
+
status: string;
|
|
1566
|
+
data?: any;
|
|
1567
|
+
error?: string;
|
|
1568
|
+
}>;
|
|
1515
1569
|
}
|
|
1516
1570
|
export default MySQLMCP;
|