This message was deleted.
# ask-ai
s
This message was deleted.
t
Thanks for reaching out, Swayam. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m looking at the logs you pasted and your SubAgent init. You’re asking: “this type of MCP request is going — from where is it hit?” I’ll explain what’s happening and then ask one quick question to confirm your setup. Short answer • The MCP requests (the
/sse
GET and the
/messages
POST you see) are initiated by the agent process itself when the agent is created with the
mcp_servers
parameter. In your case, the
mcp_servers
list passed into
SubAgent
causes the agent framework to connect to those MCP HTTP endpoints (SSE for streaming updates and POST for message exchange). Why that happens • When an Agent is constructed with
mcp_servers=mcp_servers
the MCP HTTP client attempts to: ◦ Open an SSE stream (your
/sse
GET) to discover and receive tool/transport updates. ◦ Exchange messages and context with the MCP service via the
/messages
POST endpoints. • Those requests are part of the built-in MCP integration and occur as soon as the agent initializes and connects to its configured MCP servers. What to check next (if this is unexpected) • Confirm the contents of the
mcp_servers
list you pass into
SubAgent
— any MCPServerHTTP entries there are the exact endpoints being contacted. • Verify the MCP URLs are intentionally those targets (for example,
https://orbit.uat.unifyapps.com/.../sse
) and not a leftover/test endpoint. • If you want the SubAgent to not contact MCP servers, create the SubAgent without
mcp_servers
or pass an empty list. Quick clarification that will help me if you want more detail • Do you control the code that constructs the
mcp_servers
list (and can you share how it’s built), or is that injected from elsewhere (e.g., TeamAgent or higher-level orchestrator)? If you tell me whether
mcp_servers
is coming from TeamAgent or assembled when you route the SubAgent, I can point to the exact spot in the flow that triggers the HTTP calls and suggest changes (for example, how to remove or override MCP endpoints for SubAgents). Sources: Model Context Protocol (MCP) | LiveKit Documentation, with interactive elements
r
but in code we are. not doing initialization then from where it get intilized? this request hit every time on enter to subagent
t
Thanks — I hear your frustration. You’re seeing MCP HTTP requests every time you enter the SubAgent even though you didn’t explicitly initialize MCP in your code. Let’s clarify why that happens and how to stop or control it. What’s happening • The MCP requests are triggered implicitly by the Agent initialization. Even if you don’t see explicit “initialize” calls in your SubAgent code, the base Agent constructor (called via
super().__init__(..., mcp_servers=mcp_servers)
) will start the MCP client when an
mcp_servers
list is provided. • That MCP client opens the SSE stream (
/sse
) and issues
/messages
calls automatically, which explains why you see those HTTP requests every time you enter the SubAgent. Why it looks like it’s happening “out of nowhere” • The
mcp_servers
list may be populated elsewhere (for example, in the TeamAgent, an orchestrator, or a factory that constructs SubAgent instances). Passing that list into the SubAgent constructor is sufficient for the base class to start the MCP connections at runtime. • Because the work happens inside the base class, you won’t necessarily see an explicit “initialize MCP” call in your SubAgent implementation. How to confirm the source • Search where the SubAgent is constructed and inspect the argument passed for
mcp_servers
. That is the single most important place to check. • If the SubAgent is created by TeamAgent or another builder, inspect that creation path to find where
mcp_servers
comes from. Options to stop or change the behavior • Pass an empty list or
None
for
mcp_servers
when creating the SubAgent to prevent automatic MCP connections: ◦ Example:
mcp_servers=[]
or
mcp_servers=None
(depending on constructor expectations). • If you need some MCP servers but not for this SubAgent, ensure the creator only passes the intended list (filter out the MCP endpoints you don’t want). • If removal isn’t possible at creation time, add an override in the higher-level creation code to prevent or delay MCP startup. Quick diagnostic questions so I can point to the exact line to change • Where is the SubAgent instantiated? Is it constructed inside TeamAgent code, in a factory, or in an orchestration layer you can inspect? • Can you share (or describe) the code that builds the
mcp_servers
list or the call-site that creates SubAgent instances? If you share the construction site (the few lines that call SubAgent(...)), I’ll point to the exact change to stop the automatic MCP requests. , with interactive elements
r
yes when we are passing []-> then not happening but in super().__init receives mcp servers NotGivenOr[list[mcp.MCPServer] | None] = NOT_GIVEN, and
Copy code
if isinstance(mcp_servers, list) and len(mcp_servers) == 0:
    mcp_servers = None  # treat empty list as None (but keep NOT_GIVEN)
this is the what it is doing in that where that calls happened you have knowledge of livekit/agent/voice/agent.py it is in that file
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
r
sp you dont have livekit url knowledge ? is this link cover all livekit url if not give that