MySQL Legacy MCP

v0.2.1
io.github.Rufflet/mysql-legacy-mcp Checked 2 days ago Published 2 months ago

Inspect and query MySQL 5.0–5.6; opt-in INSERT/UPDATE/DELETE/DDL.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

mysql_legacy_ping

Checks the MySQL connection with SELECT VERSION() AS version and returns {connected, version}. Call this first after connecting. For schema use mysql_legacy_list_tables; for row data use mysql_legacy_select.

mysql_legacy_select

Runs exactly one SELECT supplied in sql. Rejects SELECT INTO and locking reads; truncates by MYSQL_LEGACY_MAX_ROWS and MYSQL_LEGACY_MAX_RESULT_BYTES. On MySQL 5.6.5+ wraps in START TRANSACTION READ ONLY unless MYSQL_LEGACY_DISABLE_READ_ONLY_TRANSACTIONS=true. For columns use mysql_legacy_describe_table; for CREATE TABLE text use mysql_legacy_show_create_table; for writes use mysql_legacy_insert, mysql_legacy_update, or mysql_legacy_delete.

ParameterTypeDescription
sql *stringOne MySQL 5.1-compatible SELECT statement.

mysql_legacy_insert

Runs exactly one INSERT supplied in sql. Off unless MYSQL_LEGACY_ALLOW_INSERT=true. Returns insertId and affectedRows. INSERT ... ON DUPLICATE KEY UPDATE is accepted and can overwrite existing rows. For UPDATE/DELETE/DDL use mysql_legacy_update, mysql_legacy_delete, or mysql_legacy_ddl.

ParameterTypeDescription
sql *stringOne MySQL INSERT statement.

mysql_legacy_update

Runs exactly one UPDATE supplied in sql. WHERE is required and cannot be disabled. Off unless MYSQL_LEGACY_ALLOW_UPDATE=true. Returns affectedRows and changedRows. To empty a table use TRUNCATE via mysql_legacy_ddl, not a WHERE-less UPDATE.

ParameterTypeDescription
sql *stringOne MySQL UPDATE statement with a WHERE clause.

mysql_legacy_delete

Runs exactly one DELETE supplied in sql. WHERE is required and cannot be disabled. Off unless MYSQL_LEGACY_ALLOW_DELETE=true. Returns affectedRows. To empty a table use TRUNCATE via mysql_legacy_ddl, not a WHERE-less DELETE.

ParameterTypeDescription
sql *stringOne MySQL DELETE statement with a WHERE clause.

mysql_legacy_ddl

Runs exactly one table-level CREATE, ALTER, DROP, TRUNCATE, or RENAME supplied in sql. Off unless MYSQL_LEGACY_ALLOW_DDL=true. DROP and TRUNCATE are irreversible. Rejects DROP DATABASE, views, and indexes. For row changes use mysql_legacy_insert, mysql_legacy_update, or mysql_legacy_delete.

ParameterTypeDescription
sql *stringOne MySQL table-level DDL statement: CREATE/ALTER/DROP/TRUNCATE/RENAME TABLE.

mysql_legacy_list_databases

Lists database names via SHOW DATABASES. Hides mysql and information_schema unless include_system_databases=true (or MYSQL_LEGACY_HIDE_SYSTEM_DATABASES=false). Then pass a name to mysql_legacy_list_tables. Does not list tables or columns.

ParameterTypeDescription
include_system_databasesbooleanWhen true, include mysql and information_schema for this call. Overrides MYSQL_LEGACY_HIDE_SYSTEM_DATABASES.

mysql_legacy_list_tables

Lists base tables and views in one database via SHOW FULL TABLES FROM database. Pass database. For column types use mysql_legacy_describe_table; for CREATE TABLE text use mysql_legacy_show_create_table; for keys use mysql_legacy_list_indexes. To list databases first, use mysql_legacy_list_databases.

ParameterTypeDescription
database *stringMySQL database name, 1–64 characters.

mysql_legacy_describe_table

Lists columns for database.table via SHOW FULL COLUMNS, including type, nullability, keys, comments, and collation. Use this for per-column metadata. For the full CREATE TABLE text and default charset use mysql_legacy_show_create_table. For index column order use mysql_legacy_list_indexes.

ParameterTypeDescription
database *stringMySQL database name, 1–64 characters.
table *stringMySQL table or view name, 1–64 characters.

mysql_legacy_show_create_table

Returns SHOW CREATE TABLE for database.table plus the parsed default charset. Use this for DDL text. For per-column types and collation use mysql_legacy_describe_table. For unique/non-unique keys use mysql_legacy_list_indexes.

ParameterTypeDescription
database *stringMySQL database name, 1–64 characters.
table *stringMySQL table or view name, 1–64 characters.

mysql_legacy_list_indexes

Lists indexes for database.table via SHOW INDEX (key name, columns, uniqueness, type). Use this for keys. For column types use mysql_legacy_describe_table; for full DDL use mysql_legacy_show_create_table.

ParameterTypeDescription
database *stringMySQL database name, 1–64 characters.
table *stringMySQL table or view name, 1–64 characters.