@berthojoris/mcp-mysql-server 1.14.1 → 1.16.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 +37 -0
- package/DOCUMENTATIONS.md +366 -8
- package/README.md +21 -14
- package/dist/config/featureConfig.d.ts +6 -1
- package/dist/config/featureConfig.js +93 -0
- package/dist/index.d.ts +233 -0
- package/dist/index.js +67 -0
- package/dist/mcp-server.js +293 -0
- package/dist/tools/documentationGeneratorTools.d.ts +145 -0
- package/dist/tools/documentationGeneratorTools.js +820 -0
- package/dist/tools/intelligentQueryTools.d.ts +94 -0
- package/dist/tools/intelligentQueryTools.js +713 -0
- package/dist/tools/smartDiscoveryTools.d.ts +163 -0
- package/dist/tools/smartDiscoveryTools.js +750 -0
- package/dist/tools/utilityTools.d.ts +11 -0
- package/dist/tools/utilityTools.js +71 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,43 @@ 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.16.0] - 2025-12-09
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Phase 1: AI Enhancement Tools** - 8 new intelligent tools for AI-powered database interactions:
|
|
12
|
+
|
|
13
|
+
#### Intelligent Query Assistant
|
|
14
|
+
- `build_query_from_intent` - Converts natural language to optimized SQL with context-aware query generation. Supports analytics, reporting, data_entry, and schema_exploration contexts. Includes safety levels and complexity controls.
|
|
15
|
+
- `suggest_query_improvements` - Analyzes SQL queries and suggests optimizations for speed, memory, or readability.
|
|
16
|
+
|
|
17
|
+
#### Smart Data Discovery Agent
|
|
18
|
+
- `smart_search` - Finds relevant tables, columns, data patterns, and relationships using semantic search. Essential for exploring large databases with hundreds of tables.
|
|
19
|
+
- `find_similar_columns` - Discovers columns with similar names or data across tables. Identifies potential join candidates and implicit relationships.
|
|
20
|
+
- `discover_data_patterns` - Analyzes tables for patterns including uniqueness, null rates, duplicates, formats, and value ranges. Provides data quality scores and recommendations.
|
|
21
|
+
|
|
22
|
+
#### AI-Powered Documentation Generator
|
|
23
|
+
- `generate_documentation` - Creates comprehensive database documentation with business glossary in Markdown, HTML, or JSON format. Includes schema, relationships, and example queries.
|
|
24
|
+
- `generate_data_dictionary` - Generates detailed data dictionaries for specific tables with column descriptions, constraints, sample values, and business terms.
|
|
25
|
+
- `generate_business_glossary` - Creates business glossaries from database column names with inferred descriptions and categorization.
|
|
26
|
+
|
|
27
|
+
- **New Documentation Category** - Added `ai_enhancement` category for organizing the new AI tools.
|
|
28
|
+
- **Updated Presets** - Added AI Enhancement tools to the `analyst` preset for immediate access.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
- Updated tool count from 126 to 134 tools.
|
|
32
|
+
- Enhanced enhancement tracking file to mark Phase 1 as completed.
|
|
33
|
+
|
|
34
|
+
## [1.15.0] - 2025-12-08
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
- **Connection Profiles** - New `dev`, `stage`, and `prod` presets.
|
|
38
|
+
- `dev`: Full access to all tools.
|
|
39
|
+
- `stage`: Allows CRUD but blocks destructive DDL (drop, truncate).
|
|
40
|
+
- `prod`: Strict read-only with explicit denials for modification tools.
|
|
41
|
+
- Implements allowed/denied tools logic for robust security enforcement.
|
|
42
|
+
- **Agent-Facing Changelog Feed** - New `read_changelog` tool.
|
|
43
|
+
- Allows AI agents to read the CHANGELOG.md directly to understand new features and changes.
|
|
44
|
+
|
|
8
45
|
## [1.14.1] - 2025-12-08
|
|
9
46
|
|
|
10
47
|
### Added
|
package/DOCUMENTATIONS.md
CHANGED
|
@@ -7,7 +7,7 @@ This file contains detailed documentation for all features of the MySQL MCP Serv
|
|
|
7
7
|
## Table of Contents
|
|
8
8
|
|
|
9
9
|
1. [Category Filtering System](#🆕-category-filtering-system) - NEW!
|
|
10
|
-
2. [🔧 Complete Tools Reference](#🔧-complete-tools-reference) - All
|
|
10
|
+
2. [🔧 Complete Tools Reference](#🔧-complete-tools-reference) - All 134 tools organized by category
|
|
11
11
|
3. [DDL Operations](#🏗️-ddl-operations)
|
|
12
12
|
4. [Data Export Tools](#📤-data-export-tools)
|
|
13
13
|
5. [Data Import Tools](#📥-data-import-tools)
|
|
@@ -24,8 +24,9 @@ This file contains detailed documentation for all features of the MySQL MCP Serv
|
|
|
24
24
|
16. [Table Maintenance](#🔧-table-maintenance)
|
|
25
25
|
17. [Process & Server Management](#📊-process--server-management)
|
|
26
26
|
18. [Performance Monitoring](#📈-performance-monitoring)
|
|
27
|
-
19. [
|
|
28
|
-
20. [
|
|
27
|
+
19. [AI Enhancement Tools](#🤖-ai-enhancement-tools) - NEW!
|
|
28
|
+
20. [Usage Examples](#📋-usage-examples)
|
|
29
|
+
21. [Query Logging & Automatic SQL Display](#📝-query-logging--automatic-sql-display)
|
|
29
30
|
|
|
30
31
|
Control which database operations are available to AI using a **dual-layer filtering system**:
|
|
31
32
|
|
|
@@ -53,14 +54,14 @@ Control which database operations are available to AI using a **dual-layer filte
|
|
|
53
54
|
### Documentation Categories Reference
|
|
54
55
|
|
|
55
56
|
```bash
|
|
56
|
-
# All
|
|
57
|
+
# All 23 available categories (comma-separated):
|
|
57
58
|
database_discovery,crud_operations,bulk_operations,custom_queries,
|
|
58
59
|
schema_management,utilities,transaction_management,stored_procedures,
|
|
59
60
|
views_management,triggers_management,functions_management,index_management,
|
|
60
61
|
constraint_management,table_maintenance,server_management,
|
|
61
62
|
performance_monitoring,cache_management,query_optimization,
|
|
62
63
|
backup_restore,import_export,data_migration,schema_migrations,
|
|
63
|
-
analysis
|
|
64
|
+
analysis,ai_enhancement
|
|
64
65
|
```
|
|
65
66
|
|
|
66
67
|
### Configuration Examples
|
|
@@ -192,6 +193,16 @@ Preset bundles provide safe starting points and **merge** with any explicit perm
|
|
|
192
193
|
| `readonly` | `list,read,utility` | `database_discovery,crud_operations,custom_queries,utilities,import_export,performance_monitoring,analysis` | Safe read-only access, exports, and diagnostics |
|
|
193
194
|
| `analyst` | `list,read,utility` | `database_discovery,crud_operations,custom_queries,utilities,import_export,performance_monitoring,analysis,query_optimization,cache_management,server_management` | Exploration with EXPLAIN, cache, and performance visibility |
|
|
194
195
|
| `dba-lite` | `list,read,utility,ddl,transaction,procedure` | `database_discovery,custom_queries,utilities,server_management,schema_management,table_maintenance,index_management,constraint_management,backup_restore,schema_migrations,performance_monitoring,views_management,triggers_management,functions_management,stored_procedures` | Admin-lite schema care, maintenance, and migrations |
|
|
196
|
+
| `dev` | ALL | ALL | Full access to all tools (Development environment) |
|
|
197
|
+
| `stage` | `list,read,create,update,delete,utility,transaction` | Most categories (except schema_management) | Data modification allowed, but destructive DDL (drop_table, truncate_table) is **explicitly denied** |
|
|
198
|
+
| `prod` | `list,read,utility` | `database_discovery,crud_operations,custom_queries,utilities,performance_monitoring,analysis` | Strict read-only. Data modification and DDL are **strictly denied** (even if permissions suggest otherwise) |
|
|
199
|
+
|
|
200
|
+
### Connection Profiles (Allow/Deny Lists)
|
|
201
|
+
|
|
202
|
+
The new mechanism introduces "Connection Profiles" which can enforce strict `allow` and `deny` lists for tools, providing security beyond standard permissions.
|
|
203
|
+
|
|
204
|
+
- **Explicit Deny**: Tools in the `deniedTools` list are blocked *regardless* of their permissions. E.g., `prod` profile denies `create_record` even if `create` permission is somehow granted.
|
|
205
|
+
- **Explicit Allow**: Tools in the `allowedTools` list are enabled even if their category is not listed (unless denied).
|
|
195
206
|
|
|
196
207
|
**Usage**
|
|
197
208
|
|
|
@@ -324,6 +335,7 @@ This section provides a comprehensive reference of all 120 available tools organ
|
|
|
324
335
|
|------|-------------|
|
|
325
336
|
| `test_connection` | Test database connectivity and measure latency |
|
|
326
337
|
| `describe_connection` | Get current connection information |
|
|
338
|
+
| `read_changelog` | Read the changelog to see new features/changes |
|
|
327
339
|
| `export_table_to_csv` | Export table data to CSV format |
|
|
328
340
|
| `export_query_to_csv` | Export query results to CSV format |
|
|
329
341
|
|
|
@@ -520,6 +532,11 @@ This section provides a comprehensive reference of all 120 available tools organ
|
|
|
520
532
|
- Safety: respects the connected database only—cannot introspect other schemas—and notes when tables/columns are truncated.
|
|
521
533
|
- Output includes per-table PKs, FK targets, nullable flags, and approximate row counts from `INFORMATION_SCHEMA.TABLES` (InnoDB estimates).
|
|
522
534
|
|
|
535
|
+
#### Agent-Facing Changelog Feed
|
|
536
|
+
- **`read_changelog`**: Allows AI agents to read the project's CHANGELOG.md directly.
|
|
537
|
+
- **Purpose**: Enables the agent to understand new features, changes, and deprecations in the version it is running.
|
|
538
|
+
- **Usage**: Call `read_changelog()` to get the latest changes, or `read_changelog(version='1.15.0')` for specific version details.
|
|
539
|
+
|
|
523
540
|
---
|
|
524
541
|
|
|
525
542
|
## 🏗️ DDL Operations
|
|
@@ -2986,6 +3003,292 @@ Reset Performance Schema statistics to start fresh monitoring.
|
|
|
2986
3003
|
|
|
2987
3004
|
---
|
|
2988
3005
|
|
|
3006
|
+
## 🤖 AI Enhancement Tools
|
|
3007
|
+
|
|
3008
|
+
The AI Enhancement tools provide intelligent, AI-powered features for database exploration, query generation, and documentation. These tools are part of **Phase 1: Core AI Enhancement**.
|
|
3009
|
+
|
|
3010
|
+
### Tool Overview
|
|
3011
|
+
|
|
3012
|
+
| Tool | Description | Category |
|
|
3013
|
+
|------|-------------|----------|
|
|
3014
|
+
| `build_query_from_intent` | Converts natural language to optimized SQL with context-aware generation | `ai_enhancement` |
|
|
3015
|
+
| `suggest_query_improvements` | Analyzes SQL queries and suggests optimizations | `ai_enhancement` |
|
|
3016
|
+
| `smart_search` | Finds relevant tables, columns, and patterns using semantic search | `ai_enhancement` |
|
|
3017
|
+
| `find_similar_columns` | Discovers columns with similar names or data across tables | `ai_enhancement` |
|
|
3018
|
+
| `discover_data_patterns` | Analyzes tables for data patterns and quality issues | `ai_enhancement` |
|
|
3019
|
+
| `generate_documentation` | Generates comprehensive database documentation | `ai_enhancement` |
|
|
3020
|
+
| `generate_data_dictionary` | Creates detailed data dictionaries for tables | `ai_enhancement` |
|
|
3021
|
+
| `generate_business_glossary` | Builds business glossaries from column names | `ai_enhancement` |
|
|
3022
|
+
|
|
3023
|
+
### Intelligent Query Assistant
|
|
3024
|
+
|
|
3025
|
+
#### `build_query_from_intent`
|
|
3026
|
+
|
|
3027
|
+
Converts natural language descriptions to optimized SQL queries with context-aware generation.
|
|
3028
|
+
|
|
3029
|
+
```javascript
|
|
3030
|
+
// Basic usage
|
|
3031
|
+
{
|
|
3032
|
+
"tool": "build_query_from_intent",
|
|
3033
|
+
"arguments": {
|
|
3034
|
+
"natural_language": "show me all users who signed up last month"
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
// With context and safety settings
|
|
3039
|
+
{
|
|
3040
|
+
"tool": "build_query_from_intent",
|
|
3041
|
+
"arguments": {
|
|
3042
|
+
"natural_language": "count orders by product category for 2024",
|
|
3043
|
+
"context": "analytics",
|
|
3044
|
+
"max_complexity": "medium",
|
|
3045
|
+
"safety_level": "moderate"
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
```
|
|
3049
|
+
|
|
3050
|
+
**Parameters:**
|
|
3051
|
+
| Parameter | Type | Description |
|
|
3052
|
+
|-----------|------|-------------|
|
|
3053
|
+
| `natural_language` | string | Natural language description of what you want to query (required) |
|
|
3054
|
+
| `context` | string | Query context: `analytics`, `reporting`, `data_entry`, `schema_exploration` |
|
|
3055
|
+
| `max_complexity` | string | Maximum complexity: `simple`, `medium`, `complex` |
|
|
3056
|
+
| `safety_level` | string | Safety level: `strict`, `moderate`, `permissive` |
|
|
3057
|
+
|
|
3058
|
+
**Response includes:**
|
|
3059
|
+
- Generated SQL query
|
|
3060
|
+
- Explanation of what the query does
|
|
3061
|
+
- Tables and columns involved
|
|
3062
|
+
- Safety notes and optimization hints
|
|
3063
|
+
- Alternative query suggestions
|
|
3064
|
+
|
|
3065
|
+
#### `suggest_query_improvements`
|
|
3066
|
+
|
|
3067
|
+
Analyzes a SQL query and provides suggestions for optimization.
|
|
3068
|
+
|
|
3069
|
+
```javascript
|
|
3070
|
+
{
|
|
3071
|
+
"tool": "suggest_query_improvements",
|
|
3072
|
+
"arguments": {
|
|
3073
|
+
"query": "SELECT * FROM users WHERE email LIKE '%@gmail.com'",
|
|
3074
|
+
"optimization_goal": "speed"
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
```
|
|
3078
|
+
|
|
3079
|
+
**Optimization Goals:**
|
|
3080
|
+
- `speed` - Focuses on query execution time (default)
|
|
3081
|
+
- `memory` - Focuses on memory usage optimization
|
|
3082
|
+
- `readability` - Suggests formatting and clarity improvements
|
|
3083
|
+
|
|
3084
|
+
### Smart Data Discovery
|
|
3085
|
+
|
|
3086
|
+
#### `smart_search`
|
|
3087
|
+
|
|
3088
|
+
Search across the database schema using semantic matching to find relevant tables, columns, and data patterns.
|
|
3089
|
+
|
|
3090
|
+
```javascript
|
|
3091
|
+
// Search for anything related to "customer"
|
|
3092
|
+
{
|
|
3093
|
+
"tool": "smart_search",
|
|
3094
|
+
"arguments": {
|
|
3095
|
+
"search_term": "customer",
|
|
3096
|
+
"search_type": "all",
|
|
3097
|
+
"include_sample_data": true
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
|
|
3101
|
+
// Search specifically for columns
|
|
3102
|
+
{
|
|
3103
|
+
"tool": "smart_search",
|
|
3104
|
+
"arguments": {
|
|
3105
|
+
"search_term": "email",
|
|
3106
|
+
"search_type": "column",
|
|
3107
|
+
"similarity_threshold": 0.5
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3110
|
+
```
|
|
3111
|
+
|
|
3112
|
+
**Search Types:**
|
|
3113
|
+
- `all` - Search across tables, columns, patterns, and relationships
|
|
3114
|
+
- `table` - Search table names only
|
|
3115
|
+
- `column` - Search column names only
|
|
3116
|
+
- `data_pattern` - Search for patterns in actual data
|
|
3117
|
+
- `relationship` - Search for relationships between tables
|
|
3118
|
+
|
|
3119
|
+
#### `find_similar_columns`
|
|
3120
|
+
|
|
3121
|
+
Discover columns with similar names or data across tables to identify potential joins and relationships.
|
|
3122
|
+
|
|
3123
|
+
```javascript
|
|
3124
|
+
// Find columns similar to "user_id" in "orders" table
|
|
3125
|
+
{
|
|
3126
|
+
"tool": "find_similar_columns",
|
|
3127
|
+
"arguments": {
|
|
3128
|
+
"column_name": "user_id",
|
|
3129
|
+
"table_name": "orders",
|
|
3130
|
+
"include_data_comparison": true
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
|
|
3134
|
+
// Find all potential join candidates across the database
|
|
3135
|
+
{
|
|
3136
|
+
"tool": "find_similar_columns",
|
|
3137
|
+
"arguments": {
|
|
3138
|
+
"include_data_comparison": false,
|
|
3139
|
+
"max_results": 50
|
|
3140
|
+
}
|
|
3141
|
+
}
|
|
3142
|
+
```
|
|
3143
|
+
|
|
3144
|
+
#### `discover_data_patterns`
|
|
3145
|
+
|
|
3146
|
+
Analyze a table to discover data patterns, quality issues, and get recommendations.
|
|
3147
|
+
|
|
3148
|
+
```javascript
|
|
3149
|
+
{
|
|
3150
|
+
"tool": "discover_data_patterns",
|
|
3151
|
+
"arguments": {
|
|
3152
|
+
"table_name": "users",
|
|
3153
|
+
"pattern_types": ["unique", "null", "duplicate", "format", "range"]
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
```
|
|
3157
|
+
|
|
3158
|
+
**Pattern Types:**
|
|
3159
|
+
- `unique` - Find potentially unique columns not marked as UNIQUE
|
|
3160
|
+
- `null` - Detect high null rates and nullable mismatches
|
|
3161
|
+
- `duplicate` - Find duplicate values in columns
|
|
3162
|
+
- `format` - Detect data formats (email, phone, etc.)
|
|
3163
|
+
- `range` - Analyze numeric ranges and detect outliers
|
|
3164
|
+
|
|
3165
|
+
**Response includes:**
|
|
3166
|
+
- Data quality score (0-100)
|
|
3167
|
+
- Patterns found per column
|
|
3168
|
+
- Recommendations for each issue
|
|
3169
|
+
- Column-level metrics
|
|
3170
|
+
|
|
3171
|
+
### Documentation Generator
|
|
3172
|
+
|
|
3173
|
+
#### `generate_documentation`
|
|
3174
|
+
|
|
3175
|
+
Generate comprehensive database documentation in Markdown, HTML, or JSON format.
|
|
3176
|
+
|
|
3177
|
+
```javascript
|
|
3178
|
+
// Generate full database documentation
|
|
3179
|
+
{
|
|
3180
|
+
"tool": "generate_documentation",
|
|
3181
|
+
"arguments": {
|
|
3182
|
+
"format": "markdown",
|
|
3183
|
+
"include_business_glossary": true,
|
|
3184
|
+
"include_examples": true,
|
|
3185
|
+
"include_statistics": true
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
|
|
3189
|
+
// Document a specific table
|
|
3190
|
+
{
|
|
3191
|
+
"tool": "generate_documentation",
|
|
3192
|
+
"arguments": {
|
|
3193
|
+
"scope": "table",
|
|
3194
|
+
"table_name": "orders",
|
|
3195
|
+
"format": "html"
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3198
|
+
```
|
|
3199
|
+
|
|
3200
|
+
**Output Formats:**
|
|
3201
|
+
- `markdown` - Best for GitHub/GitLab wikis and documentation sites
|
|
3202
|
+
- `html` - Standalone HTML page with styling
|
|
3203
|
+
- `json` - Structured data for programmatic use
|
|
3204
|
+
|
|
3205
|
+
**Documentation includes:**
|
|
3206
|
+
- Table of contents
|
|
3207
|
+
- ER relationship diagrams (Mermaid.js in markdown)
|
|
3208
|
+
- Column details with data types and constraints
|
|
3209
|
+
- Foreign key relationships
|
|
3210
|
+
- Index information
|
|
3211
|
+
- Example SQL queries
|
|
3212
|
+
- Business glossary
|
|
3213
|
+
|
|
3214
|
+
#### `generate_data_dictionary`
|
|
3215
|
+
|
|
3216
|
+
Generate a detailed data dictionary for a specific table.
|
|
3217
|
+
|
|
3218
|
+
```javascript
|
|
3219
|
+
{
|
|
3220
|
+
"tool": "generate_data_dictionary",
|
|
3221
|
+
"arguments": {
|
|
3222
|
+
"table_name": "products",
|
|
3223
|
+
"include_sample_values": true,
|
|
3224
|
+
"include_constraints": true
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
```
|
|
3228
|
+
|
|
3229
|
+
**Response includes:**
|
|
3230
|
+
- Column name, type, and description
|
|
3231
|
+
- Constraints (PK, FK, NOT NULL, UNIQUE)
|
|
3232
|
+
- Default values
|
|
3233
|
+
- Sample values from actual data
|
|
3234
|
+
- Business terms (auto-inferred)
|
|
3235
|
+
|
|
3236
|
+
#### `generate_business_glossary`
|
|
3237
|
+
|
|
3238
|
+
Create a business glossary from database column names with auto-generated descriptions.
|
|
3239
|
+
|
|
3240
|
+
```javascript
|
|
3241
|
+
{
|
|
3242
|
+
"tool": "generate_business_glossary",
|
|
3243
|
+
"arguments": {
|
|
3244
|
+
"include_descriptions": true,
|
|
3245
|
+
"group_by": "category"
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3248
|
+
```
|
|
3249
|
+
|
|
3250
|
+
**Grouping Options:**
|
|
3251
|
+
- `category` - Group by inferred category (Identifiers, Timestamps, Contact, etc.)
|
|
3252
|
+
- `table` - Group by source table
|
|
3253
|
+
- `alphabetical` - A-Z sorting
|
|
3254
|
+
|
|
3255
|
+
### AI Enhancement Best Practices
|
|
3256
|
+
|
|
3257
|
+
1. **Start with Discovery**: Use `smart_search` and `find_similar_columns` to understand unfamiliar databases
|
|
3258
|
+
2. **Use Context**: When building queries, specify the `context` parameter for better results
|
|
3259
|
+
3. **Validate Generated SQL**: Always review generated SQL before executing, especially for complex queries
|
|
3260
|
+
4. **Update Documentation**: Regenerate documentation after schema changes
|
|
3261
|
+
5. **Quality Checks**: Run `discover_data_patterns` regularly to catch data quality issues early
|
|
3262
|
+
|
|
3263
|
+
### Example Workflow: Exploring a New Database
|
|
3264
|
+
|
|
3265
|
+
```javascript
|
|
3266
|
+
// Step 1: Get an overview
|
|
3267
|
+
{ "tool": "get_database_summary" }
|
|
3268
|
+
|
|
3269
|
+
// Step 2: Search for relevant tables
|
|
3270
|
+
{
|
|
3271
|
+
"tool": "smart_search",
|
|
3272
|
+
"arguments": { "search_term": "order sales revenue" }
|
|
3273
|
+
}
|
|
3274
|
+
|
|
3275
|
+
// Step 3: Generate documentation
|
|
3276
|
+
{
|
|
3277
|
+
"tool": "generate_documentation",
|
|
3278
|
+
"arguments": { "format": "markdown" }
|
|
3279
|
+
}
|
|
3280
|
+
|
|
3281
|
+
// Step 4: Build a query from natural language
|
|
3282
|
+
{
|
|
3283
|
+
"tool": "build_query_from_intent",
|
|
3284
|
+
"arguments": {
|
|
3285
|
+
"natural_language": "total sales by month for the last year"
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
```
|
|
3289
|
+
|
|
3290
|
+
---
|
|
3291
|
+
|
|
2989
3292
|
## 📋 Usage Examples
|
|
2990
3293
|
|
|
2991
3294
|
### Example 1: Read Data
|
|
@@ -3824,6 +4127,61 @@ Each bulk operation returns performance metrics:
|
|
|
3824
4127
|
|
|
3825
4128
|
---
|
|
3826
4129
|
|
|
4130
|
+
|
|
4131
|
+
---
|
|
4132
|
+
|
|
4133
|
+
## ⚡ Workflow Macros
|
|
4134
|
+
|
|
4135
|
+
Workflow macros are high-level tools that combine multiple operations into a single, safe, and efficient workflow. They are designed to simplify complex tasks and ensure best practices (like data masking) are automatically applied.
|
|
4136
|
+
|
|
4137
|
+
### Safe Export Table
|
|
4138
|
+
|
|
4139
|
+
The `safe_export_table` tool allows you to export table data to CSV while strictly enforcing data masking rules. This ensures that sensitive information (PII) is never leaked during exports, even if the agent forgets to apply masking manually.
|
|
4140
|
+
|
|
4141
|
+
#### Features
|
|
4142
|
+
|
|
4143
|
+
- **Forced Masking**: Applies a masking profile (default: `strict`) to all exported data.
|
|
4144
|
+
- **Hard Limit**: Enforces a maximum row limit (10,000) to prevent Out-Of-Memory errors during large exports.
|
|
4145
|
+
- **CSV Formatting**: Automatically handles special characters, quotes, and newlines.
|
|
4146
|
+
- **Header Control**: Option to include or exclude CSV headers.
|
|
4147
|
+
|
|
4148
|
+
#### Usage
|
|
4149
|
+
|
|
4150
|
+
```json
|
|
4151
|
+
{
|
|
4152
|
+
"tool": "safe_export_table",
|
|
4153
|
+
"arguments": {
|
|
4154
|
+
"table_name": "users",
|
|
4155
|
+
"masking_profile": "partial",
|
|
4156
|
+
"limit": 1000
|
|
4157
|
+
}
|
|
4158
|
+
}
|
|
4159
|
+
```
|
|
4160
|
+
|
|
4161
|
+
#### Parameters
|
|
4162
|
+
|
|
4163
|
+
| Parameter | Type | Required | Description | Default |
|
|
4164
|
+
|-----------|------|----------|-------------|---------|
|
|
4165
|
+
| `table_name` | string | Yes | Name of the table to export | - |
|
|
4166
|
+
| `masking_profile` | string | No | Masking profile to apply (`strict`, `partial`, `soft`) | `strict` |
|
|
4167
|
+
| `limit` | number | No | Number of rows to export (max 10,000) | 1000 |
|
|
4168
|
+
| `include_headers` | boolean | No | Whether to include CSV headers | `true` |
|
|
4169
|
+
|
|
4170
|
+
#### Response
|
|
4171
|
+
|
|
4172
|
+
```json
|
|
4173
|
+
{
|
|
4174
|
+
"status": "success",
|
|
4175
|
+
"data": {
|
|
4176
|
+
"csv": "id,name,email\n1,John Doe,j***@example.com...",
|
|
4177
|
+
"row_count": 50,
|
|
4178
|
+
"applied_profile": "partial"
|
|
4179
|
+
}
|
|
4180
|
+
}
|
|
4181
|
+
```
|
|
4182
|
+
|
|
4183
|
+
---
|
|
4184
|
+
|
|
3827
4185
|
## 🤖 OpenAI Codex Integration
|
|
3828
4186
|
|
|
3829
4187
|
OpenAI Codex CLI and VS Code Extension support MCP servers through a shared TOML configuration file. This section provides detailed setup instructions for integrating the MySQL MCP Server with Codex.
|
|
@@ -4210,9 +4568,9 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
4210
4568
|
| Safety Sandbox Mode (runQuery dry-run/EXPLAIN-only) | Medium | Low | 5 | ✅ Completed |
|
|
4211
4569
|
| Anomaly & Slow-Query Watcher | Medium | Medium | 6 | ✅ Completed |
|
|
4212
4570
|
| Data Masking Profiles for Responses | Medium | Medium | 7 | ✅ Completed |
|
|
4213
|
-
| Workflow Macros (e.g., safe_export_table) | Medium | Low | 8 |
|
|
4214
|
-
| Agent-Facing Changelog Feed | Medium | Low | 9 |
|
|
4215
|
-
| Connection Profiles (dev/stage/prod with allow/deny) | High | Low | 10 |
|
|
4571
|
+
| Workflow Macros (e.g., safe_export_table) | Medium | Low | 8 | ✅ Completed |
|
|
4572
|
+
| Agent-Facing Changelog Feed | Medium | Low | 9 | ✅ Completed |
|
|
4573
|
+
| Connection Profiles (dev/stage/prod with allow/deny) | High | Low | 10 | ✅ Completed |
|
|
4216
4574
|
|
|
4217
4575
|
---
|
|
4218
4576
|
|
package/README.md
CHANGED
|
@@ -40,20 +40,19 @@ Add to your AI agent config (`.mcp.json`, `.cursor/mcp.json`, etc.):
|
|
|
40
40
|
|
|
41
41
|
## Table of Contents
|
|
42
42
|
|
|
43
|
-
- [
|
|
44
|
-
- [
|
|
45
|
-
- [
|
|
46
|
-
- [AI Agent Configuration](#-ai-agent-configuration)
|
|
43
|
+
- [Installation](#installation)
|
|
44
|
+
- [Quick Start](#quick-start)
|
|
45
|
+
- [AI Agent Configuration](#ai-agent-configuration)
|
|
47
46
|
- [Standard JSON Config](#standard-json-configuration)
|
|
48
47
|
- [OpenAI Codex (TOML)](#openai-codex-cli--vs-code-extension)
|
|
49
|
-
- [Zed IDE](#zed-ide)
|
|
48
|
+
- [Zed IDE](#zed-ide)
|
|
50
49
|
- [Environment Variables](#environment-variables-configuration)
|
|
51
50
|
- [Local Development](#local-path-configuration)
|
|
52
|
-
- [Permission System](
|
|
53
|
-
- [Available Tools (
|
|
54
|
-
- [Documentation](
|
|
55
|
-
- [Comparison: MCP vs Manual Access](
|
|
56
|
-
- [License](
|
|
51
|
+
- [Permission System](#permission-system)
|
|
52
|
+
- [Available Tools (134 total)](#available-tools)
|
|
53
|
+
- [Documentation](DOCUMENTATIONS.md)
|
|
54
|
+
- [Comparison: MCP vs Manual Access](#mysql-mcp-vs-manual-database-access)
|
|
55
|
+
- [License](#license)
|
|
57
56
|
|
|
58
57
|
---
|
|
59
58
|
| **Data Masking** | Protect PII/Secrets in responses with configurable profiles (soft/partial/strict) |
|
|
@@ -388,6 +387,12 @@ Alternative approach using environment variables instead of connection string:
|
|
|
388
387
|
|
|
389
388
|
Add `MCP_PRESET` for the base bundle and optionally layer on `MCP_PERMISSIONS` / `MCP_CATEGORIES` for project-specific overrides.
|
|
390
389
|
|
|
390
|
+
#### Connection Profiles (dev/stage/prod)
|
|
391
|
+
New presets are available for environment-specific control:
|
|
392
|
+
- `dev`: Full access to all tools (explicitly allows everything).
|
|
393
|
+
- `stage`: Allows data modification but blocks destructive DDL (drop/truncate).
|
|
394
|
+
- `prod`: Strict read-only mode, explicitly denying keys modification keys.
|
|
395
|
+
|
|
391
396
|
---
|
|
392
397
|
|
|
393
398
|
### Local Path Configuration
|
|
@@ -641,11 +646,11 @@ Use both 2nd argument (permissions) and 3rd argument (categories):
|
|
|
641
646
|
|
|
642
647
|
## Available Tools
|
|
643
648
|
|
|
644
|
-
The MCP server provides **
|
|
649
|
+
The MCP server provides **134 powerful tools** organized into 23 categories:
|
|
645
650
|
|
|
646
651
|
### Quick Reference
|
|
647
652
|
|
|
648
|
-
**
|
|
653
|
+
**134 Tools Available** - Organized into 23 categories
|
|
649
654
|
|
|
650
655
|
| Category | Count | Key Tools |
|
|
651
656
|
|----------|-------|-----------|
|
|
@@ -667,11 +672,12 @@ The MCP server provides **124 powerful tools** organized into categories:
|
|
|
667
672
|
| Cache | 5 | `get_cache_stats`, `clear_cache` |
|
|
668
673
|
| Query Optimization | 3 | `analyze_query`, `get_optimization_hints`, `repair_query` |
|
|
669
674
|
| Backup & Restore | 5 | `backup_database`, `restore_from_sql` |
|
|
670
|
-
| Import/Export |
|
|
675
|
+
| Import/Export | 6 | `safe_export_table`, `export_table_to_json`, `import_from_csv` |
|
|
671
676
|
| Data Migration | 5 | `copy_table_data`, `sync_table_data` |
|
|
672
677
|
| Schema Migrations | 9 | `create_migration`, `apply_migrations` |
|
|
673
678
|
| Utilities | 4 | `test_connection`, `export_table_to_csv` |
|
|
674
|
-
| Analysis | 4 | `get_column_statistics`, `get_database_summary`, `get_schema_erd
|
|
679
|
+
| Analysis | 4 | `get_column_statistics`, `get_database_summary`, `get_schema_erd` |
|
|
680
|
+
| **AI Enhancement** | 8 | `build_query_from_intent`, `smart_search`, `generate_documentation` |
|
|
675
681
|
|
|
676
682
|
> **📖 For detailed tool descriptions, parameters, and examples, see [DOCUMENTATIONS.md](DOCUMENTATIONS.md#🔧-complete-tools-reference)**
|
|
677
683
|
|
|
@@ -689,6 +695,7 @@ For comprehensive documentation, see **[DOCUMENTATIONS.md](DOCUMENTATIONS.md)**:
|
|
|
689
695
|
- **Schema Versioning** - Version control for database schema changes
|
|
690
696
|
- **Transaction Management** - ACID transactions
|
|
691
697
|
- **Stored Procedures** - Create and execute with IN/OUT/INOUT parameters
|
|
698
|
+
- **AI Enhancement** - Natural language to SQL, smart discovery, and auto-documentation
|
|
692
699
|
- **Query Logging** - See all SQL queries executed automatically
|
|
693
700
|
- **Security Features** - Built-in security and best practices
|
|
694
701
|
- **Bulk Operations** - High-performance batch processing
|
|
@@ -40,7 +40,8 @@ export declare enum DocCategory {
|
|
|
40
40
|
IMPORT_EXPORT = "import_export",
|
|
41
41
|
DATA_MIGRATION = "data_migration",
|
|
42
42
|
SCHEMA_MIGRATIONS = "schema_migrations",
|
|
43
|
-
ANALYSIS = "analysis"
|
|
43
|
+
ANALYSIS = "analysis",
|
|
44
|
+
AI_ENHANCEMENT = "ai_enhancement"
|
|
44
45
|
}
|
|
45
46
|
/**
|
|
46
47
|
* Permission preset bundles for faster, safer configuration
|
|
@@ -50,6 +51,8 @@ export interface PermissionPreset {
|
|
|
50
51
|
description: string;
|
|
51
52
|
permissions: ToolCategory[];
|
|
52
53
|
categories: DocCategory[];
|
|
54
|
+
allowedTools?: string[];
|
|
55
|
+
deniedTools?: string[];
|
|
53
56
|
}
|
|
54
57
|
/**
|
|
55
58
|
* Map of tool names to their legacy categories
|
|
@@ -68,6 +71,8 @@ export declare const toolDocCategoryMap: Record<string, DocCategory>;
|
|
|
68
71
|
export declare class FeatureConfig {
|
|
69
72
|
private enabledLegacyCategories;
|
|
70
73
|
private enabledDocCategories;
|
|
74
|
+
private allowedTools;
|
|
75
|
+
private deniedTools;
|
|
71
76
|
private originalPermissionsString;
|
|
72
77
|
private originalCategoriesString;
|
|
73
78
|
private useDualLayer;
|