fix(connections): wire Google connector browser launch end-to-end - #205
Merged
Conversation
- mcp/browser: respect BROWSER env (VS Code remote helper) before falling back to xdg-open via open package. In minimal containers xdg-open is absent/misconfigured, so the browser never opened and the Google connector appeared dead. The extension host already propagates BROWSER via ServerManager env inheritance; this makes McpBrowser honour it. - app/status-popover-body: wire onStartAuth for google/google-drive (was declared in the tab but never passed, so clicking 'Connect with browser' did nothing). Now POSTs to /amicode/connections/auth and falls back to window.open for the returned URL. - server/amicode/connections: add POST /amicode/connections/auth handler for browser method. Opens the Google account chooser as a placeholder via McpBrowser (BROWSER-aware) and returns waiting- browser state so the card shows progress. Replace placeholder URL with real OAuth authorization URL once client ID is provisioned. - server/routes: wire the new auth route. Fixes the reported 'browser for the google connector doesnt launch anything' and makes the whole flow diagnosable (browser env logged). Test: existing mcp/oauth-browser tests still pass (mocked browser layer); manual verification in devcontainer shows BROWSER=.../browser.sh now actually opens via code --openExternal and the Google card flips to 'Waiting for your browser'.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe change adds Google and Google Drive browser authentication. The server exposes an authenticated endpoint, launches the provider URL, and returns a waiting state. The Amicode UI starts the flow, tracks its status, and opens returned HTTPS URLs. ChangesGoogle browser authentication
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant AmicodeUI
participant HTTPAPI
participant AmicodeConnections
participant Browser
AmicodeUI->>HTTPAPI: POST /amicode/connections/auth
HTTPAPI->>AmicodeConnections: startAuthResponse(requestBody)
AmicodeConnections->>Browser: Launch provider URL
AmicodeConnections-->>HTTPAPI: waiting-browser response
HTTPAPI-->>AmicodeUI: JSON authentication state
AmicodeUI->>AmicodeUI: Open returned HTTPS URL
Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This was referenced Aug 14, 2026
Rchari1
added a commit
that referenced
this pull request
Aug 14, 2026
…holder (#206) Follow-up to #205 (already merged). The first iteration used https://accounts.google.com/signin as a placeholder to prove the browser wiring. This replaces it with the real https://accounts.google.com/o/oauth2/v2/auth URL, scopes, and env handling: - google → gmail.readonly + userinfo.email - google-drive → drive.file + spreadsheets + userinfo.email Reads GOOGLE_CLIENT_ID / GOOGLE_REDIRECT_URI (default loopback), generates state, and opens the real consent screen via the BROWSER-aware path. No more placeholder confusion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes harmoniqs/amicode#335 follow-up — 'browser for the google connector doesnt launch anything'.
This is a real Google connector — not a placeholder.
Root cause
McpBrowserusedopen(xdg-open on Linux) which is absent/misconfigured in minimal devcontainers, so the browser never opened. VS Code remote setsBROWSERto the helper that doescode --openExternalviaVSCODE_IPC_HOOK_CLI, but the browser service ignored it.onStartAuthfor google/google-drive but never wired it — the tab's 'Connect with browser' button posted nothing, and the server had no/amicode/connections/authhandler.Fix
mcp/browser.ts: respectBROWSERenv first (VS Code helper) before falling back toopen. The extension host propagatesBROWSERviaServerManagerenv inheritance.app/status-popover-body.tsx: wireonStartAuthfor google/google-drive to POST/amicode/connections/authand fall back towindow.openfor the returned URL. The overlay tracks validating state.server/amicode/connections.ts+server/routes: addPOST /amicode/connections/authhandler. This is a real Google connector — it constructs the actual Google OAuth authorization URL (https://accounts.google.com/o/oauth2/v2/auth) with scopes:google→gmail.readonly+userinfo.email(read an email)google-drive→drive.file+spreadsheets+userinfo.email(create/populate a Sheet)Reads
GOOGLE_CLIENT_ID/GOOGLE_REDIRECT_URIfrom env (default loopbackhttp://127.0.0.1:8085/oauth/callback), generatesstate, and opens the system browser via the BROWSER-aware path. When no client is configured it still opens Google with an error hint rather than silently doing nothing — set the env and it does the full OAuth.Verification
BROWSER=.../browser.shnow opens viacode --openExternalin devcontainer (previouslyopen→xdg-openfailed silently).mcp/oauth-browsertests pass (mocked layer).Companion: harmoniqs/amicode#387 (logs BROWSER at spawn; bump vendored opencode after merge).