Skip to content

Recent changes in asyncmy break MariaDB MCP #61

Description

@ekopari

Recent commits in asyncmy (https://github.com/long2ice/asyncmy/commits/main) have changed internal connection fields accessed by MariaDB MCP. The MCP server starts up, but any tool call generates the following exception:

ERROR - Unexpected error during query execution (Connection: not acquired): 'SafeConnection' object has no attribute '_reader'
Traceback (most recent call last):
  File "/home/user/mariadb-mcp/src/server.py", line 259, in _execute_query
    async with self.pool.acquire() as conn:
  File "/home/user/mariadb-mcp/.venv/lib/python3.11/site-packages/asyncmy/contexts.py", line 75, in __aenter__
    self._conn = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "asyncmy/pool.pyx", line 118, in _acquire
  File "asyncmy/pool.pyx", line 120, in asyncmy.pool.Pool._acquire
  File "/home/user/mariadb-mcp/src/custom_connection.py", line 72, in fill_free_pool
    if conn._reader.at_eof() or conn._reader.exception():
       ^^^^^^^^^^^^
AttributeError: 'SafeConnection' object has no attribute '_reader'
2026-08-07 12:07:48,816 - config - ERROR - TOOL ERROR: list_databases failed: An unexpected error occurred: 'SafeConnection' object has no attribute '_reader'
Traceback (most recent call last):
  File "/home/user/mariadb-mcp/src/server.py", line 259, in _execute_query
    async with self.pool.acquire() as conn:
  File "/home/user/mariadb-mcp/.venv/lib/python3.11/site-packages/asyncmy/contexts.py", line 75, in __aenter__
    self._conn = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "asyncmy/pool.pyx", line 118, in _acquire
  File "asyncmy/pool.pyx", line 120, in asyncmy.pool.Pool._acquire
  File "/home/user/mariadb-mcp/src/custom_connection.py", line 72, in fill_free_pool
    if conn._reader.at_eof() or conn._reader.exception():
       ^^^^^^^^^^^^
AttributeError: 'SafeConnection' object has no attribute '_reader'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user/mariadb-mcp/src/server.py", line 379, in list_databases
    results = await self._execute_query(sql)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/mariadb-mcp/src/server.py", line 295, in _execute_query
    raise RuntimeError(f"An unexpected error occurred: {e}") from e

I can confirm that downgrading asyncmy to 0.2.11 "solves" the problem, so the issue must be caused by recent changes to asyncmy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions