
How to add MySQL MCP Server to Windsurf
MCP server for MySQL database operations: query, execute, list and describe tables via prepared statements. Paste the config into ~/.codeium/windsurf/mcp_config.json and restart Windsurf.
Last updated June 14, 2026 · 162★ · stdio · no auth
Windsurf 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 Windsurf → Cascade → the hammer/MCP icon → Configure (or edit ~/.codeium/windsurf/mcp_config.json).
- 2Paste the MySQL MCP Server config below.
- 3Fill in placeholder secrets, then save.
- 4Click Refresh in the MCP panel.
- 5MySQL MCP Server's tools become available to Cascade.
Before you start
- Node.js (for npx)
- A reachable MySQL database with valid credentials
What MySQL MCP Server can do in Windsurf
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 + Windsurf FAQ
Where is the Windsurf config file?
Windsurf reads MCP servers from ~/.codeium/windsurf/mcp_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 Windsurf?
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.