@cano721/mysql-mcp-server 0.5.0 → 0.6.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.
Files changed (2) hide show
  1. package/build/index.js +14 -11
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -49,6 +49,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
49
49
  // Check if optional commands are enabled
50
50
  const allowExplain = process.env.MYSQL_ALLOW_EXPLAIN !== 'false';
51
51
  const allowAnalyze = process.env.MYSQL_ALLOW_ANALYZE !== 'false';
52
+ console.error('[Setup] Security settings:', { allowExplain, allowAnalyze });
52
53
  // Build allowed commands description for execute_query
53
54
  const allowedCommands = ['SELECT', 'SHOW', 'DESCRIBE'];
54
55
  if (allowExplain) {
@@ -149,21 +150,21 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
149
150
  // Add analyze_query tool if enabled
150
151
  if (allowAnalyze) {
151
152
  tools.push({
152
- name: "analyze_table",
153
- description: "Analyze table statistics for query optimization",
153
+ name: "analyze_query",
154
+ description: "Analyze query performance and statistics using ANALYZE",
154
155
  inputSchema: {
155
156
  type: "object",
156
157
  properties: {
157
- table: {
158
+ query: {
158
159
  type: "string",
159
- description: "Table name to analyze"
160
+ description: "SQL query to analyze (SELECT, UPDATE, DELETE, INSERT, REPLACE statements)"
160
161
  },
161
162
  database: {
162
163
  type: "string",
163
164
  description: "Database name (optional, uses default if not specified)"
164
165
  }
165
166
  },
166
- required: ["table"]
167
+ required: ["query"]
167
168
  }
168
169
  });
169
170
  }
@@ -250,14 +251,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
250
251
  }]
251
252
  };
252
253
  }
253
- case "analyze_table": {
254
- console.error('[Tool] Executing analyze_table');
255
- const table = request.params.arguments?.table;
254
+ case "analyze_query": {
255
+ console.error('[Tool] Executing analyze_query');
256
+ const query = request.params.arguments?.query;
256
257
  const database = request.params.arguments?.database;
257
- if (!table) {
258
- throw new McpError(ErrorCode.InvalidParams, "Table name is required");
258
+ if (!query) {
259
+ throw new McpError(ErrorCode.InvalidParams, "Query is required");
259
260
  }
260
- const { rows } = await executeQuery(pool, `ANALYZE TABLE \`${table}\``, [], database);
261
+ // Build ANALYZE query
262
+ const analyzeQuery = `ANALYZE ${query}`;
263
+ const { rows } = await executeQuery(pool, analyzeQuery, [], database);
261
264
  return {
262
265
  content: [{
263
266
  type: "text",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cano721/mysql-mcp-server",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "An MCP server that provides read-only access to MySQL databases.",
5
5
  "type": "module",
6
6
  "bin": {