MCP Server for MySQL based on NodeJS
Overview
MCP Server for MySQL is a Model Context Protocol server that provides read-only access to MySQL databases, enabling LLMs to inspect database schemas and execute read-only queries.
To use the MCP Server, you can install it via Smithery, MCP Get, or manually using npm/pnpm. After installation, configure your LLM application to connect to the MCP server using your MySQL connection details.
- Execute read-only SQL queries securely. - Provides comprehensive database information including table schemas and statistics. - Security features like SQL injection prevention and query whitelisting. - Performance optimizations such as connection pooling and query result caching. - Monitoring and debugging tools for query logging and performance metrics.
- Allowing LLMs to query MySQL databases without write access.
- Providing a secure interface for data analysis and reporting.
- Enabling developers to build applications that require read-only access to database information.
Add to your AI client
Use these steps to connect MCP Server for MySQL based on NodeJS 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": {
"mcp-server-mysql-zhaoxin34": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-mysql-zhaoxin34"
]
}
}
}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": {
"mcp-server-mysql-zhaoxin34": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-mysql-zhaoxin34"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"mcp-server-mysql-zhaoxin34": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-mysql-zhaoxin34"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"mcp-server-mysql-zhaoxin34": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-mysql-zhaoxin34"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"mcp-server-mysql-zhaoxin34": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-mysql-zhaoxin34"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"mcp-server-mysql-zhaoxin34": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-mysql-zhaoxin34"
]
}
}
}FAQ
Can I use MCP Server for write operations?
No, the MCP Server is designed for read-only access to ensure data integrity.
How do I troubleshoot connection issues?
Verify your MySQL server is running, check credentials, and ensure SSL/TLS settings are correct.
Is there a way to monitor query performance?
Yes, the server includes comprehensive query logging and performance metrics collection.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":3256,"uuid":"f317e513-6b7c-4a5f-8377-889949f45b85","name":"mcp-server-mysql","title":"MCP Server for MySQL based on NodeJS","description":"","avatar_url":"https://avatars.githubusercontent.com/u/11487192?v=4","created_at":"2025-03-18T12:05:06.940Z","updated_at":"2025-03-18T14:08:04.960Z","status":"created","author_name":"zhaoxin34","author_avatar_url":"https://avatars.githubusercontent.com/u/11487192?v=4","tags":"[]","category":"developer-tools","is_featured":false,"sort":1,"url":"https://github.com/zhaoxin34/mcp-server-mysql","target":"_self","content":"$29","summary":"$2a","img_url":"https://camo.githubusercontent.com/63018550e894ba17849267881248eb5a28c3f9a6b105a3aaee64033f4c96ad82/68747470733a2f2f736d6974686572792e61692f62616467652f4062656e626f726c6132392f6d63702d7365727665722d6d7973716c","type":null,"metadata":"{\"star\":\"0\",\"license\":\"MIT license\",\"language\":\"TypeScript\",\"is_official\":false,\"latest_commit_time\":\"2025-04-02 14:46:12\"}","user_uuid":null,"tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]