Skip to content

fix: fallback copy for Servers File and Server Entry buttons#1128

Open
MumuTW wants to merge 2 commits intomodelcontextprotocol:mainfrom
MumuTW:fix-servers-copy-913
Open

fix: fallback copy for Servers File and Server Entry buttons#1128
MumuTW wants to merge 2 commits intomodelcontextprotocol:mainfrom
MumuTW:fix-servers-copy-913

Conversation

@MumuTW
Copy link

@MumuTW MumuTW commented Mar 6, 2026

Summary

  • add a resilient clipboard copy helper in Sidebar copy actions
  • use navigator.clipboard.writeText when available and fall back to document.execCommand("copy")
  • keep existing success toasts/UX behavior for both copy buttons
  • add tests for clipboard rejection + fallback success paths

Why

In non-secure or restricted contexts, navigator.clipboard.writeText can fail (for example NotAllowedError). This caused copy actions to show an error instead of copying. The fallback restores copy behavior for those contexts.

Testing

  • cd client && npm test -- --runTestsByPath src/components/__tests__/Sidebar.test.tsx

Closes #913

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.

Servers File Export is Broken

1 participant