Overview
What is MCP Server for MySQL based on NodeJS?
A Model Context Protocol server that provides access to MySQL databases, enabling LLMs to inspect database schemas and execute SQL queries. It’s designed for developers using AI assistants like Claude or Cursor to interact with MySQL databases.
How to use MCP Server for MySQL based on NodeJS?
Install via npx -y @benborla29/mcp-server-mysql, Smithery, MCP Get, npm/pnpm, or by cloning the repository. Configure environment variables like MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASS, and MYSQL_DB. Use the mysql_query tool to run SQL queries; write operations (INSERT/UPDATE/DELETE) are disabled by default and must be enabled via ALLOW_INSERT_OPERATION, ALLOW_UPDATE_OPERATION, ALLOW_DELETE_OPERATION.
Key features of MCP Server for MySQL based on NodeJS
- Execute SQL queries via the
mysql_querytool. - Enforce read-only operations by default.
- Optional INSERT, UPDATE, DELETE permissions.
- Automatic discovery of table schemas, indexes, constraints.
- Security features: prepared statements, rate limiting, query complexity analysis.
- Performance optimizations: connection pooling, caching, result streaming.
- Monitoring: comprehensive query logging and performance metrics.
Use cases of MCP Server for MySQL based on NodeJS
- Allow an LLM (e.g., Claude) to inspect MySQL database schemas.
- Let an LLM run SQL SELECT queries for data analysis.
- Enable an LLM to insert, update, or delete data when explicitly permitted.
- Integrate with Cursor IDE for database-aware coding assistance.
- Use via Smithery for one-click setup with any compliant client.
FAQ from MCP Server for MySQL based on NodeJS
What are the system requirements?
Node.js v18 or higher and MySQL 5.7 or higher (MySQL 8.0+ recommended). The MySQL user must have appropriate permissions for the operations needed.
Are write operations enabled by default?
No. INSERT, UPDATE, and DELETE operations are disabled by default for security. Set ALLOW_INSERT_OPERATION, ALLOW_UPDATE_OPERATION, or ALLOW_DELETE_OPERATION to "true" to enable them.
How do I install this server?
You can install via npx -y @benborla29/mcp-server-mysql, using Smithery (npx -y @smithery/cli@latest install @benborla29/mcp-server-mysql --client claude), MCP Get, npm/pnpm globally, or by cloning the GitHub repository and building from source.
Does the server support SSL/TLS for database connections?
Yes. Set MYSQL_SSL to "true" in the environment configuration to enable encrypted connections.
How does the server protect against SQL injection?
All queries use prepared statements to prevent SQL injection. Additional security measures include rate limiting, query complexity analysis, and optional query whitelisting/blacklisting.