{"record":{"id":"b839a95ec8141525","repo":"BerriAI/litellm","slug":"server-misconfigured-mcp-server-has-no-routable-n","errorCode":null,"errorMessage":"Server misconfigured: MCP server has no routable name","messagePattern":"Server misconfigured: MCP server has no routable name","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py","lineNumber":793,"sourceCode":"        (``lookup_mcp_server_auth_in_headers`` tries ``alias`` before ``server_name``). Keying\n        under ``server_name`` would leave a caller-supplied ``x-mcp-{alias}-authorization`` at the\n        higher-priority alias slot, pairing the admitted identity with an attacker's upstream\n        credential; the alias-keyed injection overwrites any such caller value.\n        \"\"\"\n        from litellm.proxy.proxy_server import master_key\n\n        if not master_key:\n            raise HTTPException(status_code=500, detail=\"Server misconfigured: master_key is not set\")\n\n        await MCPRequestHandler._run_pre_db_read_auth_checks(request=request, route=route)\n\n        keys: Final = envelope_keys_from_master_key(master_key)\n        result: Final = resolve_bridge_envelope(authorization_value, keys, datetime.now(timezone.utc), server.server_id)\n        match result:\n            case BridgeEnvelopeAdmitted():\n                header_key: Final = server.alias or server.server_name\n                if header_key is None:\n                    raise HTTPException(status_code=500, detail=\"Server misconfigured: MCP server has no routable name\")\n                admitted: Final = await MCPRequestHandler._reload_admitted_principal(result.identity)\n                await MCPRequestHandler._enforce_admitted_live_policy(admitted=admitted, request=request, route=route)\n                injected: Final = {header_key: {\"Authorization\": result.upstream_authorization.get_secret_value()}}\n                new_headers: Final = {**(mcp_server_auth_headers or {}), **injected}\n                return admitted, new_headers\n            case BridgeEnvelopeInvalid() | NotBridgeEnvelope():\n                raise HTTPException(status_code=401, detail=\"Invalid or expired credential\")\n            case _:\n                assert_never(result)\n\n    @staticmethod\n    async def _admit_gateway_session(\n        authorization_value: str,\n        request: Request,\n        route: str,\n        mcp_servers: list[str] | None,\n    ) -> UserAPIKeyAuth:\n        \"\"\"Open a gateway DCR session bearer and admit the live litellm user it references.","sourceCodeStart":775,"sourceCodeEnd":811,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py#L775-L811","documentation":"HTTP 500 in the alias/server-name injection logic: the resolved MCP server row has neither an alias nor a server_name, so there is no x-mcp-{name}-authorization header key to inject the upstream credential under. Indicates a malformed server record.","triggerScenarios":"Thrown at litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py:793 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Give the MCP server a name/alias in the proxy config so requests can be routed."],"exampleFix":"mcp_servers: {my_server: {url: ..., alias: my_server}}","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-14T00:17:10.932Z"}