{"record":{"id":"379ddc28aaa5c931","repo":"langchain-ai/deepagents","slug":"no-mcp-oauth-provider-matched-server-url-r","errorCode":null,"errorMessage":"No MCP OAuth provider matched {server_url!r}","messagePattern":"No MCP OAuth provider matched (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/mcp_providers/_registry.py","lineNumber":39,"sourceCode":"\ndef resolve_provider(server_url: str) -> OAuthProvider:\n    \"\"\"Return the provider policy that owns `server_url`.\n\n    Args:\n        server_url: Remote MCP endpoint URL.\n\n    Returns:\n        The first matching `OAuthProvider`; falls back to `GenericProvider`.\n\n    Raises:\n        RuntimeError: If no provider matches (unreachable in practice since\n            `GenericProvider.matches` always returns `True`).\n    \"\"\"\n    for provider in _REGISTRY:\n        if provider.matches(server_url):\n            return provider\n    msg = f\"No MCP OAuth provider matched {server_url!r}\"\n    raise RuntimeError(msg)\n","sourceCodeStart":21,"sourceCodeEnd":40,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/mcp_providers/_registry.py#L21-L40","documentation":"resolve_provider scans the internal OAuth provider registry and returns the first provider whose `matches(server_url)` is true; the generic provider is documented to always match. Raising here means the registry has no matching entry — effectively a broken/incomplete registry build rather than a user config problem.","triggerScenarios":"Calling resolve_provider (via build_oauth_provider or login) with a server_url when _REGISTRY is empty or its entries' matches() predicates all fail — i.e. the always-matching GenericProvider is missing from the registry.","commonSituations":"Test code monkeypatching/clearing _REGISTRY; custom builds that registered only specific providers (e.g. GitHub) and removed the generic fallback; plugin code that filtered the registry before login.","solutions":["Check whether _REGISTRY was modified/cleared in your session or test setup; restore the default registry including the generic fallback provider.","Reinstall deepagents-code to restore the complete built-in registry.","If you maintain a custom registry, ensure GenericProvider (whose matches() always returns True) is registered last.","Verify the server_url is well-formed; a malformed URL combined with strict provider predicates can skip all specific providers."],"exampleFix":"// before (test setup)\n_registry_override[:] = [GitHubProvider]\n// after\n_registry_override[:] = [GitHubProvider, GenericProvider()]","handlingStrategy":"fallback","validationCode":"from deepagents_code.mcp_providers import _registry\nassert _registry._REGISTRY, \"OAuth provider registry is empty\"","typeGuard":null,"tryCatchPattern":"try:\n    provider = resolve_provider(server_url)\nexcept RuntimeError as exc:\n    if str(exc).startswith(\"No MCP OAuth provider matched\"):\n        provider = GenericProvider()  # fallback for custom registries\n    else:\n        raise","preventionTips":["Never clear or replace _REGISTRY without keeping a catch-all provider","Register GenericProvider last so unknown URLs always match","Smoke-test login against a non-standard server URL in CI"],"tags":["mcp","oauth","registry","provider"],"backgroundTag":"no-provider-matched","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}