
MySQL MCP Server
MCP server for MySQL database operations: query, execute, list and describe tables via prepared statements.
Add to your client
Copy the config for your MCP client and paste it into its config file.
npx @f4ww4z/mcp-mysql-serverPaste into ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"mysql-mcp-server": {
"command": "npx",
"args": [
"-y",
"@f4ww4z/mcp-mysql-server",
"mysql://user:password@localhost:port/database"
]
}
}
}Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf
Before you start
- Node.js (for npx)
- A reachable MySQL database with valid credentials
About MySQL MCP Server
A Model Context Protocol server that provides MySQL database operations, enabling AI models to interact with MySQL databases through a standardized interface. It supports secure connection handling with automatic cleanup, prepared statement support for query parameters, comprehensive error handling and validation, and automatic connection management. Credentials can be passed either as a MySQL connection URL argument or through MYSQL_HOST/MYSQL_USER/MYSQL_PASSWORD/MYSQL_DATABASE environment variables.
Tools & capabilities (5)
connect_dbEstablish connection to MySQL database using provided credentials (host, user, password, database).
queryExecute SELECT queries with optional prepared statement parameters.
executeExecute INSERT, UPDATE, or DELETE queries with optional prepared statement parameters.
list_tablesList all tables in the connected database.
describe_tableGet the structure of a specific table.
What this server can do
MySQL MCP Server provides tools for these capabilities — tap one to see every MCP server that does the same:
When to use it
- Let an AI assistant inspect a MySQL schema by listing and describing tables.
- Run parameterized SELECT queries against a MySQL database from an AI client.
- Perform INSERT/UPDATE/DELETE operations on MySQL data through prepared statements.
- Explore and prototype against a live MySQL database during development.
Security notes
Uses prepared statements to prevent SQL injection and validates queries before execution. Supports secure password handling through environment variables and automatically closes connections when done.
MySQL MCP Server FAQ
How do I provide database credentials?
Either pass a MySQL connection URL (mysql://user:password@host:port/database) as an argument in the args array, or set the MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, and MYSQL_DATABASE environment variables in your MCP settings.
Does it protect against SQL injection?
Yes. The server uses prepared statements for query parameters and validates queries before execution.
How do I install it for Claude Desktop?
You can install it automatically via Smithery with: npx -y @smithery/cli install @f4ww4z/mcp-mysql-server --client claude, or configure it manually with npx @f4ww4z/mcp-mysql-server.
Alternatives to MySQL MCP Server
Compare all alternatives →Google's official MCP server with prebuilt BigQuery tools, querying datasets via Application Default Credentials.
Read/write Postgres access plus index tuning, EXPLAIN plans, and database health analysis for AI agents.
Official Supabase server: manage tables, run SQL, branches, configs and edge functions from your AI client.
Compare MySQL MCP Server with: