Notion MCP auth fails on Windows 10 with connection reset after OAuth approval #9227

Open
opened 2026-02-16 18:11:57 -05:00 by yindo · 1 comment
Owner

Originally created by @j-token on GitHub (Feb 12, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

Running opencode mcp auth for a Notion MCP server on Windows 10 fails after browser authorization. OAuth approval succeeds, but the callback page shows ERR_CONNECTION_RESET (Korean browser message: 연결이 재설정되었습니다.), and auth is not completed.

Steps to reproduce

  1. Configure a Notion MCP server in OpenCode.
  2. Make sure OpenCode is not running.
  3. Run opencode mcp auth.
  4. Complete Notion authorization in the browser.
  5. Observe callback failure with connection reset.

Expected behavior

OAuth callback should complete and MCP authentication should succeed.

Actual behavior

Browser shows connection reset and authentication does not finish.

Environment

  • OS: Windows 10 (reproducible)
  • macOS: not reproducible (works)
  • MCP server: Notion
    "notion": {
      "type": "remote",
      "url": "https://mcp.notion.com/mcp"
    }
Originally created by @j-token on GitHub (Feb 12, 2026). Originally assigned to: @rekram1-node on GitHub. ## Description Running `opencode mcp auth` for a Notion MCP server on Windows 10 fails after browser authorization. OAuth approval succeeds, but the callback page shows `ERR_CONNECTION_RESET` (Korean browser message: `연결이 재설정되었습니다.`), and auth is not completed. ## Steps to reproduce 1. Configure a Notion MCP server in OpenCode. 2. Make sure OpenCode is not running. 3. Run `opencode mcp auth`. 4. Complete Notion authorization in the browser. 5. Observe callback failure with connection reset. ## Expected behavior OAuth callback should complete and MCP authentication should succeed. ## Actual behavior Browser shows connection reset and authentication does not finish. ## Environment - OS: Windows 10 (reproducible) - macOS: not reproducible (works) - MCP server: Notion ``` "notion": { "type": "remote", "url": "https://mcp.notion.com/mcp" } ```
yindo added the windows label 2026-02-16 18:11:57 -05:00
Author
Owner

@j-token commented on GitHub (Feb 12, 2026):

Confirmed the root cause with reproduction logs.

What happens

  • The MCP OAuth callback URL is hard-coded to http://127.0.0.1:19876/mcp/oauth/callback.
  • Running opencode mcp auth notion logged:
    • oauth callback server already running on another instance
  • On the affected Windows machine, port 19876 was already occupied by an unrelated process:
    • netstat -ano | findstr :19876 → PID 28364
    • tasklist /FI "PID eq 28364"MaEPSBroker.exe
  • Killing that process allowed opencode mcp auth to succeed immediately.

Root cause

This is a callback-port collision. The OAuth provider authorization itself succeeds, but OpenCode cannot receive the redirect when another process already owns 127.0.0.1:19876. The browser shows a connection-reset / connection-refused error as a result.

Proposed fix (PR incoming)

  1. Add a configurable mcp.<name>.oauth.callbackPort option.
  2. Fail fast with a clear error when the callback port is already in use, instead of silently assuming another OpenCode instance is running.
@j-token commented on GitHub (Feb 12, 2026): Confirmed the root cause with reproduction logs. ### What happens - The MCP OAuth callback URL is hard-coded to `http://127.0.0.1:19876/mcp/oauth/callback`. - Running `opencode mcp auth notion` logged: - `oauth callback server already running on another instance` - On the affected Windows machine, port `19876` was already occupied by an unrelated process: - `netstat -ano | findstr :19876` → PID `28364` - `tasklist /FI "PID eq 28364"` → `MaEPSBroker.exe` - Killing that process allowed `opencode mcp auth` to succeed immediately. ### Root cause This is a callback-port collision. The OAuth provider authorization itself succeeds, but OpenCode cannot receive the redirect when another process already owns `127.0.0.1:19876`. The browser shows a connection-reset / connection-refused error as a result. ### Proposed fix (PR incoming) 1. Add a configurable `mcp.<name>.oauth.callbackPort` option. 2. Fail fast with a clear error when the callback port is already in use, instead of silently assuming another OpenCode instance is running.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9227