[BUG] Unable to configure MySQL MCP Server

Resolved 💬 3 comments Opened Oct 9, 2025 by paulohgo Closed Oct 13, 2025

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:

  1. @liangshanli/mcp-server-mysql (v2.0.1)
  2. @f4ww4z/mcp-mysql-server (v0.1.0)

Configuration Attempts Made:

  1. Initial attempt: Connection string format

/mcp add mysql-local mcp-server-mysql mysql://root@127.0.0.1:3306/portalv2

  1. With credentials:

/mcp add mysql-local mcp-server-mysql mysql://mcp_user:mcp_password@127.0.0.1:3306/portalv2

  1. Batch wrapper scripts to set environment variables (both packages)
  2. 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:

  1. A working example of MySQL MCP configuration specifically for Claude Code on Windows
  2. Better error messages from /mcp command (currently just says "Failed to reconnect")
  3. Documentation on how environment variables should be passed to MCP servers
  4. Clarification on whether .mcp.json file is automatically detected or needs explicit loading
  5. 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_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗