I don't understand

I tried giving my agent a mcp tool following the official documentation and got this :

"passing MCP servers to AgentSession or Agent is deprecated and will be removed in a future version. Use MCPToolset instead. "

Which is weird because I don’t see it anywhere. So for a few minutes the agent didn’t talk and I got this error before it started talking : Exception Group Traceback (most recent call last):
| File “C:\Users\ndoum\AppData\Roaming\Python\Python313\site-packages\livekit\agents\utils\log.py”, line 17, in async_fn_logs
| return await fn(*args, **kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File “C:\Users\ndoum\AppData\Roaming\Python\Python313\site-packages\livekit\agents\voice\agent_activity.py”, line 602, in _setup_toolset
| await toolset.setup()
| File “C:\Users\ndoum\AppData\Roaming\Python\Python313\site-packages\livekit\agents\llm\mcp.py”, line 407, in setup
| await self._mcp_server.initialize()
| File “C:\Users\ndoum\AppData\Roaming\Python\Python313\site-packages\livekit\agents\llm\mcp.py”, line 100, in initialize
| streams = await self._exit_stack.enter_async_context(self.client_streams())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File “C:\Python313\Lib\contextlib.py”, line 668, in enter_async_context
| result = await _enter(cm)
| ^^^^^^^^^^^^^^^^
| File “C:\Python313\Lib\contextlib.py”, line 214, in aenter
| return await anext(self.gen)
| ^^^^^^^^^^^^^^^^^^^^^
| File “C:\Users\ndoum\AppData\Roaming\Python\Python313\site-packages\mcp\client\sse.py”, line 63, in sse_client
| async with anyio.create_task_group() as tg:
| ~~~~~~~~~~~~~~~~~~~~~~~^^
| File “C:\Users\ndoum\AppData\Roaming\Python\Python313\site-packages\anyio_backends_asyncio.py”, line 781, in aexit
| raise BaseExceptionGroup(
| “unhandled errors in a TaskGroup”, self._exceptions
| ) from None
| ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
±±--------------- 1 ----------------
| Traceback (most recent call last):
| File “C:\Users\ndoum\AppData\Roaming\Python\Python313\site-packages\mcp\client\sse.py”, line 154, in sse_client
| endpoint_url = await tg.start(sse_reader)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
| File “C:\Users\ndoum\AppData\Roaming\Python\Python313\site-packages\anyio_backends_asyncio.py”, line 907, in start
| return await future
| ^^^^^^^^^^^^
| RuntimeError: Child exited without calling task_status.started()
±-----------------------------------

here is how I initiated the mcp server :

async def my_agent(ctx: agents.JobContext):

token = os.environ.get("ZAPIER_TOKEN")

zapier_url = f"https://mcp.zapier.com/api/v1/connect?token={token}"



mcp_server = mcp.MCPServerHTTP(

    url=zapier_url,

    transport_type="sse"

)



session = AgentSession(

    mcp_servers=\[mcp_server\],

    llm=openai.realtime.RealtimeModel(

        voice="coral",

        turn_detection=TurnDetection(

            type="semantic_vad"

        )

    )

)

You need to use MCPToolset, not mcp_servers.

The LiveKit current MCP reference shows that MCPToolset(id, mcp_server) is the wrapper that exposes MCP tools to the agent, while MCPServerHTTP is only the servers connection object. Also note that SSE is being deprecated in favor of streamable HTTP.

Your crash is from::

transport_type="sse"

That traceback means the SSE client started, but the child reader exited before it successfully produced the MCP endpoint session. Check:

token = os.environ.get("ZAPIER_TOKEN")
if not token:
    raise RuntimeError("ZAPIER_TOKEN is not set")

Try switching to MCPToolset, try transport_type="streamable_http", and increase the timeout.

Hope it helps.

It is in the reference, but it is missing from the documentation. Sorry about the confusion, the documentation will be updated in the next few days.

Switching to MCPToolset is a good idea, livekit.agents.llm.mcp API documentation , but it feels like the root cause of your issue will be something else (as stated in the above answer)