MySQL Database Access MCP Server
Overview
MySQL Database Access MCP Server is a tool that provides read-only access to MySQL databases, allowing users to interact with their databases securely and efficiently.
To use the server, you need to build it, configure the necessary environment variables, and add it to your MCP settings. Once set up, you can use various tools to list databases, tables, and execute read-only SQL queries.
- Read-only access to MySQL databases - Query validation to prevent SQL injection - Query timeout to manage resource consumption - Row limit to prevent excessive data return
- Listing available databases for analysis.
- Describing table schemas for documentation.
- Executing read-only queries for reporting purposes.
Add to your AI client
Use these steps to connect MySQL Database Access 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-dpflucas": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mysql-mcp-server-dpflucas"
]
}
}
}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-dpflucas": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mysql-mcp-server-dpflucas"
]
}
}
}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-dpflucas": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mysql-mcp-server-dpflucas"
]
}
}
}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-dpflucas": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mysql-mcp-server-dpflucas"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"mysql-mcp-server-dpflucas": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mysql-mcp-server-dpflucas"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"mysql-mcp-server-dpflucas": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mysql-mcp-server-dpflucas"
]
}
}
}FAQ
Can I modify data using this server?
No, this server only allows read-only operations to ensure data integrity.
How do I set up the server?
Follow the installation instructions provided in the documentation to build and configure the server.
What types of queries can I execute?
You can execute SELECT, SHOW, DESCRIBE, and EXPLAIN statements only.