Repository navigation
fix: share MCP server sign-ins across accounts - #3
Merged
Merged
Conversation
Claude Code keeps MCP OAuth tokens (mcpOAuth) in the same credential as the Claude login, so each account restored its own stale copy and every switch forced a fresh MCP sign-in. MCP tokens now live in one pool in the vault, shared by every account; a switch swaps only the Claude login. The live credential is authoritative, so signing out of a server sticks, while a credential with no mcpOAuth key (a fresh /login) leaves the pool alone. The first run seeds the pool from every stored account, keeping the newest copy of each server. Add `ccswitch mcp [status | isolate <name> | share <name>]` for an account that signs in to MCP servers as someone else. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Switching accounts forced a fresh sign-in to every OAuth MCP server (Figma, Sentry, PostHog...). Claude Code keeps those tokens (
mcpOAuth) in the same credential as the Claude login, so each account restored its own stale copy — often one a renewal had already consumed.~/.config/ccswitch/mcp-oauth.json, shared by every account. A switch swaps only the Claude login;claudeAiOauthand every other key are restored exactly as before.mcpOAuthas the pool, so signing out of a server sticks across switches. A credential with nomcpOAuthkey at all (a fresh/login) leaves the pool alone, andccswitch loginhands the new account the shared tokens.ccswitch mcp isolate <name>gives an account its own MCP sign-ins (e.g. a client's Figma), kept in its slot and never written to the pool.ccswitch mcp share <name>reverts;ccswitch mcpshows status.Test plan
test/smoke.sh— 90 passed, including: tokens follow a switch, a stale stored copy loses to a renewal, upgrade gathers and keeps the newest, sign-out is not undone, a fresh credential leaves the pool alone, isolate/share keep tokens apart, Claude token untouched throughouttest/keychain.sh— 13 passed, including MCP tokens across a keychain switchshellcheck -S styleclean🤖 Generated with Claude Code