MCP Bridge for Claude Code with Multi-Model Support. Install globally: claude mcp add --scope user stravinsky -- uvx stravinsky. Add to CLAUDE.md: See https://pypi.org/project/stravinsky/
Project description
Stravinsky
The Avant-Garde MCP Bridge for Claude Code
Movement โข Rhythm โข Precision
What is Stravinsky?
Multi-model AI orchestration with OAuth authentication for Claude Code.
Features
- ๐ OAuth Authentication - Secure browser-based auth for Google (Gemini) and OpenAI (ChatGPT)
- ๐ค Multi-Model Support - Seamlessly invoke Gemini and GPT models from Claude
- ๐ฏ Native Subagent Orchestration - Auto-delegating orchestrator with parallel execution (zero CLI overhead)
- ๐ ๏ธ 40 MCP Tools - Model invocation, code search, semantic search, LSP refactoring, session management, and more
- ๐ง 9 Specialized Native Agents - Stravinsky (orchestrator), Research Lead, Implementation Lead, Delphi (GPT-5.2 advisor), Dewey (documentation), Explore (code search), Frontend (Gemini 3 Pro High UI/UX), Code Reviewer, Debugger
- ๐ Hook-Based Delegation - PreToolUse hooks enforce delegation patterns with hard boundaries (exit code 2)
- ๐ LSP Integration - Full Language Server Protocol support with persistent servers (35x speedup), code refactoring, and advanced navigation
- ๐ AST-Aware Search - Structural code search and refactoring with ast-grep
- ๐ง Semantic Code Search - Natural language queries with local embeddings (ChromaDB + Ollama)
- โก Cost-Optimized Routing - Free/cheap agents (explore, dewey) always async, expensive (delphi) only when needed
Quick Start
Installation
CRITICAL: Always use --scope user with @latest for auto-updates and Python 3.13
# CORRECT: User-level installation with Python 3.13 and automatic updates
claude mcp add --scope user stravinsky -- uvx --python python3.13 stravinsky@latest
# Why this matters:
# - --scope user: Works across all projects (stored in ~/.claude.json)
# - @latest: Auto-checks PyPI on every Claude restart (no stale cache)
# - --python python3.13: Required due to chromadb โ onnxruntime dependency (no Python 3.14+ support)
โ ๏ธ Python 3.13 Required: Stravinsky requires Python 3.13 or earlier. Python 3.14+ is not supported because chromadb depends on onnxruntime, which lacks wheels for Python 3.14+.
WRONG - Do NOT use these:
# โ Missing --python python3.13 (will fail on system Python 3.14+)
claude mcp add --global stravinsky -- uvx stravinsky@latest
# โ Local scope (only works in one project)
claude mcp add stravinsky -- uvx --python python3.13 stravinsky@latest
# โ No @latest (cache never updates, stays on old version)
claude mcp add --global stravinsky -- uvx --python python3.13 stravinsky
# โ uv tool install (requires manual upgrades)
uv tool install stravinsky
Development (local editable install):
# ONLY for active development on stravinsky source code
cd /path/to/stravinsky
uv tool install --editable . --force
claude mcp add --scope user stravinsky -- stravinsky
Authentication
Stravinsky supports two authentication methods for Gemini (API key takes precedence):
Option 1: API Key (Recommended for Development)
Simplest setup - just add your Gemini API key to .env:
# Add to your .env file (or export in shell)
GEMINI_API_KEY=your_api_key_here
# Or use GOOGLE_API_KEY (same effect)
GOOGLE_API_KEY=your_api_key_here
Get your API key:
- Visit Google AI Studio
- Create an API key
- Add to
.envfile in your project root
When to use: Development, testing, simple applications, or when you don't need OAuth scopes.
Option 2: OAuth (Production/Advanced)
Full OAuth flow with automatic token refresh:
# Login to Google (Gemini)
stravinsky-auth login gemini
# Login to OpenAI (ChatGPT Plus/Pro required)
stravinsky-auth login openai
# Check status
stravinsky-auth status
# Logout
stravinsky-auth logout gemini
When to use: Production apps, when you need OAuth scopes, or user-based access control.
Secure Token Storage:
OAuth tokens are stored securely with automatic fallback:
- Primary: System keyring (macOS Keychain, Linux Secret Service, Windows Credential Locker)
- Fallback: Encrypted files at
~/.stravinsky/tokens/using Fernet symmetric encryption - Encryption: AES-128-CBC with keys stored at
~/.stravinsky/tokens/.key(0o600 permissions) - No password prompts: Seamless authentication across all terminal sessions after initial login
- Global access: Works everywhere after one-time authentication per provider
Troubleshooting: Password Prompts (macOS)
If you experience persistent password prompts when authenticating, configure keyring to bypass macOS Keychain:
# 1. Create keyring config directory
mkdir -p ~/.config/python_keyring
# 2. Configure keyring to use fail backend (bypasses Keychain entirely)
cat <<EOT > ~/.config/python_keyring/keyringrc.cfg
[backend]
default-keyring = keyring.backends.fail.Keyring
EOT
# 3. Verify configuration
cat ~/.config/python_keyring/keyringrc.cfg
# 4. Re-authenticate (tokens will be stored in encrypted files only)
stravinsky-auth login gemini
This configuration stores tokens in encrypted files at ~/.stravinsky/tokens/ instead of macOS Keychain, eliminating password prompts across terminal sessions. See docs/KEYRING_AUTH_FIX.md for detailed information.
Slash Commands
Slash commands are discovered from:
- Project-local:
.claude/commands/**/*.md(recursive) - User-global:
~/.claude/commands/**/*.md(recursive)
Commands can be organized in subdirectories (e.g., .claude/commands/strav/stravinsky.md).
Native Subagent Architecture
Stravinsky uses native Claude Code subagents (.claude/agents/) with automatic delegation:
How It Works
- Auto-Delegation: Claude Code automatically delegates complex tasks to the Stravinsky orchestrator
- Hook-Based Control: PreToolUse hooks intercept direct tool calls and enforce delegation patterns
- Parallel Execution: Task tool enables true parallel execution of specialist agents
- Multi-Model Routing: Specialists use invoke_gemini/openai MCP tools for multi-model access
Agent Types
| Agent | Model | Cost | Use For |
|---|---|---|---|
| stravinsky | Claude Sonnet 4.5 (32k thinking) | Moderate | Auto-delegating orchestrator (primary) |
| explore | Gemini 3 Flash (via MCP) | Free | Code search, always async |
| dewey | Gemini 3 Flash + WebSearch | Cheap | Documentation research, always async |
| code-reviewer | Claude Sonnet (native) | Cheap | Quality analysis, always async |
| debugger | Claude Sonnet (native) | Medium | Root cause (after 2+ failures) |
| frontend | Gemini 3 Pro High (via MCP) | Medium | ALL visual changes (blocking) |
| delphi | GPT-5.2 Medium (via MCP) | Expensive | Architecture (after 3+ failures) |
Delegation Rules (oh-my-opencode Pattern)
- Always Async: explore, dewey, code-reviewer (free/cheap)
- Blocking: debugger (2+ failures), frontend (ALL visual), delphi (3+ failures or architecture)
- Never Work Alone: Orchestrator blocks Read/Grep/Bash via PreToolUse hooks
ULTRATHINK / ULTRAWORK
- ULTRATHINK: Engage exhaustive deep reasoning with extended thinking budget (32k tokens)
- ULTRAWORK: Maximum parallel execution - spawn all async agents immediately
Tools (40)
| Category | Tools |
|---|---|
| Model Invoke | invoke_gemini, invoke_openai, get_system_health |
| Environment | get_project_context, task_spawn, task_status, task_list |
| Agents | agent_spawn, agent_output, agent_cancel, agent_list, agent_progress, agent_retry |
| Code Search | ast_grep_search, ast_grep_replace, grep_search, glob_files |
| Semantic | semantic_search, semantic_index, semantic_stats, cancel_indexing, delete_index |
| LSP | lsp_diagnostics, lsp_hover, lsp_goto_definition, lsp_find_references, lsp_document_symbols, lsp_workspace_symbols, lsp_prepare_rename, lsp_rename, lsp_code_actions, lsp_code_action_resolve, lsp_extract_refactor, lsp_servers (12 tools) |
| Sessions | session_list, session_read, session_search |
| Skills | skill_list, skill_get |
LSP Performance & Refactoring
The Phase 2 update introduced the LSPManager, which maintains persistent language server instances:
- 35x Speedup: Subsequent LSP calls are near-instant because the server no longer needs to re-initialize and re-index the codebase for every request
- Code Refactoring: New support for
lsp_extract_refactorallows automated code extraction (e.g., extracting a method or variable) with full symbol resolution - Code Actions:
lsp_code_action_resolveenables complex, multi-step refactoring workflows with automatic fixes for diagnostics
Semantic Code Search
Natural language code search powered by embeddings. Find code by meaning, not just keywords.
Prerequisites:
# Install Ollama (default provider - free, local)
brew install ollama
# Pull the recommended lightweight embedding model (274MB)
ollama pull nomic-embed-text
# Or for better accuracy (670MB, slower):
ollama pull mxbai-embed-large
Recommended model: nomic-embed-text is lightweight (274MB), fast, and works great for code search. It's the best choice for most users, especially on space-constrained systems like MacBooks.
Workflow:
# STEP 1: Initial indexing (REQUIRED - run once per project)
semantic_index(project_path=".", provider="ollama")
# STEP 2: Enable auto-updates (OPTIONAL - recommended for active projects)
start_file_watcher(".", provider="ollama", debounce_seconds=2.0)
# STEP 3: Search your codebase with natural language
semantic_search(query="OAuth authentication logic", n_results=5)
semantic_stats() # View index statistics
# STEP 4: Stop watching when done (optional - watcher cleans up on exit)
stop_file_watcher(".")
# OPTIONAL: Cancel ongoing indexing (for large codebases)
cancel_indexing(project_path=".", provider="ollama")
# OPTIONAL: Delete indexes
delete_index(project_path=".", provider="ollama") # Delete ollama index for this project
delete_index(project_path=".") # Delete all provider indexes for this project
delete_index(delete_all=True) # Delete ALL indexes for ALL projects
โ ๏ธ Important: You MUST run semantic_index() first before using semantic search or starting the FileWatcher. If you skip this step:
semantic_search()will return no resultsstart_file_watcher()will show a warning but still work (indexes on first file change)
Example queries:
- "find authentication logic"
- "error handling in API endpoints"
- "database connection pooling"
Providers:
| Provider | Model | Size | Cost | Setup |
|---|---|---|---|---|
ollama (default) |
nomic-embed-text (recommended) | 274MB | Free/local | ollama pull nomic-embed-text |
ollama |
mxbai-embed-large (advanced) | 670MB | Free/local | ollama pull mxbai-embed-large |
gemini |
gemini-embedding-001 | N/A | OAuth/cloud | stravinsky-auth login gemini |
openai |
text-embedding-3-small | N/A | OAuth/cloud | stravinsky-auth login openai |
Technical details:
- AST-aware chunking: Python files split by functions/classes for better semantic boundaries
- Persistent storage: ChromaDB at
~/.stravinsky/vectordb/<project>_<provider>/ - Async parallel embeddings: 10 concurrent for fast indexing
- Automatic file watching: Background reindexing on code changes with configurable debouncing (2s default)
Native Subagents (9)
Configured in .claude/agents/*.md:
| Agent | Purpose | Location |
|---|---|---|
stravinsky |
Task orchestration with 32k extended thinking (Sonnet 4.5) | .claude/agents/stravinsky.md |
research-lead |
Research coordinator - spawns explore/dewey, synthesizes findings (Gemini Flash) | .claude/agents/research-lead.md |
implementation-lead |
Implementation coordinator - spawns frontend/debugger/reviewer (Haiku) | .claude/agents/implementation-lead.md |
explore |
Codebase search and structural analysis (Gemini 3 Flash) | .claude/agents/explore.md |
dewey |
Documentation research and web search (Gemini 3 Flash) | .claude/agents/dewey.md |
code-reviewer |
Security, quality, and best practice analysis (Claude Sonnet) | .claude/agents/code-reviewer.md |
debugger |
Root cause analysis and fix strategies (Claude Sonnet) | .claude/agents/debugger.md |
frontend |
UI/UX implementation with creative generation (Gemini 3 Pro High) | .claude/agents/frontend.md |
delphi |
Strategic architecture advisor with 32k thinking (GPT-5.2 Medium) | .claude/agents/delphi.md |
Development
# Install in development mode
uv pip install -e .
# Run server
stravinsky
Project Structure
stravinsky/
โโโ .claude/ # Claude Code configuration
โ โโโ agents/ # Native subagent configurations (7 agents)
โ โ โโโ stravinsky.md # Orchestrator (auto-delegated)
โ โ โโโ explore.md # Code search specialist
โ โ โโโ dewey.md # Documentation research
โ โ โโโ code-reviewer.md # Quality analysis
โ โ โโโ debugger.md # Root cause analysis
โ โ โโโ frontend.md # UI/UX specialist
โ โ โโโ delphi.md # Strategic advisor (GPT-5.2)
โ โ โโโ HOOKS.md # Hook architecture guide
โ โโโ commands/ # Slash commands (skills)
โ โ โโโ stravinsky.md # /strav orchestrator
โ โ โโโ delphi.md # /delphi strategic advisor
โ โ โโโ dewey.md # /dewey documentation research
โ โ โโโ publish.md # /publish PyPI release
โ โ โโโ review.md # /review code review
โ โ โโโ verify.md # /verify post-implementation
โ โ โโโ version.md # /version diagnostic info
โ โโโ hooks/ # Native Claude Code hooks (11 hooks)
โ โ โโโ stravinsky_mode.py # PreToolUse delegation enforcer
โ โ โโโ context.py # UserPromptSubmit context injection
โ โ โโโ todo_continuation.py # UserPromptSubmit todo continuation
โ โ โโโ truncator.py # PostToolUse output truncation
โ โ โโโ tool_messaging.py # PostToolUse user messaging
โ โ โโโ edit_recovery.py # PostToolUse edit backup
โ โ โโโ todo_delegation.py # PostToolUse parallel reminder
โ โ โโโ parallel_execution.py # PostToolUse parallel enforcement
โ โ โโโ notification_hook.py # PreToolUse agent spawn notifications
โ โ โโโ subagent_stop.py # PostToolUse agent completion handling
โ โ โโโ pre_compact.py # PreCompact context preservation
โ โโโ skills/ # Skill library (empty, skills in commands/)
โ โโโ settings.json # Hook configuration
โ โโโ HOOKS_INTEGRATION.md # Hook integration guide
โโโ mcp_bridge/ # Python MCP server
โ โโโ server.py # MCP server entry point
โ โโโ server_tools.py # Tool definitions
โ โโโ auth/ # OAuth authentication
โ โ โโโ oauth.py # Google OAuth (Gemini)
โ โ โโโ openai_oauth.py # OpenAI OAuth (ChatGPT)
โ โ โโโ token_store.py # Keyring storage
โ โ โโโ token_refresh.py # Auto-refresh tokens
โ โ โโโ cli.py # stravinsky-auth CLI
โ โโโ tools/ # MCP tool implementations
โ โ โโโ model_invoke.py # invoke_gemini, invoke_openai
โ โ โโโ agent_manager.py # agent_spawn, agent_output, etc.
โ โ โโโ code_search.py # ast_grep, grep, glob
โ โ โโโ semantic_search.py # semantic_search, semantic_index, semantic_stats
โ โ โโโ session_manager.py # session_list, session_read, etc.
โ โ โโโ skill_loader.py # skill_list, skill_get
โ โ โโโ project_context.py # get_project_context
โ โ โโโ lsp/ # LSP tool implementations
โ โ โโโ templates.py # Project templates
โ โโโ prompts/ # Agent system prompts (legacy CLI)
โ โ โโโ stravinsky.py # Legacy orchestrator prompt
โ โ โโโ delphi.py # Legacy advisor prompt
โ โ โโโ dewey.py # Legacy research prompt
โ โ โโโ explore.py # Legacy search prompt
โ โ โโโ frontend.py # Legacy UI/UX prompt
โ โ โโโ multimodal.py # Multimodal analysis prompt
โ โโโ hooks/ # MCP internal hooks (17+ hooks)
โ โ โโโ manager.py # Hook orchestration
โ โ โโโ truncator.py # Output truncation
โ โ โโโ parallel_enforcer.py # Parallel execution
โ โ โโโ todo_enforcer.py # Todo continuation
โ โ โโโ ... # 13+ more optimization hooks
โ โโโ native_hooks/ # Native Claude Code hooks
โ โ โโโ stravinsky_mode.py # PreToolUse delegation enforcer
โ โ โโโ tool_messaging.py # PostToolUse user messaging
โ โ โโโ todo_delegation.py # TodoWrite parallel reminder
โ โ โโโ todo_continuation.py # UserPromptSubmit todo injection
โ โ โโโ context.py # UserPromptSubmit context
โ โ โโโ truncator.py # PostToolUse truncation
โ โ โโโ edit_recovery.py # PostToolUse backup
โ โโโ cli/ # CLI utilities
โ โ โโโ session_report.py # Session analysis
โ โโโ config/ # Configuration
โ โ โโโ hooks.py # Hook configuration
โ โโโ utils/ # Utility functions
โโโ .stravinsky/ # Agent execution logs (gitignored)
โโโ assets/ # Logo, images
โโโ docs/ # Additional documentation
โโโ logs/ # Application logs
โโโ tests/ # Test suite
โโโ pyproject.toml # Build configuration
โโโ uv.lock # Dependency lock
โโโ ARCHITECTURE.md # Architecture guide (oh-my-opencode comparison)
โโโ CLAUDE.md # Project instructions
โโโ INSTALL.md # Installation guide
โโโ README.md # This file
Troubleshooting
OpenAI "Port 1455 in use"
The Codex CLI uses the same port. Stop it with: killall codex
OpenAI Authentication Failed
- Ensure you have a ChatGPT Plus/Pro subscription
- Tokens expire occasionally; run
stravinsky-auth login openaito refresh
Claude Code Not Loading Latest Version After Update
Problem: After deploying a new version to PyPI, Claude Code still uses the old cached version even after restart.
Root Cause: uvx caches packages and doesn't automatically check for updates. This is a known uvx behavior that affects all packages, not just Stravinsky.
Solution - Force Reinstall:
# Option 1: Run latest version with uvx (if using uvx in .mcp.json)
uvx stravinsky@latest
# Option 2: Upgrade with uv tool (if installed globally)
uv tool install --upgrade --force stravinsky
# or reinstall all tools:
uv tool upgrade --all --reinstall
# Option 3: Clear uvx cache entirely (nuclear option)
uv cache prune
# Option 4: Remove and re-add MCP server
claude mcp remove stravinsky
claude mcp add stravinsky -- uvx stravinsky@latest
# After any option, restart Claude Code
claude restart
Verify Version:
# Check installed version
stravinsky --version
# or
python -c "import mcp_bridge; print(mcp_bridge.__version__)"
# Check PyPI latest version
curl -s https://pypi.org/pypi/stravinsky/json | python -c "import sys, json; print(json.load(sys.stdin)['info']['version'])"
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stravinsky-0.4.27.tar.gz.
File metadata
- Download URL: stravinsky-0.4.27.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c1677553bdaa6e832600df30a161901a501f897999a5b32be8e52e4af60d2b8
|
|
| MD5 |
2923177c95efc9b27d787a3c18804dbf
|
|
| BLAKE2b-256 |
c11b855cdfa119c126b0b1701a108f5bf3c110d73b204dc31d338c4ed7860635
|
File details
Details for the file stravinsky-0.4.27-py3-none-any.whl.
File metadata
- Download URL: stravinsky-0.4.27-py3-none-any.whl
- Upload date:
- Size: 253.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93ba583be1c9ba19e7a8d4bfeb2b81ccd88a82d2f729de161a604ba9a07985ba
|
|
| MD5 |
05121702b1c002ffd83d567e3685e7e3
|
|
| BLAKE2b-256 |
d30dd55c4f3fe3595864d6dd58929aa11c1427883efddab54d99a51a3fbb5eb9
|