{"record":{"id":"7a7024f07705f20c","repo":"langchain-ai/deepagents","slug":"server-server-name-has-unsupported-auth-value","errorCode":null,"errorMessage":"Server '{server_name}' has unsupported auth value {auth!r}. Only 'oauth' is supported.","messagePattern":"Server '(.+?)' has unsupported auth value (.+?)\\. Only 'oauth' is supported\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/mcp_tools.py","lineNumber":942,"sourceCode":"\n        if \"env\" in server_config and not isinstance(server_config[\"env\"], dict):\n            error_msg = f\"Server '{server_name}' 'env' must be a dictionary\"\n            raise TypeError(error_msg)\n    else:\n        error_msg = (\n            f\"Server '{server_name}' has unsupported transport type '{server_type}'. \"\n            \"Supported types: stdio, sse, http\"\n        )\n        raise ValueError(error_msg)\n\n    auth = server_config.get(\"auth\")\n    if auth is not None:\n        if auth != \"oauth\":\n            msg = (\n                f\"Server '{server_name}' has unsupported auth value \"\n                f\"{auth!r}. Only 'oauth' is supported.\"\n            )\n            raise ValueError(msg)\n        if server_type == \"stdio\":\n            msg = (\n                f\"Server '{server_name}' uses stdio transport; \"\n                \"'auth: oauth' is only valid for http/sse transports.\"\n            )\n            raise ValueError(msg)\n        header_names = {name.lower() for name in (server_config.get(\"headers\") or {})}\n        if \"authorization\" in header_names:\n            msg = (\n                f\"Server '{server_name}' cannot combine 'auth: oauth' \"\n                \"with an 'Authorization' header.\"\n            )\n            raise ValueError(msg)\n\n    _validate_tool_filter_fields(server_name, server_config)\n\n\ndef _validate_tool_filter_fields(","sourceCodeStart":924,"sourceCodeEnd":960,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/mcp_tools.py#L924-L960","documentation":"The optional `auth` field on an MCP server config currently accepts only the literal value `\"oauth\"` (OAuth browser-based login for remote servers). `_validate_server_config` raises this ValueError when `auth` is set to any other value, since no other auth mode is implemented.","triggerScenarios":"A server entry sets `auth` to something other than \"oauth\" or omits it — e.g. `\"auth\": \"bearer\"`, `\"auth\": \"api_key\"`, `\"auth\": \"basic\"`, `\"auth\": true` — and validation runs via `select_server`, `resolve_and_load_mcp_tools`, or the batch config validators.","commonSituations":"Guessing auth mode names copied from generic MCP client docs; switching from header-token auth and writing `auth: bearer` instead of using an Authorization header; setting `auth: true` expecting auth to be 'enabled'; older configs using auth scheme names no longer supported.","solutions":["Set `\"auth\": \"oauth\"` if the server supports OAuth login, or remove `auth` entirely if not using OAuth.","For token-based auth, remove `auth` and pass an Authorization header instead: \"headers\": {\"Authorization\": \"Bearer <token>\"}.","Check the library's supported values — currently only 'oauth' — before inventing a scheme name.","For other auth styles, supply credentials via headers/env appropriate to the transport."],"exampleFix":"// before\n{\"api\": {\"type\": \"http\", \"url\": \"https://mcp.example.com\", \"auth\": \"bearer\"}}\n// after\n{\"api\": {\"type\": \"http\", \"url\": \"https://mcp.example.com\", \"headers\": {\"Authorization\": \"Bearer <token>\"}}}","handlingStrategy":"validation","validationCode":"def validate_auth(name: str, cfg: dict) -> None:\n    auth = cfg.get(\"auth\")\n    if auth is not None and auth != \"oauth\":\n        raise ValueError(f\"Server '{name}' has unsupported auth value {auth!r}. Only 'oauth' is supported.\")","typeGuard":"def has_valid_auth(cfg: dict) -> bool:\n    auth = cfg.get(\"auth\")\n    return auth is None or auth == \"oauth\"","tryCatchPattern":"try:\n    tools = resolve_and_load_mcp_tools(config)\nexcept ValueError as e:\n    if \"unsupported auth value\" in str(e):\n        name = extract_server_name(str(e))\n        cfg = config[\"servers\"][name]\n        cfg.pop(\"auth\", None)\n        cfg.setdefault(\"headers\", {})[\"Authorization\"] = f\"Bearer {os.environ.get('MCP_TOKEN', '')}\"\n        tools = resolve_and_load_mcp_tools(config)\n    else:\n        raise","preventionTips":["Remember only \"oauth\" is a valid auth value; everything else must go through headers/env.","For bearer/API-key auth, use headers: {\"Authorization\": \"Bearer <token>\"} on http/sse servers.","Do not use boolean or scheme-name values like `auth: true` or `auth: basic`.","Check the library docs for supported auth values when upgrading versions."],"tags":["mcp","config-validation","auth","oauth"],"backgroundTag":"mcp-server-config-invalid","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}