How to make livekit access externel mcp server
# ask-ai
s
How to make livekit access externel mcp server
✅ 1
t
Thanks for reaching out, Joshua. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m responding to your question about connecting LiveKit to an external MCP server. A few quick questions so I can give the right steps: • Are you using LiveKit Agents in Python, the Agent Builder UI, or another SDK? • Do you want to connect over HTTP(S) (remote MCP) or run a local MCP process (stdio)? • Do you need to send authentication headers (Bearer token or similar)? • Can you share the MCP URL (or a sanitized example) and whether multiple MCP servers will be used? If you confirm those details, I’ll give the exact commands and sample code (HTTP or stdio) plus guidance on headers, allowed-tools filtering, and where to set servers (Agent vs AgentSession). Sources: Model Context Protocol (MCP) | LiveKit Documentation | The ReAct Pattern for Voice Agents and How AI Agents Think, Act, and Respon... | Agent Builder | LiveKit Documentation | Voice agent skills for coding assistants | LiveKit | Announcing Agent Builder: a pathway to code | LiveKit, with interactive elements
s
HTTP(S) (remote MCP)
t
Thanks — you're asking how to connect LiveKit to a remote MCP server over HTTP(S). I can give a precise code example and steps—quick clarifying question first: Which environment are you using? • Python LiveKit Agents (code example), or • LiveKit Agent Builder UI? Also let me know: • Do you need to send an auth header (Bearer token)? • Will you connect to a single MCP server or multiple? Answer these and I’ll provide the exact setup, sample code, and notes on allowed tools and where to set
mcp_servers
. , with interactive elements
s
why agent crash when data is big
t
Thanks — I’m following up about the agent crashing when handling large data. Quick clarifying questions to diagnose this: • What kind of data is large? (LLM context/text, audio file/stream, MCP tool results, RPC payloads, etc.) • Approximate size (MB or token count) when the crash happens. • Where is the agent running? (self‑hosted VM/container, cloud, GPU/CPU) • Any error message or logs you see (process killed, out of memory, REQUEST_PAYLOAD_TOO_LARGE, stack trace)? • Are you connecting to a remote MCP over HTTPS for this flow, or is MCP unrelated to the crash? What I can suggest immediately: • RPC payloads have a 15 KB limit — exceeding that causes REQUEST/RESPONSE_PAYLOAD_TOO_LARGE errors. • Large LLM contexts or model allocations can exhaust memory (reduce context size, use smaller models/quantization, or increase RAM/GPU memory). • Sessions consume memory (WebRTC, STT/TT S buffers); high concurrency needs more CPU/RAM — LiveKit recommends ~4 cores + 8 GB per agent for typical voice workloads. • Tune buffers/queues (e.g., increase
queue_size_ms
for audio) to avoid capture/queue overflows. • Monitor memory and set higher limits or scale horizontally if the process is being killed by the system. If you share the answers to the questions above and a short copy of the crash log, I’ll provide targeted steps (config flags, code/config examples, and which limits to raise). Sources: Why is my Agent insights data missing? | LiveKit | Why is my Agent insights data missing? | LiveKit | Voice Agent Architecture: STT, LLM, and TTS Pipelines Explained | LiveKit | Self-hosted deployments | LiveKit Documentation | docs/backend/SYCL.md, with interactive elements
s
its still not deploying. is it because the project is free subs
t
Thanks — I’m replying about your deployment failures and whether the free plan is the cause. Short answer: deployment is supported on the free Build plan, so being on the free subscription alone should not block deployments. The free Build plan includes 1 agent deployment and 1,000 agent session minutes per month, but you can be blocked if you’ve exceeded resource quotas or hit other errors. Please provide: • The exact deployment error message or logs you see. • Whether you already have an active agent deployment on the free plan. • Any quota/usage warnings shown in your dashboard. • Whether the agent crash with large data happens during deployment or only at runtime. What to check right away: • Dashboard usage/quota to confirm you haven’t exceeded monthly limits. • Deployment logs for messages like insufficient resources, config errors, or API key/permission failures. • Agent logs for OOM, REQUEST_PAYLOAD_TOO_LARGE, or process-killed messages. • Your agent code for large payloads (RPC >15 KB) or very large LLM context/tool results — truncate with a
tool_result_resolver
if needed. Share the deployment error/log snippet and I’ll give exact next steps (which log lines to look at, config changes, or quota actions). Sources: Model Context Protocol (MCP) | LiveKit Documentation | Pricing | LiveKit | LiveKit Platform | Build, run, and observe voice AI agents | LiveKit | https://livekit.com/pricing.md| | Agents on LiveKit Cloud | Deploy voice AI on global infrastructure | LiveKi..., with interactive elements
s
=> [internal] load remote build context 1.2s => copy /context / 0.0s => resolve image config for docker-image://docker.io/docker/dockerfile:1 2.8s => docker-image://docker.io/docker/dockerfile:1@sha256:2780b5c3bab67f1f76c781860de469442999ed1a0d799 0.9s => => resolve docker.io/docker/dockerfile:1@sha256:2780b5c3bab67f1f76c781860de469442999ed1a0d7992a5e 0.0s => => sha256:bcb5d2ab7af67a669c932851c8bb8a26895dda6258900edfd7429d57bfd3592f 14.11MB / 14.11MB 0.2s => => extracting sha256:bcb5d2ab7af67a669c932851c8bb8a26895dda6258900edfd7429d57bfd3592f 0.7s => [internal] load metadata for docker.io/library/node:22-slim 2.8s => [base 1/3] FROM docker.io/library/node:22-slim@sha256:d415caac2f1f77b98caaf9415c5f807e14bc8d7bdea 0.0s => => resolve docker.io/library/node:22-slim@sha256:d415caac2f1f77b98caaf9415c5f807e14bc8d7bdea62561 0.0s => CACHED [base 2/3] RUN apt-get update -qq && apt-get install --no-install-recommends -y ca-certifi 0.0s => CACHED [base 3/3] RUN npm install -g pnpm@10 0.0s => CACHED [stage-2 1/3] RUN adduser --disabled-password --gecos "" --home "/app" --s 0.0s => CACHED [stage-2 2/3] WORKDIR /app 0.0s => CACHED [build 1/7] WORKDIR /app 0.0s => CACHED [build 2/7] COPY package.json pnpm-lock.yaml ./ 0.0s => CACHED [build 3/7] RUN pnpm install --frozen-lockfile 0.0s => CACHED [build 4/7] COPY . . 0.0s => CACHED [build 5/7] RUN pnpm build 0.0s => CACHED [build 6/7] RUN HOME=/app pnpm download-files 0.0s => CACHED [build 7/7] RUN pnpm prune --prod 0.0s => [stage-2 3/3] COPY --from=build --chown=appuser:appuser /app /app 3.6s => => sha256:82dd35b9bc5de27ee8c44b2792d03cd863fe4c2dbb82744123aa72defdf79564 3.31kB / 3.31kB 0.1s => => sha256:d0513e5eafd994e4de548fc3a33609867d3388add5f07027e59d8ebdc6e4d0af 49.84MB / 49.84MB 3.4s => => sha256:bba7366a523c01a6c2eef57d26db45d83d0a97c45ac42b8bbb0c13139e681840 446B / 446B 0.3s => => sha256:ff86ea2e5edce334d19a34fbc65d1a511aa1fc823dba1110422f991aa56b44d4 28.24MB / 28.24MB 2.3s => exporting to image 8.7s => => exporting layers 8.7s => => exporting manifest sha256:c11c92bd31677edf6a290437cb277eff83c8a5c6a41c1a6912bcae5636b2ce52 0.0s => => exporting config sha256:6f4798b1c8fa67569cc26cf784fc96f1c1a6521b41fd712a8286d296ff4cd294 0.0s => exporting cache to registry 1.1s => => preparing build cache for export 0.4s => => sending cache export 0.7s => => writing layer sha256:2c1ce468d9f3d941396801f6e3afc8921466650dd05430fe644cd3537713d27f 0.1s => => writing layer sha256:142fed4dffbaaabef71e2778735dd89ca31f63b42864333d02e9ccbffb86209a 0.1s => => writing layer sha256:0ff41efc38c17914e128265fe0f0041933ed127fc3ce06aa9c46136a06a2e098 0.1s => => writing layer sha256:31a93ac0e568592f55f4fe500d2b9b4f2a102ba444d62067e0b9eb57407e6cdb 0.0s => => writing layer sha256:431384fa085669eaa9022d4bd4a3ac9ab0261651225d3ea079eb9b16ba802ace 0.0s => => writing layer sha256:539f12fec8ec9c8e1eedfae55c022632384375f1c26e7cbdcb9f8a10df75a6d6 0.0s => => writing layer sha256:6b88a857d8e7c81acf306fd3c45f7eb31f9907d66eda647764bee6c270f589fc 0.0s => => writing layer sha256:744c3d07283fa7d748d9715f2d7ec9090c8c4245e5dc232db4dcbc1aa9c6a926 0.0s => => writing layer sha256:82dd35b9bc5de27ee8c44b2792d03cd863fe4c2dbb82744123aa72defdf79564 0.0s => => writing layer sha256:8605ae4b9339537f06e3b7464f993530202daa364c711bec4affa47c75e90559 0.0s => => writing layer sha256:a3805f9d39ba3ac46e288c162dc4062e6506dff02219e132de0e274a34ba8ab2 0.0s => => writing layer sha256:b6f6c234e245b7523423c89b60432248f616c15bedde61c5c44155ea6351d9b4 0.0s => => writing layer sha256:bba7366a523c01a6c2eef57d26db45d83d0a97c45ac42b8bbb0c13139e681840 0.0s => => writing layer sha256:bc9c7e2d44da1a6bb3b46a460a9f2d3738380941590b00bcb3599e0537e0be6a 0.0s => => writing layer sha256:c1784f0a7d4311e2f6b3079e383b155ccba8045ebc2ce9748d66ce78d89c2933 0.0s => => writing layer sha256:d0513e5eafd994e4de548fc3a33609867d3388add5f07027e59d8ebdc6e4d0af 0.0s => => writing layer sha256:e010fd94a761a4e0a3992623b443d6e21cbf87855ee4ae02364e9387ac804ece 0.0s => => writing layer sha256:e9e164e67fd5972caab05898b6f4448db6f3241a867ed7bdb18b5da00b28df7b 0.0s => => writing layer sha256:ff86ea2e5edce334d19a34fbc65d1a511aa1fc823dba1110422f991aa56b44d4 0.0s => => writing config sha256:02a76a456f7b49e03f1463c49f315e217d6401bc2f73e7373c490758b0a3cd28 0.3s => => writing cache image manifest sha256:01b3dce318e3bbe2686ceb6b7bffad6beac3c1137fb0e39f393a34615e 0.2s
t
Thanks — I’m looking at the build output you pasted and will help troubleshoot deployment failures. Short answers first: • The Build plan supports deployments, so the free subscription itself usually does not block deployments unless you’ve exceeded quotas. • Your logs show a successful image build/export — the failure is likely occurring after the image build (push, registry access, or runtime start), or due to resource/quota or runtime crashes (OOM, payload limits). Please check these in order and share any errors you find: 1. Registry & image availability ◦ Confirm the image was pushed to the registry your deployment expects and is reachable from the LiveKit deployment environment. ◦ If you use a private registry, ensure credentials are configured where LiveKit pulls the image. 1. Deployment logs and UI ◦ Open the deployment logs or CLI output for the step after the build (image push, deploy start, container start) and paste any error lines. ◦ Check the LiveKit dashboard for deployment errors or quota warnings. 1. Credentials & config ◦ Verify agent API key/secret and any environment variables (including MCP URL and auth headers) are set in the deployment configuration. ◦ Ensure
mcp_servers
is correctly configured for HTTP(S) and any auth headers are present. 1. Runtime failures (if container starts then dies) ◦ Inspect agent/server logs for OOM, process killed,
REQUEST_PAYLOAD_TOO_LARGE
/
RESPONSE_PAYLOAD_TOO_LARGE
, or stack traces. ◦ If your agent handles large data, implement truncation (e.g.,
tool_result_resolver
) or reduce LLM context/tool result sizes to avoid memory/payload limits. 1. Quotas & resources ◦ Confirm you haven’t used the free plan’s agent deployment slot or exceeded the 1,000 session minutes or inference credits. ◦ If your agent requires more memory/CPU than default, increase resources or scale horizontally. If you paste: • The deployment error lines from the UI/CLI after the build (not the build output), and • Any container/agent start logs showing why the process exited, I’ll pinpoint the cause and give exact fixes (registry auth steps, env var examples, memory flags, or config snippets). , with interactive elements
s
how many regions in livekit
t
By regions for agent deployment on LiveKit Cloud, there are currently three supported regions: us-east (Virginia, USA), eu-central (Frankfurt, Germany), and ap-south (Mumbai, India). LiveKit also operates a broader global edge network across many locations (US, Europe, Asia, Australia, Brazil, Middle East, Africa, etc.), and more regions are being added — see the agent deployment regions docs for the latest list: https://docs.livekit.io/deploy/admin/regions/agent-deployment/ Sources: Agents on LiveKit Cloud | Deploy voice AI on global infrastructure | LiveKi... | Build voice, video, and physical AI | LiveKit, with interactive elements
s
what is the best if in ph
t
You're likely asking which LiveKit region is best if you're in the Philippines. Recommendation: • Use ap-south (Mumbai, India) — it’s the nearest LiveKit Cloud region and will typically give the lowest latency among the currently supported regions (us-east, eu-central, ap-south). If you need even lower latency: • Consider self‑hosting in a closer cloud region (e.g., Singapore) or a nearby provider region if your traffic/requirements demand it. Tip: • Check your dashboard when creating the deployment to confirm region selection and run a quick ping/test from your client to compare latency., with interactive elements
s
Error connecting to LiveKit WebSocket (body=null, retryable=true)
t
I’m responding to your “Error connecting to LiveKit WebSocket (body=null, retryable=true)” message. Quick checks to run now: • Verify the LiveKit server URL is correct and uses wss:// (or https:// for SDKs that upgrade). • Confirm your JWT token is valid (correct API key/secret, not expired) and client clock isn’t skewed. • Run the LiveKit Connection Test utility to check WebSocket/TURN reachability: https://kb.livekit.io/articles/3972989092-diagnosing-connection-errors-with-connectionchecker • Check network/firewall: allow TCP 443 (and 7880/7881) and UDP 7882, or force TURN relay if direct connectivity is blocked: https://kb.livekit.io/articles/1724892785-establishing-media-connection-firewall-troubleshooting • Inspect client and server logs for more detail (HTTP status, 401/403, TLS errors, or connection refused). Please paste: • The exact server URL you’re connecting to (sanitized if needed), • The client-side SDK error stack or server log lines around the failure, • Whether you see a 401/403 or other HTTP status, and I’ll give targeted steps (token examples, TLS checks, or config changes). Sources: Troubleshooting 401 Unauthorized and Token Errors | LiveKit | Troubleshooting 401 Unauthorized and Token Errors | LiveKit | Diagnosing Connection Errors with Connection Test Utility | Firewall Tips | Running LiveKit on AWS | LiveKit, with interactive elements
s
t
Thanks — I’ll help debug the WebSocket issue for your URL: wss://kiosk-y8v9qrlx.livekit.cloud. Please check and share the following so I can pinpoint the cause: 1. JWT/token • Are you using a server-generated room token or an API key/secret JWT? • Paste (sanitized) the token payload expiry (exp) or tell me if it’s expired. 1. Client error logs • Full SDK error stack or console lines around the WebSocket failure. • Any HTTP status (401/403) shown in logs. 1. Server reachability • Can you successfully open the WebSocket from your machine? Run: ◦ curl -v -H "Origin: https://example.com" "wss://kiosk-y8v9qrlx.livekit.cloud" (or use a WebSocket client) and paste result. 1. Network / firewall • Are you behind a corporate NAT/firewall? Confirm outbound TCP 443 is allowed. If restrictive, try forcing TURN relay. 1. TLS / custom domain • Are you using the LiveKit cloud domain as-is, or a custom domain with custom certs? If custom, confirm the cert is valid (no hostname mismatch). 1. Clock sync • Confirm client/server clocks are in sync (JWT expiry depends on this). Quick checks you can run now: • Use the Connection Test utility: https://kb.livekit.io/articles/3972989092-diagnosing-connection-errors-with-connectionchecker • Try connecting with a freshly generated short-lived token and paste the client logs. Share the token expiry, client logs, and curl/WebSocket test output and I’ll give exact fixes (token generation example, TLS steps, or firewall/TURN settings). , with interactive elements