@berthojoris/mcp-mysql-server 1.9.1 β†’ 1.9.3

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.
Files changed (3) hide show
  1. package/README.md +386 -676
  2. package/dist/index.js +12 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,145 +1,82 @@
1
- ο»Ώ# MySQL MCP Server
1
+ # MySQL MCP Server
2
2
 
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.
3
+ <div align="center">
4
+
5
+ **A production-ready Model Context Protocol (MCP) server for MySQL database integration with AI agents**
4
6
 
5
7
  [![npm version](https://img.shields.io/npm/v/@berthojoris/mcp-mysql-server)](https://www.npmjs.com/package/@berthojoris/mcp-mysql-server)
8
+ [![npm downloads](https://img.shields.io/npm/dm/@berthojoris/mcp-mysql-server)](https://www.npmjs.com/package/@berthojoris/mcp-mysql-server)
6
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue.svg)](https://www.typescriptlang.org/)
11
+ [![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-green.svg)](https://modelcontextprotocol.io/)
7
12
 
8
- ---
9
-
10
- ## 🌟 Features
13
+ [Installation](#-installation) Β· [Quick Start](#-quick-start) Β· [Configuration](#-ai-agent-configuration) Β· [Permissions](#-permission-system) Β· [Tools](#-available-tools) Β· [Documentation](DOCUMENTATIONS.md)
11
14
 
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
- - πŸ” **Secure by Default** - Parameterized queries, SQL injection protection, permission-based access control
14
- - πŸ› οΈ **100 Powerful Tools** - Complete database operations (CRUD, DDL, queries, schema inspection, transactions, stored procedures, bulk operations, backup/restore, import/export, data migration)
15
- - πŸŽ›οΈ **Dynamic Per-Project Permissions** - Each AI agent can have different access levels
16
- - πŸ—ƒοΈ **DDL Support** - Create, alter, and drop tables (when explicitly enabled)
17
- - πŸ’Ž **Transaction Support** - Full ACID transaction management (BEGIN, COMMIT, ROLLBACK)
18
- - 🌐 **Dual Mode** - Run as MCP server OR as REST API
19
- - πŸ“Š **Rich Metadata** - Table schemas, relationships, connection info
20
- - ⚑ **TypeScript** - Fully typed with TypeScript definitions
15
+ </div>
21
16
 
22
17
  ---
23
18
 
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 |
19
+ ## TL;DR - Quick Setup
63
20
 
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
21
+ ```bash
22
+ # Run directly with npx (no installation needed)
23
+ npx @berthojoris/mcp-mysql-server mysql://user:pass@localhost:3306/mydb "list,read,utility"
24
+ ```
100
25
 
101
- ### Example Workflows
26
+ Add to your AI agent config (`.mcp.json`, `.cursor/mcp.json`, etc.):
102
27
 
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';
28
+ ```json
29
+ {
30
+ "mcpServers": {
31
+ "mysql": {
32
+ "command": "npx",
33
+ "args": ["-y", "@berthojoris/mcp-mysql-server", "mysql://user:pass@localhost:3306/mydb", "list,read,utility"]
34
+ }
35
+ }
36
+ }
114
37
  ```
115
38
 
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
39
+ ---
40
+
41
+ ## Table of Contents
42
+
43
+ - [Features](#-features)
44
+ - [Installation](#-installation)
45
+ - [Quick Start](#-quick-start)
46
+ - [AI Agent Configuration](#-ai-agent-configuration)
47
+ - [Standard JSON Config](#standard-json-configuration)
48
+ - [OpenAI Codex (TOML)](#openai-codex-cli--vs-code-extension)
49
+ - [Zed IDE](#zed-ide)
50
+ - [Environment Variables](#environment-variables-configuration)
51
+ - [Local Development](#local-path-configuration)
52
+ - [Permission System](#-permission-system)
53
+ - [Available Tools (98 total)](#-available-tools)
54
+ - [Documentation](#-detailed-documentation)
55
+ - [Comparison: MCP vs Manual Access](#-mysql-mcp-vs-manual-database-access)
56
+ - [License](#-license)
121
57
 
122
- ### When to Use This MCP
58
+ ---
123
59
 
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 |
60
+ ## Features
133
61
 
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."
62
+ | Category | Description |
63
+ |----------|-------------|
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
+ | **Security First** | Parameterized queries, SQL injection protection, permission-based access control |
66
+ | **98 Powerful Tools** | Complete database operations including CRUD, DDL, transactions, stored procedures, backup/restore, migrations |
67
+ | **Granular Permissions** | 10 permission categories for fine-grained access control per project |
68
+ | **Transaction Support** | Full ACID transaction management (BEGIN, COMMIT, ROLLBACK) |
69
+ | **Schema Migrations** | Version control for database schema with up/down migrations |
70
+ | **Dual Mode** | Run as MCP server OR as REST API |
71
+ | **TypeScript** | Fully typed with TypeScript definitions |
135
72
 
136
73
  ---
137
74
 
138
- ## πŸ“¦ Installation
75
+ ## Installation
139
76
 
140
- ### Option 1: Quick Start (npx)
77
+ ### Option 1: Quick Start with npx (Recommended)
141
78
 
142
- No installation needed! Use directly with npx:
79
+ No installation required - run directly:
143
80
 
144
81
  ```bash
145
82
  npx @berthojoris/mcp-mysql-server mysql://user:pass@localhost:3306/db "list,read,utility"
@@ -154,11 +91,11 @@ mcp-mysql mysql://user:pass@localhost:3306/db "list,read,utility"
154
91
 
155
92
  ---
156
93
 
157
- ## πŸš€ Quick Start
94
+ ## Quick Start
158
95
 
159
- ### 1. Set Up Environment
96
+ ### 1. Set Up Environment (Optional)
160
97
 
161
- Create `.env` file (for local development):
98
+ Create `.env` file for local development:
162
99
 
163
100
  ```env
164
101
  DB_HOST=localhost
@@ -166,132 +103,55 @@ DB_PORT=3306
166
103
  DB_USER=root
167
104
  DB_PASSWORD=yourpassword
168
105
  DB_NAME=yourdatabase
169
-
170
- # Optional: Default permissions (can be overridden per-project)
171
106
  MCP_CONFIG=list,read,utility
172
107
  ```
173
108
 
174
- ### 2. Build Project (if cloned)
109
+ ### 2. Build Project (If Cloned Locally)
175
110
 
176
111
  ```bash
112
+ npm install
177
113
  npm run build
178
114
  ```
179
115
 
180
- ### 3. Configure AI Agent
181
-
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`):**
116
+ ### 3. Configure Your AI Agent
207
117
 
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`):**
229
-
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
- ```
118
+ See [AI Agent Configuration](#-ai-agent-configuration) section below.
245
119
 
246
- #### Windsurf
120
+ ### 4. Restart Your AI Agent
247
121
 
248
- Windsurf uses `~/.codeium/windsurf/mcp_config.json`.
122
+ Completely restart your AI agent application to load the MCP server.
249
123
 
250
- **Configuration:**
124
+ ### 5. Test It!
251
125
 
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
- ```
126
+ Try asking your AI:
267
127
 
268
- #### Cline (VS Code Extension)
128
+ > "What databases are available?"
129
+ > "Show me all tables in my database"
130
+ > "What's the structure of the users table?"
131
+ > "Show me the first 5 records from users"
269
132
 
270
- Add to Cline MCP settings in VS Code settings or cline config file.
133
+ ---
271
134
 
272
- **Configuration:**
135
+ ## AI Agent Configuration
273
136
 
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
- ```
137
+ ### Standard JSON Configuration
289
138
 
290
- #### Gemini CLI
139
+ Most AI agents use a similar JSON configuration format. Use the appropriate config file for your tool:
291
140
 
292
- Gemini CLI uses `~/.gemini/settings.json`.
141
+ | AI Agent | Config File Location |
142
+ |----------|---------------------|
143
+ | **Claude Code** | `.mcp.json` (project root) or `~/.mcp.json` (global) |
144
+ | **Cursor** | `.cursor/mcp.json` |
145
+ | **Windsurf** | `~/.codeium/windsurf/mcp_config.json` |
146
+ | **Cline** | VS Code settings or Cline config file |
147
+ | **Gemini CLI** | `~/.gemini/settings.json` |
148
+ | **Kilo Code** | VS Code MCP settings |
149
+ | **Roo Code** | VS Code MCP settings |
150
+ | **Trae AI** | MCP configuration in settings |
151
+ | **Qwen Code** | MCP configuration in settings |
152
+ | **Droid CLI** | MCP configuration in settings |
293
153
 
294
- **Configuration:**
154
+ **Universal Configuration Template:**
295
155
 
296
156
  ```json
297
157
  {
@@ -309,115 +169,60 @@ Gemini CLI uses `~/.gemini/settings.json`.
309
169
  }
310
170
  ```
311
171
 
312
- #### Trae AI
313
-
314
- Trae AI uses MCP configuration in its settings.
315
-
316
- **Configuration:**
172
+ <details>
173
+ <summary><strong>Multiple Database Configuration</strong></summary>
317
174
 
318
175
  ```json
319
176
  {
320
177
  "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": {
178
+ "mysql-prod": {
344
179
  "command": "npx",
345
180
  "args": [
346
181
  "-y",
347
182
  "@berthojoris/mcp-mysql-server",
348
- "mysql://user:password@localhost:3306/database",
183
+ "mysql://reader:pass@prod-server:3306/prod_db",
349
184
  "list,read,utility"
350
185
  ]
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": {
186
+ },
187
+ "mysql-dev": {
366
188
  "command": "npx",
367
189
  "args": [
368
190
  "-y",
369
191
  "@berthojoris/mcp-mysql-server",
370
- "mysql://user:password@localhost:3306/database",
371
- "list,read,utility"
192
+ "mysql://root:pass@localhost:3306/dev_db",
193
+ "list,read,create,update,delete,execute,ddl,utility"
372
194
  ]
373
195
  }
374
196
  }
375
197
  }
376
198
  ```
377
199
 
378
- #### Zed IDE
379
-
380
- Zed IDE uses `~/.config/zed/settings.json` for MCP configuration.
200
+ </details>
381
201
 
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
- ```
202
+ ---
401
203
 
402
- #### OpenAI Codex CLI & VS Code Extension
204
+ ### OpenAI Codex CLI & VS Code Extension
403
205
 
404
- OpenAI Codex uses `~/.codex/config.toml` for MCP configuration. This configuration is **shared between the CLI and VS Code extension**.
206
+ OpenAI Codex uses TOML format in `~/.codex/config.toml`.
405
207
 
406
- **Option 1: Using the Codex CLI command:**
208
+ **Quick setup via CLI:**
407
209
 
408
210
  ```bash
409
- codex mcp add mysql -- npx -y @berthojoris/mcp-mysql-server mysql://user:password@localhost:3306/database list,read,utility
211
+ codex mcp add mysql -- npx -y @berthojoris/mcp-mysql-server mysql://user:pass@localhost:3306/db list,read,utility
410
212
  ```
411
213
 
412
- **Option 2: Manual TOML configuration (`~/.codex/config.toml`):**
214
+ **Manual TOML configuration:**
413
215
 
414
216
  ```toml
415
217
  [mcp_servers.mysql]
416
218
  command = "npx"
417
- args = ["-y", "@berthojoris/mcp-mysql-server", "mysql://user:password@localhost:3306/database", "list,read,utility"]
219
+ args = ["-y", "@berthojoris/mcp-mysql-server", "mysql://user:pass@localhost:3306/db", "list,read,utility"]
418
220
  startup_timeout_sec = 20
419
221
  ```
420
222
 
223
+ <details>
224
+ <summary><strong>Advanced Codex Configuration</strong></summary>
225
+
421
226
  **With environment variables:**
422
227
 
423
228
  ```toml
@@ -434,13 +239,13 @@ DB_NAME = "your_database"
434
239
  MCP_PERMISSIONS = "list,read,utility"
435
240
  ```
436
241
 
437
- **Multiple database configurations:**
242
+ **Multiple databases:**
438
243
 
439
244
  ```toml
440
245
  # Production - Read Only
441
246
  [mcp_servers.mysql-prod]
442
247
  command = "npx"
443
- args = ["-y", "@berthojoris/mcp-mysql-server", "mysql://reader:pass@prod-server:3306/prod_db", "list,read,utility"]
248
+ args = ["-y", "@berthojoris/mcp-mysql-server", "mysql://reader:pass@prod:3306/prod_db", "list,read,utility"]
444
249
  startup_timeout_sec = 30
445
250
 
446
251
  # Development - Full Access
@@ -454,7 +259,7 @@ args = ["-y", "@berthojoris/mcp-mysql-server", "mysql://root:pass@localhost:3306
454
259
  ```toml
455
260
  [mcp_servers.mysql]
456
261
  command = "npx"
457
- args = ["-y", "@berthojoris/mcp-mysql-server", "mysql://user:pass@localhost:3306/database", "list,read,utility"]
262
+ args = ["-y", "@berthojoris/mcp-mysql-server", "mysql://user:pass@localhost:3306/db", "list,read,utility"]
458
263
  startup_timeout_sec = 20 # Server startup timeout (default: 10)
459
264
  tool_timeout_sec = 120 # Per-tool execution timeout (default: 60)
460
265
  enabled = true # Set false to disable without deleting
@@ -462,69 +267,71 @@ enabled = true # Set false to disable without deleting
462
267
  # disabled_tools = ["drop_table", "delete_record"] # Optional: hide specific tools
463
268
  ```
464
269
 
465
- **Codex MCP management commands:**
270
+ **Codex management commands:**
466
271
 
467
272
  ```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
273
+ codex mcp list # List all configured MCP servers
274
+ codex mcp list --json # List with JSON output
275
+ codex mcp remove mysql # Remove an MCP server
276
+ codex mcp get mysql # Get details about a specific server
479
277
  ```
480
278
 
481
- #### Kilo Code (VS Code Extension)
279
+ </details>
482
280
 
483
- Kilo Code is a VS Code extension that supports MCP servers.
281
+ ---
282
+
283
+ ### Zed IDE
484
284
 
485
- **Configuration:**
285
+ Zed IDE uses a different structure in `~/.config/zed/settings.json`:
486
286
 
487
287
  ```json
488
288
  {
489
- "mcpServers": {
289
+ "context_servers": {
490
290
  "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
- ]
291
+ "command": {
292
+ "path": "npx",
293
+ "args": [
294
+ "-y",
295
+ "@berthojoris/mcp-mysql-server",
296
+ "mysql://user:password@localhost:3306/database",
297
+ "list,read,utility"
298
+ ]
299
+ }
498
300
  }
499
301
  }
500
302
  }
501
303
  ```
502
304
 
503
- #### Roo Code (VS Code Extension)
305
+ ---
504
306
 
505
- Roo Code is a VS Code extension with MCP support.
307
+ ### Environment Variables Configuration
506
308
 
507
- **Configuration:**
309
+ Alternative approach using environment variables instead of connection string:
508
310
 
509
311
  ```json
510
312
  {
511
313
  "mcpServers": {
512
314
  "mysql": {
513
315
  "command": "npx",
514
- "args": [
515
- "-y",
516
- "@berthojoris/mcp-mysql-server",
517
- "mysql://user:password@localhost:3306/database",
518
- "list,read,utility"
519
- ]
316
+ "args": ["-y", "@berthojoris/mcp-mysql-server"],
317
+ "env": {
318
+ "DB_HOST": "localhost",
319
+ "DB_PORT": "3306",
320
+ "DB_USER": "root",
321
+ "DB_PASSWORD": "your_password",
322
+ "DB_NAME": "your_database",
323
+ "MCP_PERMISSIONS": "list,read,utility"
324
+ }
520
325
  }
521
326
  }
522
327
  }
523
328
  ```
524
329
 
525
- #### Local Path Configuration (for development)
330
+ ---
331
+
332
+ ### Local Path Configuration
526
333
 
527
- If you've cloned the repository locally:
334
+ For development or when you need full control over the source code:
528
335
 
529
336
  ```json
530
337
  {
@@ -541,246 +348,128 @@ If you've cloned the repository locally:
541
348
  }
542
349
  ```
543
350
 
544
- #### Environment Variables Configuration
545
-
546
- Alternative approach using environment variables:
547
-
548
- ```json
549
- {
550
- "mcpServers": {
551
- "mysql": {
552
- "command": "node",
553
- "args": [
554
- "/path/to/mcp_mysql/dist/mcp-server.js"
555
- ],
556
- "env": {
557
- "DB_HOST": "localhost",
558
- "DB_PORT": "3306",
559
- "DB_USER": "root",
560
- "DB_PASSWORD": "your_password",
561
- "DB_NAME": "your_database",
562
- "MCP_PERMISSIONS": "list,read,utility"
563
- }
564
- }
565
- }
566
- }
567
- ```
568
-
569
- ### 4. Restart AI Agent
570
-
571
- Completely restart your AI agent application to load the MCP server.
572
-
573
- ### 5. Test It!
574
-
575
- Try asking your AI:
576
- - *"What databases are available?"*
577
- - *"Show me all tables in my database"*
578
- - *"What's the structure of the users table?"*
579
- - *"Show me the first 5 records from users"*
580
-
581
- ---
582
-
583
- ## Local vs NPX Configuration
584
-
585
- ### When to Use Local Path Configuration
351
+ <details>
352
+ <summary><strong>When to Use Local Path</strong></summary>
586
353
 
587
- Use the local path approach when you:
588
- - **Want full control** over the version and source code
589
- - **Need offline access** without internet dependency
590
- - **Want to modify the source** for custom functionality
591
- - **Need faster startup** without package download
592
- - **Are developing/debugging** the MCP server
593
- - **Have network restrictions** or security policies
354
+ Use local path configuration when you:
594
355
 
595
- ### Local Configuration Benefits
356
+ - Want full control over the version and source code
357
+ - Need offline access without internet dependency
358
+ - Want to modify the source for custom functionality
359
+ - Need faster startup without package download
360
+ - Are developing/debugging the MCP server
361
+ - Have network restrictions or security policies
596
362
 
597
363
  | Feature | Local Path | NPX |
598
364
  |---------|------------|-----|
599
365
  | **Control** | Full control over code | Depends on npm registry |
600
- | **Offline** | Works completely offline | Requires internet download |
366
+ | **Offline** | Works completely offline | Requires internet |
601
367
  | **Speed** | Instant startup | Download time |
602
- | **Customization** | Can modify source code | Limited to published version |
603
- | **Debugging** | Full source access available | Limited debugging |
368
+ | **Customization** | Can modify source | Limited to published version |
604
369
  | **Updates** | Manual updates | Automatic updates |
605
- | **Setup** | Requires building project | Zero setup |
606
-
607
- ### Local Setup Requirements
370
+ | **Setup** | Requires building | Zero setup |
608
371
 
609
- 1. **Build the project:**
610
- ```bash
611
- cd "C:\DEKSTOP\MCP\mcp_mysql"
612
- npm run build
613
- ```
372
+ **Setup requirements:**
614
373
 
615
- 2. **Ensure paths are absolute** - Use full paths to avoid ambiguity
616
- 3. **Use correct binaries:**
617
- - `bin/mcp-mysql.js` - CLI wrapper with argument parsing
618
- - `dist/mcp-server.js` - Direct server executable
374
+ ```bash
375
+ cd /path/to/mcp_mysql
376
+ npm install
377
+ npm run build
378
+ ```
619
379
 
620
- ### Common Local Configuration Patterns
380
+ **Available binaries:**
621
381
 
622
- **Direct binary with arguments:**
623
- ```json
624
- {
625
- "command": "node",
626
- "args": [
627
- "C:\\DEKSTOP\\MCP\\mcp_mysql\\bin\\mcp-mysql.js",
628
- "mysql://user:pass@localhost:3306/database",
629
- "permissions"
630
- ]
631
- }
632
- ```
382
+ - `bin/mcp-mysql.js` - CLI wrapper with argument parsing
383
+ - `dist/mcp-server.js` - Direct server executable
633
384
 
634
- **Direct server with environment variables:**
635
- ```json
636
- {
637
- "command": "node",
638
- "args": ["C:\\DEKSTOP\\MCP\\mcp_mysql\\dist\\mcp-server.js"],
639
- "env": {
640
- "DB_HOST": "localhost",
641
- "DB_PORT": "3306",
642
- "DB_USER": "root",
643
- "DB_PASSWORD": "",
644
- "DB_NAME": "database",
645
- "MCP_PERMISSIONS": "permissions"
646
- }
647
- }
648
- ```
385
+ **Path tips:**
649
386
 
650
- ### Path Tips
387
+ - Windows: Use double backslashes `\\` in JSON
388
+ - Cross-platform: Use forward slashes `/` if supported
389
+ - Always use absolute paths for reliability
651
390
 
652
- - **Windows paths:** Use double backslashes `\\` in JSON
653
- - **Cross-platform:** Use forward slashes `/` if supported by your AI agent
654
- - **Environment variables:** Can use `%USERPROFILE%` or `$HOME` in some systems
655
- - **Relative paths:** Not recommended - use absolute paths for reliability
391
+ </details>
656
392
 
657
393
  ---
658
394
 
659
- ## πŸ” Permission System
395
+ ## Permission System
396
+
397
+ Control database access with granular permission categories:
660
398
 
661
399
  ### Permission Categories
662
400
 
663
- Control access with these permission categories:
664
-
665
- | Category | Operations | Example Use Case |
666
- |----------|------------|------------------|
667
- | **`list`** | List databases, tables, schemas | Database exploration |
668
- | **`read`** | SELECT queries, read data | Analytics, reporting |
669
- | **`create`** | INSERT new records | Data entry |
670
- | **`update`** | UPDATE existing records | Data maintenance |
671
- | **`delete`** | DELETE records | Data cleanup |
672
- | **`execute`** | Execute custom SQL (DML) + Advanced SQL features | Complex operations, advanced queries |
673
- | **`ddl`** | CREATE/ALTER/DROP tables | Schema management |
674
- | **`procedure`** | CREATE/DROP/EXECUTE stored procedures | Stored procedure management |
675
- | **`transaction`** | BEGIN, COMMIT, ROLLBACK transactions | ACID operations |
676
- | **`utility`** | Connection testing, info | Diagnostics |
401
+ | Permission | Operations | Use Case |
402
+ |------------|------------|----------|
403
+ | `list` | List databases, tables, schemas | Database exploration |
404
+ | `read` | SELECT queries, read data | Analytics, reporting |
405
+ | `create` | INSERT new records | Data entry |
406
+ | `update` | UPDATE existing records | Data maintenance |
407
+ | `delete` | DELETE records | Data cleanup |
408
+ | `execute` | Execute custom SQL (DML) + Advanced SQL | Complex operations |
409
+ | `ddl` | CREATE/ALTER/DROP tables | Schema management |
410
+ | `procedure` | Stored procedures (CREATE/DROP/EXECUTE) | Procedure management |
411
+ | `transaction` | BEGIN, COMMIT, ROLLBACK | ACID operations |
412
+ | `utility` | Connection testing, diagnostics | Troubleshooting |
413
+
414
+ ### Common Permission Sets
415
+
416
+ | Environment | Permissions | Description |
417
+ |-------------|-------------|-------------|
418
+ | **Production (Safe)** | `list,read,utility` | Read-only access |
419
+ | **Data Entry** | `list,read,create,utility` | Can add records |
420
+ | **Full Data Access** | `list,read,create,update,delete,utility` | All CRUD operations |
421
+ | **With Transactions** | `list,read,create,update,delete,transaction,utility` | CRUD + ACID |
422
+ | **Development** | `list,read,create,update,delete,execute,ddl,transaction,utility` | Full access |
423
+ | **DBA Tasks** | `list,ddl,utility` | Schema management only |
677
424
 
678
425
  ### Per-Project Configuration
679
426
 
680
- **Each project can have different permissions!** Specify as the third argument:
427
+ Each project can have different permissions - specify as the second argument after the connection string:
681
428
 
682
429
  ```json
683
430
  {
684
431
  "args": [
685
432
  "mysql://user:pass@localhost:3306/db",
686
- "list,read,utility" // ← Permissions here
433
+ "list,read,utility"
687
434
  ]
688
435
  }
689
436
  ```
690
437
 
691
- ### Common Permission Sets
692
-
693
- **Production Read-Only:**
694
- ```
695
- list,read,utility
696
- ```
697
-
698
- **Data Entry:**
699
- ```
700
- list,read,create,utility
701
- ```
702
-
703
- **Full Data Access (No Schema Changes):**
704
- ```
705
- list,read,create,update,delete,utility
706
- ```
707
-
708
- **Full Data Access with Transactions:**
709
- ```
710
- list,read,create,update,delete,transaction,utility
711
- ```
712
-
713
- **Development (Full Access):**
714
- ```
715
- list,read,create,update,delete,execute,ddl,transaction,utility
716
- ```
717
-
718
- **DBA Tasks:**
719
- ```
720
- list,ddl,utility
721
- ```
722
-
723
- ### Multiple Projects Example
724
-
725
- You can have different databases with different permissions in the same AI agent:
726
-
727
- **Using NPX:**
728
- ```json
729
- {
730
- "mcpServers": {
731
- "mysql-prod": {
732
- "command": "npx",
733
- "args": [
734
- "-y",
735
- "@berthojoris/mcp-mysql-server",
736
- "mysql://reader:pass@prod-server:3306/prod_db",
737
- "list,read,utility"
738
- ]
739
- },
740
- "mysql-dev": {
741
- "command": "npx",
742
- "args": [
743
- "-y",
744
- "@berthojoris/mcp-mysql-server",
745
- "mysql://root:pass@localhost:3306/dev_db",
746
- "list,read,create,update,delete,execute,ddl,utility"
747
- ]
748
- }
749
- }
750
- }
751
- ```
752
-
753
- **Using Local Paths:**
754
- ```json
755
- {
756
- "mcpServers": {
757
- "mysql-prod": {
758
- "command": "node",
759
- "args": [
760
- "C:\\DEKSTOP\\MCP\\mcp_mysql\\bin\\mcp-mysql.js",
761
- "mysql://reader:pass@prod-server:3306/prod_db",
762
- "list,read,utility"
763
- ]
764
- },
765
- "mysql-dev": {
766
- "command": "node",
767
- "args": [
768
- "C:\\DEKSTOP\\MCP\\mcp_mysql\\bin\\mcp-mysql.js",
769
- "mysql://root:pass@localhost:3306/dev_db",
770
- "list,read,create,update,delete,execute,ddl,utility"
771
- ]
772
- }
773
- }
774
- }
775
- ```
776
-
777
438
  ---
778
439
 
779
- ## πŸ› οΈ Available Tools
440
+ ## Available Tools
441
+
442
+ The MCP server provides **98 powerful tools** organized into categories:
443
+
444
+ ### Quick Reference
445
+
446
+ | Category | Count | Key Tools |
447
+ |----------|-------|-----------|
448
+ | [Database Discovery](#database-discovery) | 4 | `list_databases`, `list_tables`, `read_table_schema` |
449
+ | [CRUD Operations](#data-operations---crud) | 4 | `create_record`, `read_records`, `update_record`, `delete_record` |
450
+ | [Bulk Operations](#bulk-operations) | 3 | `bulk_insert`, `bulk_update`, `bulk_delete` |
451
+ | [Custom Queries](#custom-queries) | 2 | `run_query`, `execute_sql` |
452
+ | [Schema Management](#schema-management---ddl) | 4 | `create_table`, `alter_table`, `drop_table`, `execute_ddl` |
453
+ | [Transactions](#transaction-management) | 5 | `begin_transaction`, `commit_transaction`, `rollback_transaction` |
454
+ | [Stored Procedures](#stored-procedures) | 6 | `create_stored_procedure`, `execute_stored_procedure` |
455
+ | [Views](#views-management) | 6 | `create_view`, `alter_view`, `drop_view` |
456
+ | [Triggers](#triggers-management) | 5 | `create_trigger`, `drop_trigger` |
457
+ | [Functions](#functions-management) | 6 | `create_function`, `execute_function` |
458
+ | [Indexes](#index-management) | 5 | `create_index`, `drop_index`, `analyze_index` |
459
+ | [Constraints](#constraint-management) | 7 | `add_foreign_key`, `add_unique_constraint` |
460
+ | [Table Maintenance](#table-maintenance) | 8 | `analyze_table`, `optimize_table`, `repair_table` |
461
+ | [Server Management](#process--server-management) | 9 | `show_process_list`, `explain_query` |
462
+ | [Cache](#cache-management) | 5 | `get_cache_stats`, `clear_cache` |
463
+ | [Query Optimization](#query-optimization) | 2 | `analyze_query`, `get_optimization_hints` |
464
+ | [Backup & Restore](#database-backup--restore) | 5 | `backup_database`, `restore_from_sql` |
465
+ | [Import/Export](#data-importexport) | 5 | `export_table_to_json`, `import_from_csv` |
466
+ | [Data Migration](#data-migration) | 5 | `copy_table_data`, `sync_table_data` |
467
+ | [Schema Migrations](#schema-versioning--migrations) | 9 | `create_migration`, `apply_migrations` |
468
+ | [Utilities](#utilities) | 4 | `test_connection`, `export_table_to_csv` |
780
469
 
781
- The MCP server provides **100 powerful tools**:
470
+ ---
782
471
 
783
- ### Database Discovery (4 tools)
472
+ ### Database Discovery
784
473
 
785
474
  | Tool | Description |
786
475
  |------|-------------|
@@ -789,7 +478,7 @@ The MCP server provides **100 powerful tools**:
789
478
  | `read_table_schema` | Gets detailed schema (columns, types, keys, indexes) |
790
479
  | `get_table_relationships` | Discovers foreign key relationships |
791
480
 
792
- ### Data Operations - CRUD (4 tools)
481
+ ### Data Operations - CRUD
793
482
 
794
483
  | Tool | Description |
795
484
  |------|-------------|
@@ -798,40 +487,40 @@ The MCP server provides **100 powerful tools**:
798
487
  | `update_record` | Update records based on conditions |
799
488
  | `delete_record` | Delete records with safety checks |
800
489
 
801
- ### Bulk Operations (3 tools)
490
+ ### Bulk Operations
802
491
 
803
492
  | Tool | Description | Performance |
804
493
  |------|-------------|-------------|
805
- | `bulk_insert` | Insert multiple records in batches for optimal performance | Up to 10,000 records per batch |
806
- | `bulk_update` | Update multiple records with different conditions in batches | Up to 1,000 operations per batch |
807
- | `bulk_delete` | Delete multiple record sets based on different conditions | Up to 1,000 operations per batch |
494
+ | `bulk_insert` | Insert multiple records in batches | Up to 10,000 records/batch |
495
+ | `bulk_update` | Update multiple records with different conditions | Up to 1,000 ops/batch |
496
+ | `bulk_delete` | Delete multiple record sets | Up to 1,000 ops/batch |
808
497
 
809
- ### Custom Queries (2 tools)
498
+ ### Custom Queries
810
499
 
811
500
  | Tool | Description |
812
501
  |------|-------------|
813
502
  | `run_query` | Execute read-only SELECT queries |
814
- | `execute_sql` | Execute write operations (INSERT, UPDATE, DELETE, or DDL with permission) |
503
+ | `execute_sql` | Execute write operations (INSERT, UPDATE, DELETE, or DDL) |
815
504
 
816
- ### Schema Management - DDL (4 tools)
505
+ ### Schema Management - DDL
817
506
 
818
507
  | Tool | Description | Requires |
819
508
  |------|-------------|----------|
820
- | `create_table` | Create new tables with columns and indexes | `ddl` permission |
821
- | `alter_table` | Modify table structure (add/drop/modify columns, indexes) | `ddl` permission |
822
- | `drop_table` | Delete tables | `ddl` permission |
823
- | `execute_ddl` | Execute raw DDL SQL (CREATE, ALTER, DROP, TRUNCATE, RENAME) | `ddl` permission |
509
+ | `create_table` | Create new tables with columns and indexes | `ddl` |
510
+ | `alter_table` | Modify table structure | `ddl` |
511
+ | `drop_table` | Delete tables | `ddl` |
512
+ | `execute_ddl` | Execute raw DDL SQL | `ddl` |
824
513
 
825
- ### Utilities (4 tools)
514
+ ### Utilities
826
515
 
827
516
  | Tool | Description |
828
517
  |------|-------------|
829
518
  | `test_connection` | Test database connectivity and measure latency |
830
519
  | `describe_connection` | Get current connection information |
831
- | `export_table_to_csv` | Export table data to CSV format with optional filtering, pagination, and sorting |
832
- | `export_query_to_csv` | Export the results of a SELECT query to CSV format |
520
+ | `export_table_to_csv` | Export table data to CSV format |
521
+ | `export_query_to_csv` | Export query results to CSV format |
833
522
 
834
- ### Transaction Management (5 tools)
523
+ ### Transaction Management
835
524
 
836
525
  | Tool | Description |
837
526
  |------|-------------|
@@ -841,189 +530,210 @@ The MCP server provides **100 powerful tools**:
841
530
  | `get_transaction_status` | Check if a transaction is active |
842
531
  | `execute_in_transaction` | Execute SQL within a transaction context |
843
532
 
844
- ### Stored Procedures (6 tools)
533
+ ### Stored Procedures
845
534
 
846
535
  | Tool | Description | Requires |
847
536
  |------|-------------|----------|
848
- | `list_stored_procedures` | List all stored procedures in a database | `procedure` permission |
849
- | `create_stored_procedure` | Create new stored procedures with parameters | `procedure` permission |
850
- | `get_stored_procedure_info` | Get detailed information about a stored procedure | `procedure` permission |
851
- | `execute_stored_procedure` | Execute stored procedures with IN/OUT/INOUT parameters | `procedure` permission |
852
- | `drop_stored_procedure` | Delete stored procedures | `procedure` permission |
853
- | `show_create_procedure` | Show CREATE statement for a stored procedure | `procedure` permission |
537
+ | `list_stored_procedures` | List all stored procedures | `procedure` |
538
+ | `create_stored_procedure` | Create new stored procedures | `procedure` |
539
+ | `get_stored_procedure_info` | Get procedure details | `procedure` |
540
+ | `execute_stored_procedure` | Execute with IN/OUT/INOUT params | `procedure` |
541
+ | `drop_stored_procedure` | Delete stored procedures | `procedure` |
542
+ | `show_create_procedure` | Show CREATE statement | `procedure` |
854
543
 
855
- ### Views Management (6 tools) - NEW!
544
+ ### Views Management
856
545
 
857
546
  | Tool | Description | Requires |
858
547
  |------|-------------|----------|
859
- | `list_views` | List all views in the database | `list` permission |
860
- | `get_view_info` | Get detailed information about a view | `list` permission |
861
- | `create_view` | Create a new view with SELECT definition | `ddl` permission |
862
- | `alter_view` | Alter an existing view definition | `ddl` permission |
863
- | `drop_view` | Drop a view | `ddl` permission |
864
- | `show_create_view` | Show CREATE statement for a view | `list` permission |
548
+ | `list_views` | List all views in the database | `list` |
549
+ | `get_view_info` | Get detailed view information | `list` |
550
+ | `create_view` | Create a new view | `ddl` |
551
+ | `alter_view` | Alter an existing view | `ddl` |
552
+ | `drop_view` | Drop a view | `ddl` |
553
+ | `show_create_view` | Show CREATE statement | `list` |
865
554
 
866
- ### Triggers Management (5 tools) - NEW!
555
+ ### Triggers Management
867
556
 
868
557
  | Tool | Description | Requires |
869
558
  |------|-------------|----------|
870
- | `list_triggers` | List all triggers in the database | `list` permission |
871
- | `get_trigger_info` | Get detailed information about a trigger | `list` permission |
872
- | `create_trigger` | Create a new trigger on a table | `ddl` permission |
873
- | `drop_trigger` | Drop a trigger | `ddl` permission |
874
- | `show_create_trigger` | Show CREATE statement for a trigger | `list` permission |
559
+ | `list_triggers` | List all triggers | `list` |
560
+ | `get_trigger_info` | Get trigger details | `list` |
561
+ | `create_trigger` | Create a new trigger | `ddl` |
562
+ | `drop_trigger` | Drop a trigger | `ddl` |
563
+ | `show_create_trigger` | Show CREATE statement | `list` |
875
564
 
876
- ### Functions Management (6 tools) - NEW!
565
+ ### Functions Management
877
566
 
878
567
  | Tool | Description | Requires |
879
568
  |------|-------------|----------|
880
- | `list_functions` | List all user-defined functions | `list` permission |
881
- | `get_function_info` | Get detailed information about a function | `list` permission |
882
- | `create_function` | Create a new user-defined function | `ddl` permission |
883
- | `drop_function` | Drop a function | `ddl` permission |
884
- | `show_create_function` | Show CREATE statement for a function | `list` permission |
885
- | `execute_function` | Execute a function and return its result | `read` permission |
569
+ | `list_functions` | List all user-defined functions | `list` |
570
+ | `get_function_info` | Get function details | `list` |
571
+ | `create_function` | Create a new function | `ddl` |
572
+ | `drop_function` | Drop a function | `ddl` |
573
+ | `show_create_function` | Show CREATE statement | `list` |
574
+ | `execute_function` | Execute and return result | `read` |
886
575
 
887
- ### Index Management (5 tools) - NEW!
576
+ ### Index Management
888
577
 
889
578
  | Tool | Description | Requires |
890
579
  |------|-------------|----------|
891
- | `list_indexes` | List all indexes for a table | `list` permission |
892
- | `get_index_info` | Get detailed information about an index | `list` permission |
893
- | `create_index` | Create a new index (BTREE, HASH, FULLTEXT, SPATIAL) | `ddl` permission |
894
- | `drop_index` | Drop an index from a table | `ddl` permission |
895
- | `analyze_index` | Analyze index statistics | `utility` permission |
580
+ | `list_indexes` | List all indexes for a table | `list` |
581
+ | `get_index_info` | Get index details | `list` |
582
+ | `create_index` | Create index (BTREE, HASH, FULLTEXT, SPATIAL) | `ddl` |
583
+ | `drop_index` | Drop an index | `ddl` |
584
+ | `analyze_index` | Analyze index statistics | `utility` |
896
585
 
897
- ### Constraint Management (7 tools) - NEW!
586
+ ### Constraint Management
898
587
 
899
588
  | Tool | Description | Requires |
900
589
  |------|-------------|----------|
901
- | `list_foreign_keys` | List all foreign keys for a table | `list` permission |
902
- | `list_constraints` | List all constraints (PK, FK, UNIQUE, CHECK) | `list` permission |
903
- | `add_foreign_key` | Add a foreign key constraint | `ddl` permission |
904
- | `drop_foreign_key` | Drop a foreign key constraint | `ddl` permission |
905
- | `add_unique_constraint` | Add a unique constraint | `ddl` permission |
906
- | `drop_constraint` | Drop a UNIQUE or CHECK constraint | `ddl` permission |
907
- | `add_check_constraint` | Add a CHECK constraint (MySQL 8.0.16+) | `ddl` permission |
590
+ | `list_foreign_keys` | List all foreign keys | `list` |
591
+ | `list_constraints` | List all constraints (PK, FK, UNIQUE, CHECK) | `list` |
592
+ | `add_foreign_key` | Add a foreign key constraint | `ddl` |
593
+ | `drop_foreign_key` | Drop a foreign key | `ddl` |
594
+ | `add_unique_constraint` | Add a unique constraint | `ddl` |
595
+ | `drop_constraint` | Drop UNIQUE or CHECK constraint | `ddl` |
596
+ | `add_check_constraint` | Add CHECK constraint (MySQL 8.0.16+) | `ddl` |
908
597
 
909
- ### Table Maintenance (8 tools) - NEW!
598
+ ### Table Maintenance
910
599
 
911
600
  | Tool | Description | Requires |
912
601
  |------|-------------|----------|
913
- | `analyze_table` | Update index statistics for optimizer | `utility` permission |
914
- | `optimize_table` | Reclaim unused space and defragment | `utility` permission |
915
- | `check_table` | Check table for errors | `utility` permission |
916
- | `repair_table` | Repair corrupted table (MyISAM, ARCHIVE, CSV) | `utility` permission |
917
- | `truncate_table` | Remove all rows quickly | `ddl` permission |
918
- | `get_table_status` | Get detailed table status and statistics | `list` permission |
919
- | `flush_table` | Close and reopen table(s) | `utility` permission |
920
- | `get_table_size` | Get size information for tables | `list` permission |
602
+ | `analyze_table` | Update index statistics | `utility` |
603
+ | `optimize_table` | Reclaim space and defragment | `utility` |
604
+ | `check_table` | Check table for errors | `utility` |
605
+ | `repair_table` | Repair corrupted table | `utility` |
606
+ | `truncate_table` | Remove all rows quickly | `ddl` |
607
+ | `get_table_status` | Get table status and statistics | `list` |
608
+ | `flush_table` | Close and reopen table(s) | `utility` |
609
+ | `get_table_size` | Get size information | `list` |
921
610
 
922
- ### Process & Server Management (9 tools) - NEW!
611
+ ### Process & Server Management
923
612
 
924
613
  | Tool | Description | Requires |
925
614
  |------|-------------|----------|
926
- | `show_process_list` | Show all running MySQL processes | `utility` permission |
927
- | `kill_process` | Kill a MySQL process/connection | `utility` permission |
928
- | `show_status` | Show MySQL server status variables | `utility` permission |
929
- | `show_variables` | Show MySQL server configuration variables | `utility` permission |
930
- | `explain_query` | Show query execution plan (EXPLAIN) | `utility` permission |
931
- | `show_engine_status` | Show storage engine status (InnoDB) | `utility` permission |
932
- | `get_server_info` | Get comprehensive server information | `utility` permission |
933
- | `show_binary_logs` | Show binary log files | `utility` permission |
934
- | `show_replication_status` | Show replication status | `utility` permission |
935
-
936
- ### Cache Management (5 tools)
615
+ | `show_process_list` | Show running MySQL processes | `utility` |
616
+ | `kill_process` | Kill a MySQL process/connection | `utility` |
617
+ | `show_status` | Show server status variables | `utility` |
618
+ | `show_variables` | Show server configuration | `utility` |
619
+ | `explain_query` | Show query execution plan | `utility` |
620
+ | `show_engine_status` | Show storage engine status | `utility` |
621
+ | `get_server_info` | Get comprehensive server info | `utility` |
622
+ | `show_binary_logs` | Show binary log files | `utility` |
623
+ | `show_replication_status` | Show replication status | `utility` |
624
+
625
+ ### Cache Management
937
626
 
938
627
  | Tool | Description |
939
628
  |------|-------------|
940
629
  | `get_cache_stats` | Get query cache statistics |
941
630
  | `get_cache_config` | Get current cache configuration |
942
- | `configure_cache` | Configure cache settings (TTL, max size) |
943
- | `clear_cache` | Clear all cached query results |
944
- | `invalidate_table_cache` | Invalidate cache for a specific table |
631
+ | `configure_cache` | Configure cache settings |
632
+ | `clear_cache` | Clear all cached results |
633
+ | `invalidate_table_cache` | Invalidate cache for specific table |
945
634
 
946
- ### Query Optimization (2 tools)
635
+ ### Query Optimization
947
636
 
948
637
  | Tool | Description |
949
638
  |------|-------------|
950
639
  | `analyze_query` | Analyze query and get optimization suggestions |
951
- | `get_optimization_hints` | Get optimizer hints for SPEED, MEMORY, or STABILITY goals |
640
+ | `get_optimization_hints` | Get optimizer hints for SPEED, MEMORY, or STABILITY |
952
641
 
953
- ### Database Backup & Restore (5 tools) - NEW!
642
+ ### Database Backup & Restore
954
643
 
955
644
  | Tool | Description | Requires |
956
645
  |------|-------------|----------|
957
- | `backup_table` | Backup single table to SQL dump format | `utility` permission |
958
- | `backup_database` | Backup entire database to SQL dump | `utility` permission |
959
- | `restore_from_sql` | Restore database from SQL dump content | `ddl` permission |
960
- | `get_create_table_statement` | Get CREATE TABLE statement for a table | `list` permission |
961
- | `get_database_schema` | Get complete database schema (tables, views, procedures, functions, triggers) | `list` permission |
646
+ | `backup_table` | Backup single table to SQL dump | `utility` |
647
+ | `backup_database` | Backup entire database to SQL dump | `utility` |
648
+ | `restore_from_sql` | Restore from SQL dump content | `ddl` |
649
+ | `get_create_table_statement` | Get CREATE TABLE statement | `list` |
650
+ | `get_database_schema` | Get complete database schema | `list` |
962
651
 
963
- ### Data Import/Export (5 tools)
652
+ ### Data Import/Export
964
653
 
965
654
  | Tool | Description | Requires |
966
655
  |------|-------------|----------|
967
- | `export_table_to_json` | Export table data to JSON format | `utility` permission |
968
- | `export_query_to_json` | Export query results to JSON format | `utility` permission |
969
- | `export_table_to_sql` | Export table data to SQL INSERT statements | `utility` permission |
970
- | `import_from_csv` | Import data from CSV string into a table | `create` permission |
971
- | `import_from_json` | Import data from JSON array into a table | `create` permission |
656
+ | `export_table_to_json` | Export table to JSON format | `utility` |
657
+ | `export_query_to_json` | Export query results to JSON | `utility` |
658
+ | `export_table_to_sql` | Export to SQL INSERT statements | `utility` |
659
+ | `import_from_csv` | Import from CSV string | `create` |
660
+ | `import_from_json` | Import from JSON array | `create` |
972
661
 
973
- ### Data Migration (5 tools)
662
+ ### Data Migration
974
663
 
975
664
  | Tool | Description | Requires |
976
665
  |------|-------------|----------|
977
- | `copy_table_data` | Copy data from one table to another with optional column mapping | `create` permission |
978
- | `move_table_data` | Move data (copy + delete from source) | `create`, `delete` permission |
979
- | `clone_table` | Clone table structure with optional data | `ddl` permission |
980
- | `compare_table_structure` | Compare structure of two tables and identify differences | `list` permission |
981
- | `sync_table_data` | Synchronize data between tables (insert_only, update_only, upsert) | `update` permission |
666
+ | `copy_table_data` | Copy data with optional column mapping | `create` |
667
+ | `move_table_data` | Move data (copy + delete source) | `create`, `delete` |
668
+ | `clone_table` | Clone table structure with optional data | `ddl` |
669
+ | `compare_table_structure` | Compare two table structures | `list` |
670
+ | `sync_table_data` | Sync data between tables | `update` |
982
671
 
983
- ### Schema Versioning & Migrations (9 tools) - NEW!
672
+ ### Schema Versioning & Migrations
984
673
 
985
674
  | Tool | Description | Requires |
986
675
  |------|-------------|----------|
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 |
676
+ | `init_migrations_table` | Initialize migrations tracking table | `ddl` |
677
+ | `create_migration` | Create migration with up/down SQL | `ddl` |
678
+ | `apply_migrations` | Apply pending migrations (dry-run support) | `ddl` |
679
+ | `rollback_migration` | Rollback by steps or version | `ddl` |
680
+ | `get_migration_status` | Get migration history and status | `list` |
681
+ | `get_schema_version` | Get current schema version | `list` |
682
+ | `validate_migrations` | Validate migrations for issues | `list` |
683
+ | `reset_failed_migration` | Reset failed migration to pending | `ddl` |
684
+ | `generate_migration_from_diff` | Generate migration from table diff | `ddl` |
996
685
 
997
686
  ---
998
687
 
999
- ## πŸ“š Detailed Documentation
1000
-
1001
- For comprehensive documentation on all features, please see **[DOCUMENTATIONS.md](DOCUMENTATIONS.md)** which includes:
1002
-
1003
- - πŸ—ƒοΈ **DDL Operations** - Create, alter, and drop tables
1004
- - πŸ“€ **Data Export Tools** - Export data to CSV, JSON, and SQL formats
1005
- - πŸ“₯ **Data Import Tools** - Import data from CSV and JSON sources
1006
- - πŸ’Ύ **Database Backup & Restore** - Full backup/restore with SQL dumps
1007
- - πŸ”„ **Data Migration Tools** - Copy, move, clone, compare, and sync table data
1008
- - πŸ”„ **Schema Versioning & Migrations** - Version control for database schema changes
1009
- - πŸ’Ž **Transaction Management** - ACID transactions with BEGIN, COMMIT, ROLLBACK
1010
- - πŸ”§ **Stored Procedures** - Create and execute stored procedures with IN/OUT/INOUT parameters
1011
- - πŸ“‹ **Usage Examples** - Real-world examples for all tools
1012
- - πŸ” **Query Logging & Automatic SQL Display** - See all SQL queries executed automatically
1013
- - πŸ” **Security Features** - Built-in security and best practices
1014
- - πŸš€ **Bulk Operations** - High-performance batch processing
1015
- - πŸ› οΈ **Troubleshooting** - Common issues and solutions
1016
- - πŸ“„ **License** - MIT License details
1017
- - πŸ—ΊοΈ **Roadmap** - Upcoming features and improvements
688
+ ## Detailed Documentation
689
+
690
+ For comprehensive documentation, see **[DOCUMENTATIONS.md](DOCUMENTATIONS.md)**:
691
+
692
+ - **DDL Operations** - Create, alter, and drop tables
693
+ - **Data Export Tools** - Export to CSV, JSON, and SQL formats
694
+ - **Data Import Tools** - Import from CSV and JSON sources
695
+ - **Database Backup & Restore** - Full backup/restore with SQL dumps
696
+ - **Data Migration Tools** - Copy, move, clone, compare, and sync data
697
+ - **Schema Versioning** - Version control for database schema changes
698
+ - **Transaction Management** - ACID transactions
699
+ - **Stored Procedures** - Create and execute with IN/OUT/INOUT parameters
700
+ - **Query Logging** - See all SQL queries executed automatically
701
+ - **Security Features** - Built-in security and best practices
702
+ - **Bulk Operations** - High-performance batch processing
703
+ - **Troubleshooting** - Common issues and solutions
1018
704
 
1019
705
  ---
1020
706
 
1021
- ## πŸ“„ License
707
+ ## MySQL MCP vs Manual Database Access
708
+
709
+ This MySQL MCP is a **powerful intermediary layer** between AI assistants and MySQL databases.
710
+
711
+ | Comparison Topic | Documentation |
712
+ |------------------|---------------|
713
+ | Data Access & Querying | [docs/comparison/data-access-querying.md](docs/comparison/data-access-querying.md) |
714
+ | Data Analysis | [docs/comparison/data-analysis.md](docs/comparison/data-analysis.md) |
715
+ | Data Validation | [docs/comparison/data-validation.md](docs/comparison/data-validation.md) |
716
+ | Schema Inspection | [docs/comparison/schema-inspection.md](docs/comparison/schema-inspection.md) |
717
+ | Debugging & Diagnostics | [docs/comparison/debugging-diagnostics.md](docs/comparison/debugging-diagnostics.md) |
718
+ | Advanced Operations | [docs/comparison/advanced-operations.md](docs/comparison/advanced-operations.md) |
719
+ | Key Benefits | [docs/comparison/key-benefits.md](docs/comparison/key-benefits.md) |
720
+ | Example Workflows | [docs/comparison/example-workflows.md](docs/comparison/example-workflows.md) |
721
+ | When to Use | [docs/comparison/when-to-use.md](docs/comparison/when-to-use.md) |
722
+
723
+ ---
724
+
725
+ ## License
1022
726
 
1023
727
  MIT License - see [LICENSE](LICENSE) file for details.
1024
728
 
1025
729
  ---
1026
730
 
1027
- **Made with ❀️ for the AI community**
731
+ <div align="center">
732
+
733
+ **Made with care for the AI development community**
734
+
735
+ *Enabling AI agents to interact with MySQL databases safely and efficiently*
736
+
737
+ [Report Bug](https://github.com/berthojoris/mcp-mysql-server/issues) Β· [Request Feature](https://github.com/berthojoris/mcp-mysql-server/issues) Β· [Documentation](DOCUMENTATIONS.md)
1028
738
 
1029
- *Help AI agents interact with MySQL databases safely and efficiently!*
739
+ </div>