diff --git a/tools/mcp_oauth.py b/tools/mcp_oauth.py index 9003f980f..1235e9e40 100644 --- a/tools/mcp_oauth.py +++ b/tools/mcp_oauth.py @@ -915,7 +915,7 @@ def _build_client_metadata(cfg: dict) -> "OAuthClientMetadata": ) client_name = cfg.get("client_name", "Hermes Agent") scope = cfg.get("scope") - redirect_uri = f"http://127.0.0.1:{port}/callback" + redirect_uri = cfg.get("redirect_uri") or f"http://127.0.0.1:{port}/callback" metadata_kwargs: dict[str, Any] = { "client_name": client_name, @@ -942,7 +942,7 @@ def _maybe_preregister_client( if not client_id: return port = cfg["_resolved_port"] - redirect_uri = f"http://127.0.0.1:{port}/callback" + redirect_uri = cfg.get("redirect_uri") or f"http://127.0.0.1:{port}/callback" info_dict: dict[str, Any] = { "client_id": client_id,