@berthojoris/mcp-mysql-server 1.22.0 → 1.23.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/DOCUMENTATIONS.md +234 -2
- package/README.md +1 -1
- package/dist/index.d.ts +243 -0
- package/dist/index.js +87 -0
- package/dist/tools/smartQueryBuilderTools.d.ts +330 -0
- package/dist/tools/smartQueryBuilderTools.js +1131 -0
- package/package.json +1 -1
package/DOCUMENTATIONS.md
CHANGED
|
@@ -9,7 +9,7 @@ This file contains detailed documentation for all features of the MySQL MCP Serv
|
|
|
9
9
|
## Table of Contents
|
|
10
10
|
|
|
11
11
|
1. [Setup & Configuration (Extended)](#setup--configuration-extended) - Permissions + Categories
|
|
12
|
-
2. [🔧 Complete Tools Reference](#🔧-complete-tools-reference) - All
|
|
12
|
+
2. [🔧 Complete Tools Reference](#🔧-complete-tools-reference) - All 157 tools organized by category
|
|
13
13
|
3. [DDL Operations](#🏗️-ddl-operations)
|
|
14
14
|
4. [Data Export Tools](#📤-data-export-tools)
|
|
15
15
|
5. [Data Import Tools](#📥-data-import-tools)
|
|
@@ -201,7 +201,7 @@ Add 'bulk_operations' to the categories argument.
|
|
|
201
201
|
|
|
202
202
|
## 🔧 Complete Tools Reference
|
|
203
203
|
|
|
204
|
-
This section provides a comprehensive reference of all
|
|
204
|
+
This section provides a comprehensive reference of all 157 available tools organized by category.
|
|
205
205
|
|
|
206
206
|
### Database Discovery
|
|
207
207
|
|
|
@@ -2983,6 +2983,238 @@ The AI Enhancement tools provide intelligent, AI-powered features for database e
|
|
|
2983
2983
|
| `predict_query_performance` | Predicts query scan/cost changes under growth assumptions (heuristic) | `ai_enhancement` |
|
|
2984
2984
|
| `forecast_database_growth` | Forecasts table/database growth from current sizes and rates | `ai_enhancement` |
|
|
2985
2985
|
|
|
2986
|
+
### Smart Query Builder
|
|
2987
|
+
|
|
2988
|
+
| Tool | Description | Category |
|
|
2989
|
+
|------|-------------|----------|
|
|
2990
|
+
| `start_query_builder` | Starts an interactive query building session with step-by-step guidance | `ai_enhancement` |
|
|
2991
|
+
| `add_tables_to_query` | Adds tables to the current query building session | `ai_enhancement` |
|
|
2992
|
+
| `define_joins` | Defines table relationships and join conditions for the query | `ai_enhancement` |
|
|
2993
|
+
| `select_columns` | Selects columns to include in the query output | `ai_enhancement` |
|
|
2994
|
+
| `add_conditions` | Adds WHERE conditions to filter query results | `ai_enhancement` |
|
|
2995
|
+
| `add_aggregations` | Adds aggregate functions (COUNT, SUM, AVG, MIN, MAX) to the query | `ai_enhancement` |
|
|
2996
|
+
| `configure_grouping_and_ordering` | Configures GROUP BY, ORDER BY, LIMIT, and OFFSET clauses | `ai_enhancement` |
|
|
2997
|
+
| `preview_query` | Previews the generated SQL query without executing it | `ai_enhancement` |
|
|
2998
|
+
| `execute_query` | Executes the built query with optional dry-run mode | `ai_enhancement` |
|
|
2999
|
+
| `get_session_state` | Retrieves the current state of the query building session | `ai_enhancement` |
|
|
3000
|
+
| `get_query_templates` | Provides pre-built query templates for common analysis tasks | `ai_enhancement` |
|
|
3001
|
+
| `apply_query_template` | Applies a predefined template to the current session | `ai_enhancement` |
|
|
3002
|
+
| `suggest_next_step` | AI-powered suggestions for the next logical step in query building | `ai_enhancement` |
|
|
3003
|
+
| `end_session` | Ends the current query building session and cleans up resources | `ai_enhancement` |
|
|
3004
|
+
|
|
3005
|
+
#### `start_query_builder`
|
|
3006
|
+
|
|
3007
|
+
Starts an interactive query building session with step-by-step guidance and AI-powered suggestions.
|
|
3008
|
+
|
|
3009
|
+
```javascript
|
|
3010
|
+
// Start a basic session
|
|
3011
|
+
{
|
|
3012
|
+
"tool": "start_query_builder",
|
|
3013
|
+
"arguments": {
|
|
3014
|
+
"intent": "Show me customer orders with total amounts",
|
|
3015
|
+
"context": "analytics"
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
|
|
3019
|
+
// Start with specific database
|
|
3020
|
+
{
|
|
3021
|
+
"tool": "start_query_builder",
|
|
3022
|
+
"arguments": {
|
|
3023
|
+
"intent": "Analyze sales performance by region",
|
|
3024
|
+
"context": "reporting",
|
|
3025
|
+
"database": "sales_db"
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
```
|
|
3029
|
+
|
|
3030
|
+
**Parameters:**
|
|
3031
|
+
| Parameter | Type | Description |
|
|
3032
|
+
|-----------|------|-------------|
|
|
3033
|
+
| `intent` | string | Natural language description of the query goal (required) |
|
|
3034
|
+
| `context` | string | Query context: `analytics`, `reporting`, `data_entry`, `schema_exploration` |
|
|
3035
|
+
| `database` | string | Target database name (optional) |
|
|
3036
|
+
|
|
3037
|
+
**Response includes:**
|
|
3038
|
+
- Session ID for subsequent operations
|
|
3039
|
+
- Initial suggestions based on intent
|
|
3040
|
+
- Available query templates
|
|
3041
|
+
- Recommended next steps
|
|
3042
|
+
|
|
3043
|
+
#### `add_tables_to_query`
|
|
3044
|
+
|
|
3045
|
+
Adds tables to the current query building session with validation and relationship detection.
|
|
3046
|
+
|
|
3047
|
+
```javascript
|
|
3048
|
+
{
|
|
3049
|
+
"tool": "add_tables_to_query",
|
|
3050
|
+
"arguments": {
|
|
3051
|
+
"session_id": "uuid-session-id",
|
|
3052
|
+
"tables": ["customers", "orders", "products"]
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
```
|
|
3056
|
+
|
|
3057
|
+
#### `define_joins`
|
|
3058
|
+
|
|
3059
|
+
Defines table relationships and join conditions with automatic foreign key detection.
|
|
3060
|
+
|
|
3061
|
+
```javascript
|
|
3062
|
+
{
|
|
3063
|
+
"tool": "define_joins",
|
|
3064
|
+
"arguments": {
|
|
3065
|
+
"session_id": "uuid-session-id",
|
|
3066
|
+
"joins": [
|
|
3067
|
+
{
|
|
3068
|
+
"from_table": "customers",
|
|
3069
|
+
"from_column": "customer_id",
|
|
3070
|
+
"to_table": "orders",
|
|
3071
|
+
"to_column": "customer_id",
|
|
3072
|
+
"join_type": "INNER"
|
|
3073
|
+
}
|
|
3074
|
+
]
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
```
|
|
3078
|
+
|
|
3079
|
+
#### `select_columns`
|
|
3080
|
+
|
|
3081
|
+
Selects specific columns to include in the query output with optional aliases.
|
|
3082
|
+
|
|
3083
|
+
```javascript
|
|
3084
|
+
{
|
|
3085
|
+
"tool": "select_columns",
|
|
3086
|
+
"arguments": {
|
|
3087
|
+
"session_id": "uuid-session-id",
|
|
3088
|
+
"columns": [
|
|
3089
|
+
{"table": "customers", "column": "name", "alias": "customer_name"},
|
|
3090
|
+
{"table": "orders", "column": "total_amount"}
|
|
3091
|
+
]
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3094
|
+
```
|
|
3095
|
+
|
|
3096
|
+
#### `add_conditions`
|
|
3097
|
+
|
|
3098
|
+
Adds WHERE conditions to filter query results with various operators.
|
|
3099
|
+
|
|
3100
|
+
```javascript
|
|
3101
|
+
{
|
|
3102
|
+
"tool": "add_conditions",
|
|
3103
|
+
"arguments": {
|
|
3104
|
+
"session_id": "uuid-session-id",
|
|
3105
|
+
"conditions": [
|
|
3106
|
+
{
|
|
3107
|
+
"table": "orders",
|
|
3108
|
+
"column": "order_date",
|
|
3109
|
+
"operator": "gte",
|
|
3110
|
+
"value": "2024-01-01"
|
|
3111
|
+
}
|
|
3112
|
+
]
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3115
|
+
```
|
|
3116
|
+
|
|
3117
|
+
#### `add_aggregations`
|
|
3118
|
+
|
|
3119
|
+
Adds aggregate functions for data analysis and reporting.
|
|
3120
|
+
|
|
3121
|
+
```javascript
|
|
3122
|
+
{
|
|
3123
|
+
"tool": "add_aggregations",
|
|
3124
|
+
"arguments": {
|
|
3125
|
+
"session_id": "uuid-session-id",
|
|
3126
|
+
"aggregations": [
|
|
3127
|
+
{
|
|
3128
|
+
"function": "SUM",
|
|
3129
|
+
"column": "total_amount",
|
|
3130
|
+
"alias": "total_sales",
|
|
3131
|
+
"table": "orders"
|
|
3132
|
+
}
|
|
3133
|
+
]
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
```
|
|
3137
|
+
|
|
3138
|
+
#### `configure_grouping_and_ordering`
|
|
3139
|
+
|
|
3140
|
+
Configures GROUP BY, ORDER BY, LIMIT, and OFFSET clauses for result organization.
|
|
3141
|
+
|
|
3142
|
+
```javascript
|
|
3143
|
+
{
|
|
3144
|
+
"tool": "configure_grouping_and_ordering",
|
|
3145
|
+
"arguments": {
|
|
3146
|
+
"session_id": "uuid-session-id",
|
|
3147
|
+
"group_by": [
|
|
3148
|
+
{"table": "customers", "column": "region"}
|
|
3149
|
+
],
|
|
3150
|
+
"order_by": [
|
|
3151
|
+
{"table": "orders", "column": "order_date", "direction": "desc"}
|
|
3152
|
+
],
|
|
3153
|
+
"limit": 100
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
```
|
|
3157
|
+
|
|
3158
|
+
#### `preview_query`
|
|
3159
|
+
|
|
3160
|
+
Previews the generated SQL query without executing it, allowing for review and validation.
|
|
3161
|
+
|
|
3162
|
+
```javascript
|
|
3163
|
+
{
|
|
3164
|
+
"tool": "preview_query",
|
|
3165
|
+
"arguments": {
|
|
3166
|
+
"session_id": "uuid-session-id"
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
```
|
|
3170
|
+
|
|
3171
|
+
#### `execute_query`
|
|
3172
|
+
|
|
3173
|
+
Executes the built query with optional dry-run mode for testing.
|
|
3174
|
+
|
|
3175
|
+
```javascript
|
|
3176
|
+
{
|
|
3177
|
+
"tool": "execute_query",
|
|
3178
|
+
"arguments": {
|
|
3179
|
+
"session_id": "uuid-session-id",
|
|
3180
|
+
"dry_run": false
|
|
3181
|
+
}
|
|
3182
|
+
}
|
|
3183
|
+
```
|
|
3184
|
+
|
|
3185
|
+
#### `get_query_templates`
|
|
3186
|
+
|
|
3187
|
+
Provides pre-built query templates for common analysis tasks.
|
|
3188
|
+
|
|
3189
|
+
```javascript
|
|
3190
|
+
{
|
|
3191
|
+
"tool": "get_query_templates",
|
|
3192
|
+
"arguments": {
|
|
3193
|
+
"category": "analytics"
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
```
|
|
3197
|
+
|
|
3198
|
+
**Available Templates:**
|
|
3199
|
+
- Customer Analysis (customer lifetime value, purchase patterns)
|
|
3200
|
+
- Sales Reporting (regional performance, product trends)
|
|
3201
|
+
- Product Analytics (inventory analysis, category performance)
|
|
3202
|
+
- User Activity (session analysis, engagement metrics)
|
|
3203
|
+
|
|
3204
|
+
#### `suggest_next_step`
|
|
3205
|
+
|
|
3206
|
+
AI-powered suggestions for the next logical step in query building based on current state.
|
|
3207
|
+
|
|
3208
|
+
```javascript
|
|
3209
|
+
{
|
|
3210
|
+
"tool": "suggest_next_step",
|
|
3211
|
+
"arguments": {
|
|
3212
|
+
"session_id": "uuid-session-id",
|
|
3213
|
+
"user_input": "I want to see the top customers"
|
|
3214
|
+
}
|
|
3215
|
+
}
|
|
3216
|
+
```
|
|
3217
|
+
|
|
2986
3218
|
### Intelligent Query Assistant
|
|
2987
3219
|
|
|
2988
3220
|
#### `build_query_from_intent`
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**A production-ready Model Context Protocol (MCP) server for MySQL database integration with AI agents**
|
|
6
6
|
|
|
7
|
-
**Last Updated:** 2025-12-
|
|
7
|
+
**Last Updated:** 2025-12-18 13:45:00
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/@berthojoris/mysql-mcp)
|
|
10
10
|
[](https://www.npmjs.com/package/@berthojoris/mysql-mcp)
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export declare class MySQLMCP {
|
|
|
35
35
|
private schemaPatternTools;
|
|
36
36
|
private queryVisualizationTools;
|
|
37
37
|
private forecastingTools;
|
|
38
|
+
private smartQueryBuilderTools;
|
|
38
39
|
private security;
|
|
39
40
|
private featureConfig;
|
|
40
41
|
constructor(permissionsConfig?: string, categoriesConfig?: string);
|
|
@@ -1564,5 +1565,247 @@ export declare class MySQLMCP {
|
|
|
1564
1565
|
data?: any;
|
|
1565
1566
|
error?: string;
|
|
1566
1567
|
}>;
|
|
1568
|
+
startQueryBuilder(params: {
|
|
1569
|
+
intent: string;
|
|
1570
|
+
context?: "analytics" | "reporting" | "data_entry" | "schema_exploration";
|
|
1571
|
+
database?: string;
|
|
1572
|
+
}): Promise<{
|
|
1573
|
+
status: string;
|
|
1574
|
+
data?: {
|
|
1575
|
+
session_id: string;
|
|
1576
|
+
current_step: string;
|
|
1577
|
+
suggestions: string[];
|
|
1578
|
+
template_suggestions?: import("./tools/smartQueryBuilderTools").QueryTemplate[];
|
|
1579
|
+
next_actions: string[];
|
|
1580
|
+
};
|
|
1581
|
+
error?: string;
|
|
1582
|
+
}>;
|
|
1583
|
+
addTablesToQuery(params: {
|
|
1584
|
+
session_id: string;
|
|
1585
|
+
tables: string[];
|
|
1586
|
+
database?: string;
|
|
1587
|
+
}): Promise<{
|
|
1588
|
+
status: string;
|
|
1589
|
+
data?: {
|
|
1590
|
+
session_id: string;
|
|
1591
|
+
current_step: string;
|
|
1592
|
+
added_tables: string[];
|
|
1593
|
+
suggested_joins: Array<{
|
|
1594
|
+
from_table: string;
|
|
1595
|
+
to_table: string;
|
|
1596
|
+
on_column: string;
|
|
1597
|
+
join_type: string;
|
|
1598
|
+
}>;
|
|
1599
|
+
next_actions: string[];
|
|
1600
|
+
};
|
|
1601
|
+
error?: string;
|
|
1602
|
+
}>;
|
|
1603
|
+
defineJoins(params: {
|
|
1604
|
+
session_id: string;
|
|
1605
|
+
joins: Array<{
|
|
1606
|
+
from_table: string;
|
|
1607
|
+
from_column: string;
|
|
1608
|
+
to_table: string;
|
|
1609
|
+
to_column: string;
|
|
1610
|
+
join_type?: "INNER" | "LEFT" | "RIGHT" | "FULL";
|
|
1611
|
+
}>;
|
|
1612
|
+
database?: string;
|
|
1613
|
+
}): Promise<{
|
|
1614
|
+
status: string;
|
|
1615
|
+
data?: {
|
|
1616
|
+
session_id: string;
|
|
1617
|
+
current_step: string;
|
|
1618
|
+
added_joins: number;
|
|
1619
|
+
next_actions: string[];
|
|
1620
|
+
};
|
|
1621
|
+
error?: string;
|
|
1622
|
+
}>;
|
|
1623
|
+
selectColumns(params: {
|
|
1624
|
+
session_id: string;
|
|
1625
|
+
columns: Array<{
|
|
1626
|
+
table: string;
|
|
1627
|
+
column: string;
|
|
1628
|
+
alias?: string;
|
|
1629
|
+
}>;
|
|
1630
|
+
database?: string;
|
|
1631
|
+
}): Promise<{
|
|
1632
|
+
status: string;
|
|
1633
|
+
data?: {
|
|
1634
|
+
session_id: string;
|
|
1635
|
+
current_step: string;
|
|
1636
|
+
selected_columns: number;
|
|
1637
|
+
next_actions: string[];
|
|
1638
|
+
};
|
|
1639
|
+
error?: string;
|
|
1640
|
+
}>;
|
|
1641
|
+
addConditions(params: {
|
|
1642
|
+
session_id: string;
|
|
1643
|
+
conditions: Array<{
|
|
1644
|
+
table: string;
|
|
1645
|
+
column: string;
|
|
1646
|
+
operator: "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "like" | "in" | "not_in" | "is_null" | "is_not_null";
|
|
1647
|
+
value?: any;
|
|
1648
|
+
values?: any[];
|
|
1649
|
+
}>;
|
|
1650
|
+
database?: string;
|
|
1651
|
+
}): Promise<{
|
|
1652
|
+
status: string;
|
|
1653
|
+
data?: {
|
|
1654
|
+
session_id: string;
|
|
1655
|
+
current_step: string;
|
|
1656
|
+
added_conditions: number;
|
|
1657
|
+
next_actions: string[];
|
|
1658
|
+
};
|
|
1659
|
+
error?: string;
|
|
1660
|
+
}>;
|
|
1661
|
+
addAggregations(params: {
|
|
1662
|
+
session_id: string;
|
|
1663
|
+
aggregations: Array<{
|
|
1664
|
+
function: "COUNT" | "SUM" | "AVG" | "MIN" | "MAX";
|
|
1665
|
+
column: string;
|
|
1666
|
+
alias: string;
|
|
1667
|
+
table: string;
|
|
1668
|
+
}>;
|
|
1669
|
+
database?: string;
|
|
1670
|
+
}): Promise<{
|
|
1671
|
+
status: string;
|
|
1672
|
+
data?: {
|
|
1673
|
+
session_id: string;
|
|
1674
|
+
current_step: string;
|
|
1675
|
+
added_aggregations: number;
|
|
1676
|
+
next_actions: string[];
|
|
1677
|
+
};
|
|
1678
|
+
error?: string;
|
|
1679
|
+
}>;
|
|
1680
|
+
configureGroupingAndOrdering(params: {
|
|
1681
|
+
session_id: string;
|
|
1682
|
+
group_by?: Array<{
|
|
1683
|
+
table: string;
|
|
1684
|
+
column: string;
|
|
1685
|
+
}>;
|
|
1686
|
+
order_by?: Array<{
|
|
1687
|
+
table: string;
|
|
1688
|
+
column: string;
|
|
1689
|
+
direction: "asc" | "desc";
|
|
1690
|
+
}>;
|
|
1691
|
+
limit?: number;
|
|
1692
|
+
offset?: number;
|
|
1693
|
+
database?: string;
|
|
1694
|
+
}): Promise<{
|
|
1695
|
+
status: string;
|
|
1696
|
+
data?: {
|
|
1697
|
+
session_id: string;
|
|
1698
|
+
current_step: string;
|
|
1699
|
+
next_actions: string[];
|
|
1700
|
+
};
|
|
1701
|
+
error?: string;
|
|
1702
|
+
}>;
|
|
1703
|
+
previewQuery(params: {
|
|
1704
|
+
session_id: string;
|
|
1705
|
+
database?: string;
|
|
1706
|
+
}): Promise<{
|
|
1707
|
+
status: string;
|
|
1708
|
+
data?: {
|
|
1709
|
+
session_id: string;
|
|
1710
|
+
generated_query: string;
|
|
1711
|
+
query_complexity: "simple" | "medium" | "complex";
|
|
1712
|
+
estimated_rows?: number;
|
|
1713
|
+
optimization_suggestions: string[];
|
|
1714
|
+
current_step: string;
|
|
1715
|
+
};
|
|
1716
|
+
error?: string;
|
|
1717
|
+
}>;
|
|
1718
|
+
executeQuery(params: {
|
|
1719
|
+
session_id: string;
|
|
1720
|
+
dry_run?: boolean;
|
|
1721
|
+
database?: string;
|
|
1722
|
+
}): Promise<{
|
|
1723
|
+
status: string;
|
|
1724
|
+
data?: {
|
|
1725
|
+
session_id: string;
|
|
1726
|
+
executed_query: string;
|
|
1727
|
+
results?: any[];
|
|
1728
|
+
execution_time?: number;
|
|
1729
|
+
row_count?: number;
|
|
1730
|
+
is_dry_run: boolean;
|
|
1731
|
+
};
|
|
1732
|
+
error?: string;
|
|
1733
|
+
}>;
|
|
1734
|
+
getSessionState(params: {
|
|
1735
|
+
session_id: string;
|
|
1736
|
+
database?: string;
|
|
1737
|
+
}): Promise<{
|
|
1738
|
+
status: string;
|
|
1739
|
+
data?: {
|
|
1740
|
+
session: import("./tools/smartQueryBuilderTools").QueryBuilderSession;
|
|
1741
|
+
current_step: string;
|
|
1742
|
+
progress: {
|
|
1743
|
+
tables_selected: boolean;
|
|
1744
|
+
joins_defined: boolean;
|
|
1745
|
+
columns_selected: boolean;
|
|
1746
|
+
conditions_added: boolean;
|
|
1747
|
+
aggregations_added: boolean;
|
|
1748
|
+
grouping_configured: boolean;
|
|
1749
|
+
ready_to_execute: boolean;
|
|
1750
|
+
};
|
|
1751
|
+
};
|
|
1752
|
+
error?: string;
|
|
1753
|
+
}>;
|
|
1754
|
+
getQueryTemplates(params: {
|
|
1755
|
+
category?: "analytics" | "reporting" | "data_entry" | "schema_exploration";
|
|
1756
|
+
database?: string;
|
|
1757
|
+
}): Promise<{
|
|
1758
|
+
status: string;
|
|
1759
|
+
data?: {
|
|
1760
|
+
templates: import("./tools/smartQueryBuilderTools").QueryTemplate[];
|
|
1761
|
+
total_count: number;
|
|
1762
|
+
};
|
|
1763
|
+
error?: string;
|
|
1764
|
+
}>;
|
|
1765
|
+
applyQueryTemplate(params: {
|
|
1766
|
+
session_id: string;
|
|
1767
|
+
template_name: string;
|
|
1768
|
+
database?: string;
|
|
1769
|
+
}): Promise<{
|
|
1770
|
+
status: string;
|
|
1771
|
+
data?: {
|
|
1772
|
+
session_id: string;
|
|
1773
|
+
applied_template: string;
|
|
1774
|
+
suggested_tables: string[];
|
|
1775
|
+
next_actions: string[];
|
|
1776
|
+
};
|
|
1777
|
+
error?: string;
|
|
1778
|
+
}>;
|
|
1779
|
+
suggestNextStep(params: {
|
|
1780
|
+
session_id: string;
|
|
1781
|
+
user_input?: string;
|
|
1782
|
+
database?: string;
|
|
1783
|
+
}): Promise<{
|
|
1784
|
+
status: string;
|
|
1785
|
+
data?: {
|
|
1786
|
+
session_id: string;
|
|
1787
|
+
current_step: string;
|
|
1788
|
+
suggestions: Array<{
|
|
1789
|
+
type: "action" | "table" | "column" | "condition" | "template";
|
|
1790
|
+
description: string;
|
|
1791
|
+
command?: string;
|
|
1792
|
+
parameters?: any;
|
|
1793
|
+
}>;
|
|
1794
|
+
next_actions: string[];
|
|
1795
|
+
};
|
|
1796
|
+
error?: string;
|
|
1797
|
+
}>;
|
|
1798
|
+
endSession(params: {
|
|
1799
|
+
session_id: string;
|
|
1800
|
+
database?: string;
|
|
1801
|
+
}): Promise<{
|
|
1802
|
+
status: string;
|
|
1803
|
+
data?: {
|
|
1804
|
+
session_id: string;
|
|
1805
|
+
session_ended: boolean;
|
|
1806
|
+
final_query?: string;
|
|
1807
|
+
};
|
|
1808
|
+
error?: string;
|
|
1809
|
+
}>;
|
|
1567
1810
|
}
|
|
1568
1811
|
export default MySQLMCP;
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ const testDataTools_1 = require("./tools/testDataTools");
|
|
|
36
36
|
const schemaPatternTools_1 = require("./tools/schemaPatternTools");
|
|
37
37
|
const queryVisualizationTools_1 = require("./tools/queryVisualizationTools");
|
|
38
38
|
const forecastingTools_1 = require("./tools/forecastingTools");
|
|
39
|
+
const smartQueryBuilderTools_1 = require("./tools/smartQueryBuilderTools");
|
|
39
40
|
const securityLayer_1 = __importDefault(require("./security/securityLayer"));
|
|
40
41
|
const connection_1 = __importDefault(require("./db/connection"));
|
|
41
42
|
const featureConfig_1 = require("./config/featureConfig");
|
|
@@ -80,6 +81,7 @@ class MySQLMCP {
|
|
|
80
81
|
this.schemaPatternTools = new schemaPatternTools_1.SchemaPatternTools(this.security);
|
|
81
82
|
this.queryVisualizationTools = new queryVisualizationTools_1.QueryVisualizationTools(this.security);
|
|
82
83
|
this.forecastingTools = new forecastingTools_1.ForecastingTools(this.security);
|
|
84
|
+
this.smartQueryBuilderTools = new smartQueryBuilderTools_1.SmartQueryBuilderTools(this.security);
|
|
83
85
|
}
|
|
84
86
|
// Helper method to check if tool is enabled
|
|
85
87
|
checkToolEnabled(toolName) {
|
|
@@ -1202,6 +1204,91 @@ class MySQLMCP {
|
|
|
1202
1204
|
return { status: "error", error: check.error };
|
|
1203
1205
|
return await this.forecastingTools.forecastDatabaseGrowth(params);
|
|
1204
1206
|
}
|
|
1207
|
+
// Smart Query Builder Tools
|
|
1208
|
+
async startQueryBuilder(params) {
|
|
1209
|
+
const check = this.checkToolEnabled("startQueryBuilder");
|
|
1210
|
+
if (!check.enabled)
|
|
1211
|
+
return { status: "error", error: check.error };
|
|
1212
|
+
return await this.smartQueryBuilderTools.startQueryBuilder(params);
|
|
1213
|
+
}
|
|
1214
|
+
async addTablesToQuery(params) {
|
|
1215
|
+
const check = this.checkToolEnabled("addTablesToQuery");
|
|
1216
|
+
if (!check.enabled)
|
|
1217
|
+
return { status: "error", error: check.error };
|
|
1218
|
+
return await this.smartQueryBuilderTools.addTablesToQuery(params);
|
|
1219
|
+
}
|
|
1220
|
+
async defineJoins(params) {
|
|
1221
|
+
const check = this.checkToolEnabled("defineJoins");
|
|
1222
|
+
if (!check.enabled)
|
|
1223
|
+
return { status: "error", error: check.error };
|
|
1224
|
+
return await this.smartQueryBuilderTools.defineJoins(params);
|
|
1225
|
+
}
|
|
1226
|
+
async selectColumns(params) {
|
|
1227
|
+
const check = this.checkToolEnabled("selectColumns");
|
|
1228
|
+
if (!check.enabled)
|
|
1229
|
+
return { status: "error", error: check.error };
|
|
1230
|
+
return await this.smartQueryBuilderTools.selectColumns(params);
|
|
1231
|
+
}
|
|
1232
|
+
async addConditions(params) {
|
|
1233
|
+
const check = this.checkToolEnabled("addConditions");
|
|
1234
|
+
if (!check.enabled)
|
|
1235
|
+
return { status: "error", error: check.error };
|
|
1236
|
+
return await this.smartQueryBuilderTools.addConditions(params);
|
|
1237
|
+
}
|
|
1238
|
+
async addAggregations(params) {
|
|
1239
|
+
const check = this.checkToolEnabled("addAggregations");
|
|
1240
|
+
if (!check.enabled)
|
|
1241
|
+
return { status: "error", error: check.error };
|
|
1242
|
+
return await this.smartQueryBuilderTools.addAggregations(params);
|
|
1243
|
+
}
|
|
1244
|
+
async configureGroupingAndOrdering(params) {
|
|
1245
|
+
const check = this.checkToolEnabled("configureGroupingAndOrdering");
|
|
1246
|
+
if (!check.enabled)
|
|
1247
|
+
return { status: "error", error: check.error };
|
|
1248
|
+
return await this.smartQueryBuilderTools.configureGroupingAndOrdering(params);
|
|
1249
|
+
}
|
|
1250
|
+
async previewQuery(params) {
|
|
1251
|
+
const check = this.checkToolEnabled("previewQuery");
|
|
1252
|
+
if (!check.enabled)
|
|
1253
|
+
return { status: "error", error: check.error };
|
|
1254
|
+
return await this.smartQueryBuilderTools.previewQuery(params);
|
|
1255
|
+
}
|
|
1256
|
+
async executeQuery(params) {
|
|
1257
|
+
const check = this.checkToolEnabled("executeQuery");
|
|
1258
|
+
if (!check.enabled)
|
|
1259
|
+
return { status: "error", error: check.error };
|
|
1260
|
+
return await this.smartQueryBuilderTools.executeQuery(params);
|
|
1261
|
+
}
|
|
1262
|
+
async getSessionState(params) {
|
|
1263
|
+
const check = this.checkToolEnabled("getSessionState");
|
|
1264
|
+
if (!check.enabled)
|
|
1265
|
+
return { status: "error", error: check.error };
|
|
1266
|
+
return await this.smartQueryBuilderTools.getSessionState(params);
|
|
1267
|
+
}
|
|
1268
|
+
async getQueryTemplates(params) {
|
|
1269
|
+
const check = this.checkToolEnabled("getQueryTemplates");
|
|
1270
|
+
if (!check.enabled)
|
|
1271
|
+
return { status: "error", error: check.error };
|
|
1272
|
+
return await this.smartQueryBuilderTools.getQueryTemplates(params);
|
|
1273
|
+
}
|
|
1274
|
+
async applyQueryTemplate(params) {
|
|
1275
|
+
const check = this.checkToolEnabled("applyQueryTemplate");
|
|
1276
|
+
if (!check.enabled)
|
|
1277
|
+
return { status: "error", error: check.error };
|
|
1278
|
+
return await this.smartQueryBuilderTools.applyQueryTemplate(params);
|
|
1279
|
+
}
|
|
1280
|
+
async suggestNextStep(params) {
|
|
1281
|
+
const check = this.checkToolEnabled("suggestNextStep");
|
|
1282
|
+
if (!check.enabled)
|
|
1283
|
+
return { status: "error", error: check.error };
|
|
1284
|
+
return await this.smartQueryBuilderTools.suggestNextStep(params);
|
|
1285
|
+
}
|
|
1286
|
+
async endSession(params) {
|
|
1287
|
+
const check = this.checkToolEnabled("endSession");
|
|
1288
|
+
if (!check.enabled)
|
|
1289
|
+
return { status: "error", error: check.error };
|
|
1290
|
+
return await this.smartQueryBuilderTools.endSession(params);
|
|
1291
|
+
}
|
|
1205
1292
|
}
|
|
1206
1293
|
exports.MySQLMCP = MySQLMCP;
|
|
1207
1294
|
exports.default = MySQLMCP;
|