ccs - Claude Code Switcher

A lightweight CLI tool for switching between Claude Code profiles with different MCP server configurations and authentication methods.
Features
- π Quick Profile Switching: Interactive TUI for selecting profiles
- π Dual Auth Support: Standard Claude account (keychain) and Vertex AI (env vars)
- βοΈ MCP Configuration: Automatic merging of MCP server configs
- π¨ Beautiful TUI: Clean, keyboard-driven interface with visual indicators
- π Secure: Credentials stored in system keyring (macOS Keychain / Linux Secret Service)
- π¦ Self-Contained: Single binary with no external dependencies
Installation
Homebrew (macOS/Linux)
brew install virtuallytd/tap/claude-code-switcher
Shell Integration β Add to ~/.zshrc or ~/.bashrc:
ccs() {
# If no arguments, "switch", or "reload", run with eval
if [[ $# -eq 0 ]] || [[ "$1" == "switch" ]] || [[ "$1" == "reload" ]]; then
eval "$(command ccs "$@")"
else
# Pass through other commands (save, current, version, help) directly
command ccs "$@"
fi
}
Reload your shell:
source ~/.zshrc
Verify:
ccs version
For more Homebrew options and tap usage, see virtuallytd/homebrew-tap.
Manual Install
- Download the latest binary from releases
- Extract and move to your PATH:
tar -xzf ccs_*.tar.gz
sudo mv ccs /usr/local/bin/
- Add the shell function above to your shell config
From Source
git clone https://github.com/virtuallytd/claude-code-switcher
cd claude-code-switcher
make install
Then add the shell function above to your shell config.
Usage
Switch Profiles
Interactive profile selector:
ccs
This launches a TUI where you can:
- Navigate with arrow keys or
j/k
- Select with
Enter
- Quit with
q, Esc, or Ctrl+C
Reload Current Profile
Re-apply the current profile without interactive selection (useful after editing settings.json):
ccs reload
Save Session Token
Save your current Claude Code session token for a profile (required once per standard auth profile):
claude login # Login to Claude first
ccs save personal # Save token for "personal" profile
This is only needed for standard auth profiles. Vertex AI profiles use gcloud credentials.
Show Current Profile
ccs current
Output example:
work (vertex)
Profile Structure
Profiles live in ~/.claude/profiles/<name>/:
~/.claude/profiles/
βββ personal/
β βββ settings.json # MCP server config (required)
βββ work/
βββ settings.json # MCP server config (required)
βββ env.zsh # Vertex AI vars (optional)
Standard Auth Profile (Claude Account)
Create directory and settings:
mkdir -p ~/.claude/profiles/personal
Add settings.json:
{
"mcpServers": {
"server-name": {
"type": "sse",
"url": "http://localhost:3000/sse"
}
}
}
Then save your session token:
claude login
ccs save personal
Vertex AI Profile
Create directory, settings, and env vars:
mkdir -p ~/.claude/profiles/work
Add settings.json (same format as above).
Add env.zsh:
export CLAUDE_CODE_USE_VERTEX=1
export CLOUD_ML_REGION=us-east5
export ANTHROPIC_VERTEX_PROJECT_ID=your-project-id
Vertex AI authentication relies on gcloud auth being configured.
How It Works
Switching Process
- Profile Discovery: Scans
~/.claude/profiles/ for valid profiles
- Interactive Selection: Shows TUI with profile list
- Environment Cleanup: Clears Vertex AI vars (prevents leakage)
- Authentication:
- Vertex AI profiles: Sources
env.zsh environment variables
- Standard profiles: Restores session token from keyring to active
"Claude Code" entry
- Settings Merge: Merges
mcpServers from profile into ~/.claude/settings.json
- Shell Commands: Outputs
export/unset commands to stdout (eval'd by shell function)
Visual Indicators
β Filled dot = Currently active profile
β Empty dot = Inactive profile
- Orange text = Vertex AI profile
- Blue text = Standard auth profile
β― Cursor on selected item
- β
macOS: Uses Keychain for secure token storage
- β
Linux: Uses Secret Service (gnome-keyring, KWallet)
- β Windows: Not currently supported
MCP Server Configuration
Transport Types
SSE (Server-Sent Events) for local servers:
{
"type": "sse",
"url": "http://localhost:3000/sse"
}
HTTP for OAuth-based remote servers:
{
"type": "http",
"url": "https://api.example.com"
}
β οΈ Important: Never use "http" for SSE servers β it will cause OAuth authentication errors.
Security
- Session tokens: Encrypted in system keyring (Keychain/Secret Service)
- Vertex AI credentials: Uses
gcloud auth (not stored in profiles)
- Environment isolation: Vertex vars cleared before every switch
- File permissions: Settings files should be
0644 (readable by owner)
Troubleshooting
"No active Claude session found"
Run claude login first, then switch profiles.
"No saved token for profile"
For standard auth profiles, you need to save the token:
claude login
ccs save <profile-name>
Profile not appearing in list
Ensure the profile directory has a valid settings.json file.
Development
See CONTRIBUTING.md for contribution guidelines.
Build
make build # Build binary
make test # Run tests
make snapshot # Test GoReleaser build locally
Dependencies
Project Structure
ccs/
βββ main.go # CLI entrypoint
βββ cmd/
β βββ switch.go # Interactive switcher (TUI)
β βββ current.go # Show active profile
β βββ reload.go # Reload current profile
β βββ save.go # Save session token
βββ internal/
βββ profile/ # Profile discovery & loading
βββ keyring/ # Keyring wrapper
βββ config/ # Settings.json merging
Security
See SECURITY.md for security policy and reporting vulnerabilities
License
MIT
Contributing
Issues and pull requests welcome!