Skip to content

fix(mcp-store): fix MCP connect button loading state#2917

Open
cvolzer3 wants to merge 4 commits into
mainfrom
codex/mcp-connect-loading-reset
Open

fix(mcp-store): fix MCP connect button loading state#2917
cvolzer3 wants to merge 4 commits into
mainfrom
codex/mcp-connect-loading-reset

Conversation

@cvolzer3

@cvolzer3 cvolzer3 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Problem

MCP server connection failures could leave the Connect button stuck in a loading state. Reconnecting an OAuth MCP server also hit the browser redirect boundary: the MCP Store authorize endpoint redirects to the provider, but browser fetch cannot expose a cross-origin Location header, which produced the status 0 failure.

Reconnect can also be blocked by a transient PostHog token-refresh 500 if the app preemptively refreshes a still-valid in-memory access token.

Changes

  • Reset MCP template connection loading from the install mutation state so failed installs return the button to Connect.
  • Expect MCP authorize to return a JSON redirect_url for PostHog Code instead of trying to inspect a manual browser redirect.
  • Let core auth use the current in-memory access token when a preemptive refresh fails but the token has not actually expired.
  • Preserve the existing logout behavior when the refresh token is rejected.
  • Added regressions for failed install loading state, authorize JSON redirects, transient refresh failures, and refresh-token auth failures.

Backend companion PR: PostHog/posthog#65917

How did you test this?

I did not do a manual app walkthrough. I ran:

  • pnpm --dir packages/ui exec vitest run src/features/mcp-servers/hooks/useMcpServers.test.tsx
  • pnpm --filter @posthog/api-client test -- src/fetcher.test.ts src/posthog-client.test.ts
  • pnpm --filter @posthog/api-client typecheck
  • pnpm --filter @posthog/ui typecheck
  • pnpm --filter @posthog/core test -- src/auth/auth.test.ts
  • pnpm --filter @posthog/core typecheck
  • pnpm exec biome lint packages/core
  • pnpm exec biome check --write packages/ui/src/features/mcp-servers/hooks/useMcpServers.ts packages/ui/src/features/mcp-servers/hooks/useMcpServers.test.tsx
  • pnpm exec biome check --write packages/api-client/src/fetcher.ts packages/api-client/src/posthog-client.ts packages/api-client/src/fetcher.test.ts packages/api-client/src/posthog-client.test.ts
  • git diff --check

The pre-commit hook also ran pnpm typecheck before the latest Code commits.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 54ea3d7.

@greptile-apps

greptile-apps Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(ui): reset MCP connect loading state" | Re-trigger Greptile

@cvolzer3 cvolzer3 changed the title Fix MCP connect button loading state fix(mcp-store): fix MCP connect button loading state Jun 24, 2026
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