
How to add MySQL MCP Server to Claude Desktop
MCP server for MySQL database operations: query, execute, list and describe tables via prepared statements. Paste the config into ~/Library/Application Support/Claude/claude_desktop_config.json and restart Claude Desktop.
Last updated June 14, 2026 ยท 162โ ยท stdio ยท no auth
Claude Desktop config for MySQL MCP Server
npx @f4ww4z/mcp-mysql-server{
"mcpServers": {
"mysql-mcp-server": {
"command": "npx",
"args": [
"-y",
"@f4ww4z/mcp-mysql-server",
"mysql://user:password@localhost:port/database"
]
}
}
}Setup steps
- 1Open Claude Desktop โ Settings โ Developer โ Edit Config (this opens ~/Library/Application Support/Claude/claude_desktop_config.json).
- 2Paste the MySQL MCP Server config below under the top-level "mcpServers" key.
- 3Fill in any placeholder secrets (API keys, paths) in the snippet.
- 4Save the file, then fully quit and reopen Claude Desktop.
- 5Open a chat and confirm MySQL MCP Server's tools appear under the ๐ tools menu.
Before you start
- Node.js (for npx)
- A reachable MySQL database with valid credentials
What MySQL MCP Server can do in Claude Desktop
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.
Security
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 + Claude Desktop FAQ
Where is the Claude Desktop config file?
Claude Desktop reads MCP servers from ~/Library/Application Support/Claude/claude_desktop_config.json. Paste the MySQL MCP Server config there under the "mcpServers" key and restart the client.
Is MySQL MCP Server safe to use with Claude Desktop?
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.
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.