
How to add Selvage to Windsurf
AI-powered code review automation: analyzes Git diffs to find bugs, security issues, and quality improvements. Paste the config into ~/.codeium/windsurf/mcp_config.json and restart Windsurf.
Last updated June 14, 2026 · 34★ · stdio · apikey
Windsurf config for Selvage
uv tool install selvage{
"mcpServers": {
"selvage": {
"command": "uvx",
"args": [
"selvage",
"mcp"
],
"env": {
"OPENROUTER_API_KEY": "your_openrouter_api_key_here"
}
}
}
}Requires `uv` (the Python package runner). Install it from https://docs.astral.sh/uv/ if `uvx` is not found.
Setup steps
- 1Open Windsurf → Cascade → the hammer/MCP icon → Configure (or edit ~/.codeium/windsurf/mcp_config.json).
- 2Paste the Selvage config below.
- 3Fill in placeholder secrets, then save.
- 4Click Refresh in the MCP panel.
- 5Selvage's tools become available to Cascade.
Before you start
- uv (or pipx/pip) to install and run Selvage
- Git repository to review
- An LLM provider API key (OPENROUTER_API_KEY recommended, or OPENAI/ANTHROPIC/GEMINI keys) — not required when using get_review_context / the Claude Code plugin
What Selvage can do in Windsurf
reviewRuns an AI code review of the current changes (staged, unstaged, or against a target branch/commit) using a selected model, returning quality improvements, bug findings, and security issues. Triggered via natural language such as 'Review current changes using selvage mcp'.
get_review_contextReturns structured review context (Git diff + AST-based Smart Context + system prompt) so the host agent (Claude Code, Cursor, Antigravity, etc.) can perform the code review with its own LLM — no Selvage/external API key required.
Security
Selvage runs the code review itself using an LLM provider API key (OPENROUTER_API_KEY, or individual OPENAI_API_KEY / ANTHROPIC_API_KEY / GEMINI_API_KEY). Keys are read from environment variables or the MCP `env` block — keep them out of shared/committed config. Alternatively, use the `get_review_context` tool (or the Claude Code plugin) so the host agent reviews with its own LLM and no external API key is needed. Diffs of your code are sent to the chosen LLM provider for analysis.
Selvage + Windsurf FAQ
Where is the Windsurf config file?
Windsurf reads MCP servers from ~/.codeium/windsurf/mcp_config.json. Paste the Selvage config there under the "mcpServers" key and restart the client.
Is Selvage safe to use with Windsurf?
Selvage runs the code review itself using an LLM provider API key (OPENROUTER_API_KEY, or individual OPENAI_API_KEY / ANTHROPIC_API_KEY / GEMINI_API_KEY). Keys are read from environment variables or the MCP `env` block — keep them out of shared/committed config. Alternatively, use the `get_review_context` tool (or the Claude Code plugin) so the host agent reviews with its own LLM and no external API key is needed. Diffs of your code are sent to the chosen LLM provider for analysis.
Do I need an API key to use Selvage?
Not always. If you use the `get_review_context` tool (or the Claude Code plugin's /review skill), the host agent performs the review with its own LLM and no external API key is needed. For Selvage to run the review itself, set OPENROUTER_API_KEY (recommended) or an individual provider key.
How does it keep reviews cost-effective?
Selvage uses Tree-sitter based AST analysis (Smart Context) to send only the minimal function/class blocks containing changed lines plus their dependencies, instead of whole files. It also auto-switches to a multi-turn Large Context Mode once total tokens exceed ~200k.
Which AI models are supported?
OpenAI (e.g. gpt-5.2-codex), Anthropic (claude-opus-4.6, claude-sonnet-4.5), Google (gemini-3-pro/flash), and OpenRouter-provided models like minimax-m2.5, glm-5, qwen3-coder, kimi-k2.5, and DeepSeek — all manageable with a single OpenRouter API key.