[BUG] Unable to configure MySQL MCP Server
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Environment:
- Windows 10/11
- WAMP with MySQL 9.1.0
- Claude Code CLI
- Database: Local MySQL on 127.0.0.1:3306
Problem:
Cannot successfully connect any MySQL MCP server to Claude Code. All attempts result in "Failed to reconnect" error.
MCP Packages Tested:
- @liangshanli/mcp-server-mysql (v2.0.1)
- @f4ww4z/mcp-mysql-server (v0.1.0)
Configuration Attempts Made:
- Initial attempt: Connection string format
/mcp add mysql-local mcp-server-mysql mysql://root@127.0.0.1:3306/portalv2
- With credentials:
/mcp add mysql-local mcp-server-mysql mysql://mcp_user:mcp_password@127.0.0.1:3306/portalv2
- Batch wrapper scripts to set environment variables (both packages)
- Project .mcp.json file:
{
"mcpServers": {
"mysql-local": {
"command": "npx",
"args": ["-y", "@f4ww4z/mcp-mysql-server"],
"env": {
"MYSQL_HOST": "127.0.0.1",
"MYSQL_USER": "mcp_user",
"MYSQL_PASSWORD": "mcp_password",
"MYSQL_DATABASE": "portalv2"
}
}
}
}
Verification Done:
- MySQL server confirmed running and accessible
- Created dedicated MySQL user (mcp_user) with proper privileges
- Tested database connection via Laravel (works fine)
- MCP packages confirmed installed globally via npm
What Would Help:
- A working example of MySQL MCP configuration specifically for Claude Code on Windows
- Better error messages from /mcp command (currently just says "Failed to reconnect")
- Documentation on how environment variables should be passed to MCP servers
- Clarification on whether .mcp.json file is automatically detected or needs explicit loading
- Debug mode for MCP connections to see actual connection attempts/errors
Expected Behavior:
After configuration, /mcp should show mysql-local as connected and MCP tools should be available.
Actual Behavior:
All configuration attempts result in "Failed to reconnect to mysql-local" with no additional error details.
What Should Happen?
It should connect successfully to the local MySQL Server.
Error Messages/Logs
Steps to Reproduce
Install any of the packages above on the following environment:
Windows 10/11
WAMP with MySQL 9.1.0
Claude Code CLI
Database: Local MySQL on 127.0.0.1:3306
Configure mcp.json accordingly and try to list the mcp servers installed. It will always fail to connect.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.13
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗