Dive icon indicating copy to clipboard operation
Dive copied to clipboard

[Bug] Docker MCP Toolkit support not working

Open ww2283 opened this issue 1 year ago • 5 comments

with Docker MCP Toolkit, it should be straightforward . However, the following settings does not work:

{
  "mcpServers": {
    "MCP_DOCKER": {
      "transport": "stdio",
      "enabled": true,
      "command": "docker",
      "args": [
        "mcp",
        "gateway",
        "run"
      ],
      "env": {},
      "url": null,
      "extraData": null,
      "proxy": null,
      "headers": null,
      "exclude_tools": []
    }
  }
}

Following is the message:

| dive_mcp_host.host.errors.McpSessionGroupError: Client initialization error for MCP_DOCKER: (ExceptionGroup('unhandled errors in a TaskGroup', [TimeoutError()]),) (1 sub-exception) +-+---------------- 1 ---------------- | Exception Group Traceback (most recent call last): | File "/Applications/Dive.app/Contents/Resources/python/lib/python3.12/site-packages/dive_mcp_host/host/tools/hack/stdio_server.py", line 154, in stdio_client | yield read_stream, write_stream, process.pid | File "/Applications/Dive.app/Contents/Resources/python/lib/python3.12/site-packages/dive_mcp_host/host/tools/mcp_server.py", line 452, in _stdio_client_watcher | ClientSession( | File "/Applications/Dive.app/Contents/Resources/python/lib/python3.12/site-packages/mcp/shared/session.py", line 218, in __aexit__ | return await self._task_group.__aexit__(exc_type, exc_val, exc_tb) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/Applications/Dive.app/Contents/Resources/python/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 772, in __aexit__ | raise BaseExceptionGroup( | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) +-+---------------- 1 ---------------- | Traceback (most recent call last): | File "/Applications/Dive.app/Contents/Resources/python/lib/python3.12/site-packages/anyio/streams/memory.py", line 111, in receive | return self.receive_nowait() | ^^^^^^^^^^^^^^^^^^^^^ | File "/Applications/Dive.app/Contents/Resources/python/lib/python3.12/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 "/Applications/Dive.app/Contents/Resources/python/lib/python3.12/site-packages/dive_mcp_host/host/tools/mcp_server.py", line 219, in _init_tool_info | self._initialize_result = await session.initialize() | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/Applications/Dive.app/Contents/Resources/python/lib/python3.12/site-packages/mcp/client/session.py", line 123, in initialize | result = await self.send_request( | ^^^^^^^^^^^^^^^^^^^^^^^^ | File "/Applications/Dive.app/Contents/Resources/python/lib/python3.12/site-packages/mcp/shared/session.py", line 272, in send_request | response_or_error = await response_stream_reader.receive() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/Applications/Dive.app/Contents/Resources/python/lib/python3.12/site-packages/anyio/streams/memory.py", line 119, in receive | await receive_event.wait() | File "/Applications/Dive.app/Contents/Resources/python/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 1774, in wait | await self._event.wait() | File "/Applications/Dive.app/Contents/Resources/python/lib/python3.12/asyncio/locks.py", line 212, in wait | await fut | asyncio.exceptions.CancelledError | | The above exception was the direct cause of the following exception: | | Traceback (most recent call last): | File "/Applications/Dive.app/Contents/Resources/python/lib/python3.12/site-packages/dive_mcp_host/host/tools/mcp_server.py", line 458, in _stdio_client_watcher | await self._init_tool_info(session) | File "/Applications/Dive.app/Contents/Resources/python/lib/python3.12/site-packages/dive_mcp_host/host/tools/mcp_server.py", line 217, in _init_tool_info | async with asyncio.timeout(10): | ^^^^^^^^^^^^^^^^^^^ | File "/Applications/Dive.app/Contents/Resources/python/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__ | raise TimeoutError from exc_val | TimeoutError +------------------------------------

ww2283 avatar Aug 03 '25 02:08 ww2283

Thanks for the report!

This looks like the same timeout issue as #209. The current timeout in Dive MCP Host is too short for Docker MCP Toolkit initialization.

We'll fix this in the next release by either increasing the default timeout or adding a configurable timeout option for MCP servers that need a longer init time.

Will update this issue when the fix is ready.

kevinwatt avatar Aug 04 '25 05:08 kevinwatt

thx and looking forward to the development! additionally , I tried to implement a longer timeout but failed to work at this moment:

{
  "mcpServers": {
    "MCP_DOCKER": {
      "transport": "stdio",
      "enabled": true,
      "command": "docker",
      "args": [
        "mcp",
        "gateway",
        "run"
      ],
      "env": {
        "init_timeout_seconds": "60"
      },
      "url": null,
      "extraData": null,
      "proxy": null,
      "headers": null,
      "exclude_tools": []
    }
  }
}

ww2283 avatar Aug 04 '25 12:08 ww2283

Haha, it's not working like that. We need to add this timeout value and send it back to the MCP Host. Let it handle the timeout value. Please wait, we will release it very soon.

kevinwatt avatar Aug 06 '25 10:08 kevinwatt

A field for setting the timeout has been added in version 0.9.1.

johnfunmula avatar Aug 08 '25 07:08 johnfunmula

I confirm the timeout issue is solved but here comes a new type of issue:

Error in query, type: BadRequestError, content: Error code: 400 - {'error': {'message': "Invalid 'tools': array too long. Expected an array with maximum length 128, but got an array with length 198 instead.", 'type': 'invalid_request_error', 'param': 'tools', 'code': 'array_above_max_length'}}

This is what happens when I use o4-mini from OpenAI. I believe this may have to do with how many tools are registered. My docker mcp gateway has 160 tools, plus some other mcp servers, it could be that the total is exceeding this 128 limit. Add: I confirm this is the case. I removed some tools to be under 128, then OpenAI works without issue. Though, o4-mini does not have tool calling capability it seems.

When I use the ModelScope hosted qwen3-235B-A22B-2507-Instruct, then the error is different:

<thread-query-error>Error in query, type: BadRequestError, content: Error code: 400 - {'error': {'code': 'invalid_parameter_error', 'message': '<400> InternalError.Algo.InvalidParameter: Tool names are not allowed to be [search]', 'param': None, 'type': 'invalid_request_error'}, 'request_id': 'b921da53-443a-464d-8757-2ebb3d398c2e'}</thread-query-error>

This error I don't understand from my end.

ww2283 avatar Aug 09 '25 18:08 ww2283