Skip to content

fix: prevent browser caching of Klavis MCP servers list#347

Open
felarof99 wants to merge 1 commit intomainfrom
fix/klavis-servers-cache
Open

fix: prevent browser caching of Klavis MCP servers list#347
felarof99 wants to merge 1 commit intomainfrom
fix/klavis-servers-cache

Conversation

@felarof99
Copy link
Contributor

Summary

  • Fix new Klavis MCP servers not showing up for existing users after OTA updates
  • Root cause: /klavis/servers endpoint had no Cache-Control headers, allowing browsers to serve stale cached responses
  • Existing users' browsers would cache the old server list and never fetch the updated one

Changes

Backend (1 file):

  • klavis.ts — Added Cache-Control: no-store header to /klavis/servers endpoint to prevent browser caching

Frontend (1 file):

  • useGetMCPServersList.tsx — Added cache: 'no-store' to fetch request and revalidateOnFocus: true to SWR config (matching the pattern used by useGetUserMCPIntegrations)

Test plan

  • Deploy the update and verify existing users now see all new MCP servers (Stripe, Brave Search, Exa, etc.) without needing to clear cache
  • Verify the "Add built-in app" dialog shows the full list of servers
  • Run bun test — all 3 Klavis route tests pass

🤖 Generated with Claude Code

Existing users weren't seeing new MCP servers after OTA updates because
the /klavis/servers endpoint had no Cache-Control headers, allowing the
browser to serve stale cached responses.

- Add Cache-Control: no-store header to /klavis/servers endpoint
- Add cache: 'no-store' to the frontend fetch request
- Add revalidateOnFocus: true to SWR hook (matching useGetUserMCPIntegrations)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the fix label Feb 21, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 21, 2026

Greptile Summary

Fixed browser caching issue preventing new Klavis MCP servers from appearing for existing users after OTA updates by adding Cache-Control: no-store header to backend endpoint and cache: 'no-store' to frontend fetch request.

  • Backend: Added Cache-Control: no-store header to /klavis/servers endpoint
  • Frontend: Added cache: 'no-store' to fetch config and revalidateOnFocus: true to SWR config

The changes implement defense-in-depth caching prevention at both layers (backend headers and frontend fetch options) to ensure users always receive the latest server list.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are minimal, focused, and directly address the stated issue. Both backend and frontend cache prevention mechanisms are added correctly. The fix follows existing patterns in the codebase and includes appropriate HTTP headers and fetch options. No logic changes, no security concerns, and aligns with the test plan.
  • No files require special attention

Important Files Changed

Filename Overview
apps/server/src/api/routes/klavis.ts Added Cache-Control: no-store header to prevent browser caching of MCP servers list
apps/agent/entrypoints/app/connect-mcp/useGetMCPServersList.tsx Added cache: 'no-store' to fetch and revalidateOnFocus: true to SWR config for cache busting

Last reviewed commit: ce8cfa6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant