Open
Conversation
- Add Sign in control when MCP status is needs_auth; posts authenticateMcp
to run CLI POST /mcp/{name}/auth/authenticate.
- On SSE mcp.browser.open.failed, open the auth URL via
vscode.env.openExternal (CLI subprocess open() often fails under VS Code).
- Dedupe openExternal when multiple webviews receive the same event.
Fixes UI regression described in GitHub issue Kilo-Org#8904.
Made-with: Cursor
- Move MCP connect/disconnect/authenticate and openExternal dedupe to kilo-provider/mcp-oauth.ts. - eslint-disable-next-line complexity for the webview message router. Made-with: Cursor
ensureRunning() used to return early when isPortInUse() was true, assuming another instance served /mcp/oauth/callback. That left this process without Bun.serve while authenticate() still registered waitForCallback here — the browser redirect to 127.0.0.1:19876 could hit nothing (ERR_CONNECTION_REFUSED). - Remove the port-probe short-circuit; always attempt Bun.serve in-process. - Serialize concurrent ensureRunning with startInFlight. - Clear startInFlight in stop(); log bind errors (EADDRINUSE) with a hint. - Drop unused isPortInUse helper. Made-with: Cursor
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (6 files)
|
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.
Context
Remote MCP servers with OAuth showed
needs authin VS Code settings butprovided no way to trigger the sign-in flow. Fixes #8904.
Two separate bugs caused this:
needs_auth.127.0.0.1:19876) was never bound in the VS Codeprocess because
ensureRunning()short-circuited onisPortInUse(), so thebrowser redirect always hit
ERR_CONNECTION_REFUSED.Implementation
UI fix (
packages/kilo-vscode)AgentBehaviourTab— renders a Sign in button when MCP status isneeds_auth;sends
authenticateMcpmessage which callsPOST /mcp/{name}/auth/authenticate.KiloProvider— listens formcp.browser.open.failedSSE and opens the authURL via
vscode.env.openExternal. The CLI's subprocessopen()fails silentlyinside the VS Code extension host on some platforms, so the fallback is
necessary. Deduped so multiple webviews don't open the same URL twice.
kilo-provider/mcp-oauth.tsto stay within ESLintmax-lines/complexitylimits.Callback server fix (
packages/opencode)isPortInUseprobe inMcpOAuthCallback.ensureRunning().The old assumption — that a port already in use means another instance is
serving the callback — was wrong: when VS Code spawns the CLI in-process,
there is no other instance. Now
Bun.serveis always attempted here.ensureRunning()calls are serialized viastartInFlight.EADDRINUSEis logged with an actionable hint instead of being swallowed.Screenshots
needs authwith no action availableHow to Test
http://localhost:8080/mcp) inAgent Behaviour → MCP Servers.
needs auth.connected.