@berthojoris/mcp-mysql-server 1.8.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +102 -0
- package/DOCUMENTATIONS.md +703 -9
- package/README.md +466 -22
- package/dist/config/featureConfig.js +10 -0
- package/dist/index.d.ts +117 -0
- package/dist/index.js +95 -0
- package/dist/mcp-server.js +218 -0
- package/dist/tools/schemaVersioningTools.d.ts +147 -0
- package/dist/tools/schemaVersioningTools.js +1007 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MySQL MCP Server
|
|
2
2
|
|
|
3
|
-
A fully-featured **Model Context Protocol (MCP)** server for MySQL database integration with AI agents like Claude
|
|
3
|
+
A fully-featured **Model Context Protocol (MCP)** server for MySQL database integration with AI agents like Claude Code, Cursor, Windsurf, Zed, Cline, Kilo Code, Roo Code, Gemini CLI, OpenAI Codex, and other MCP-compatible tools.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@berthojoris/mcp-mysql-server)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -9,7 +9,7 @@ A fully-featured **Model Context Protocol (MCP)** server for MySQL database inte
|
|
|
9
9
|
|
|
10
10
|
## 🌟 Features
|
|
11
11
|
|
|
12
|
-
- ✅ **Full MCP Protocol Support** - Works with Claude
|
|
12
|
+
- ✅ **Full MCP Protocol Support** - Works with Claude Code, Cursor, Windsurf, Zed, Cline, Kilo Code, Roo Code, Gemini CLI, OpenAI Codex, and any MCP-compatible AI agent
|
|
13
13
|
- 🔐 **Secure by Default** - Parameterized queries, SQL injection protection, permission-based access control
|
|
14
14
|
- 🛠️ **100 Powerful Tools** - Complete database operations (CRUD, DDL, queries, schema inspection, transactions, stored procedures, bulk operations, backup/restore, import/export, data migration)
|
|
15
15
|
- 🎛️ **Dynamic Per-Project Permissions** - Each AI agent can have different access levels
|
|
@@ -21,6 +21,120 @@ A fully-featured **Model Context Protocol (MCP)** server for MySQL database inte
|
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
24
|
+
## 🔄 MySQL MCP vs Manual Database Access: A Comprehensive Comparison
|
|
25
|
+
|
|
26
|
+
This MySQL MCP is a **powerful intermediary layer** between AI assistants and MySQL databases. Here's how it compares to manual database access:
|
|
27
|
+
|
|
28
|
+
### Data Access & Querying
|
|
29
|
+
|
|
30
|
+
| Feature | MySQL MCP | Manual Database Access |
|
|
31
|
+
|---------|-----------|------------------------|
|
|
32
|
+
| **Query Execution** | AI can run SELECT/INSERT/UPDATE/DELETE via natural language | Requires manual SQL writing in terminal/client |
|
|
33
|
+
| **Parameterized Queries** | Automatic protection against SQL injection | Must manually parameterize |
|
|
34
|
+
| **Bulk Operations** | Up to 10,000 records per batch with auto-batching | Manual scripting required |
|
|
35
|
+
| **Query Caching** | Built-in LRU cache with TTL | Must implement yourself |
|
|
36
|
+
|
|
37
|
+
### Data Analysis
|
|
38
|
+
|
|
39
|
+
| Feature | MySQL MCP | Manual Database Access |
|
|
40
|
+
|---------|-----------|------------------------|
|
|
41
|
+
| **Query Analysis** | Auto-detects complexity, joins, bottlenecks | Run EXPLAIN manually, interpret yourself |
|
|
42
|
+
| **Optimization Hints** | Auto-generates MySQL 8.0+ optimizer hints | Must know hint syntax |
|
|
43
|
+
| **Execution Plans** | Get EXPLAIN in JSON/TREE/TRADITIONAL formats | Run EXPLAIN manually |
|
|
44
|
+
| **Server Diagnostics** | 9 tools for status, processes, replication | Multiple manual commands |
|
|
45
|
+
|
|
46
|
+
### Data Validation
|
|
47
|
+
|
|
48
|
+
| Feature | MySQL MCP | Manual Database Access |
|
|
49
|
+
|---------|-----------|------------------------|
|
|
50
|
+
| **Input Validation** | Automatic type/length/format validation | Manual validation code |
|
|
51
|
+
| **SQL Injection Prevention** | Multi-layer protection (identifiers, keywords, params) | Depends on your code |
|
|
52
|
+
| **Permission Enforcement** | 10 granular permission categories | Configure in MySQL grants |
|
|
53
|
+
| **Dangerous Query Blocking** | Blocks GRANT, DROP USER, system schema access | No automatic protection |
|
|
54
|
+
|
|
55
|
+
### Schema Inspection
|
|
56
|
+
|
|
57
|
+
| Feature | MySQL MCP | Manual Database Access |
|
|
58
|
+
|---------|-----------|------------------------|
|
|
59
|
+
| **Table Structure** | One command shows columns, keys, indexes | Multiple SHOW/DESCRIBE commands |
|
|
60
|
+
| **Foreign Key Discovery** | Auto-discovers relationships | Manual INFORMATION_SCHEMA queries |
|
|
61
|
+
| **Full Schema Export** | Get entire DB schema (tables, views, procs, triggers) | Multiple manual exports |
|
|
62
|
+
| **Object Comparison** | Compare table structures automatically | Manual diff work |
|
|
63
|
+
|
|
64
|
+
### Debugging & Diagnostics
|
|
65
|
+
|
|
66
|
+
| Feature | MySQL MCP | Manual Database Access |
|
|
67
|
+
|---------|-----------|------------------------|
|
|
68
|
+
| **Query Logging** | Automatic logging with timing, params, status | Enable general_log manually |
|
|
69
|
+
| **Formatted Output** | SQL formatted with highlighted keywords | Raw output |
|
|
70
|
+
| **Process Management** | View/kill processes via simple commands | SHOW PROCESSLIST + KILL manually |
|
|
71
|
+
| **Cache Monitoring** | Hit rate, memory usage, statistics | No built-in tracking |
|
|
72
|
+
|
|
73
|
+
### Advanced Operations
|
|
74
|
+
|
|
75
|
+
| Feature | MySQL MCP | Manual Database Access |
|
|
76
|
+
|---------|-----------|------------------------|
|
|
77
|
+
| **Transactions** | Begin/Commit/Rollback via commands | Manual SQL |
|
|
78
|
+
| **Stored Procedures** | Create, execute, manage with parameter handling | Write DDL manually |
|
|
79
|
+
| **Data Migration** | Copy, move, clone, sync tables with one command | Complex scripts required |
|
|
80
|
+
| **Backup/Restore** | Full DB or table backup/restore | mysqldump + manual restore |
|
|
81
|
+
| **Import/Export** | CSV, JSON, SQL formats supported | Manual scripting |
|
|
82
|
+
|
|
83
|
+
### Key Benefits of Using This MCP
|
|
84
|
+
|
|
85
|
+
1. **Natural Language Interface** - Ask Claude "show me all users with orders > $100" instead of writing SQL
|
|
86
|
+
|
|
87
|
+
2. **Built-in Security** - 5+ validation layers protect against:
|
|
88
|
+
- SQL injection
|
|
89
|
+
- Privilege escalation
|
|
90
|
+
- Cross-database access
|
|
91
|
+
- Dangerous operations
|
|
92
|
+
|
|
93
|
+
3. **Audit Trail** - Every query automatically logged with timing and parameters
|
|
94
|
+
|
|
95
|
+
4. **100 Tools in 16 Categories** - Covers virtually every database task
|
|
96
|
+
|
|
97
|
+
5. **Permission Granularity** - Give AI read-only access in production, full access in dev
|
|
98
|
+
|
|
99
|
+
6. **Error Handling** - Detailed, human-readable error messages
|
|
100
|
+
|
|
101
|
+
### Example Workflows
|
|
102
|
+
|
|
103
|
+
**Without MCP (Manual):**
|
|
104
|
+
```sql
|
|
105
|
+
-- Connect to MySQL client
|
|
106
|
+
mysql -u user -p database
|
|
107
|
+
-- Write schema query
|
|
108
|
+
DESCRIBE users;
|
|
109
|
+
SHOW INDEX FROM users;
|
|
110
|
+
-- Write analysis query
|
|
111
|
+
EXPLAIN SELECT * FROM users WHERE email LIKE '%@gmail.com';
|
|
112
|
+
-- Check if safe, then run
|
|
113
|
+
SELECT * FROM users WHERE email LIKE '%@gmail.com';
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**With MCP (AI-Assisted):**
|
|
117
|
+
> "Show me the users table structure and find all Gmail users"
|
|
118
|
+
- AI calls `read_table_schema`, `explain_query`, `read_records`
|
|
119
|
+
- Returns formatted results with execution time
|
|
120
|
+
- All queries logged, validated, parameterized automatically
|
|
121
|
+
|
|
122
|
+
### When to Use This MCP
|
|
123
|
+
|
|
124
|
+
| Use Case | Recommendation |
|
|
125
|
+
|----------|----------------|
|
|
126
|
+
| Quick data lookups | MCP - faster, safer |
|
|
127
|
+
| Complex analysis | MCP - AI can iterate and refine |
|
|
128
|
+
| Schema exploration | MCP - comprehensive tools |
|
|
129
|
+
| Production debugging | MCP with read-only permissions |
|
|
130
|
+
| Bulk data operations | MCP - auto-batching |
|
|
131
|
+
| Data migrations | MCP - 5 migration tools |
|
|
132
|
+
| Learning SQL | Both - MCP shows what it executes |
|
|
133
|
+
|
|
134
|
+
This MCP transforms database work from "write SQL, hope it's safe, interpret results" to "describe what you need, get validated results with full audit trail."
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
24
138
|
## 📦 Installation
|
|
25
139
|
|
|
26
140
|
### Option 1: Quick Start (npx)
|
|
@@ -65,13 +179,119 @@ npm run build
|
|
|
65
179
|
|
|
66
180
|
### 3. Configure AI Agent
|
|
67
181
|
|
|
68
|
-
|
|
182
|
+
This MCP server works with multiple AI coding assistants. Below are configuration examples for each platform.
|
|
183
|
+
|
|
184
|
+
#### Claude Code (CLI)
|
|
185
|
+
|
|
186
|
+
Claude Code uses a `.mcp.json` file in your project root or home directory.
|
|
187
|
+
|
|
188
|
+
**Project-level config (`.mcp.json` in project root):**
|
|
189
|
+
|
|
190
|
+
```json
|
|
191
|
+
{
|
|
192
|
+
"mcpServers": {
|
|
193
|
+
"mysql": {
|
|
194
|
+
"command": "npx",
|
|
195
|
+
"args": [
|
|
196
|
+
"-y",
|
|
197
|
+
"@berthojoris/mcp-mysql-server",
|
|
198
|
+
"mysql://user:password@localhost:3306/database",
|
|
199
|
+
"list,read,utility"
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**Global config (`~/.mcp.json`):**
|
|
207
|
+
|
|
208
|
+
```json
|
|
209
|
+
{
|
|
210
|
+
"mcpServers": {
|
|
211
|
+
"mysql": {
|
|
212
|
+
"command": "npx",
|
|
213
|
+
"args": [
|
|
214
|
+
"-y",
|
|
215
|
+
"@berthojoris/mcp-mysql-server",
|
|
216
|
+
"mysql://user:password@localhost:3306/database",
|
|
217
|
+
"list,read,create,update,delete,ddl"
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
#### Cursor
|
|
225
|
+
|
|
226
|
+
Cursor uses `.cursor/mcp.json` in your project root.
|
|
227
|
+
|
|
228
|
+
**Configuration (`.cursor/mcp.json`):**
|
|
69
229
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
230
|
+
```json
|
|
231
|
+
{
|
|
232
|
+
"mcpServers": {
|
|
233
|
+
"mysql": {
|
|
234
|
+
"command": "npx",
|
|
235
|
+
"args": [
|
|
236
|
+
"-y",
|
|
237
|
+
"@berthojoris/mcp-mysql-server",
|
|
238
|
+
"mysql://user:password@localhost:3306/database",
|
|
239
|
+
"list,read,utility"
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
#### Windsurf
|
|
247
|
+
|
|
248
|
+
Windsurf uses `~/.codeium/windsurf/mcp_config.json`.
|
|
249
|
+
|
|
250
|
+
**Configuration:**
|
|
251
|
+
|
|
252
|
+
```json
|
|
253
|
+
{
|
|
254
|
+
"mcpServers": {
|
|
255
|
+
"mysql": {
|
|
256
|
+
"command": "npx",
|
|
257
|
+
"args": [
|
|
258
|
+
"-y",
|
|
259
|
+
"@berthojoris/mcp-mysql-server",
|
|
260
|
+
"mysql://user:password@localhost:3306/database",
|
|
261
|
+
"list,read,utility"
|
|
262
|
+
]
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
#### Cline (VS Code Extension)
|
|
269
|
+
|
|
270
|
+
Add to Cline MCP settings in VS Code settings or cline config file.
|
|
271
|
+
|
|
272
|
+
**Configuration:**
|
|
273
|
+
|
|
274
|
+
```json
|
|
275
|
+
{
|
|
276
|
+
"mcpServers": {
|
|
277
|
+
"mysql": {
|
|
278
|
+
"command": "npx",
|
|
279
|
+
"args": [
|
|
280
|
+
"-y",
|
|
281
|
+
"@berthojoris/mcp-mysql-server",
|
|
282
|
+
"mysql://user:password@localhost:3306/database",
|
|
283
|
+
"list,read,utility"
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
#### Gemini CLI
|
|
73
291
|
|
|
74
|
-
|
|
292
|
+
Gemini CLI uses `~/.gemini/settings.json`.
|
|
293
|
+
|
|
294
|
+
**Configuration:**
|
|
75
295
|
|
|
76
296
|
```json
|
|
77
297
|
{
|
|
@@ -89,7 +309,222 @@ npm run build
|
|
|
89
309
|
}
|
|
90
310
|
```
|
|
91
311
|
|
|
92
|
-
|
|
312
|
+
#### Trae AI
|
|
313
|
+
|
|
314
|
+
Trae AI uses MCP configuration in its settings.
|
|
315
|
+
|
|
316
|
+
**Configuration:**
|
|
317
|
+
|
|
318
|
+
```json
|
|
319
|
+
{
|
|
320
|
+
"mcpServers": {
|
|
321
|
+
"mysql": {
|
|
322
|
+
"command": "npx",
|
|
323
|
+
"args": [
|
|
324
|
+
"-y",
|
|
325
|
+
"@berthojoris/mcp-mysql-server",
|
|
326
|
+
"mysql://user:password@localhost:3306/database",
|
|
327
|
+
"list,read,utility"
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### Qwen Code
|
|
335
|
+
|
|
336
|
+
Qwen Code supports MCP servers with standard configuration.
|
|
337
|
+
|
|
338
|
+
**Configuration:**
|
|
339
|
+
|
|
340
|
+
```json
|
|
341
|
+
{
|
|
342
|
+
"mcpServers": {
|
|
343
|
+
"mysql": {
|
|
344
|
+
"command": "npx",
|
|
345
|
+
"args": [
|
|
346
|
+
"-y",
|
|
347
|
+
"@berthojoris/mcp-mysql-server",
|
|
348
|
+
"mysql://user:password@localhost:3306/database",
|
|
349
|
+
"list,read,utility"
|
|
350
|
+
]
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
#### Droid CLI
|
|
357
|
+
|
|
358
|
+
Droid CLI uses MCP configuration in its settings file.
|
|
359
|
+
|
|
360
|
+
**Configuration:**
|
|
361
|
+
|
|
362
|
+
```json
|
|
363
|
+
{
|
|
364
|
+
"mcpServers": {
|
|
365
|
+
"mysql": {
|
|
366
|
+
"command": "npx",
|
|
367
|
+
"args": [
|
|
368
|
+
"-y",
|
|
369
|
+
"@berthojoris/mcp-mysql-server",
|
|
370
|
+
"mysql://user:password@localhost:3306/database",
|
|
371
|
+
"list,read,utility"
|
|
372
|
+
]
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
#### Zed IDE
|
|
379
|
+
|
|
380
|
+
Zed IDE uses `~/.config/zed/settings.json` for MCP configuration.
|
|
381
|
+
|
|
382
|
+
**Configuration:**
|
|
383
|
+
|
|
384
|
+
```json
|
|
385
|
+
{
|
|
386
|
+
"context_servers": {
|
|
387
|
+
"mysql": {
|
|
388
|
+
"command": {
|
|
389
|
+
"path": "npx",
|
|
390
|
+
"args": [
|
|
391
|
+
"-y",
|
|
392
|
+
"@berthojoris/mcp-mysql-server",
|
|
393
|
+
"mysql://user:password@localhost:3306/database",
|
|
394
|
+
"list,read,utility"
|
|
395
|
+
]
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
#### OpenAI Codex CLI & VS Code Extension
|
|
403
|
+
|
|
404
|
+
OpenAI Codex uses `~/.codex/config.toml` for MCP configuration. This configuration is **shared between the CLI and VS Code extension**.
|
|
405
|
+
|
|
406
|
+
**Option 1: Using the Codex CLI command:**
|
|
407
|
+
|
|
408
|
+
```bash
|
|
409
|
+
codex mcp add mysql -- npx -y @berthojoris/mcp-mysql-server mysql://user:password@localhost:3306/database list,read,utility
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
**Option 2: Manual TOML configuration (`~/.codex/config.toml`):**
|
|
413
|
+
|
|
414
|
+
```toml
|
|
415
|
+
[mcp_servers.mysql]
|
|
416
|
+
command = "npx"
|
|
417
|
+
args = ["-y", "@berthojoris/mcp-mysql-server", "mysql://user:password@localhost:3306/database", "list,read,utility"]
|
|
418
|
+
startup_timeout_sec = 20
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
**With environment variables:**
|
|
422
|
+
|
|
423
|
+
```toml
|
|
424
|
+
[mcp_servers.mysql]
|
|
425
|
+
command = "npx"
|
|
426
|
+
args = ["-y", "@berthojoris/mcp-mysql-server"]
|
|
427
|
+
|
|
428
|
+
[mcp_servers.mysql.env]
|
|
429
|
+
DB_HOST = "localhost"
|
|
430
|
+
DB_PORT = "3306"
|
|
431
|
+
DB_USER = "root"
|
|
432
|
+
DB_PASSWORD = "your_password"
|
|
433
|
+
DB_NAME = "your_database"
|
|
434
|
+
MCP_PERMISSIONS = "list,read,utility"
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
**Multiple database configurations:**
|
|
438
|
+
|
|
439
|
+
```toml
|
|
440
|
+
# Production - Read Only
|
|
441
|
+
[mcp_servers.mysql-prod]
|
|
442
|
+
command = "npx"
|
|
443
|
+
args = ["-y", "@berthojoris/mcp-mysql-server", "mysql://reader:pass@prod-server:3306/prod_db", "list,read,utility"]
|
|
444
|
+
startup_timeout_sec = 30
|
|
445
|
+
|
|
446
|
+
# Development - Full Access
|
|
447
|
+
[mcp_servers.mysql-dev]
|
|
448
|
+
command = "npx"
|
|
449
|
+
args = ["-y", "@berthojoris/mcp-mysql-server", "mysql://root:pass@localhost:3306/dev_db", "list,read,create,update,delete,execute,ddl,utility"]
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
**Advanced options:**
|
|
453
|
+
|
|
454
|
+
```toml
|
|
455
|
+
[mcp_servers.mysql]
|
|
456
|
+
command = "npx"
|
|
457
|
+
args = ["-y", "@berthojoris/mcp-mysql-server", "mysql://user:pass@localhost:3306/database", "list,read,utility"]
|
|
458
|
+
startup_timeout_sec = 20 # Server startup timeout (default: 10)
|
|
459
|
+
tool_timeout_sec = 120 # Per-tool execution timeout (default: 60)
|
|
460
|
+
enabled = true # Set false to disable without deleting
|
|
461
|
+
# enabled_tools = ["list_tables", "read_records"] # Optional: limit exposed tools
|
|
462
|
+
# disabled_tools = ["drop_table", "delete_record"] # Optional: hide specific tools
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
**Codex MCP management commands:**
|
|
466
|
+
|
|
467
|
+
```bash
|
|
468
|
+
# List all configured MCP servers
|
|
469
|
+
codex mcp list
|
|
470
|
+
|
|
471
|
+
# List with JSON output
|
|
472
|
+
codex mcp list --json
|
|
473
|
+
|
|
474
|
+
# Remove an MCP server
|
|
475
|
+
codex mcp remove mysql
|
|
476
|
+
|
|
477
|
+
# Get details about a specific server
|
|
478
|
+
codex mcp get mysql
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
#### Kilo Code (VS Code Extension)
|
|
482
|
+
|
|
483
|
+
Kilo Code is a VS Code extension that supports MCP servers.
|
|
484
|
+
|
|
485
|
+
**Configuration:**
|
|
486
|
+
|
|
487
|
+
```json
|
|
488
|
+
{
|
|
489
|
+
"mcpServers": {
|
|
490
|
+
"mysql": {
|
|
491
|
+
"command": "npx",
|
|
492
|
+
"args": [
|
|
493
|
+
"-y",
|
|
494
|
+
"@berthojoris/mcp-mysql-server",
|
|
495
|
+
"mysql://user:password@localhost:3306/database",
|
|
496
|
+
"list,read,utility"
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
#### Roo Code (VS Code Extension)
|
|
504
|
+
|
|
505
|
+
Roo Code is a VS Code extension with MCP support.
|
|
506
|
+
|
|
507
|
+
**Configuration:**
|
|
508
|
+
|
|
509
|
+
```json
|
|
510
|
+
{
|
|
511
|
+
"mcpServers": {
|
|
512
|
+
"mysql": {
|
|
513
|
+
"command": "npx",
|
|
514
|
+
"args": [
|
|
515
|
+
"-y",
|
|
516
|
+
"@berthojoris/mcp-mysql-server",
|
|
517
|
+
"mysql://user:password@localhost:3306/database",
|
|
518
|
+
"list,read,utility"
|
|
519
|
+
]
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
#### Local Path Configuration (for development)
|
|
526
|
+
|
|
527
|
+
If you've cloned the repository locally:
|
|
93
528
|
|
|
94
529
|
```json
|
|
95
530
|
{
|
|
@@ -97,7 +532,7 @@ npm run build
|
|
|
97
532
|
"mysql": {
|
|
98
533
|
"command": "node",
|
|
99
534
|
"args": [
|
|
100
|
-
"
|
|
535
|
+
"/path/to/mcp_mysql/bin/mcp-mysql.js",
|
|
101
536
|
"mysql://user:password@localhost:3306/database",
|
|
102
537
|
"list,read,utility"
|
|
103
538
|
]
|
|
@@ -106,7 +541,9 @@ npm run build
|
|
|
106
541
|
}
|
|
107
542
|
```
|
|
108
543
|
|
|
109
|
-
|
|
544
|
+
#### Environment Variables Configuration
|
|
545
|
+
|
|
546
|
+
Alternative approach using environment variables:
|
|
110
547
|
|
|
111
548
|
```json
|
|
112
549
|
{
|
|
@@ -114,13 +551,13 @@ npm run build
|
|
|
114
551
|
"mysql": {
|
|
115
552
|
"command": "node",
|
|
116
553
|
"args": [
|
|
117
|
-
"
|
|
554
|
+
"/path/to/mcp_mysql/dist/mcp-server.js"
|
|
118
555
|
],
|
|
119
556
|
"env": {
|
|
120
557
|
"DB_HOST": "localhost",
|
|
121
558
|
"DB_PORT": "3306",
|
|
122
559
|
"DB_USER": "root",
|
|
123
|
-
"DB_PASSWORD": "",
|
|
560
|
+
"DB_PASSWORD": "your_password",
|
|
124
561
|
"DB_NAME": "your_database",
|
|
125
562
|
"MCP_PERMISSIONS": "list,read,utility"
|
|
126
563
|
}
|
|
@@ -129,14 +566,6 @@ npm run build
|
|
|
129
566
|
}
|
|
130
567
|
```
|
|
131
568
|
|
|
132
|
-
#### Cline (VS Code Extension)
|
|
133
|
-
|
|
134
|
-
Add to Cline MCP settings (same JSON format as Claude Desktop).
|
|
135
|
-
|
|
136
|
-
#### Windsurf
|
|
137
|
-
|
|
138
|
-
Add to Windsurf MCP settings (same JSON format as Claude Desktop).
|
|
139
|
-
|
|
140
569
|
### 4. Restart AI Agent
|
|
141
570
|
|
|
142
571
|
Completely restart your AI agent application to load the MCP server.
|
|
@@ -227,7 +656,7 @@ Use the local path approach when you:
|
|
|
227
656
|
|
|
228
657
|
---
|
|
229
658
|
|
|
230
|
-
##
|
|
659
|
+
## 🔐 Permission System
|
|
231
660
|
|
|
232
661
|
### Permission Categories
|
|
233
662
|
|
|
@@ -541,7 +970,7 @@ The MCP server provides **100 powerful tools**:
|
|
|
541
970
|
| `import_from_csv` | Import data from CSV string into a table | `create` permission |
|
|
542
971
|
| `import_from_json` | Import data from JSON array into a table | `create` permission |
|
|
543
972
|
|
|
544
|
-
### Data Migration (5 tools)
|
|
973
|
+
### Data Migration (5 tools)
|
|
545
974
|
|
|
546
975
|
| Tool | Description | Requires |
|
|
547
976
|
|------|-------------|----------|
|
|
@@ -551,6 +980,20 @@ The MCP server provides **100 powerful tools**:
|
|
|
551
980
|
| `compare_table_structure` | Compare structure of two tables and identify differences | `list` permission |
|
|
552
981
|
| `sync_table_data` | Synchronize data between tables (insert_only, update_only, upsert) | `update` permission |
|
|
553
982
|
|
|
983
|
+
### Schema Versioning & Migrations (9 tools) - NEW!
|
|
984
|
+
|
|
985
|
+
| Tool | Description | Requires |
|
|
986
|
+
|------|-------------|----------|
|
|
987
|
+
| `init_migrations_table` | Initialize the migrations tracking table | `ddl` permission |
|
|
988
|
+
| `create_migration` | Create a new migration with up/down SQL | `ddl` permission |
|
|
989
|
+
| `apply_migrations` | Apply pending migrations (with dry-run support) | `ddl` permission |
|
|
990
|
+
| `rollback_migration` | Rollback applied migrations by steps or version | `ddl` permission |
|
|
991
|
+
| `get_migration_status` | Get migration history and status | `list` permission |
|
|
992
|
+
| `get_schema_version` | Get current schema version | `list` permission |
|
|
993
|
+
| `validate_migrations` | Validate migrations for issues | `list` permission |
|
|
994
|
+
| `reset_failed_migration` | Reset failed migration to pending | `ddl` permission |
|
|
995
|
+
| `generate_migration_from_diff` | Generate migration from table comparison | `ddl` permission |
|
|
996
|
+
|
|
554
997
|
---
|
|
555
998
|
|
|
556
999
|
## 📚 Detailed Documentation
|
|
@@ -562,6 +1005,7 @@ For comprehensive documentation on all features, please see **[DOCUMENTATIONS.md
|
|
|
562
1005
|
- 📥 **Data Import Tools** - Import data from CSV and JSON sources
|
|
563
1006
|
- 💾 **Database Backup & Restore** - Full backup/restore with SQL dumps
|
|
564
1007
|
- 🔄 **Data Migration Tools** - Copy, move, clone, compare, and sync table data
|
|
1008
|
+
- 🔄 **Schema Versioning & Migrations** - Version control for database schema changes
|
|
565
1009
|
- 💎 **Transaction Management** - ACID transactions with BEGIN, COMMIT, ROLLBACK
|
|
566
1010
|
- 🔧 **Stored Procedures** - Create and execute stored procedures with IN/OUT/INOUT parameters
|
|
567
1011
|
- 📋 **Usage Examples** - Real-world examples for all tools
|
|
@@ -147,6 +147,16 @@ exports.toolCategoryMap = {
|
|
|
147
147
|
cloneTable: ToolCategory.DDL,
|
|
148
148
|
compareTableStructure: ToolCategory.LIST,
|
|
149
149
|
syncTableData: ToolCategory.UPDATE,
|
|
150
|
+
// Schema versioning and migrations tools
|
|
151
|
+
initMigrationsTable: ToolCategory.DDL,
|
|
152
|
+
createMigration: ToolCategory.DDL,
|
|
153
|
+
applyMigrations: ToolCategory.DDL,
|
|
154
|
+
rollbackMigration: ToolCategory.DDL,
|
|
155
|
+
getMigrationStatus: ToolCategory.LIST,
|
|
156
|
+
getSchemaVersion: ToolCategory.LIST,
|
|
157
|
+
validateMigrations: ToolCategory.LIST,
|
|
158
|
+
resetFailedMigration: ToolCategory.DDL,
|
|
159
|
+
generateMigrationFromDiff: ToolCategory.DDL,
|
|
150
160
|
};
|
|
151
161
|
/**
|
|
152
162
|
* Class to manage feature configuration based on runtime or environment variables
|