@berthojoris/mcp-mysql-server 1.10.0 โ 1.10.2
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/DOCUMENTATIONS.md +4083 -3617
- package/README.md +199 -283
- package/bin/mcp-mysql.js +110 -53
- package/dist/config/featureConfig.d.ts +72 -9
- package/dist/config/featureConfig.js +404 -87
- package/dist/index.d.ts +7 -1
- package/dist/index.js +10 -2
- package/dist/mcp-server.js +25 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
**A production-ready Model Context Protocol (MCP) server for MySQL database integration with AI agents**
|
|
6
6
|
|
|
7
|
-
[](https://www.npmjs.com/package/@berthojoris/
|
|
8
|
-
[](https://www.npmjs.com/package/@berthojoris/mysql-mcp)
|
|
8
|
+
[](https://www.npmjs.com/package/@berthojoris/mysql-mcp)
|
|
9
9
|
[](https://opensource.org/licenses/MIT)
|
|
10
10
|
[](https://www.typescriptlang.org/)
|
|
11
11
|
[](https://modelcontextprotocol.io/)
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
# Run directly with npx (no installation needed)
|
|
23
|
-
npx @berthojoris/
|
|
23
|
+
npx @berthojoris/mysql-mcp mysql://user:pass@localhost:3306/mydb "list,read,utility"
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
Add to your AI agent config (`.mcp.json`, `.cursor/mcp.json`, etc.):
|
|
@@ -30,7 +30,7 @@ Add to your AI agent config (`.mcp.json`, `.cursor/mcp.json`, etc.):
|
|
|
30
30
|
"mcpServers": {
|
|
31
31
|
"mysql": {
|
|
32
32
|
"command": "npx",
|
|
33
|
-
"args": ["-y", "@berthojoris/
|
|
33
|
+
"args": ["-y", "@berthojoris/mysql-mcp", "mysql://user:pass@localhost:3306/mydb", "list,read,utility"]
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -50,7 +50,7 @@ Add to your AI agent config (`.mcp.json`, `.cursor/mcp.json`, etc.):
|
|
|
50
50
|
- [Environment Variables](#environment-variables-configuration)
|
|
51
51
|
- [Local Development](#local-path-configuration)
|
|
52
52
|
- [Permission System](#-permission-system)
|
|
53
|
-
- [Available Tools (
|
|
53
|
+
- [Available Tools (119 total)](#-available-tools)
|
|
54
54
|
- [Documentation](#-detailed-documentation)
|
|
55
55
|
- [Comparison: MCP vs Manual Access](#-mysql-mcp-vs-manual-database-access)
|
|
56
56
|
- [License](#-license)
|
|
@@ -63,8 +63,8 @@ Add to your AI agent config (`.mcp.json`, `.cursor/mcp.json`, etc.):
|
|
|
63
63
|
|----------|-------------|
|
|
64
64
|
| **Full MCP Support** | Works with Claude Code, Cursor, Windsurf, Zed, Cline, Kilo Code, Roo Code, Gemini CLI, OpenAI Codex, and any MCP-compatible AI agent |
|
|
65
65
|
| **Security First** | Parameterized queries, SQL injection protection, permission-based access control |
|
|
66
|
-
| **
|
|
67
|
-
|
|
|
66
|
+
| **119 Powerful Tools** | Complete database operations including CRUD, DDL, transactions, stored procedures, backup/restore, migrations |
|
|
67
|
+
| **๐ Category Filtering** | 22 documentation categories for intuitive, fine-grained access control (backward compatible with 10 legacy categories) |
|
|
68
68
|
| **Transaction Support** | Full ACID transaction management (BEGIN, COMMIT, ROLLBACK) |
|
|
69
69
|
| **Schema Migrations** | Version control for database schema with up/down migrations |
|
|
70
70
|
| **Dual Mode** | Run as MCP server OR as REST API |
|
|
@@ -79,13 +79,13 @@ Add to your AI agent config (`.mcp.json`, `.cursor/mcp.json`, etc.):
|
|
|
79
79
|
No installation required - run directly:
|
|
80
80
|
|
|
81
81
|
```bash
|
|
82
|
-
npx @berthojoris/
|
|
82
|
+
npx @berthojoris/mysql-mcp mysql://user:pass@localhost:3306/db "list,read,utility"
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
### Option 2: Global Installation
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
|
-
npm install -g @berthojoris/
|
|
88
|
+
npm install -g @berthojoris/mysql-mcp
|
|
89
89
|
mcp-mysql mysql://user:pass@localhost:3306/db "list,read,utility"
|
|
90
90
|
```
|
|
91
91
|
|
|
@@ -153,6 +153,7 @@ Most AI agents use a similar JSON configuration format. Use the appropriate conf
|
|
|
153
153
|
|
|
154
154
|
**Universal Configuration Template:**
|
|
155
155
|
|
|
156
|
+
**Option 1: Single-Layer (Permissions Only) - Simple Setup**
|
|
156
157
|
```json
|
|
157
158
|
{
|
|
158
159
|
"mcpServers": {
|
|
@@ -160,7 +161,7 @@ Most AI agents use a similar JSON configuration format. Use the appropriate conf
|
|
|
160
161
|
"command": "npx",
|
|
161
162
|
"args": [
|
|
162
163
|
"-y",
|
|
163
|
-
"@berthojoris/
|
|
164
|
+
"@berthojoris/mysql-mcp",
|
|
164
165
|
"mysql://user:password@localhost:3306/database",
|
|
165
166
|
"list,read,utility"
|
|
166
167
|
]
|
|
@@ -169,6 +170,26 @@ Most AI agents use a similar JSON configuration format. Use the appropriate conf
|
|
|
169
170
|
}
|
|
170
171
|
```
|
|
171
172
|
|
|
173
|
+
**Option 2: Dual-Layer (Permissions + Categories) - Recommended for Fine Control**
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"mcpServers": {
|
|
177
|
+
"mysql": {
|
|
178
|
+
"command": "npx",
|
|
179
|
+
"args": [
|
|
180
|
+
"-y",
|
|
181
|
+
"@berthojoris/mysql-mcp",
|
|
182
|
+
"mysql://user:password@localhost:3306/database",
|
|
183
|
+
"list,read,utility",
|
|
184
|
+
"database-discovery,data-read,schema-inspection"
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
> **๐ก 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.
|
|
192
|
+
|
|
172
193
|
<details>
|
|
173
194
|
<summary><strong>Multiple Database Configuration</strong></summary>
|
|
174
195
|
|
|
@@ -179,7 +200,7 @@ Most AI agents use a similar JSON configuration format. Use the appropriate conf
|
|
|
179
200
|
"command": "npx",
|
|
180
201
|
"args": [
|
|
181
202
|
"-y",
|
|
182
|
-
"@berthojoris/
|
|
203
|
+
"@berthojoris/mysql-mcp",
|
|
183
204
|
"mysql://reader:pass@prod-server:3306/prod_db",
|
|
184
205
|
"list,read,utility"
|
|
185
206
|
]
|
|
@@ -188,7 +209,7 @@ Most AI agents use a similar JSON configuration format. Use the appropriate conf
|
|
|
188
209
|
"command": "npx",
|
|
189
210
|
"args": [
|
|
190
211
|
"-y",
|
|
191
|
-
"@berthojoris/
|
|
212
|
+
"@berthojoris/mysql-mcp",
|
|
192
213
|
"mysql://root:pass@localhost:3306/dev_db",
|
|
193
214
|
"list,read,create,update,delete,execute,ddl,utility"
|
|
194
215
|
]
|
|
@@ -208,7 +229,7 @@ OpenAI Codex uses TOML format in `~/.codex/config.toml`.
|
|
|
208
229
|
**Quick setup via CLI:**
|
|
209
230
|
|
|
210
231
|
```bash
|
|
211
|
-
codex mcp add mysql -- npx -y @berthojoris/
|
|
232
|
+
codex mcp add mysql -- npx -y @berthojoris/mysql-mcp mysql://user:pass@localhost:3306/db list,read,utility
|
|
212
233
|
```
|
|
213
234
|
|
|
214
235
|
**Manual TOML configuration:**
|
|
@@ -216,7 +237,7 @@ codex mcp add mysql -- npx -y @berthojoris/mcp-mysql-server mysql://user:pass@lo
|
|
|
216
237
|
```toml
|
|
217
238
|
[mcp_servers.mysql]
|
|
218
239
|
command = "npx"
|
|
219
|
-
args = ["-y", "@berthojoris/
|
|
240
|
+
args = ["-y", "@berthojoris/mysql-mcp", "mysql://user:pass@localhost:3306/db", "list,read,utility"]
|
|
220
241
|
startup_timeout_sec = 20
|
|
221
242
|
```
|
|
222
243
|
|
|
@@ -228,7 +249,7 @@ startup_timeout_sec = 20
|
|
|
228
249
|
```toml
|
|
229
250
|
[mcp_servers.mysql]
|
|
230
251
|
command = "npx"
|
|
231
|
-
args = ["-y", "@berthojoris/
|
|
252
|
+
args = ["-y", "@berthojoris/mysql-mcp"]
|
|
232
253
|
|
|
233
254
|
[mcp_servers.mysql.env]
|
|
234
255
|
DB_HOST = "localhost"
|
|
@@ -245,13 +266,13 @@ MCP_PERMISSIONS = "list,read,utility"
|
|
|
245
266
|
# Production - Read Only
|
|
246
267
|
[mcp_servers.mysql-prod]
|
|
247
268
|
command = "npx"
|
|
248
|
-
args = ["-y", "@berthojoris/
|
|
269
|
+
args = ["-y", "@berthojoris/mysql-mcp", "mysql://reader:pass@prod:3306/prod_db", "list,read,utility"]
|
|
249
270
|
startup_timeout_sec = 30
|
|
250
271
|
|
|
251
272
|
# Development - Full Access
|
|
252
273
|
[mcp_servers.mysql-dev]
|
|
253
274
|
command = "npx"
|
|
254
|
-
args = ["-y", "@berthojoris/
|
|
275
|
+
args = ["-y", "@berthojoris/mysql-mcp", "mysql://root:pass@localhost:3306/dev_db", "list,read,create,update,delete,execute,ddl,utility"]
|
|
255
276
|
```
|
|
256
277
|
|
|
257
278
|
**Advanced options:**
|
|
@@ -259,7 +280,7 @@ args = ["-y", "@berthojoris/mcp-mysql-server", "mysql://root:pass@localhost:3306
|
|
|
259
280
|
```toml
|
|
260
281
|
[mcp_servers.mysql]
|
|
261
282
|
command = "npx"
|
|
262
|
-
args = ["-y", "@berthojoris/
|
|
283
|
+
args = ["-y", "@berthojoris/mysql-mcp", "mysql://user:pass@localhost:3306/db", "list,read,utility"]
|
|
263
284
|
startup_timeout_sec = 20 # Server startup timeout (default: 10)
|
|
264
285
|
tool_timeout_sec = 120 # Per-tool execution timeout (default: 60)
|
|
265
286
|
enabled = true # Set false to disable without deleting
|
|
@@ -292,7 +313,7 @@ Zed IDE uses a different structure in `~/.config/zed/settings.json`:
|
|
|
292
313
|
"path": "npx",
|
|
293
314
|
"args": [
|
|
294
315
|
"-y",
|
|
295
|
-
"@berthojoris/
|
|
316
|
+
"@berthojoris/mysql-mcp",
|
|
296
317
|
"mysql://user:password@localhost:3306/database",
|
|
297
318
|
"list,read,utility"
|
|
298
319
|
]
|
|
@@ -313,7 +334,7 @@ Alternative approach using environment variables instead of connection string:
|
|
|
313
334
|
"mcpServers": {
|
|
314
335
|
"mysql": {
|
|
315
336
|
"command": "npx",
|
|
316
|
-
"args": ["-y", "@berthojoris/
|
|
337
|
+
"args": ["-y", "@berthojoris/mysql-mcp"],
|
|
317
338
|
"env": {
|
|
318
339
|
"DB_HOST": "localhost",
|
|
319
340
|
"DB_PORT": "3306",
|
|
@@ -394,9 +415,43 @@ npm run build
|
|
|
394
415
|
|
|
395
416
|
## Permission System
|
|
396
417
|
|
|
397
|
-
Control database access with
|
|
398
|
-
|
|
399
|
-
|
|
418
|
+
Control database access with a **dual-layer filtering system** that provides both broad and fine-grained control:
|
|
419
|
+
|
|
420
|
+
- **Layer 1 (Permissions)**: Broad operation-level control using legacy categories
|
|
421
|
+
- **Layer 2 (Categories)**: Optional fine-grained tool-level filtering using documentation categories
|
|
422
|
+
|
|
423
|
+
**Filtering Logic**: `Tool enabled = (Has Permission) AND (Has Category OR No categories specified)`
|
|
424
|
+
|
|
425
|
+
### ๐ Documentation Categories (Recommended)
|
|
426
|
+
|
|
427
|
+
Use these categories for fine-grained control that matches the tool organization:
|
|
428
|
+
|
|
429
|
+
| Category | Tools Count | Description |
|
|
430
|
+
|----------|-------------|-------------|
|
|
431
|
+
| `database_discovery` | 4 | List databases, tables, schemas, relationships |
|
|
432
|
+
| `crud_operations` | 4 | Basic Create, Read, Update, Delete operations |
|
|
433
|
+
| `bulk_operations` | 3 | Bulk insert, update, delete with batching |
|
|
434
|
+
| `custom_queries` | 2 | Run custom SELECT or execute SQL |
|
|
435
|
+
| `schema_management` | 4 | CREATE/ALTER/DROP tables (DDL) |
|
|
436
|
+
| `utilities` | 4 | Connection testing, diagnostics, CSV export |
|
|
437
|
+
| `transaction_management` | 5 | BEGIN, COMMIT, ROLLBACK transactions |
|
|
438
|
+
| `stored_procedures` | 6 | Create, execute, manage stored procedures |
|
|
439
|
+
| `views_management` | 6 | Create, alter, drop views |
|
|
440
|
+
| `triggers_management` | 5 | Create, drop triggers |
|
|
441
|
+
| `functions_management` | 6 | Create, execute functions |
|
|
442
|
+
| `index_management` | 5 | Create, drop, analyze indexes |
|
|
443
|
+
| `constraint_management` | 7 | Foreign keys, unique, check constraints |
|
|
444
|
+
| `table_maintenance` | 8 | Analyze, optimize, repair tables |
|
|
445
|
+
| `server_management` | 9 | Process list, explain queries, server info |
|
|
446
|
+
| `performance_monitoring` | 10 | Metrics, slow queries, health checks |
|
|
447
|
+
| `cache_management` | 5 | Query cache stats and configuration |
|
|
448
|
+
| `query_optimization` | 2 | Analyze queries, get optimization hints |
|
|
449
|
+
| `backup_restore` | 5 | Backup/restore database and tables |
|
|
450
|
+
| `import_export` | 5 | Import/export JSON, CSV, SQL |
|
|
451
|
+
| `data_migration` | 5 | Copy, move, clone, sync table data |
|
|
452
|
+
| `schema_migrations` | 9 | Version control for database schema |
|
|
453
|
+
|
|
454
|
+
### Legacy Categories (Backward Compatible)
|
|
400
455
|
|
|
401
456
|
| Permission | Operations | Use Case |
|
|
402
457
|
|------------|------------|----------|
|
|
@@ -411,7 +466,22 @@ Control database access with granular permission categories:
|
|
|
411
466
|
| `transaction` | BEGIN, COMMIT, ROLLBACK | ACID operations |
|
|
412
467
|
| `utility` | Connection testing, diagnostics | Troubleshooting |
|
|
413
468
|
|
|
414
|
-
### Common
|
|
469
|
+
### Common Category Sets
|
|
470
|
+
|
|
471
|
+
#### Using Documentation Categories (Recommended)
|
|
472
|
+
|
|
473
|
+
| Environment | Categories | Description |
|
|
474
|
+
|-------------|------------|-------------|
|
|
475
|
+
| **Production Read-Only** | `database_discovery,utilities` | Safe exploration only |
|
|
476
|
+
| **Analytics & Reporting** | `database_discovery,crud_operations,custom_queries,performance_monitoring` | Read and analyze |
|
|
477
|
+
| **Data Entry** | `database_discovery,crud_operations,utilities` | Basic CRUD operations |
|
|
478
|
+
| **Data Management** | `database_discovery,crud_operations,bulk_operations,utilities` | CRUD + bulk operations |
|
|
479
|
+
| **Application Backend** | `database_discovery,crud_operations,bulk_operations,custom_queries,transaction_management` | Full app support |
|
|
480
|
+
| **Development & Testing** | `database_discovery,crud_operations,bulk_operations,custom_queries,schema_management,utilities,transaction_management` | Development access |
|
|
481
|
+
| **DBA & DevOps** | `database_discovery,schema_management,table_maintenance,backup_restore,schema_migrations,performance_monitoring` | Admin tasks |
|
|
482
|
+
| **Full Access** | *(leave empty)* | All 119 tools enabled |
|
|
483
|
+
|
|
484
|
+
#### Using Legacy Categories (Backward Compatible)
|
|
415
485
|
|
|
416
486
|
| Environment | Permissions | Description |
|
|
417
487
|
|-------------|-------------|-------------|
|
|
@@ -424,14 +494,87 @@ Control database access with granular permission categories:
|
|
|
424
494
|
|
|
425
495
|
### Per-Project Configuration
|
|
426
496
|
|
|
427
|
-
|
|
497
|
+
#### Single-Layer: Permissions Only (Backward Compatible)
|
|
498
|
+
|
|
499
|
+
Use only the 2nd argument for broad permission-based filtering:
|
|
500
|
+
|
|
501
|
+
```json
|
|
502
|
+
{
|
|
503
|
+
"mcpServers": {
|
|
504
|
+
"mysql": {
|
|
505
|
+
"command": "node",
|
|
506
|
+
"args": [
|
|
507
|
+
"/path/to/bin/mcp-mysql.js",
|
|
508
|
+
"mysql://user:password@localhost:3306/db",
|
|
509
|
+
"list,read,utility"
|
|
510
|
+
]
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
**Result**: All tools within `list`, `read`, and `utility` permissions are enabled.
|
|
517
|
+
|
|
518
|
+
#### Dual-Layer: Permissions + Categories (Recommended for Fine Control)
|
|
519
|
+
|
|
520
|
+
Use both 2nd argument (permissions) and 3rd argument (categories):
|
|
428
521
|
|
|
429
522
|
```json
|
|
430
523
|
{
|
|
431
|
-
"
|
|
432
|
-
"mysql
|
|
433
|
-
|
|
434
|
-
|
|
524
|
+
"mcpServers": {
|
|
525
|
+
"mysql-prod": {
|
|
526
|
+
"command": "node",
|
|
527
|
+
"args": [
|
|
528
|
+
"/path/to/bin/mcp-mysql.js",
|
|
529
|
+
"mysql://readonly:pass@prod:3306/app_db",
|
|
530
|
+
"list,read,utility",
|
|
531
|
+
"database_discovery,performance_monitoring"
|
|
532
|
+
]
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
**Result**: Only tools that have BOTH:
|
|
539
|
+
- Permission: `list`, `read`, OR `utility` AND
|
|
540
|
+
- Category: `database_discovery` OR `performance_monitoring`
|
|
541
|
+
|
|
542
|
+
**Enabled**: `list_databases`, `list_tables`, `read_table_schema`, `get_table_relationships`, `get_performance_metrics`, `get_slow_queries`, etc.
|
|
543
|
+
|
|
544
|
+
**Disabled**: `test_connection` (has `utility` permission but not in allowed categories), `read_records` (has `read` permission but category is `crud_operations`), etc.
|
|
545
|
+
|
|
546
|
+
#### Multiple Environments Example
|
|
547
|
+
|
|
548
|
+
```json
|
|
549
|
+
{
|
|
550
|
+
"mcpServers": {
|
|
551
|
+
"mysql-prod-readonly": {
|
|
552
|
+
"command": "node",
|
|
553
|
+
"args": [
|
|
554
|
+
"/path/to/bin/mcp-mysql.js",
|
|
555
|
+
"mysql://readonly:pass@prod:3306/app_db",
|
|
556
|
+
"list,read,utility",
|
|
557
|
+
"database_discovery,performance_monitoring"
|
|
558
|
+
]
|
|
559
|
+
},
|
|
560
|
+
"mysql-dev-full": {
|
|
561
|
+
"command": "node",
|
|
562
|
+
"args": [
|
|
563
|
+
"/path/to/bin/mcp-mysql.js",
|
|
564
|
+
"mysql://dev:pass@localhost:3306/dev_db",
|
|
565
|
+
"list,read,create,update,delete,ddl,transaction,utility"
|
|
566
|
+
]
|
|
567
|
+
},
|
|
568
|
+
"mysql-dba": {
|
|
569
|
+
"command": "node",
|
|
570
|
+
"args": [
|
|
571
|
+
"/path/to/bin/mcp-mysql.js",
|
|
572
|
+
"mysql://dba:pass@server:3306/app_db",
|
|
573
|
+
"list,ddl,utility",
|
|
574
|
+
"database_discovery,schema_management,table_maintenance,backup_restore,index_management"
|
|
575
|
+
]
|
|
576
|
+
}
|
|
577
|
+
}
|
|
435
578
|
}
|
|
436
579
|
```
|
|
437
580
|
|
|
@@ -443,261 +586,34 @@ The MCP server provides **119 powerful tools** organized into categories:
|
|
|
443
586
|
|
|
444
587
|
### Quick Reference
|
|
445
588
|
|
|
589
|
+
**119 Tools Available** - Organized into 22 categories
|
|
590
|
+
|
|
446
591
|
| Category | Count | Key Tools |
|
|
447
592
|
|----------|-------|-----------|
|
|
448
|
-
|
|
|
449
|
-
|
|
|
450
|
-
|
|
|
451
|
-
|
|
|
452
|
-
|
|
|
453
|
-
|
|
|
454
|
-
|
|
|
455
|
-
|
|
|
456
|
-
|
|
|
457
|
-
|
|
|
458
|
-
|
|
|
459
|
-
|
|
|
460
|
-
|
|
|
461
|
-
|
|
|
462
|
-
|
|
|
463
|
-
|
|
|
464
|
-
|
|
|
465
|
-
|
|
|
466
|
-
|
|
|
467
|
-
|
|
|
468
|
-
|
|
|
469
|
-
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
### Database Discovery
|
|
474
|
-
|
|
475
|
-
| Tool | Description |
|
|
476
|
-
|------|-------------|
|
|
477
|
-
| `list_databases` | Lists all databases on the MySQL server |
|
|
478
|
-
| `list_tables` | Lists all tables in the current/specified database |
|
|
479
|
-
| `read_table_schema` | Gets detailed schema (columns, types, keys, indexes) |
|
|
480
|
-
| `get_table_relationships` | Discovers foreign key relationships |
|
|
481
|
-
|
|
482
|
-
### Data Operations - CRUD
|
|
483
|
-
|
|
484
|
-
| Tool | Description |
|
|
485
|
-
|------|-------------|
|
|
486
|
-
| `create_record` | Insert new records with automatic SQL generation |
|
|
487
|
-
| `read_records` | Query records with filtering, pagination, and sorting |
|
|
488
|
-
| `update_record` | Update records based on conditions |
|
|
489
|
-
| `delete_record` | Delete records with safety checks |
|
|
490
|
-
|
|
491
|
-
### Bulk Operations
|
|
492
|
-
|
|
493
|
-
| Tool | Description | Performance |
|
|
494
|
-
|------|-------------|-------------|
|
|
495
|
-
| `bulk_insert` | Insert multiple records in batches | Up to 10,000 records/batch |
|
|
496
|
-
| `bulk_update` | Update multiple records with different conditions | Up to 1,000 ops/batch |
|
|
497
|
-
| `bulk_delete` | Delete multiple record sets | Up to 1,000 ops/batch |
|
|
498
|
-
|
|
499
|
-
### Custom Queries
|
|
500
|
-
|
|
501
|
-
| Tool | Description |
|
|
502
|
-
|------|-------------|
|
|
503
|
-
| `run_query` | Execute read-only SELECT queries |
|
|
504
|
-
| `execute_sql` | Execute write operations (INSERT, UPDATE, DELETE, or DDL) |
|
|
505
|
-
|
|
506
|
-
### Schema Management - DDL
|
|
507
|
-
|
|
508
|
-
| Tool | Description | Requires |
|
|
509
|
-
|------|-------------|----------|
|
|
510
|
-
| `create_table` | Create new tables with columns and indexes | `ddl` |
|
|
511
|
-
| `alter_table` | Modify table structure | `ddl` |
|
|
512
|
-
| `drop_table` | Delete tables | `ddl` |
|
|
513
|
-
| `execute_ddl` | Execute raw DDL SQL | `ddl` |
|
|
514
|
-
|
|
515
|
-
### Utilities
|
|
516
|
-
|
|
517
|
-
| Tool | Description |
|
|
518
|
-
|------|-------------|
|
|
519
|
-
| `test_connection` | Test database connectivity and measure latency |
|
|
520
|
-
| `describe_connection` | Get current connection information |
|
|
521
|
-
| `export_table_to_csv` | Export table data to CSV format |
|
|
522
|
-
| `export_query_to_csv` | Export query results to CSV format |
|
|
523
|
-
|
|
524
|
-
### Transaction Management
|
|
525
|
-
|
|
526
|
-
| Tool | Description |
|
|
527
|
-
|------|-------------|
|
|
528
|
-
| `begin_transaction` | Start a new database transaction |
|
|
529
|
-
| `commit_transaction` | Commit the current transaction |
|
|
530
|
-
| `rollback_transaction` | Rollback the current transaction |
|
|
531
|
-
| `get_transaction_status` | Check if a transaction is active |
|
|
532
|
-
| `execute_in_transaction` | Execute SQL within a transaction context |
|
|
533
|
-
|
|
534
|
-
### Stored Procedures
|
|
535
|
-
|
|
536
|
-
| Tool | Description | Requires |
|
|
537
|
-
|------|-------------|----------|
|
|
538
|
-
| `list_stored_procedures` | List all stored procedures | `procedure` |
|
|
539
|
-
| `create_stored_procedure` | Create new stored procedures | `procedure` |
|
|
540
|
-
| `get_stored_procedure_info` | Get procedure details | `procedure` |
|
|
541
|
-
| `execute_stored_procedure` | Execute with IN/OUT/INOUT params | `procedure` |
|
|
542
|
-
| `drop_stored_procedure` | Delete stored procedures | `procedure` |
|
|
543
|
-
| `show_create_procedure` | Show CREATE statement | `procedure` |
|
|
544
|
-
|
|
545
|
-
### Views Management
|
|
546
|
-
|
|
547
|
-
| Tool | Description | Requires |
|
|
548
|
-
|------|-------------|----------|
|
|
549
|
-
| `list_views` | List all views in the database | `list` |
|
|
550
|
-
| `get_view_info` | Get detailed view information | `list` |
|
|
551
|
-
| `create_view` | Create a new view | `ddl` |
|
|
552
|
-
| `alter_view` | Alter an existing view | `ddl` |
|
|
553
|
-
| `drop_view` | Drop a view | `ddl` |
|
|
554
|
-
| `show_create_view` | Show CREATE statement | `list` |
|
|
555
|
-
|
|
556
|
-
### Triggers Management
|
|
557
|
-
|
|
558
|
-
| Tool | Description | Requires |
|
|
559
|
-
|------|-------------|----------|
|
|
560
|
-
| `list_triggers` | List all triggers | `list` |
|
|
561
|
-
| `get_trigger_info` | Get trigger details | `list` |
|
|
562
|
-
| `create_trigger` | Create a new trigger | `ddl` |
|
|
563
|
-
| `drop_trigger` | Drop a trigger | `ddl` |
|
|
564
|
-
| `show_create_trigger` | Show CREATE statement | `list` |
|
|
565
|
-
|
|
566
|
-
### Functions Management
|
|
567
|
-
|
|
568
|
-
| Tool | Description | Requires |
|
|
569
|
-
|------|-------------|----------|
|
|
570
|
-
| `list_functions` | List all user-defined functions | `list` |
|
|
571
|
-
| `get_function_info` | Get function details | `list` |
|
|
572
|
-
| `create_function` | Create a new function | `ddl` |
|
|
573
|
-
| `drop_function` | Drop a function | `ddl` |
|
|
574
|
-
| `show_create_function` | Show CREATE statement | `list` |
|
|
575
|
-
| `execute_function` | Execute and return result | `read` |
|
|
576
|
-
|
|
577
|
-
### Index Management
|
|
578
|
-
|
|
579
|
-
| Tool | Description | Requires |
|
|
580
|
-
|------|-------------|----------|
|
|
581
|
-
| `list_indexes` | List all indexes for a table | `list` |
|
|
582
|
-
| `get_index_info` | Get index details | `list` |
|
|
583
|
-
| `create_index` | Create index (BTREE, HASH, FULLTEXT, SPATIAL) | `ddl` |
|
|
584
|
-
| `drop_index` | Drop an index | `ddl` |
|
|
585
|
-
| `analyze_index` | Analyze index statistics | `utility` |
|
|
586
|
-
|
|
587
|
-
### Constraint Management
|
|
588
|
-
|
|
589
|
-
| Tool | Description | Requires |
|
|
590
|
-
|------|-------------|----------|
|
|
591
|
-
| `list_foreign_keys` | List all foreign keys | `list` |
|
|
592
|
-
| `list_constraints` | List all constraints (PK, FK, UNIQUE, CHECK) | `list` |
|
|
593
|
-
| `add_foreign_key` | Add a foreign key constraint | `ddl` |
|
|
594
|
-
| `drop_foreign_key` | Drop a foreign key | `ddl` |
|
|
595
|
-
| `add_unique_constraint` | Add a unique constraint | `ddl` |
|
|
596
|
-
| `drop_constraint` | Drop UNIQUE or CHECK constraint | `ddl` |
|
|
597
|
-
| `add_check_constraint` | Add CHECK constraint (MySQL 8.0.16+) | `ddl` |
|
|
598
|
-
|
|
599
|
-
### Table Maintenance
|
|
600
|
-
|
|
601
|
-
| Tool | Description | Requires |
|
|
602
|
-
|------|-------------|----------|
|
|
603
|
-
| `analyze_table` | Update index statistics | `utility` |
|
|
604
|
-
| `optimize_table` | Reclaim space and defragment | `utility` |
|
|
605
|
-
| `check_table` | Check table for errors | `utility` |
|
|
606
|
-
| `repair_table` | Repair corrupted table | `utility` |
|
|
607
|
-
| `truncate_table` | Remove all rows quickly | `ddl` |
|
|
608
|
-
| `get_table_status` | Get table status and statistics | `list` |
|
|
609
|
-
| `flush_table` | Close and reopen table(s) | `utility` |
|
|
610
|
-
| `get_table_size` | Get size information | `list` |
|
|
611
|
-
|
|
612
|
-
### Process & Server Management
|
|
613
|
-
|
|
614
|
-
| Tool | Description | Requires |
|
|
615
|
-
|------|-------------|----------|
|
|
616
|
-
| `show_process_list` | Show running MySQL processes | `utility` |
|
|
617
|
-
| `kill_process` | Kill a MySQL process/connection | `utility` |
|
|
618
|
-
| `show_status` | Show server status variables | `utility` |
|
|
619
|
-
| `show_variables` | Show server configuration | `utility` |
|
|
620
|
-
| `explain_query` | Show query execution plan | `utility` |
|
|
621
|
-
| `show_engine_status` | Show storage engine status | `utility` |
|
|
622
|
-
| `get_server_info` | Get comprehensive server info | `utility` |
|
|
623
|
-
| `show_binary_logs` | Show binary log files | `utility` |
|
|
624
|
-
| `show_replication_status` | Show replication status | `utility` |
|
|
625
|
-
|
|
626
|
-
### Performance Monitoring
|
|
627
|
-
|
|
628
|
-
| Tool | Description | Requires |
|
|
629
|
-
|------|-------------|----------|
|
|
630
|
-
| `get_performance_metrics` | Get comprehensive performance metrics | `utility` |
|
|
631
|
-
| `get_top_queries_by_time` | Find slowest queries by execution time | `utility` |
|
|
632
|
-
| `get_top_queries_by_count` | Find most frequently executed queries | `utility` |
|
|
633
|
-
| `get_slow_queries` | Identify queries exceeding time threshold | `utility` |
|
|
634
|
-
| `get_table_io_stats` | Monitor table I/O operations | `utility` |
|
|
635
|
-
| `get_index_usage_stats` | Track index usage statistics | `utility` |
|
|
636
|
-
| `get_unused_indexes` | Identify unused indexes | `utility` |
|
|
637
|
-
| `get_connection_pool_stats` | Monitor connection pool health | `utility` |
|
|
638
|
-
| `get_database_health_check` | Comprehensive health assessment | `utility` |
|
|
639
|
-
| `reset_performance_stats` | Reset performance schema statistics | `utility` |
|
|
640
|
-
|
|
641
|
-
### Cache Management
|
|
642
|
-
|
|
643
|
-
| Tool | Description |
|
|
644
|
-
|------|-------------|
|
|
645
|
-
| `get_cache_stats` | Get query cache statistics |
|
|
646
|
-
| `get_cache_config` | Get current cache configuration |
|
|
647
|
-
| `configure_cache` | Configure cache settings |
|
|
648
|
-
| `clear_cache` | Clear all cached results |
|
|
649
|
-
| `invalidate_table_cache` | Invalidate cache for specific table |
|
|
650
|
-
|
|
651
|
-
### Query Optimization
|
|
652
|
-
|
|
653
|
-
| Tool | Description |
|
|
654
|
-
|------|-------------|
|
|
655
|
-
| `analyze_query` | Analyze query and get optimization suggestions |
|
|
656
|
-
| `get_optimization_hints` | Get optimizer hints for SPEED, MEMORY, or STABILITY |
|
|
657
|
-
|
|
658
|
-
### Database Backup & Restore
|
|
659
|
-
|
|
660
|
-
| Tool | Description | Requires |
|
|
661
|
-
|------|-------------|----------|
|
|
662
|
-
| `backup_table` | Backup single table to SQL dump | `utility` |
|
|
663
|
-
| `backup_database` | Backup entire database to SQL dump | `utility` |
|
|
664
|
-
| `restore_from_sql` | Restore from SQL dump content | `ddl` |
|
|
665
|
-
| `get_create_table_statement` | Get CREATE TABLE statement | `list` |
|
|
666
|
-
| `get_database_schema` | Get complete database schema | `list` |
|
|
667
|
-
|
|
668
|
-
### Data Import/Export
|
|
669
|
-
|
|
670
|
-
| Tool | Description | Requires |
|
|
671
|
-
|------|-------------|----------|
|
|
672
|
-
| `export_table_to_json` | Export table to JSON format | `utility` |
|
|
673
|
-
| `export_query_to_json` | Export query results to JSON | `utility` |
|
|
674
|
-
| `export_table_to_sql` | Export to SQL INSERT statements | `utility` |
|
|
675
|
-
| `import_from_csv` | Import from CSV string | `create` |
|
|
676
|
-
| `import_from_json` | Import from JSON array | `create` |
|
|
677
|
-
|
|
678
|
-
### Data Migration
|
|
679
|
-
|
|
680
|
-
| Tool | Description | Requires |
|
|
681
|
-
|------|-------------|----------|
|
|
682
|
-
| `copy_table_data` | Copy data with optional column mapping | `create` |
|
|
683
|
-
| `move_table_data` | Move data (copy + delete source) | `create`, `delete` |
|
|
684
|
-
| `clone_table` | Clone table structure with optional data | `ddl` |
|
|
685
|
-
| `compare_table_structure` | Compare two table structures | `list` |
|
|
686
|
-
| `sync_table_data` | Sync data between tables | `update` |
|
|
687
|
-
|
|
688
|
-
### Schema Versioning & Migrations
|
|
689
|
-
|
|
690
|
-
| Tool | Description | Requires |
|
|
691
|
-
|------|-------------|----------|
|
|
692
|
-
| `init_migrations_table` | Initialize migrations tracking table | `ddl` |
|
|
693
|
-
| `create_migration` | Create migration with up/down SQL | `ddl` |
|
|
694
|
-
| `apply_migrations` | Apply pending migrations (dry-run support) | `ddl` |
|
|
695
|
-
| `rollback_migration` | Rollback by steps or version | `ddl` |
|
|
696
|
-
| `get_migration_status` | Get migration history and status | `list` |
|
|
697
|
-
| `get_schema_version` | Get current schema version | `list` |
|
|
698
|
-
| `validate_migrations` | Validate migrations for issues | `list` |
|
|
699
|
-
| `reset_failed_migration` | Reset failed migration to pending | `ddl` |
|
|
700
|
-
| `generate_migration_from_diff` | Generate migration from table diff | `ddl` |
|
|
593
|
+
| Database Discovery | 4 | `list_databases`, `list_tables`, `read_table_schema` |
|
|
594
|
+
| CRUD Operations | 4 | `create_record`, `read_records`, `update_record`, `delete_record` |
|
|
595
|
+
| Bulk Operations | 3 | `bulk_insert`, `bulk_update`, `bulk_delete` |
|
|
596
|
+
| Custom Queries | 2 | `run_query`, `execute_sql` |
|
|
597
|
+
| Schema Management | 4 | `create_table`, `alter_table`, `drop_table` |
|
|
598
|
+
| Transactions | 5 | `begin_transaction`, `commit_transaction`, `rollback_transaction` |
|
|
599
|
+
| Stored Procedures | 6 | `create_stored_procedure`, `execute_stored_procedure` |
|
|
600
|
+
| Views | 6 | `create_view`, `alter_view`, `drop_view` |
|
|
601
|
+
| Triggers | 5 | `create_trigger`, `drop_trigger` |
|
|
602
|
+
| Functions | 6 | `create_function`, `execute_function` |
|
|
603
|
+
| Indexes | 5 | `create_index`, `drop_index`, `analyze_index` |
|
|
604
|
+
| Constraints | 7 | `add_foreign_key`, `add_unique_constraint` |
|
|
605
|
+
| Table Maintenance | 8 | `analyze_table`, `optimize_table`, `repair_table` |
|
|
606
|
+
| Server Management | 9 | `show_process_list`, `explain_query` |
|
|
607
|
+
| Performance Monitoring | 10 | `get_performance_metrics`, `get_database_health_check` |
|
|
608
|
+
| Cache | 5 | `get_cache_stats`, `clear_cache` |
|
|
609
|
+
| Query Optimization | 2 | `analyze_query`, `get_optimization_hints` |
|
|
610
|
+
| Backup & Restore | 5 | `backup_database`, `restore_from_sql` |
|
|
611
|
+
| Import/Export | 5 | `export_table_to_json`, `import_from_csv` |
|
|
612
|
+
| Data Migration | 5 | `copy_table_data`, `sync_table_data` |
|
|
613
|
+
| Schema Migrations | 9 | `create_migration`, `apply_migrations` |
|
|
614
|
+
| Utilities | 4 | `test_connection`, `export_table_to_csv` |
|
|
615
|
+
|
|
616
|
+
> **๐ For detailed tool descriptions, parameters, and examples, see [DOCUMENTATIONS.md](DOCUMENTATIONS.md#๐ง-complete-tools-reference)**
|
|
701
617
|
|
|
702
618
|
---
|
|
703
619
|
|
|
@@ -750,6 +666,6 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
750
666
|
|
|
751
667
|
*Enabling AI agents to interact with MySQL databases safely and efficiently*
|
|
752
668
|
|
|
753
|
-
[Report Bug](https://github.com/berthojoris/
|
|
669
|
+
[Report Bug](https://github.com/berthojoris/mysql-mcp/issues) ยท [Request Feature](https://github.com/berthojoris/mysql-mcp/issues) ยท [Documentation](DOCUMENTATIONS.md)
|
|
754
670
|
|
|
755
671
|
</div>
|