{"record":{"id":"f2b0147cbc943aba","repo":"BerriAI/litellm","slug":"mcp-per-user-env-vars-require-a-database-connectio","errorCode":null,"errorMessage":"MCP per-user env vars require a database connection, but none is configured. Connect a database to your proxy to use per-user MCP env vars.","messagePattern":"MCP per-user env vars require a database connection, but none is configured\\. Connect a database to your proxy to use per-user MCP env vars\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/_experimental/mcp_server/mcp_server_manager.py","lineNumber":3114,"sourceCode":"        \"\"\"\n        if user_api_key_auth is None:\n            return {}\n        user_id: Final[str | None] = getattr(user_api_key_auth, \"user_id\", None)\n        if not user_id:\n            return {}\n\n        cache_key: Final = (user_id, server.server_id)\n        if not force_refresh:\n            cached: Final = _user_env_vars_cache.get(cache_key)\n            if cached is not None:\n                values, ts = cached\n                if time.monotonic() - ts < _USER_ENV_VARS_CACHE_TTL:\n                    return values\n\n        from litellm.proxy.proxy_server import prisma_client  # noqa: PLC0415\n\n        if prisma_client is None:\n            raise RuntimeError(\n                \"MCP per-user env vars require a database connection, but none \"\n                \"is configured. Connect a database to your proxy to use per-user \"\n                \"MCP env vars.\"\n            )\n        from litellm.proxy._experimental.mcp_server.db import (  # noqa: PLC0415\n            get_user_env_vars,\n        )\n\n        values = await get_user_env_vars(prisma_client, user_id, server.server_id)\n        _write_user_env_vars_cache(user_id, server.server_id, values)\n        return values\n\n    async def _resolve_v2_auth(\n        self,\n        *,\n        server: MCPServer,\n        spec: ServerSpec,\n        provider: UpstreamCredentialProvider,","sourceCodeStart":3096,"sourceCodeEnd":3132,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py#L3096-L3132","documentation":"Per-user MCP env-var resolution needs a Prisma query, but prisma_client is None because no database is connected. This is an environment/infrastructure precondition failure, raised before any cache or lookup work.","triggerScenarios":"Thrown at litellm/proxy/_experimental/mcp_server/mcp_server_manager.py:3114 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Connect a database (set DATABASE_URL) to enable per-user MCP env vars.","Or avoid per-user variables for this server."],"exampleFix":"export DATABASE_URL='postgresql://...'","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}