@berthojoris/mcp-mysql-server 1.2.6 → 1.4.1

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.
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.validateStoredProcedureExecution = exports.validateShowCreateProcedure = exports.validateDropStoredProcedure = exports.validateCreateStoredProcedure = exports.validateExecuteStoredProcedure = exports.validateGetStoredProcedureInfo = exports.validateListStoredProcedures = exports.validateExecuteInTransaction = exports.validateRollbackTransaction = exports.validateCommitTransaction = exports.validateBeginTransaction = exports.validateExecuteDdl = exports.validateDropTable = exports.validateAlterTable = exports.validateCreateTable = exports.validateExecuteSql = exports.validateRunQuery = exports.validateBulkDelete = exports.validateBulkUpdate = exports.validateBulkInsert = exports.validateDeleteRecord = exports.validateUpdateRecord = exports.validateReadRecords = exports.validateCreateRecord = exports.validateReadTableSchema = exports.validateListTables = exports.showCreateProcedureSchema = exports.dropStoredProcedureSchema = exports.createStoredProcedureSchema = exports.executeStoredProcedureSchema = exports.getStoredProcedureInfoSchema = exports.listStoredProceduresSchema = exports.executeInTransactionSchema = exports.getTransactionStatusSchema = exports.rollbackTransactionSchema = exports.commitTransactionSchema = exports.beginTransactionSchema = exports.getTableRelationshipsSchema = exports.executeDdlSchema = exports.dropTableSchema = exports.alterTableSchema = exports.createTableSchema = exports.executeSqlSchema = exports.runQuerySchema = exports.deleteRecordSchema = exports.updateRecordSchema = exports.readRecordsSchema = exports.createRecordSchema = exports.readTableSchemaSchema = exports.listTablesSchema = void 0;
7
- exports.validateGetTableRelationships = exports.validateStoredProcedureCreation = void 0;
6
+ exports.validateDropStoredProcedure = exports.validateCreateStoredProcedure = exports.validateExecuteStoredProcedure = exports.validateGetStoredProcedureInfo = exports.validateListStoredProcedures = exports.validateExecuteInTransaction = exports.validateRollbackTransaction = exports.validateCommitTransaction = exports.validateBeginTransaction = exports.validateExecuteDdl = exports.validateDropTable = exports.validateAlterTable = exports.validateCreateTable = exports.validateExecuteSql = exports.validateRunQuery = exports.validateBulkDelete = exports.validateBulkUpdate = exports.validateBulkInsert = exports.validateDeleteRecord = exports.validateUpdateRecord = exports.validateReadRecords = exports.validateCreateRecord = exports.validateReadTableSchema = exports.validateListTables = exports.exportQueryToCsvSchema = exports.exportTableToCsvSchema = exports.showCreateProcedureSchema = exports.dropStoredProcedureSchema = exports.createStoredProcedureSchema = exports.executeStoredProcedureSchema = exports.getStoredProcedureInfoSchema = exports.listStoredProceduresSchema = exports.executeInTransactionSchema = exports.getTransactionStatusSchema = exports.rollbackTransactionSchema = exports.commitTransactionSchema = exports.beginTransactionSchema = exports.getTableRelationshipsSchema = exports.executeDdlSchema = exports.dropTableSchema = exports.alterTableSchema = exports.createTableSchema = exports.executeSqlSchema = exports.runQuerySchema = exports.deleteRecordSchema = exports.updateRecordSchema = exports.readRecordsSchema = exports.createRecordSchema = exports.readTableSchemaSchema = exports.listTablesSchema = void 0;
7
+ exports.validateExportQueryToCsv = exports.validateExportTableToCsv = exports.validateGetTableRelationships = exports.validateStoredProcedureCreation = exports.validateStoredProcedureExecution = exports.validateShowCreateProcedure = void 0;
8
8
  const ajv_1 = __importDefault(require("ajv"));
9
9
  const ajv = new ajv_1.default();
10
10
  // Schema definitions
@@ -442,6 +442,64 @@ const bulkDeleteSchema = {
442
442
  required: ['table_name', 'condition_sets'],
443
443
  additionalProperties: false
444
444
  };
445
+ // Data Export schemas
446
+ exports.exportTableToCsvSchema = {
447
+ type: 'object',
448
+ required: ['table_name'],
449
+ properties: {
450
+ table_name: { type: 'string' },
451
+ filters: {
452
+ type: 'array',
453
+ items: {
454
+ type: 'object',
455
+ required: ['field', 'operator', 'value'],
456
+ properties: {
457
+ field: { type: 'string' },
458
+ operator: {
459
+ type: 'string',
460
+ enum: ['eq', 'neq', 'gt', 'gte', 'lt', 'lte', 'like', 'in']
461
+ },
462
+ value: {}
463
+ }
464
+ },
465
+ nullable: true
466
+ },
467
+ pagination: {
468
+ type: 'object',
469
+ properties: {
470
+ page: { type: 'integer', minimum: 1 },
471
+ limit: { type: 'integer', minimum: 1, maximum: 10000 }
472
+ },
473
+ required: ['page', 'limit'],
474
+ nullable: true
475
+ },
476
+ sorting: {
477
+ type: 'object',
478
+ properties: {
479
+ field: { type: 'string' },
480
+ direction: { type: 'string', enum: ['asc', 'desc'] }
481
+ },
482
+ required: ['field', 'direction'],
483
+ nullable: true
484
+ },
485
+ include_headers: { type: 'boolean', nullable: true }
486
+ },
487
+ additionalProperties: false
488
+ };
489
+ exports.exportQueryToCsvSchema = {
490
+ type: 'object',
491
+ required: ['query'],
492
+ properties: {
493
+ query: { type: 'string' },
494
+ params: {
495
+ type: 'array',
496
+ items: {},
497
+ nullable: true
498
+ },
499
+ include_headers: { type: 'boolean', nullable: true }
500
+ },
501
+ additionalProperties: false
502
+ };
445
503
  // Compile validators
446
504
  exports.validateListTables = ajv.compile(exports.listTablesSchema);
447
505
  exports.validateReadTableSchema = ajv.compile(exports.readTableSchemaSchema);
@@ -471,3 +529,5 @@ exports.validateShowCreateProcedure = ajv.compile(exports.showCreateProcedureSch
471
529
  exports.validateStoredProcedureExecution = ajv.compile(exports.executeStoredProcedureSchema);
472
530
  exports.validateStoredProcedureCreation = ajv.compile(exports.createStoredProcedureSchema);
473
531
  exports.validateGetTableRelationships = ajv.compile(exports.getTableRelationshipsSchema);
532
+ exports.validateExportTableToCsv = ajv.compile(exports.exportTableToCsvSchema);
533
+ exports.validateExportQueryToCsv = ajv.compile(exports.exportQueryToCsvSchema);
package/manifest.json CHANGED
@@ -1,248 +1,248 @@
1
- {
2
- "name": "mysql-mcp",
3
- "description": "A Model Context Protocol for MySQL database interaction",
4
- "version": "1.0.0",
5
- "tools": [
6
- {
7
- "name": "list_databases",
8
- "description": "Lists all databases available on the MySQL server.",
9
- "input_schema": {},
10
- "output_schema": {
11
- "type": "array",
12
- "items": { "type": "string" }
13
- }
14
- },
15
- {
16
- "name": "list_tables",
17
- "description": "Lists all tables in the connected MySQL database.",
18
- "input_schema": {},
19
- "output_schema": {
20
- "type": "array",
21
- "items": { "type": "string" }
22
- }
23
- },
24
- {
25
- "name": "read_table_schema",
26
- "description": "Reads the schema of a specified table.",
27
- "input_schema": {
28
- "type": "object",
29
- "properties": {
30
- "table_name": { "type": "string" }
31
- },
32
- "required": ["table_name"]
33
- },
34
- "output_schema": {
35
- "type": "object",
36
- "properties": {
37
- "columns": {
38
- "type": "array",
39
- "items": {
40
- "type": "object",
41
- "properties": {
42
- "name": { "type": "string" },
43
- "type": { "type": "string" },
44
- "nullable": { "type": "boolean" },
45
- "default": { "type": ["string", "null"] },
46
- "primary_key": { "type": "boolean" }
47
- }
48
- }
49
- },
50
- "primary_key": { "type": ["string", "null"] },
51
- "indexes": {
52
- "type": "array",
53
- "items": { "type": "string" }
54
- }
55
- }
56
- }
57
- },
58
- {
59
- "name": "create_record",
60
- "description": "Creates a new record in the specified table.",
61
- "input_schema": {
62
- "type": "object",
63
- "properties": {
64
- "table_name": { "type": "string" },
65
- "data": { "type": "object" }
66
- },
67
- "required": ["table_name", "data"]
68
- },
69
- "output_schema": {
70
- "type": "object",
71
- "properties": {
72
- "success": { "type": "boolean" },
73
- "id": { "type": ["string", "number"] },
74
- "affected_rows": { "type": "number" }
75
- }
76
- }
77
- },
78
- {
79
- "name": "read_records",
80
- "description": "Reads records from the specified table with optional filtering, pagination, and sorting.",
81
- "input_schema": {
82
- "type": "object",
83
- "properties": {
84
- "table_name": { "type": "string" },
85
- "filters": { "type": "object" },
86
- "limit": { "type": "number" },
87
- "offset": { "type": "number" },
88
- "sort_by": { "type": "string" },
89
- "sort_direction": { "type": "string", "enum": ["ASC", "DESC"] }
90
- },
91
- "required": ["table_name"]
92
- },
93
- "output_schema": {
94
- "type": "object",
95
- "properties": {
96
- "records": { "type": "array" },
97
- "total": { "type": "number" }
98
- }
99
- }
100
- },
101
- {
102
- "name": "update_record",
103
- "description": "Updates an existing record in the specified table.",
104
- "input_schema": {
105
- "type": "object",
106
- "properties": {
107
- "table_name": { "type": "string" },
108
- "id_field": { "type": "string" },
109
- "id": { "type": ["string", "number"] },
110
- "data": { "type": "object" }
111
- },
112
- "required": ["table_name", "id", "data"]
113
- },
114
- "output_schema": {
115
- "type": "object",
116
- "properties": {
117
- "success": { "type": "boolean" },
118
- "affected_rows": { "type": "number" }
119
- }
120
- }
121
- },
122
- {
123
- "name": "delete_record",
124
- "description": "Deletes a record from the specified table.",
125
- "input_schema": {
126
- "type": "object",
127
- "properties": {
128
- "table_name": { "type": "string" },
129
- "id_field": { "type": "string" },
130
- "id": { "type": ["string", "number"] }
131
- },
132
- "required": ["table_name", "id"]
133
- },
134
- "output_schema": {
135
- "type": "object",
136
- "properties": {
137
- "success": { "type": "boolean" },
138
- "affected_rows": { "type": "number" }
139
- }
140
- }
141
- },
142
- {
143
- "name": "run_query",
144
- "description": "Runs a read-only SQL query with optional parameters.",
145
- "input_schema": {
146
- "type": "object",
147
- "properties": {
148
- "query": { "type": "string" },
149
- "params": { "type": "array" }
150
- },
151
- "required": ["query"]
152
- },
153
- "output_schema": {
154
- "type": "object",
155
- "properties": {
156
- "results": { "type": "array" },
157
- "fields": { "type": "array" }
158
- }
159
- }
160
- },
161
- {
162
- "name": "execute_sql",
163
- "description": "Executes a write SQL operation (INSERT, UPDATE, DELETE) with optional parameters.",
164
- "input_schema": {
165
- "type": "object",
166
- "properties": {
167
- "query": { "type": "string" },
168
- "params": { "type": "array" }
169
- },
170
- "required": ["query"]
171
- },
172
- "output_schema": {
173
- "type": "object",
174
- "properties": {
175
- "success": { "type": "boolean" },
176
- "affected_rows": { "type": "number" },
177
- "insert_id": { "type": ["number", "null"] }
178
- }
179
- }
180
- },
181
- {
182
- "name": "describe_connection",
183
- "description": "Returns information about the current database connection.",
184
- "input_schema": {},
185
- "output_schema": {
186
- "type": "object",
187
- "properties": {
188
- "host": { "type": "string" },
189
- "port": { "type": "number" },
190
- "database": { "type": "string" },
191
- "user": { "type": "string" },
192
- "connected": { "type": "boolean" }
193
- }
194
- }
195
- },
196
- {
197
- "name": "test_connection",
198
- "description": "Tests the database connection and returns latency information.",
199
- "input_schema": {},
200
- "output_schema": {
201
- "type": "object",
202
- "properties": {
203
- "success": { "type": "boolean" },
204
- "latency_ms": { "type": "number" },
205
- "message": { "type": "string" }
206
- }
207
- }
208
- },
209
- {
210
- "name": "get_table_relationships",
211
- "description": "Returns foreign key relationships for a specified table.",
212
- "input_schema": {
213
- "type": "object",
214
- "properties": {
215
- "table_name": { "type": "string" }
216
- },
217
- "required": ["table_name"]
218
- },
219
- "output_schema": {
220
- "type": "object",
221
- "properties": {
222
- "as_parent": {
223
- "type": "array",
224
- "items": {
225
- "type": "object",
226
- "properties": {
227
- "table": { "type": "string" },
228
- "column": { "type": "string" },
229
- "referenced_column": { "type": "string" }
230
- }
231
- }
232
- },
233
- "as_child": {
234
- "type": "array",
235
- "items": {
236
- "type": "object",
237
- "properties": {
238
- "table": { "type": "string" },
239
- "column": { "type": "string" },
240
- "referenced_column": { "type": "string" }
241
- }
242
- }
243
- }
244
- }
245
- }
246
- }
247
- ]
1
+ {
2
+ "name": "mysql-mcp",
3
+ "description": "A Model Context Protocol for MySQL database interaction",
4
+ "version": "1.2.6",
5
+ "tools": [
6
+ {
7
+ "name": "list_databases",
8
+ "description": "Lists all databases available on the MySQL server.",
9
+ "input_schema": {},
10
+ "output_schema": {
11
+ "type": "array",
12
+ "items": { "type": "string" }
13
+ }
14
+ },
15
+ {
16
+ "name": "list_tables",
17
+ "description": "Lists all tables in the connected MySQL database.",
18
+ "input_schema": {},
19
+ "output_schema": {
20
+ "type": "array",
21
+ "items": { "type": "string" }
22
+ }
23
+ },
24
+ {
25
+ "name": "read_table_schema",
26
+ "description": "Reads the schema of a specified table.",
27
+ "input_schema": {
28
+ "type": "object",
29
+ "properties": {
30
+ "table_name": { "type": "string" }
31
+ },
32
+ "required": ["table_name"]
33
+ },
34
+ "output_schema": {
35
+ "type": "object",
36
+ "properties": {
37
+ "columns": {
38
+ "type": "array",
39
+ "items": {
40
+ "type": "object",
41
+ "properties": {
42
+ "name": { "type": "string" },
43
+ "type": { "type": "string" },
44
+ "nullable": { "type": "boolean" },
45
+ "default": { "type": ["string", "null"] },
46
+ "primary_key": { "type": "boolean" }
47
+ }
48
+ }
49
+ },
50
+ "primary_key": { "type": ["string", "null"] },
51
+ "indexes": {
52
+ "type": "array",
53
+ "items": { "type": "string" }
54
+ }
55
+ }
56
+ }
57
+ },
58
+ {
59
+ "name": "create_record",
60
+ "description": "Creates a new record in the specified table.",
61
+ "input_schema": {
62
+ "type": "object",
63
+ "properties": {
64
+ "table_name": { "type": "string" },
65
+ "data": { "type": "object" }
66
+ },
67
+ "required": ["table_name", "data"]
68
+ },
69
+ "output_schema": {
70
+ "type": "object",
71
+ "properties": {
72
+ "success": { "type": "boolean" },
73
+ "id": { "type": ["string", "number"] },
74
+ "affected_rows": { "type": "number" }
75
+ }
76
+ }
77
+ },
78
+ {
79
+ "name": "read_records",
80
+ "description": "Reads records from the specified table with optional filtering, pagination, and sorting.",
81
+ "input_schema": {
82
+ "type": "object",
83
+ "properties": {
84
+ "table_name": { "type": "string" },
85
+ "filters": { "type": "object" },
86
+ "limit": { "type": "number" },
87
+ "offset": { "type": "number" },
88
+ "sort_by": { "type": "string" },
89
+ "sort_direction": { "type": "string", "enum": ["ASC", "DESC"] }
90
+ },
91
+ "required": ["table_name"]
92
+ },
93
+ "output_schema": {
94
+ "type": "object",
95
+ "properties": {
96
+ "records": { "type": "array" },
97
+ "total": { "type": "number" }
98
+ }
99
+ }
100
+ },
101
+ {
102
+ "name": "update_record",
103
+ "description": "Updates an existing record in the specified table.",
104
+ "input_schema": {
105
+ "type": "object",
106
+ "properties": {
107
+ "table_name": { "type": "string" },
108
+ "id_field": { "type": "string" },
109
+ "id": { "type": ["string", "number"] },
110
+ "data": { "type": "object" }
111
+ },
112
+ "required": ["table_name", "id", "data"]
113
+ },
114
+ "output_schema": {
115
+ "type": "object",
116
+ "properties": {
117
+ "success": { "type": "boolean" },
118
+ "affected_rows": { "type": "number" }
119
+ }
120
+ }
121
+ },
122
+ {
123
+ "name": "delete_record",
124
+ "description": "Deletes a record from the specified table.",
125
+ "input_schema": {
126
+ "type": "object",
127
+ "properties": {
128
+ "table_name": { "type": "string" },
129
+ "id_field": { "type": "string" },
130
+ "id": { "type": ["string", "number"] }
131
+ },
132
+ "required": ["table_name", "id"]
133
+ },
134
+ "output_schema": {
135
+ "type": "object",
136
+ "properties": {
137
+ "success": { "type": "boolean" },
138
+ "affected_rows": { "type": "number" }
139
+ }
140
+ }
141
+ },
142
+ {
143
+ "name": "run_query",
144
+ "description": "Runs a read-only SQL query with optional parameters.",
145
+ "input_schema": {
146
+ "type": "object",
147
+ "properties": {
148
+ "query": { "type": "string" },
149
+ "params": { "type": "array" }
150
+ },
151
+ "required": ["query"]
152
+ },
153
+ "output_schema": {
154
+ "type": "object",
155
+ "properties": {
156
+ "results": { "type": "array" },
157
+ "fields": { "type": "array" }
158
+ }
159
+ }
160
+ },
161
+ {
162
+ "name": "execute_sql",
163
+ "description": "Executes a write SQL operation (INSERT, UPDATE, DELETE) with optional parameters.",
164
+ "input_schema": {
165
+ "type": "object",
166
+ "properties": {
167
+ "query": { "type": "string" },
168
+ "params": { "type": "array" }
169
+ },
170
+ "required": ["query"]
171
+ },
172
+ "output_schema": {
173
+ "type": "object",
174
+ "properties": {
175
+ "success": { "type": "boolean" },
176
+ "affected_rows": { "type": "number" },
177
+ "insert_id": { "type": ["number", "null"] }
178
+ }
179
+ }
180
+ },
181
+ {
182
+ "name": "describe_connection",
183
+ "description": "Returns information about the current database connection.",
184
+ "input_schema": {},
185
+ "output_schema": {
186
+ "type": "object",
187
+ "properties": {
188
+ "host": { "type": "string" },
189
+ "port": { "type": "number" },
190
+ "database": { "type": "string" },
191
+ "user": { "type": "string" },
192
+ "connected": { "type": "boolean" }
193
+ }
194
+ }
195
+ },
196
+ {
197
+ "name": "test_connection",
198
+ "description": "Tests the database connection and returns latency information.",
199
+ "input_schema": {},
200
+ "output_schema": {
201
+ "type": "object",
202
+ "properties": {
203
+ "success": { "type": "boolean" },
204
+ "latency_ms": { "type": "number" },
205
+ "message": { "type": "string" }
206
+ }
207
+ }
208
+ },
209
+ {
210
+ "name": "get_table_relationships",
211
+ "description": "Returns foreign key relationships for a specified table.",
212
+ "input_schema": {
213
+ "type": "object",
214
+ "properties": {
215
+ "table_name": { "type": "string" }
216
+ },
217
+ "required": ["table_name"]
218
+ },
219
+ "output_schema": {
220
+ "type": "object",
221
+ "properties": {
222
+ "as_parent": {
223
+ "type": "array",
224
+ "items": {
225
+ "type": "object",
226
+ "properties": {
227
+ "table": { "type": "string" },
228
+ "column": { "type": "string" },
229
+ "referenced_column": { "type": "string" }
230
+ }
231
+ }
232
+ },
233
+ "as_child": {
234
+ "type": "array",
235
+ "items": {
236
+ "type": "object",
237
+ "properties": {
238
+ "table": { "type": "string" },
239
+ "column": { "type": "string" },
240
+ "referenced_column": { "type": "string" }
241
+ }
242
+ }
243
+ }
244
+ }
245
+ }
246
+ }
247
+ ]
248
248
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@berthojoris/mcp-mysql-server",
3
- "version": "1.2.6",
4
- "description": "Model Context Protocol server for MySQL database integration with dynamic per-project permissions",
3
+ "version": "1.4.1",
4
+ "description": "Model Context Protocol server for MySQL database integration with dynamic per-project permissions and data export capabilities",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "bin": {
@@ -49,6 +49,7 @@
49
49
  "dist",
50
50
  "bin",
51
51
  "README.md",
52
+ "CHANGELOG.md",
52
53
  "LICENSE",
53
54
  "manifest.json"
54
55
  ],