polite-oil-10264
10/27/2025, 4:01 PMtall-airline-16756
10/27/2025, 4:02 PMtall-airline-16756
10/27/2025, 4:03 PMmcp_servers parameter in the AgentSession or Agent constructor to specify your URL as an MCPServerHTTP instance.
2. Make sure to include only your production URL in the mcp_servers list so the agent won't fall back to other sources.
Here’s a quick example for you:
from livekit.agents import AgentSession, mcp
session = AgentSession(
vad=silero.VAD.load(),
stt="assemblyai/universal-streaming",
llm="openai/gpt-4.1-mini",
tts="cartesia/sonic-2:6f84f4b8-58a2-430c-8c79-688dad597532",
turn_detection=MultilingualModel(),
mcp_servers=[mcp.MCPServerHTTP(url="<YOUR_PRODUCTION_URL>")],
)
Just replace <YOUR_PRODUCTION_URL> with your actual production URL, and your agent will fetch data exclusively from there. If you ever want to switch URLs on the fly, you can create a new agent instance with the new URL and update your session using session.update_agent(new_agent).
Also, don’t forget to install the necessary mcp dependencies and set up environment variables like LIVEKIT_URL, LIVEKIT_API_KEY, and LIVEKIT_API_SECRET to keep everything running smoothly.
If you have any questions or need a hand with this, just let me know—I’m here to help!
Sources: Tool definition and use | LiveKit Docs | README.mdpolite-oil-10264
10/27/2025, 4:16 PMtall-airline-16756
10/27/2025, 4:17 PMpolite-oil-10264
10/27/2025, 4:25 PMtall-airline-16756
10/27/2025, 4:25 PM