@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.
@@ -659,6 +659,23 @@ const TOOLS = [
659
659
  properties: {},
660
660
  },
661
661
  },
662
+ {
663
+ name: "read_changelog",
664
+ description: "Reads the changelog to see what features are new or changed.",
665
+ inputSchema: {
666
+ type: "object",
667
+ properties: {
668
+ version: {
669
+ type: "string",
670
+ description: "Optional: specific version to read (e.g., '1.0.0')",
671
+ },
672
+ limit: {
673
+ type: "number",
674
+ description: "Optional: limit character count (default: 5000)",
675
+ },
676
+ },
677
+ },
678
+ },
662
679
  {
663
680
  name: "test_connection",
664
681
  description: "Tests the database connection and returns latency information.",
@@ -2806,6 +2823,249 @@ const TOOLS = [
2806
2823
  properties: {},
2807
2824
  },
2808
2825
  },
2826
+ // ==========================================
2827
+ // PHASE 1: AI Enhancement Tools
2828
+ // ==========================================
2829
+ // Intelligent Query Assistant
2830
+ {
2831
+ name: "build_query_from_intent",
2832
+ description: "Converts natural language to optimized SQL with context-aware query generation. Analyzes your intent and generates safe, optimized SQL queries with explanations.",
2833
+ inputSchema: {
2834
+ type: "object",
2835
+ properties: {
2836
+ natural_language: {
2837
+ type: "string",
2838
+ description: "Natural language description of what you want to query, e.g., 'show me all users who registered last month'",
2839
+ },
2840
+ context: {
2841
+ type: "string",
2842
+ enum: ["analytics", "reporting", "data_entry", "schema_exploration"],
2843
+ description: "Context for query generation (default: analytics)",
2844
+ },
2845
+ max_complexity: {
2846
+ type: "string",
2847
+ enum: ["simple", "medium", "complex"],
2848
+ description: "Maximum allowed query complexity (default: medium)",
2849
+ },
2850
+ safety_level: {
2851
+ type: "string",
2852
+ enum: ["strict", "moderate", "permissive"],
2853
+ description: "Safety level for query generation (default: moderate)",
2854
+ },
2855
+ database: {
2856
+ type: "string",
2857
+ description: "Optional: specific database name",
2858
+ },
2859
+ },
2860
+ required: ["natural_language"],
2861
+ },
2862
+ },
2863
+ {
2864
+ name: "suggest_query_improvements",
2865
+ description: "Analyzes a SQL query and suggests improvements for speed, memory, or readability. Identifies inefficient patterns and provides optimized alternatives.",
2866
+ inputSchema: {
2867
+ type: "object",
2868
+ properties: {
2869
+ query: {
2870
+ type: "string",
2871
+ description: "SQL query to analyze and improve",
2872
+ },
2873
+ optimization_goal: {
2874
+ type: "string",
2875
+ enum: ["speed", "memory", "readability"],
2876
+ description: "Primary optimization goal (default: speed)",
2877
+ },
2878
+ database: {
2879
+ type: "string",
2880
+ description: "Optional: specific database name",
2881
+ },
2882
+ },
2883
+ required: ["query"],
2884
+ },
2885
+ },
2886
+ // Smart Data Discovery
2887
+ {
2888
+ name: "smart_search",
2889
+ description: "Finds relevant tables, columns, data patterns, and relationships using semantic search. Essential for exploring large databases with hundreds of tables.",
2890
+ inputSchema: {
2891
+ type: "object",
2892
+ properties: {
2893
+ search_term: {
2894
+ type: "string",
2895
+ description: "Search term to find related database objects (e.g., 'customer', 'order date', 'email')",
2896
+ },
2897
+ search_type: {
2898
+ type: "string",
2899
+ enum: ["column", "table", "data_pattern", "relationship", "all"],
2900
+ description: "Type of search (default: all)",
2901
+ },
2902
+ similarity_threshold: {
2903
+ type: "number",
2904
+ description: "Minimum similarity score 0-1 (default: 0.3)",
2905
+ },
2906
+ include_sample_data: {
2907
+ type: "boolean",
2908
+ description: "Include sample values from matched columns (default: false)",
2909
+ },
2910
+ max_results: {
2911
+ type: "number",
2912
+ description: "Maximum results per category (default: 20)",
2913
+ },
2914
+ database: {
2915
+ type: "string",
2916
+ description: "Optional: specific database name",
2917
+ },
2918
+ },
2919
+ required: ["search_term"],
2920
+ },
2921
+ },
2922
+ {
2923
+ name: "find_similar_columns",
2924
+ description: "Finds columns with similar names or data across tables. Discovers potential join candidates and implicit relationships between tables.",
2925
+ inputSchema: {
2926
+ type: "object",
2927
+ properties: {
2928
+ column_name: {
2929
+ type: "string",
2930
+ description: "Optional: reference column name to find similar columns",
2931
+ },
2932
+ table_name: {
2933
+ type: "string",
2934
+ description: "Optional: table containing the reference column",
2935
+ },
2936
+ include_data_comparison: {
2937
+ type: "boolean",
2938
+ description: "Compare actual data overlap between columns (slower but more accurate, default: false)",
2939
+ },
2940
+ max_results: {
2941
+ type: "number",
2942
+ description: "Maximum results (default: 20)",
2943
+ },
2944
+ database: {
2945
+ type: "string",
2946
+ description: "Optional: specific database name",
2947
+ },
2948
+ },
2949
+ },
2950
+ },
2951
+ {
2952
+ name: "discover_data_patterns",
2953
+ description: "Discovers data patterns in a table including uniqueness, null rates, duplicates, formats, and value ranges. Provides data quality score and recommendations.",
2954
+ inputSchema: {
2955
+ type: "object",
2956
+ properties: {
2957
+ table_name: {
2958
+ type: "string",
2959
+ description: "Name of the table to analyze",
2960
+ },
2961
+ pattern_types: {
2962
+ type: "array",
2963
+ items: {
2964
+ type: "string",
2965
+ enum: ["unique", "null", "duplicate", "format", "range"],
2966
+ },
2967
+ description: "Types of patterns to discover (default: all)",
2968
+ },
2969
+ max_columns: {
2970
+ type: "number",
2971
+ description: "Maximum columns to analyze (default: 20)",
2972
+ },
2973
+ database: {
2974
+ type: "string",
2975
+ description: "Optional: specific database name",
2976
+ },
2977
+ },
2978
+ required: ["table_name"],
2979
+ },
2980
+ },
2981
+ // Documentation Generator
2982
+ {
2983
+ name: "generate_documentation",
2984
+ description: "Generates comprehensive database documentation with business glossary in Markdown, HTML, or JSON format. Includes schema, relationships, and example queries.",
2985
+ inputSchema: {
2986
+ type: "object",
2987
+ properties: {
2988
+ scope: {
2989
+ type: "string",
2990
+ enum: ["database", "table", "column", "relationship"],
2991
+ description: "Documentation scope (default: database)",
2992
+ },
2993
+ table_name: {
2994
+ type: "string",
2995
+ description: "Optional: specific table to document (for table scope)",
2996
+ },
2997
+ include_business_glossary: {
2998
+ type: "boolean",
2999
+ description: "Include business term glossary (default: true)",
3000
+ },
3001
+ format: {
3002
+ type: "string",
3003
+ enum: ["markdown", "html", "json"],
3004
+ description: "Output format (default: markdown)",
3005
+ },
3006
+ include_examples: {
3007
+ type: "boolean",
3008
+ description: "Include example SQL queries (default: true)",
3009
+ },
3010
+ include_statistics: {
3011
+ type: "boolean",
3012
+ description: "Include row counts and statistics (default: true)",
3013
+ },
3014
+ database: {
3015
+ type: "string",
3016
+ description: "Optional: specific database name",
3017
+ },
3018
+ },
3019
+ },
3020
+ },
3021
+ {
3022
+ name: "generate_data_dictionary",
3023
+ description: "Generates a detailed data dictionary for a specific table with column descriptions, constraints, sample values, and business terms.",
3024
+ inputSchema: {
3025
+ type: "object",
3026
+ properties: {
3027
+ table_name: {
3028
+ type: "string",
3029
+ description: "Name of the table to document",
3030
+ },
3031
+ include_sample_values: {
3032
+ type: "boolean",
3033
+ description: "Include sample values for each column (default: true)",
3034
+ },
3035
+ include_constraints: {
3036
+ type: "boolean",
3037
+ description: "Include constraint information (default: true)",
3038
+ },
3039
+ database: {
3040
+ type: "string",
3041
+ description: "Optional: specific database name",
3042
+ },
3043
+ },
3044
+ required: ["table_name"],
3045
+ },
3046
+ },
3047
+ {
3048
+ name: "generate_business_glossary",
3049
+ description: "Generates a business glossary from database column names with inferred descriptions and categorization. Helps with onboarding and data governance.",
3050
+ inputSchema: {
3051
+ type: "object",
3052
+ properties: {
3053
+ include_descriptions: {
3054
+ type: "boolean",
3055
+ description: "Include auto-generated descriptions (default: true)",
3056
+ },
3057
+ group_by: {
3058
+ type: "string",
3059
+ enum: ["table", "category", "alphabetical"],
3060
+ description: "How to group glossary terms (default: category)",
3061
+ },
3062
+ database: {
3063
+ type: "string",
3064
+ description: "Optional: specific database name",
3065
+ },
3066
+ },
3067
+ },
3068
+ },
2809
3069
  ];
2810
3070
  // Create the MCP server
2811
3071
  const server = new index_js_1.Server({
@@ -2874,6 +3134,9 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
2874
3134
  case "test_connection":
2875
3135
  result = await mysqlMCP.testConnection();
2876
3136
  break;
3137
+ case "read_changelog":
3138
+ result = await mysqlMCP.readChangelog((args || {}));
3139
+ break;
2877
3140
  case "get_table_relationships":
2878
3141
  result = await mysqlMCP.getTableRelationships((args || {}));
2879
3142
  break;
@@ -3204,6 +3467,36 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
3204
3467
  case "repair_query":
3205
3468
  result = await mysqlMCP.repairQuery((args || {}));
3206
3469
  break;
3470
+ // ==========================================
3471
+ // PHASE 1: AI Enhancement Tools
3472
+ // ==========================================
3473
+ // Intelligent Query Assistant
3474
+ case "build_query_from_intent":
3475
+ result = await mysqlMCP.buildQueryFromIntent((args || {}));
3476
+ break;
3477
+ case "suggest_query_improvements":
3478
+ result = await mysqlMCP.suggestQueryImprovements((args || {}));
3479
+ break;
3480
+ // Smart Data Discovery
3481
+ case "smart_search":
3482
+ result = await mysqlMCP.smartSearch((args || {}));
3483
+ break;
3484
+ case "find_similar_columns":
3485
+ result = await mysqlMCP.findSimilarColumns((args || {}));
3486
+ break;
3487
+ case "discover_data_patterns":
3488
+ result = await mysqlMCP.discoverDataPatterns((args || {}));
3489
+ break;
3490
+ // Documentation Generator
3491
+ case "generate_documentation":
3492
+ result = await mysqlMCP.generateDocumentation((args || {}));
3493
+ break;
3494
+ case "generate_data_dictionary":
3495
+ result = await mysqlMCP.generateDataDictionary((args || {}));
3496
+ break;
3497
+ case "generate_business_glossary":
3498
+ result = await mysqlMCP.generateBusinessGlossary((args || {}));
3499
+ break;
3207
3500
  default:
3208
3501
  throw new Error(`Unknown tool: ${name}`);
3209
3502
  }
@@ -0,0 +1,145 @@
1
+ import { SecurityLayer } from "../security/securityLayer";
2
+ /**
3
+ * AI-Powered Documentation Generator
4
+ * Automatic database documentation generation with business glossary
5
+ */
6
+ export declare class DocumentationGeneratorTools {
7
+ private db;
8
+ private security;
9
+ constructor(security: SecurityLayer);
10
+ /**
11
+ * Validate database access - ensures only the connected database can be accessed
12
+ */
13
+ private validateDatabaseAccess;
14
+ /**
15
+ * Generate comprehensive database documentation
16
+ */
17
+ generateDocumentation(params: {
18
+ scope?: "database" | "table" | "column" | "relationship";
19
+ table_name?: string;
20
+ include_business_glossary?: boolean;
21
+ format?: "markdown" | "html" | "json";
22
+ include_examples?: boolean;
23
+ include_statistics?: boolean;
24
+ database?: string;
25
+ }): Promise<{
26
+ status: string;
27
+ data?: {
28
+ format: string;
29
+ scope: string;
30
+ content: string;
31
+ metadata: {
32
+ generated_at: string;
33
+ database: string;
34
+ tables_documented: number;
35
+ columns_documented: number;
36
+ };
37
+ };
38
+ error?: string;
39
+ }>;
40
+ /**
41
+ * Generate data dictionary for a specific table
42
+ */
43
+ generateDataDictionary(params: {
44
+ table_name: string;
45
+ include_sample_values?: boolean;
46
+ include_constraints?: boolean;
47
+ database?: string;
48
+ }): Promise<{
49
+ status: string;
50
+ data?: {
51
+ table_name: string;
52
+ description: string;
53
+ columns: Array<{
54
+ name: string;
55
+ data_type: string;
56
+ description: string;
57
+ constraints: string[];
58
+ is_nullable: boolean;
59
+ default_value: string | null;
60
+ sample_values?: any[];
61
+ business_term?: string;
62
+ }>;
63
+ primary_key: string[];
64
+ foreign_keys: Array<{
65
+ column: string;
66
+ references_table: string;
67
+ references_column: string;
68
+ }>;
69
+ indexes: Array<{
70
+ name: string;
71
+ columns: string[];
72
+ is_unique: boolean;
73
+ }>;
74
+ };
75
+ error?: string;
76
+ }>;
77
+ /**
78
+ * Generate a business glossary from the schema
79
+ */
80
+ generateBusinessGlossaryReport(params: {
81
+ include_descriptions?: boolean;
82
+ group_by?: "table" | "category" | "alphabetical";
83
+ database?: string;
84
+ }): Promise<{
85
+ status: string;
86
+ data?: {
87
+ glossary: Array<{
88
+ term: string;
89
+ technical_name: string;
90
+ source_table: string;
91
+ data_type: string;
92
+ description: string;
93
+ category: string;
94
+ related_terms?: string[];
95
+ }>;
96
+ categories: string[];
97
+ total_terms: number;
98
+ };
99
+ error?: string;
100
+ }>;
101
+ /**
102
+ * Generate business glossary from columns
103
+ */
104
+ private generateBusinessGlossary;
105
+ /**
106
+ * Get table statistics
107
+ */
108
+ private getTableStatistics;
109
+ /**
110
+ * Generate Markdown documentation
111
+ */
112
+ private generateMarkdown;
113
+ /**
114
+ * Generate HTML documentation
115
+ */
116
+ private generateHTML;
117
+ /**
118
+ * Generate JSON documentation
119
+ */
120
+ private generateJSON;
121
+ /**
122
+ * Group indexes by name
123
+ */
124
+ private groupIndexes;
125
+ /**
126
+ * Infer business term from column name
127
+ */
128
+ private inferBusinessTerm;
129
+ /**
130
+ * Infer column description from name and type
131
+ */
132
+ private inferColumnDescription;
133
+ /**
134
+ * Infer table description from name
135
+ */
136
+ private inferTableDescription;
137
+ /**
138
+ * Infer category from column name and type
139
+ */
140
+ private inferCategory;
141
+ /**
142
+ * Normalize column name for comparison
143
+ */
144
+ private normalizeColumnName;
145
+ }