@berthojoris/mcp-mysql-server 1.16.4 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/DOCUMENTATIONS.md +296 -24
- package/README.md +36 -458
- package/dist/config/featureConfig.js +12 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +41 -0
- package/dist/mcp-server.js +154 -1
- package/dist/tools/forecastingTools.d.ts +36 -0
- package/dist/tools/forecastingTools.js +256 -0
- package/dist/tools/queryVisualizationTools.d.ts +22 -0
- package/dist/tools/queryVisualizationTools.js +155 -0
- package/dist/tools/schemaPatternTools.d.ts +19 -0
- package/dist/tools/schemaPatternTools.js +253 -0
- package/dist/tools/testDataTools.d.ts +26 -0
- package/dist/tools/testDataTools.js +325 -0
- package/manifest.json +109 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,22 @@ All notable changes to the MySQL MCP Server will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.17.0] - 2025-12-12
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Phase 3: AI Enhancement Tools** - 5 new tools for data generation, schema review, visualization, and forecasting:
|
|
12
|
+
- `generate_test_data` - Generate FK-aware SQL INSERT statements for synthetic test data (does not execute)
|
|
13
|
+
- `analyze_schema_patterns` - Detect common schema anti-patterns (missing PKs, wide tables, unindexed FKs, EAV-like design)
|
|
14
|
+
- `visualize_query` - Produce a Mermaid flowchart representation of a query using EXPLAIN FORMAT=JSON
|
|
15
|
+
- `predict_query_performance` - Heuristic prediction of query scan/cost impact under growth assumptions
|
|
16
|
+
- `forecast_database_growth` - Forecast table/database size growth from current INFORMATION_SCHEMA sizes and user-supplied rates
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Updated total tool count from 145 to 150 tools.
|
|
20
|
+
|
|
21
|
+
### Documentation
|
|
22
|
+
- Updated README.md and DOCUMENTATIONS.md to include Phase 3 AI Enhancement tools.
|
|
23
|
+
|
|
8
24
|
## [1.16.4] - 2025-12-12
|
|
9
25
|
|
|
10
26
|
### Added
|
package/DOCUMENTATIONS.md
CHANGED
|
@@ -6,27 +6,263 @@ This file contains detailed documentation for all features of the MySQL MCP Serv
|
|
|
6
6
|
|
|
7
7
|
## Table of Contents
|
|
8
8
|
|
|
9
|
-
1. [
|
|
10
|
-
2. [
|
|
11
|
-
3. [
|
|
12
|
-
4. [
|
|
13
|
-
5. [Data
|
|
14
|
-
6. [
|
|
15
|
-
7. [
|
|
16
|
-
8. [
|
|
17
|
-
9. [
|
|
18
|
-
10. [
|
|
19
|
-
11. [
|
|
20
|
-
12. [
|
|
21
|
-
13. [
|
|
22
|
-
14. [
|
|
23
|
-
15. [
|
|
24
|
-
16. [
|
|
25
|
-
17. [
|
|
26
|
-
18. [
|
|
27
|
-
19. [
|
|
28
|
-
20. [
|
|
29
|
-
21. [
|
|
9
|
+
1. [Setup & Configuration (Extended)](#setup--configuration-extended) - Agent clients, env vars, local path, multi-DB
|
|
10
|
+
2. [Category Filtering System](#🆕-category-filtering-system) - NEW!
|
|
11
|
+
3. [🔧 Complete Tools Reference](#🔧-complete-tools-reference) - All 150 tools organized by category
|
|
12
|
+
4. [DDL Operations](#🏗️-ddl-operations)
|
|
13
|
+
5. [Data Export Tools](#📤-data-export-tools)
|
|
14
|
+
6. [Data Import Tools](#📥-data-import-tools)
|
|
15
|
+
7. [Database Backup & Restore](#💾-database-backup--restore)
|
|
16
|
+
8. [Data Migration Tools](#🔄-data-migration-tools)
|
|
17
|
+
9. [Schema Versioning & Migrations](#🔄-schema-versioning-and-migrations)
|
|
18
|
+
10. [Transaction Management](#💰-transaction-management)
|
|
19
|
+
11. [Stored Procedures](#🔧-stored-procedures)
|
|
20
|
+
12. [Views Management](#👁️-views-management)
|
|
21
|
+
13. [Triggers Management](#⚡-triggers-management)
|
|
22
|
+
14. [Functions Management](#🔢-functions-management)
|
|
23
|
+
15. [Index Management](#📇-index-management)
|
|
24
|
+
16. [Constraint Management](#🔗-constraint-management)
|
|
25
|
+
17. [Table Maintenance](#🔧-table-maintenance)
|
|
26
|
+
18. [Process & Server Management](#📊-process--server-management)
|
|
27
|
+
19. [Performance Monitoring](#📈-performance-monitoring)
|
|
28
|
+
20. [AI Enhancement Tools](#🤖-ai-enhancement-tools) - NEW!
|
|
29
|
+
21. [Usage Examples](#📋-usage-examples)
|
|
30
|
+
22. [Query Logging & Automatic SQL Display](#📝-query-logging--automatic-sql-display)
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Setup & Configuration (Extended)
|
|
35
|
+
|
|
36
|
+
This section collects **client-specific configuration snippets** and **advanced setup patterns**. For the shortest setup, see [README.md](README.md).
|
|
37
|
+
|
|
38
|
+
### Agent Configuration Examples
|
|
39
|
+
|
|
40
|
+
Most clients ultimately need the same `command` + `args` shape, but the **config file path** differs.
|
|
41
|
+
|
|
42
|
+
| AI Agent | Config File Location |
|
|
43
|
+
|----------|---------------------|
|
|
44
|
+
| **Claude Code** | `.mcp.json` (project root) or `~/.mcp.json` (global) |
|
|
45
|
+
| **Cursor** | `.cursor/mcp.json` |
|
|
46
|
+
| **Windsurf** | `~/.codeium/windsurf/mcp_config.json` |
|
|
47
|
+
| **Cline** | VS Code settings or Cline config file |
|
|
48
|
+
| **Gemini CLI** | `~/.gemini/settings.json` |
|
|
49
|
+
| **Kilo Code** | VS Code MCP settings |
|
|
50
|
+
| **Roo Code** | VS Code MCP settings |
|
|
51
|
+
| **Trae AI** | MCP configuration in settings |
|
|
52
|
+
| **Qwen Code** | MCP configuration in settings |
|
|
53
|
+
| **Droid CLI** | MCP configuration in settings |
|
|
54
|
+
|
|
55
|
+
#### Standard JSON Configuration (Universal)
|
|
56
|
+
|
|
57
|
+
**Option 1: Single-Layer (Permissions Only) - Simple Setup**
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"mcpServers": {
|
|
62
|
+
"mysql": {
|
|
63
|
+
"command": "npx",
|
|
64
|
+
"args": [
|
|
65
|
+
"-y",
|
|
66
|
+
"@berthojoris/mysql-mcp",
|
|
67
|
+
"mysql://user:password@localhost:3306/database",
|
|
68
|
+
"list,read,utility"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Option 2: Dual-Layer (Permissions + Categories) - Recommended for Fine Control**
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"mcpServers": {
|
|
80
|
+
"mysql": {
|
|
81
|
+
"command": "npx",
|
|
82
|
+
"args": [
|
|
83
|
+
"-y",
|
|
84
|
+
"@berthojoris/mysql-mcp",
|
|
85
|
+
"mysql://user:password@localhost:3306/database",
|
|
86
|
+
"list,read,utility",
|
|
87
|
+
"database_discovery,performance_monitoring"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### Multiple Database Configuration
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"mcpServers": {
|
|
99
|
+
"mysql-prod": {
|
|
100
|
+
"command": "npx",
|
|
101
|
+
"args": [
|
|
102
|
+
"-y",
|
|
103
|
+
"@berthojoris/mysql-mcp",
|
|
104
|
+
"mysql://reader:pass@prod-server:3306/prod_db",
|
|
105
|
+
"list,read,utility"
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
"mysql-dev": {
|
|
109
|
+
"command": "npx",
|
|
110
|
+
"args": [
|
|
111
|
+
"-y",
|
|
112
|
+
"@berthojoris/mysql-mcp",
|
|
113
|
+
"mysql://root:pass@localhost:3306/dev_db",
|
|
114
|
+
"list,read,create,update,delete,execute,ddl,utility"
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### OpenAI Codex CLI & VS Code Extension
|
|
122
|
+
|
|
123
|
+
OpenAI Codex uses TOML format in `~/.codex/config.toml`.
|
|
124
|
+
|
|
125
|
+
**Quick setup via CLI:**
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
codex mcp add mysql -- npx -y @berthojoris/mysql-mcp mysql://user:pass@localhost:3306/db list,read,utility
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Manual TOML configuration:**
|
|
132
|
+
|
|
133
|
+
```toml
|
|
134
|
+
[mcp_servers.mysql]
|
|
135
|
+
command = "npx"
|
|
136
|
+
args = ["-y", "@berthojoris/mysql-mcp", "mysql://user:pass@localhost:3306/db", "list,read,utility"]
|
|
137
|
+
startup_timeout_sec = 20
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Zed IDE
|
|
141
|
+
|
|
142
|
+
Zed uses `~/.config/zed/settings.json`:
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"context_servers": {
|
|
147
|
+
"mysql": {
|
|
148
|
+
"command": {
|
|
149
|
+
"path": "npx",
|
|
150
|
+
"args": [
|
|
151
|
+
"-y",
|
|
152
|
+
"@berthojoris/mysql-mcp",
|
|
153
|
+
"mysql://user:password@localhost:3306/database",
|
|
154
|
+
"list,read,utility"
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Environment Variables Configuration
|
|
163
|
+
|
|
164
|
+
Alternative approach using environment variables instead of a connection string.
|
|
165
|
+
|
|
166
|
+
**Option 1: Permissions Only (Simple)**
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"mcpServers": {
|
|
171
|
+
"mysql": {
|
|
172
|
+
"command": "npx",
|
|
173
|
+
"args": ["-y", "@berthojoris/mysql-mcp"],
|
|
174
|
+
"env": {
|
|
175
|
+
"DB_HOST": "localhost",
|
|
176
|
+
"DB_PORT": "3306",
|
|
177
|
+
"DB_USER": "root",
|
|
178
|
+
"DB_PASSWORD": "your_password",
|
|
179
|
+
"DB_NAME": "your_database",
|
|
180
|
+
"MCP_PERMISSIONS": "list,read,utility"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Option 2: Permissions + Categories (Recommended)**
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"mcpServers": {
|
|
192
|
+
"mysql": {
|
|
193
|
+
"command": "npx",
|
|
194
|
+
"args": ["-y", "@berthojoris/mysql-mcp"],
|
|
195
|
+
"env": {
|
|
196
|
+
"DB_HOST": "localhost",
|
|
197
|
+
"DB_PORT": "3306",
|
|
198
|
+
"DB_USER": "root",
|
|
199
|
+
"DB_PASSWORD": "your_password",
|
|
200
|
+
"DB_NAME": "your_database",
|
|
201
|
+
"MCP_PERMISSIONS": "list,read,utility",
|
|
202
|
+
"MCP_CATEGORIES": "database_discovery,performance_monitoring",
|
|
203
|
+
"MCP_MASKING_PROFILE": "partial"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Option 3: Adaptive Preset (Merges with Overrides)**
|
|
211
|
+
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"mcpServers": {
|
|
215
|
+
"mysql": {
|
|
216
|
+
"command": "npx",
|
|
217
|
+
"args": ["-y", "@berthojoris/mysql-mcp"],
|
|
218
|
+
"env": {
|
|
219
|
+
"DB_HOST": "localhost",
|
|
220
|
+
"DB_PORT": "3306",
|
|
221
|
+
"DB_USER": "root",
|
|
222
|
+
"DB_PASSWORD": "your_password",
|
|
223
|
+
"DB_NAME": "your_database",
|
|
224
|
+
"MCP_PRESET": "readonly",
|
|
225
|
+
"MCP_PERMISSIONS": "list,read,utility",
|
|
226
|
+
"MCP_CATEGORIES": "performance_monitoring"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Presets and profiles (`dev`/`stage`/`prod`) are described in the [Category Filtering System](#🆕-category-filtering-system).
|
|
234
|
+
|
|
235
|
+
### Local Path Configuration
|
|
236
|
+
|
|
237
|
+
For development or when you need full control over the source code:
|
|
238
|
+
|
|
239
|
+
```json
|
|
240
|
+
{
|
|
241
|
+
"mcpServers": {
|
|
242
|
+
"mysql": {
|
|
243
|
+
"command": "node",
|
|
244
|
+
"args": [
|
|
245
|
+
"/path/to/mcp_mysql/bin/mcp-mysql.js",
|
|
246
|
+
"mysql://user:password@localhost:3306/database",
|
|
247
|
+
"list,read,utility"
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
When to use local path:
|
|
255
|
+
|
|
256
|
+
- You need offline usage (no npm registry access)
|
|
257
|
+
- You are developing/debugging the server
|
|
258
|
+
- You need to pin to a custom build
|
|
259
|
+
|
|
260
|
+
Build requirements:
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
npm install
|
|
264
|
+
npm run build
|
|
265
|
+
```
|
|
30
266
|
|
|
31
267
|
Control which database operations are available to AI using a **dual-layer filtering system**:
|
|
32
268
|
|
|
@@ -240,7 +476,7 @@ The system uses both arguments to determine access:
|
|
|
240
476
|
- **3rd argument**: Categories (Layer 2, optional) - comma-separated documentation categories
|
|
241
477
|
|
|
242
478
|
**Decision logic**:
|
|
243
|
-
1. If no arguments: All
|
|
479
|
+
1. If no arguments: All 150 tools enabled
|
|
244
480
|
2. If only 2nd argument (permissions): Tools enabled if they match permission
|
|
245
481
|
3. If both arguments: Tools enabled if they match BOTH permission AND category
|
|
246
482
|
|
|
@@ -285,7 +521,7 @@ Add 'bulk_operations' to the categories argument.
|
|
|
285
521
|
|
|
286
522
|
## 🔧 Complete Tools Reference
|
|
287
523
|
|
|
288
|
-
This section provides a comprehensive reference of all
|
|
524
|
+
This section provides a comprehensive reference of all 150 available tools organized by category.
|
|
289
525
|
|
|
290
526
|
### Database Discovery
|
|
291
527
|
|
|
@@ -3005,7 +3241,38 @@ Reset Performance Schema statistics to start fresh monitoring.
|
|
|
3005
3241
|
|
|
3006
3242
|
## 🤖 AI Enhancement Tools
|
|
3007
3243
|
|
|
3008
|
-
The AI Enhancement tools provide intelligent, AI-powered features for database exploration, query generation, documentation, schema design, security auditing,
|
|
3244
|
+
The AI Enhancement tools provide intelligent, AI-powered features for database exploration, query generation, documentation, schema design, security auditing, index recommendations, data generation, visualization, and forecasting. These tools include **Phase 1-3** enhancements.
|
|
3245
|
+
|
|
3246
|
+
### At a Glance (Phase 1–3 - Implemented)
|
|
3247
|
+
|
|
3248
|
+
- **Intelligent Query Assistant**
|
|
3249
|
+
- **`build_query_from_intent`** - Converts natural language to optimized SQL queries
|
|
3250
|
+
- **`suggest_query_improvements`** - AI-powered query optimization suggestions
|
|
3251
|
+
- *Use case: "Show me active users from last month" → Automatically generates SQL*
|
|
3252
|
+
|
|
3253
|
+
- **Smart Data Discovery Agent**
|
|
3254
|
+
- **`smart_search`** - Semantic search for tables, columns, and data patterns
|
|
3255
|
+
- **`find_similar_columns`** - Discover columns with similar names or data patterns
|
|
3256
|
+
- **`discover_data_patterns`** - Automatic identification of data patterns and relationships
|
|
3257
|
+
- *Use case: Find all customer-related columns across hundreds of tables*
|
|
3258
|
+
|
|
3259
|
+
- **AI-Powered Documentation Generator**
|
|
3260
|
+
- **`generate_documentation`** - Automatic database documentation with business glossary
|
|
3261
|
+
- **`generate_data_dictionary`** - Interactive data dictionaries with examples
|
|
3262
|
+
- **`generate_business_glossary`** - Business terminology mapping to technical fields
|
|
3263
|
+
- *Use case: Generate complete documentation for a new database in seconds*
|
|
3264
|
+
|
|
3265
|
+
- **Schema + Security + Indexing**
|
|
3266
|
+
- **`design_schema_from_requirements`** - Generate proposed tables, relationships, and DDL from business requirements
|
|
3267
|
+
- **`audit_database_security`** - Best-effort MySQL security audit with prioritized findings
|
|
3268
|
+
- **`recommend_indexes`** - Concrete index recommendations from observed query patterns (performance_schema)
|
|
3269
|
+
|
|
3270
|
+
- **Data Generation + Patterns + Visualization + Forecasting**
|
|
3271
|
+
- **`generate_test_data`** - Generate FK-aware SQL INSERT statements for synthetic test data (does not execute)
|
|
3272
|
+
- **`analyze_schema_patterns`** - Detect schema anti-patterns (missing PKs, wide tables, unindexed FKs, EAV-like tables)
|
|
3273
|
+
- **`visualize_query`** - Mermaid flowchart visualization of queries using EXPLAIN FORMAT=JSON
|
|
3274
|
+
- **`predict_query_performance`** - Heuristic prediction of EXPLAIN scan/cost under growth assumptions
|
|
3275
|
+
- **`forecast_database_growth`** - Forecast table/database size growth from current sizes and user-supplied rates
|
|
3009
3276
|
|
|
3010
3277
|
### Tool Overview
|
|
3011
3278
|
|
|
@@ -3022,6 +3289,11 @@ The AI Enhancement tools provide intelligent, AI-powered features for database e
|
|
|
3022
3289
|
| `design_schema_from_requirements` | Designs a proposed schema and outputs DDL from natural language requirements | `ai_enhancement` |
|
|
3023
3290
|
| `audit_database_security` | Audits MySQL security configuration and (optionally) accounts/privileges | `ai_enhancement` |
|
|
3024
3291
|
| `recommend_indexes` | Suggests concrete CREATE INDEX statements from observed query patterns | `ai_enhancement` |
|
|
3292
|
+
| `generate_test_data` | Generates SQL INSERT statements for synthetic test data (non-executing) | `ai_enhancement` |
|
|
3293
|
+
| `analyze_schema_patterns` | Detects schema patterns/anti-patterns and provides recommendations | `ai_enhancement` |
|
|
3294
|
+
| `visualize_query` | Produces Mermaid query diagrams from EXPLAIN JSON | `ai_enhancement` |
|
|
3295
|
+
| `predict_query_performance` | Predicts query scan/cost changes under growth assumptions (heuristic) | `ai_enhancement` |
|
|
3296
|
+
| `forecast_database_growth` | Forecasts table/database growth from current sizes and rates | `ai_enhancement` |
|
|
3025
3297
|
|
|
3026
3298
|
### Intelligent Query Assistant
|
|
3027
3299
|
|