Skip to content

Fix MCP startup stall, add browser auth, validate auth status - #6

Open
BrewingCoder wants to merge 2 commits into
mainfrom
fix/browser-auth-and-mcp-startup
Open

Fix MCP startup stall, add browser auth, validate auth status#6
BrewingCoder wants to merge 2 commits into
mainfrom
fix/browser-auth-and-mcp-startup

Conversation

@BrewingCoder

Copy link
Copy Markdown
Contributor

Summary

Three related fixes uncovered while debugging "Claude can't connect to MCP server" and an inability to re-authenticate.

MCP server startup

FastMCP 3.x runs a network update-check + banner at startup, adding a ~3s stall before the stdio transport is ready. On a slow/offline network that can exceed Claude Desktop's init timeout and surface as "can't connect to MCP server". Disabled both (FASTMCP_CHECK_FOR_UPDATES=off, FASTMCP_SHOW_SERVER_BANNER=false) before importing fastmcp, plus show_banner=False on the stdio run. Startup: ~3s → ~1s.

Browser authentication

Device-code flow is blocked by Conditional Access in many tenants ("an authentication flow that is restricted by your admin", AADSTS), making re-auth impossible. Added MSAL interactive browser login (login_browser, auth code + PKCE) and a new outpost auth login command (--device falls back to device-code). outpost setup now uses the browser flow.

Requires http://localhost as a redirect URI on the app registration (added out-of-band).

Auth status validation

get_auth_status() only checked for a cached account, so it reported "Logged in" even with a dead token (90-day refresh-token expiry). It now validates the token via acquire_token_silent_with_error and reports "Session expired — run 'outpost auth login'" when it can't be silently renewed.

Docs

  • README: setup opens browser, surface outpost auth login, wiki link wording.
  • Wiki Setup-&-Authentication updated (separate repo).

Tests

345 passing. Updated setup tests to patch login_browser; added coverage for expired auth status, the new auth login command, and browser/device flow selection.

BrewingCoder and others added 2 commits June 5, 2026 18:48
MCP server:
- Disable FastMCP 3.x startup network update-check and banner
  (FASTMCP_CHECK_FOR_UPDATES=off, FASTMCP_SHOW_SERVER_BANNER=false) before
  importing fastmcp. The update-check added a ~3s network stall during stdio
  startup that could exceed Claude Desktop's init timeout and surface as
  "can't connect to MCP server". Also pass show_banner=False to stdio run().

Auth:
- Add browser-based interactive login (login_browser via MSAL
  acquire_token_interactive) and a new `outpost auth login` command
  (--device falls back to device-code). Device-code flow is blocked by
  Conditional Access in many tenants ("authentication flow restricted by
  your admin", AADSTS); browser auth-code+PKCE sidesteps it. `outpost setup`
  now uses the browser flow.
- Fix get_auth_status: validate the cached token instead of only checking
  for a cached account. An expired refresh token (90-day inactivity) or
  scope change now reports not-logged-in with a "run 'outpost auth login'"
  message, instead of falsely reporting "Logged in".

Tests: update setup tests to patch login_browser; add coverage for expired
auth status, the new auth login command, and browser/device flow selection.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Reflect the switch from device-code to browser interactive login: note that
`outpost setup` opens the browser, surface the new `outpost auth login`
re-auth command, and update the wiki link description.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant