Skip to content

[Bug]: Not working with any streamableHttp MCP servers #67

@boris7776

Description

@boris7776

What happened?

I was doing a small agent when I run it I got this error. I tried it in different OS (Debian, Ubuntu), I tried more MCP servers that were working with other MCP host.

Version check

  • Yes I was.

Relevant log output

# nerve run agent.yml 
[08-29-25 16:23:36] INFO 🧠 nerve v1.8.0
[08-29-25 16:23:37] INFO 🧰 importing 14 tools from MCP server filesystem
Task exception was never retrieved
future: <Task finished name='Task-10' coro=<<async_generator_athrow without __name__>()> exception=SystemExit(0)>
Traceback (most recent call last):
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/nerve/cli/run.py", line 83, in _run
    actors=[await Agent.create_from_file(args.generator, args.input_path, args.conversation_strategy)],
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/nerve/runtime/agent.py", line 102, in create_from_file
    return await cls.create(
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/nerve/runtime/agent.py", line 74, in create
    runtime = await Runtime.build(
              ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/nerve/runtime/__init__.py", line 77, in build
    server_tools = await mcp_compiler.get_tools_from_mcp(name, server, working_dir=working_dir)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/nerve/tools/mcp/compiler.py", line 129, in get_tools_from_mcp
    mpc_tools = await client.tools()
                ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/nerve/tools/mcp/client.py", line 154, in tools
    await self.connect()
  File "/usr/local/lib/python3.11/dist-packages/nerve/tools/mcp/client.py", line 126, in connect
    self._read_stream, self._write_stream = await self._exit_stack.enter_async_context(self._client_context)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/nerve/tools/mcp/client.py", line 86, in _safe_stdio_context
    async with stdio_client(server=self.server_params, errlog=sys.stderr) as (read_stream, write_stream):
  File "/usr/lib/python3.11/contextlib.py", line 211, in __aexit__
    await anext(self.gen)
RuntimeError: anext(): asynchronous generator is already running

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/typer/main.py", line 323, in __call__
    return get_command(self)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/typer/core.py", line 740, in main
    return _main(
           ^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/typer/core.py", line 195, in _main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/typer/main.py", line 698, in wrapper
    return callback(**use_params)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 3, in func
  File "/usr/local/lib/python3.11/dist-packages/nerve/cli/run.py", line 38, in run
    asyncio.run(
  File "/usr/lib/python3.11/asyncio/runners.py", line 189, in run
    with Runner(debug=debug) as runner:
  File "/usr/lib/python3.11/asyncio/runners.py", line 63, in __exit__
    self.close()
  File "/usr/lib/python3.11/asyncio/runners.py", line 72, in close
    loop.run_until_complete(loop.shutdown_asyncgens())
  File "/usr/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
    self._run_once()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
    handle._run()
  File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.11/dist-packages/nerve/tools/mcp/client.py", line 98, in _safe_stdio_context
    exit(0)
  File "<frozen _sitebuiltins>", line 26, in __call__
SystemExit: 0
Exception ignored in: <async_generator object stdio_client at 0x7f21f6b22a40>
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/mcp/client/stdio/__init__.py", line 180, in stdio_client
    async with (
  File "/usr/local/lib/python3.11/dist-packages/anyio/_backends/_asyncio.py", line 736, in __aexit__
    loop = get_running_loop()
           ^^^^^^^^^^^^^^^^^^
RuntimeError: no running event loop

Relevant screenshots (optional)

agent.yml:
`root@debian:~/new-agent# cat agent.yml
agent: You are a helpful assistant!
task: Ask something...
using:

  • task
  • reasoning

mcp:
filesystem:
command: npx
args: ["-y", "@modelcontextprotocol/server-filesystem", "."]

github:
url: stream://fleet-mcp-github.ai.svc.cluster.local:8000/mcp`

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions