mirror of
https://github.com/langchain-ai/deepagents.git
synced 2026-08-27 20:50:04 -04:00
fix(code): polish MCP auth success UX (#3614)
Post-auth polish for the MCP login flow: the OAuth success page now self-closes the browser tab, and the in-app reconnect modal leads its title with a checkmark glyph so success reads at a glance.
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ curl -LsSf https://langch.in/dcode | bash
|
||||
|
||||
An open-source, async coding agent for your org's internal workflows. Runs each task in an isolated cloud sandbox, integrates with Slack, Linear, and GitHub, and ships PRs end-to-end.
|
||||
|
||||
```bash
|
||||
```text
|
||||
@open-swe fix this user-reported bug plz!
|
||||
```
|
||||
|
||||
|
||||
@@ -614,7 +614,8 @@ class _LoopbackOAuthCallbackServer:
|
||||
handler,
|
||||
200,
|
||||
_oauth_success_html(
|
||||
"MCP authorization complete. You can close this browser tab.",
|
||||
"MCP authorization complete. "
|
||||
"This tab will close automatically.",
|
||||
),
|
||||
)
|
||||
else:
|
||||
@@ -658,7 +659,7 @@ class _LoopbackOAuthCallbackServer:
|
||||
handler,
|
||||
200,
|
||||
_oauth_success_html(
|
||||
"MCP authorization complete. You can close this browser tab.",
|
||||
"MCP authorization complete. This tab will close automatically.",
|
||||
),
|
||||
)
|
||||
|
||||
@@ -707,6 +708,16 @@ def _oauth_result_html(
|
||||
escaped_title = html.escape(title)
|
||||
escaped_heading = html.escape(heading)
|
||||
escaped = html.escape(message)
|
||||
# `window.close()` is only honored for tabs the script itself opened
|
||||
# (browser policy), but for the common case where the auth flow was
|
||||
# launched via `window.open` / `target=_blank` from another page, the
|
||||
# tab closes cleanly. When the browser refuses, the user still sees the
|
||||
# static success page and the message text remains accurate.
|
||||
auto_close = (
|
||||
"<script>setTimeout(function(){window.close();},2000);</script>"
|
||||
if status == "success"
|
||||
else ""
|
||||
)
|
||||
return (
|
||||
'<!doctype html><html><head><meta charset="utf-8">'
|
||||
'<meta name="viewport" content="width=device-width, initial-scale=1">'
|
||||
@@ -727,6 +738,7 @@ def _oauth_result_html(
|
||||
f'<div class="mark" style="background:{background};color:{accent}">{mark}</div>'
|
||||
f"<h1>{escaped_heading}</h1><p>{escaped}</p>"
|
||||
"</main>"
|
||||
f"{auto_close}"
|
||||
"</body></html>"
|
||||
)
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ from textual.content import Content
|
||||
from textual.screen import ModalScreen
|
||||
from textual.widgets import Static
|
||||
|
||||
from deepagents_code.config import get_glyphs
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from textual.app import ComposeResult
|
||||
|
||||
@@ -87,10 +89,12 @@ class MCPReconnectPromptScreen(ModalScreen[ReconnectChoice]):
|
||||
Yields:
|
||||
Title, body, and help-row widgets parented inside a `Vertical`.
|
||||
"""
|
||||
glyphs = get_glyphs()
|
||||
with Vertical():
|
||||
yield Static(
|
||||
Content.from_markup(
|
||||
"Connected to [bold]$name[/bold]",
|
||||
"$check Connected to [bold]$name[/bold]",
|
||||
check=glyphs.checkmark,
|
||||
name=self._server_name,
|
||||
),
|
||||
classes="mcp-reconnect-title",
|
||||
|
||||
Reference in New Issue
Block a user