MySQL MCP Server
A Model Context Protocol (MCP) server that enables secure interaction with MySQL databases
Overview
MySQL MCP Server is a Model Context Protocol (MCP) server that enables secure interaction with MySQL databases, allowing AI assistants to list tables, read data, and execute SQL queries through a controlled interface.
To use the MySQL MCP Server, clone the repository, install dependencies, configure the environment variables for database access, and run the server using PHP.
- List available MySQL tables as resources - Read table contents - Execute SQL queries with proper error handling - Secure database access through environment variables - Comprehensive logging
- Securely interacting with MySQL databases for data analysis.
- Allowing AI assistants to perform database operations safely.
- Enabling structured database exploration for developers.
Add to your AI client
Use these steps to connect MySQL MCP Server in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"mysql-mcp-server-he426100": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mysql-mcp-server-he426100"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"mysql-mcp-server-he426100": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mysql-mcp-server-he426100"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"mysql-mcp-server-he426100": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mysql-mcp-server-he426100"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"mysql-mcp-server-he426100": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mysql-mcp-server-he426100"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"mysql-mcp-server-he426100": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mysql-mcp-server-he426100"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"mysql-mcp-server-he426100": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mysql-mcp-server-he426100"
]
}
}
}FAQ
Is MySQL MCP Server secure?
Yes! It is designed with security best practices, including minimal permissions and logging.
How do I configure the server?
Set the required environment variables for database access before running the server.
Can I use it for production?
Yes, but ensure to follow security best practices and restrict database access.