A Model Context Protocol (MCP) server for MySQL, designed to integrate AI assistants like Claude Desktop, Cursor, Cline, and Windsurf with MySQL 8+ databases. Version 1.0.1 provides tools for safe SQL querying, transactional execution, and schema inspection. It automatically connects on startup using environment variables, uses a connection pool via mysql2 with auto-reconnect, enforces SQL safety by blocking DROP/TRUNCATE/ALTER operations, requiring WHERE clauses for UPDATE/DELETE, limiting queries to 200 rows, and wrapping writes in transactions. Ships TypeScript types. Requires Node >=20.0.0.
npm install mysql-mcp-xNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to configure mysql-mcp-x as an MCP server in Claude Desktop with environment variables for database connection.
Upgrade Node.js to v20 or later.
Specify LIMIT in your SQL to override the default.
Use execute only for DML (INSERT/UPDATE/DELETE); for DDL, use a direct MySQL client.
Set environment variables (MYSQL_HOST, MYSQL_USER, etc.) before starting the server.
Use a MySQL client (e.g., mysql CLI) to execute such commands.
Always include a WHERE clause in UPDATE/DELETE statements.
Run 'npx -y mysql-mcp-x' or install globally with 'npm install -g mysql-mcp-x'
Ensure Node >=20 and mysql2 is up-to-date; alternatively, alter MySQL user to mysql_native_password (not recommended).
Use a direct MySQL client to execute these statements.
Add a WHERE clause to your UPDATE or DELETE statement.
Use 'npx mysql-mcp-x' or the MCP server configuration instead of importing.