mysql_mcp_server icon indicating copy to clipboard operation
mysql_mcp_server copied to clipboard

My mcp-mysql-server seems not run rightly

Open miaojincs opened this issue 9 months ago • 1 comments

enviroment

sys: windows 11, mysql : 8.0.42 python : conda base: Python 3.12.2 use: vscode + cline

my config

{
  "mcpServers": {
    "amap-maps": {
      "autoApprove": [],
      "disabled": false,
      "timeout": 60,
      "command": "cmd",
      "args": [
        "/c",
        "npx",
        "-y",
        "@amap/amap-maps-mcp-server"
      ],
      "env": {
        "AMAP_MAPS_API_KEY": ""
      },
      "transportType": "stdio"
    },
    "mysql": {
      "disabled": false,
      "timeout": 60,
      "command": "uvx",
      "args": [
        "--from",
        "mysql-mcp-server",
        "mysql_mcp_server"
      ],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root",
        "MYSQL_PASSWORD": "123456",
        "MYSQL_DATABASE": "test"
      },
      "transportType": "stdio"
    }
  }
}

i use powershell run command :

uvx --from mysql-mcp-server mysql_mcp_server --debug --verbose

this is the logs,and long time without response

Image

if i interrupt previous command

Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\uv\cache\archive-v0\9sSZ4V3IwvttpWcx5F4PT\Lib\site-packages\anyio\streams\memory.py", line 111, in receive
    return self.receive_nowait()
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\uv\cache\archive-v0\9sSZ4V3IwvttpWcx5F4PT\Lib\site-packages\anyio\streams\memory.py", line 106, in receive_nowait
    raise WouldBlock
anyio.WouldBlock

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\environment\miniconda\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\environment\miniconda\Lib\asyncio\base_events.py", line 685, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\uv\cache\archive-v0\9sSZ4V3IwvttpWcx5F4PT\Lib\site-packages\mysql_mcp_server\server.py", line 172, in main
    await app.run(
  File "C:\Users\user\AppData\Local\uv\cache\archive-v0\9sSZ4V3IwvttpWcx5F4PT\Lib\site-packages\mcp\server\lowlevel\server.py", line 495, in run
(base)     async with AsyncExitStack() as stack:
  File "D:\environment\miniconda\Lib\contextlib.py", line 754, in __aexit__
PS E:\mcp\mysql_mcp_server-main>     raise exc_details[1]
  File "D:\environment\miniconda\Lib\contextlib.py", line 737, in __aexit__
    cb_suppress = await cb(*exc_details)
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\uv\cache\archive-v0\9sSZ4V3IwvttpWcx5F4PT\Lib\site-packages\mcp\shared\session.py", line 220, in __aexit__
    return await self._task_group.__aexit__(exc_type, exc_val, exc_tb)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\uv\cache\archive-v0\9sSZ4V3IwvttpWcx5F4PT\Lib\site-packages\anyio\_backends\_asyncio.py", line 776, in __aexit__
    raise exc_val
  File "C:\Users\user\AppData\Local\uv\cache\archive-v0\9sSZ4V3IwvttpWcx5F4PT\Lib\site-packages\mcp\server\lowlevel\server.py", line 506, in run
    async with anyio.create_task_group() as tg:
  File "C:\Users\user\AppData\Local\uv\cache\archive-v0\9sSZ4V3IwvttpWcx5F4PT\Lib\site-packages\anyio\_backends\_asyncio.py", line 776, in __aexit__
    raise exc_val
  File "C:\Users\user\AppData\Local\uv\cache\archive-v0\9sSZ4V3IwvttpWcx5F4PT\Lib\site-packages\mcp\server\lowlevel\server.py", line 507, in run
    async for message in session.incoming_messages:
  File "C:\Users\user\AppData\Local\uv\cache\archive-v0\9sSZ4V3IwvttpWcx5F4PT\Lib\site-packages\anyio\abc\_streams.py", line 35, in __anext__
    return await self.receive()
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\uv\cache\archive-v0\9sSZ4V3IwvttpWcx5F4PT\Lib\site-packages\anyio\streams\memory.py", line 119, in receive
    await receive_event.wait()
  File "C:\Users\user\AppData\Local\uv\cache\archive-v0\9sSZ4V3IwvttpWcx5F4PT\Lib\site-packages\anyio\_backends\_asyncio.py", line 1774, in wait
    await self._event.wait()
  File "D:\environment\miniconda\Lib\asyncio\locks.py", line 212, in wait
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\user\AppData\Local\uv\cache\archive-v0\9sSZ4V3IwvttpWcx5F4PT\Scripts\mysql_mcp_server.exe\__main__.py", line 10, in <module>
  File "C:\Users\user\AppData\Local\uv\cache\archive-v0\9sSZ4V3IwvttpWcx5F4PT\Lib\site-packages\mysql_mcp_server\__init__.py", line 6, in main
    asyncio.run(server.main())
  File "D:\environment\miniconda\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "D:\environment\miniconda\Lib\asyncio\runners.py", line 123, in run
    raise KeyboardInterrupt()
KeyboardInterrupt

miaojincs avatar May 19 '25 10:05 miaojincs

You could try creating a permissive username other than root with a password. It might also help to test your MySQL server with another client first.

The MCP Inspector provides a convenient way to test and debug the MCP itself.

designcomputer avatar May 30 '25 20:05 designcomputer