Last Verified: September 2026 — commands checked against Serena’s official GitHub docs and CLI source
You ask Claude Code to change one function, and it greps for the name, opens a 900-line file, reads half of it, opens three more files, and your context window is gone before the first edit. Then the rename it does is a dozen fragile find-and-replace edits that still miss a call site.
Serena fixes that by giving the agent the tools your IDE already has. It can jump straight to a symbol, list every reference to it, rename it across the project, or replace one function body without reading the rest of the file. Under the hood it runs real language servers (LSP) for 40+ languages. It’s free and open source (by Oraios AI, ~30k GitHub stars, updated daily), and setup is three commands.
Quick Start
With uv installed, these three commands do the whole setup:
uv tool install -p 3.13 serena-agent
serena init
serena setup claude-code
Restart Claude Code and run /mcp. You should see serena listed. Total time: about 5 minutes.
⚡ Copy This Prompt: Let Claude Code Install and Verify It For You
Skip the manual steps below and hand the whole job to the agent instead:
You have shell access and the `claude mcp` CLI on this machine. Set up the Serena MCP server and report back. Do not tell me it's done unless step 5 actually confirms it:
1. Check `uv --version`. If uv is missing, install it with the official installer for my OS:
- macOS / Linux: `curl -LsSf https://astral.sh/uv/install.sh | sh`
- Windows (PowerShell): `powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"`
The installer puts uv in `~/.local/bin`, which may not be on this shell's PATH yet. Add it for this session (or call uv by its full path), then confirm `uv --version` works before continuing.
2. Install Serena: `uv tool install -p 3.13 serena-agent`, then run `serena init`.
3. Register it with Claude Code: `serena setup claude-code`. If that fails, fall back to: `claude mcp add --scope user serena -- serena start-mcp-server --context claude-code --project-from-cwd`
4. From my project root, run `serena project health-check` and show me the output.
5. Run `claude mcp list` and confirm serena shows as Connected.
If any step fails, give me the exact error and the command that produced it. Do not skip ahead.
Step 4 is the important one. A health check proves the language server actually parses your code, not just that the config entry exists.
What You’ll Need
| Requirement | Why You Need It | Time |
|---|---|---|
| Claude Code installed | Provides the claude mcp command Serena registers itself with | 0 min |
uv (Python package manager) | Serena is installed and managed through uv; it’s the only hard prerequisite | ~1 min |
| A real codebase | Serena shines on medium-to-large projects; on a 3-file script it adds little | 0 min |
| Language-specific extras (sometimes) | A few languages need an extra toolchain for their language server; see Serena’s language support page | 0–5 min |
Step-by-Step Setup
Prefer to do it by hand instead of delegating to the agent? Here’s the manual version.
Step 1 — Install uv
~1 min
macOS / Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
Windows (PowerShell):
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Open a new terminal afterward so uv is on your PATH.
Step 2 — Install Serena
~2 min
The package is called serena-agent. The -p 3.13 flag pins the Python version uv uses for it:
uv tool install -p 3.13 serena-agent
When it finishes, the serena command should be available in your shell.
Step 3 — Initialise Serena
~1 min
Creates Serena’s global config and sets the free language-server backend as the default:
serena init
You should get a success message. (JetBrains users can run serena init -b JetBrains to use the paid IDE-plugin backend instead.)
Step 4 — Register it with Claude Code
~1 min
The one-command way:
serena setup claude-code
Or add it manually. Global (every project, Serena picks up whichever folder you launch Claude Code from):
claude mcp add --scope user serena -- serena start-mcp-server --context claude-code --project-from-cwd
Per-project (only the current repo):
claude mcp add serena -- serena start-mcp-server --context claude-code --project "$(pwd)"
Step 5 — Index a large project (optional)
~1–5 min
From the project root, pre-build the symbol cache so the first queries aren’t slow:
serena project index
Step 6 — Make Claude Code actually use it (recommended)
~2 min
Serena’s own docs flag this: Claude Code’s long built-in tool descriptions create a strong bias toward its native grep/read tools, so the agent often ignores Serena even when it’s connected. Serena ships a system-prompt override that counteracts that. Launch Claude Code with it (bash/zsh, or Git Bash on Windows):
claude --system-prompt="$(serena prompts print-cc-system-prompt-override)"
Step 7 — Add Serena’s reminder hooks (optional)
~2 min
For long sessions, Serena provides hooks that nudge the agent back to its symbolic tools, activate the project at session start, and auto-approve Serena calls in permissive modes. Add the hooks you want to ~/.claude/settings.json (global) or .claude/settings.json (project):
{
"hooks": {
"PreToolUse": [
{ "matcher": "", "hooks": [{ "type": "command", "command": "serena-hooks remind --client=claude-code" }] },
{ "matcher": "mcp__serena__*", "hooks": [{ "type": "command", "command": "serena-hooks auto-approve --client=claude-code" }] }
],
"SessionStart": [
{ "matcher": "", "hooks": [{ "type": "command", "command": "serena-hooks activate --client=claude-code" }] }
],
"SessionEnd": [
{ "matcher": "", "hooks": [{ "type": "command", "command": "serena-hooks cleanup --client=claude-code" }] }
]
}
}
Serena labels hooks as an alpha feature. New to hooks? Our Claude Code hooks guide explains how PreToolUse and SessionStart work.
What Each Piece Does
| Piece | What It Does |
|---|---|
serena init | Writes the global config and picks the analysis backend (free LSP by default) |
serena setup claude-code | Registers the MCP server with Claude Code for you |
--context claude-code | Loads a tool set tuned for Claude Code; basic file/shell tools it already has are switched off to avoid overlap |
--project-from-cwd | Uses whatever directory you start Claude Code in as the active project |
serena project index | Pre-caches symbols so lookups on big repos are fast from the first call |
| System-prompt override | Counteracts Claude Code’s bias toward its built-in tools so Serena actually gets used |
serena-hooks | Optional reminder / activation / auto-approve hooks for long sessions |
The tools the agent gets
| Serena Tool | Replaces This Slow Pattern |
|---|---|
find_symbol | Grepping for a function name and reading every match |
get_symbols_overview | Opening a whole file just to see what’s defined in it |
find_referencing_symbols | Searching text for call sites and hoping none were missed |
replace_symbol_body | Line-number-based edits that break when the file shifts |
rename_symbol | Find-and-replace across files (and accidentally renaming the wrong thing) |
insert_after_symbol / insert_before_symbol | Guessing the right line to add a new method |
Verify It’s Actually Working
claude mcp list
! serena Timed out during startup → raise MCP_TIMEOUT (see mistakes below)
✘ serena Failed to connect → usually
serena not found on PATH
“Connected” only proves the server started. Check that the language server can read your code:
serena project health-check
Then give the agent a task that needs symbol-level understanding, and watch which tools it calls:
Activate the current project with Serena. Then use Serena's tools (not grep) to find every place that calls [A FUNCTION IN YOUR CODE] and summarize how each caller uses it.
If the tool calls show mcp__serena__find_symbol and find_referencing_symbols instead of Grep and Read, it’s working end to end.
Common Mistakes to Avoid
- Installing it from an MCP or plugin marketplace. Serena’s README explicitly warns that marketplace listings carry outdated install commands. Use
uv tool installas shown above. - Assuming “Connected” means “used”. Claude Code often keeps reaching for its built-in grep/read tools. Use the system-prompt override (Step 6) and, for long sessions, the hooks (Step 7).
- Startup timeouts on big projects. If Serena doesn’t come up in time, raise the MCP timeout:
export MCP_TIMEOUT=60000in your shell profile (Windows:setx MCP_TIMEOUT 60000, then open a new terminal). serenanot found by Claude Code. Even when it works in your terminal, the client may not see it on PATH. Replaceserenain theclaude mcp addcommand with the full path (which serenaon macOS/Linux,where serenaon Windows).- Forgetting to activate the project with a global install. With
--project-from-cwd, start Claude Code from the project root. Otherwise ask it to “activate the current directory as a project using Serena”.
Q&A
Is Serena free?
Yes. The default language-server backend is free and open source (GPL-3.0). There’s an optional paid JetBrains plugin backend (free trial) that adds extras like move/inline refactors and interactive debugging.
Which languages does it support?
40+ through language servers, including Python, TypeScript/JavaScript, Go, Rust, Java, C#, C/C++, PHP, Ruby, Kotlin, Swift, and more. A few need an extra toolchain installed; check the language support page.
Does it replace Claude Code’s built-in tools?
No, it adds to them. In the claude-code context, Serena turns off its own basic file/shell tools because Claude Code already has them, and focuses on symbol-level retrieval and editing.
Global or per-project install?
Global with --project-from-cwd is the simplest if you work across many repos. Per-project pins Serena to one folder and never switches.
How do I remove it?
claude mcp remove serena removes it from Claude Code, and uv tool uninstall serena-agent removes the package.
Official Resources
- Serena on GitHub — source, README, issue tracker
- Serena client setup docs — Claude Code, Codex, IDEs
- Serena language support — per-language requirements
- uv installation docs
- Claude Code MCP Documentation — the
claude mcpcommand reference
If this guide got Claude Code navigating your codebase like an IDE instead of grepping blind, follow us on X for more setup guides and prompt tips.
Leave a Reply