Serena
:rocket: Serena is a powerful coding agent toolkit capable of turning an LLM into a fully-featured agent that works directly on your codebase. Unlike most other tools, it is not tied to an LLM, framework or an interface, making it easy to use it in a variety of ways.
:wrench: Serena provides essential semantic code retrieval and editing tools that are akin to an IDE's capabilities, extracting code entities at the symbol level and exploiting relational structure. When combined with an existing coding agent, these tools greatly enhance (token) efficiency.
:free: Serena is free & open-source, enhancing the capabilities of LLMs you already have access to free of charge.
You can think of Serena as providing IDE-like tools to your LLM/coding agent.
With it, the agent no longer needs to read entire files, perform grep-like searches or basic string replacements to find the right parts of the code and to edit code.
Instead, it can use code-centric tools like find_symbol, find_referencing_symbols and insert_after_symbol.
TheSerena JetBrains plugin has been released!
LLM Integration
Serena provides the necessary tools for coding workflows, but an LLM is required to do the actual work, orchestrating tool use.
In general, Serena can be integrated with an LLM in several ways:
by using the model context protocol (MCP). Serena provides an MCP server which integrates with
by using mcpo to connect it to ChatGPT or other clients that don't support MCP but do support tool calling via OpenAPI.
by incorporating Serena's tools into an agent framework of your choice, as illustrated here. Serena's tool implementation is decoupled from the framework-specific code and can thus easily be adapted to any agent framework.
Related MCP server: MCP Files
Serena in Action
Demonstration 1: Efficient Operation in Claude Code
A demonstration of Serena efficiently retrieving and editing code within Claude Code, thereby saving tokens and time. Efficient operations are not only useful for saving costs, but also for generally improving the generated code's quality. This effect may be less pronounced in very small projects, but often becomes of crucial importance in larger ones.
https://github.com/user-attachments/assets/ab78ebe0-f77d-43cc-879a-cc399efefd87
Demonstration 2: Serena in Claude Desktop
A demonstration of Serena implementing a small feature for itself (a better log GUI) with Claude Desktop. Note how Serena's tools enable Claude to find and edit the right symbols.
https://github.com/user-attachments/assets/6eaa9aa1-610d-4723-a2d6-bf1e487ba753
Programming Language Support & Semantic Analysis Capabilities
Serena provides a set of versatile code querying and editing functionalities based on symbolic understanding of the code. Equipped with these capabilities, Serena discovers and edits code just like a seasoned developer making use of an IDE's capabilities would. Serena can efficiently find the right context and do the right thing even in very large and complex projects!
There are two alternative technologies powering these capabilities:
Language servers implementing the language server Protocol (LSP) — the free/open-source alternative.
The Serena JetBrains Plugin, which leverages the powerful code analysis and editing capabilities of your JetBrains IDE.
You can choose either of these backends depending on your preferences and requirements.
Language Servers
Serena incorporates a powerful abstraction layer for the integration of language servers that implement the language server protocol (LSP). The underlying language servers are typically open-source projects (like Serena) or at least freely available for use.
With Serena's LSP library, we provide support for over 30 programming languages, including AL, Bash, C#, C/C++, Clojure, Dart, Elixir, Elm, Erlang, Fortran, Go, Groovy (partial support), Haskell, Java, Javascript, Julia, Kotlin, Lua, Markdown, MATLAB, Nix, Perl, PHP, PowerShell, Python, R, Ruby, Rust, Scala, Swift, TOML, TypeScript, YAML, and Zig.
Some language servers require additional dependencies to be installed; see theLanguage Support page for details.
The Serena JetBrains Plugin
As an alternative to language servers, the Serena JetBrains Plugin leverages the powerful code analysis capabilities of your JetBrains IDE. The plugin naturally supports all programming languages and frameworks that are supported by JetBrains IDEs, including IntelliJ IDEA, PyCharm, Android Studio, WebStorm, PhpStorm, RubyMine, GoLand, CLion, and others. Only Rider is not supported.
The plugin offers the most robust and most powerful Serena experience.
See our documentation page for further details and instructions.
Quick Start
Prerequisites. Serena is managed by uv. If you don’t already have it, you need to install uv before proceeding.
Starting the MCP Server. The easiest way to start the Serena MCP server is by running the latest version from GitHub using uvx. Issue this command to see available options:
uvx --from git+https://github.com/oraios/serena serena start-mcp-server --helpConfiguring Your Client. To connect Serena to your preferred MCP client, you typically need to configure a launch command in your client. Follow the link for specific instructions on how to set up Serena for Claude Code, Codex, Claude Desktop, MCP-enabled IDEs and other clients (such as local and web-based GUIs).
While getting started quickly is easy, Serena is a powerful toolkit with many configuration options. We highly recommend reading through theuser guide to get the most out of Serena.
Specifically, we recommend to read about ...
User Guide
Please refer to the user guide for detailed instructions on how to use Serena effectively.
Community Feedback
Most users report that Serena has strong positive effects on the results of their coding agents, even when used within very capable agents like Claude Code. Serena is often described to be a game changer, providing an enormous productivity boost.
Serena excels at navigating and manipulating complex codebases, providing tools that support precise code retrieval and editing in the presence of large, strongly structured codebases. However, when dealing with tasks that involve only very few/small files, you may not benefit from including Serena on top of your existing coding agent. In particular, when writing code from scratch, Serena will not provide much value initially, as the more complex structures that Serena handles more gracefully than simplistic, file-based approaches are yet to be created.
Several videos and blog posts have talked about Serena:
YouTube:
Blog posts:
Acknowledgements
Sponsors
We are very grateful to our sponsors who help us drive Serena's development. The core team (the founders of Oraios AI) put in a lot of work in order to turn Serena into a useful open source project. So far, there is no business model behind this project, and sponsors are our only source of income from it.
Sponsors help us dedicating more time to the project, managing contributions, and working on larger features (like better tooling based on more advanced LSP features, VSCode integration, debugging via the DAP, and several others). If you find this project useful to your work, or would like to accelerate the development of Serena, consider becoming a sponsor.
We are proud to announce that the Visual Studio Code team, together with Microsoft’s Open Source Programs Office and GitHub Open Source have decided to sponsor Serena with a one-time contribution!
Community Contributions
A significant part of Serena, especially support for various languages, was contributed by the open source community. We are very grateful for the many contributors who made this possible and who played an important role in making Serena what it is today.
Technologies
We built Serena on top of multiple existing open-source technologies, the most important ones being:
multilspy. A library which wraps language server implementations and adapts them for interaction via Python. It provided the basis for our library Solid-LSP (
src/solidlsp). Solid-LSP provides pure synchronous LSP calls and extends the original library with the symbolic logic that Serena required.All the language servers that we use through Solid-LSP.
Without these projects, Serena would not have been possible (or would have been significantly more difficult to build).
Customizing and Extending Serena
It is straightforward to extend Serena's AI functionality with your own ideas.
Simply implement a new tool by subclassing
serena.agent.Tool and implement the apply method with a signature
that matches the tool's requirements.
Once implemented, SerenaAgent will automatically have access to the new tool.
It is also relatively straightforward to add support for a new programming language.
We look forward to seeing what the community will come up with! For details on contributing, see contributing guidelines.
Available Tools
29 toolsactivate_projectActivate ProjectBRead-only
Activates the project with the given name or path.
Inputs: project (required). Returns: result
check_onboarding_performedCheck Onboarding PerformedARead-only
Checks whether project onboarding was already performed. You should always call this tool before beginning to actually work on the project/after activating a project.
Inputs: no named parameters. Returns: result
create_text_fileCreate Text FileADestructive
Write a new file or overwrite an existing file. Returns a message indicating success or failure.
Inputs: relative_path (required), content (required). Returns: result
delete_memoryDelete MemoryADestructive
Delete a memory file. Should only happen if a user asks for it explicitly, for example by saying that the information retrieved from a memory file is no longer correct or no longer relevant for the project.
Inputs: memory_file_name (required). Returns: result
edit_memoryEdit MemoryADestructive
Replaces content matching a regular expression in a memory.
Inputs: memory_file_name (required), needle (required), repl (required), mode (required). Returns: result
execute_shell_commandExecute Shell CommandADestructive
Execute a shell command and return its output. If there is a memory about suggested commands, read that first. Never execute unsafe shell commands! IMPORTANT: Do not use this tool to start
long-running processes (e.g. servers) that are not intended to terminate quickly,
processes that require user interaction. Returns a JSON object containing the command's stdout and optionally stderr output.
Inputs: command (required), cwd, capture_stderr, max_answer_chars. Returns: result
find_fileFind FileARead-only
Finds non-gitignored files matching the given file mask within the given relative path. Returns a JSON object with the list of matching files.
Inputs: file_mask (required), relative_path (required). Returns: result
find_referencing_symbolsFind Referencing SymbolsARead-only
Finds references to the symbol at the given name_path. The result will contain metadata about the referencing symbols
as well as a short code snippet around the reference. Returns a list of JSON objects with the symbols referencing the requested symbol.
Inputs: name_path (required), relative_path (required), include_kinds, exclude_kinds, +1 more. Returns: result
find_symbolFind SymbolARead-only
Retrieves information on all symbols/code entities (classes, methods, etc.) based on the given name path pattern.
The returned symbol information can be used for edits or further queries.
Specify depth > 0 to also retrieve children/descendants (e.g., methods of a class).
A name path is a path in the symbol tree within a source file.
For example, the method my_method defined in class MyClass would have the name path MyClass/my_method.
If a symbol is overloaded (e.g., in Java), a 0-based index is appended (e.g. "MyClass/my_method[0]") to
uniquely identify it.
To search for a symbol, you provide a name path pattern that is used to match against name paths. It can be
a simple name (e.g. "method"), which will match any symbol with that name
a relative path like "class/method", which will match any symbol with that name path suffix
an absolute name path "/class/method" (absolute name path), which requires an exact match of the full name path within the source file. Append an index
[i]to match a specific overload only, e.g. "MyClass/my_method[1]". Returns a list of symbols (with locations) matching the name.
Inputs: name_path_pattern (required), depth, relative_path, include_body, +4 more. Returns: result
get_current_configGet Current ConfigARead-only
Print the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
Inputs: no named parameters. Returns: result
get_symbols_overviewGet Symbols OverviewARead-only
Use this tool to get a high-level understanding of the code symbols in a file. This should be the first tool to call when you want to understand a new file, unless you already know what you are looking for. Returns a JSON object containing info about top-level symbols in the file.
Inputs: relative_path (required), depth, max_answer_chars. Returns: result
initial_instructionsInitial InstructionsARead-only
Provides the 'Serena Instructions Manual', which contains essential information on how to use the Serena toolbox. IMPORTANT: If you have not yet read the manual, call this tool immediately after you are given your task by the user, as it will critically inform you!.
Inputs: no named parameters. Returns: result
insert_after_symbolInsert After SymbolADestructive
Inserts the given body/content after the end of the definition of the given symbol (via the symbol's location). A typical use case is to insert a new class, function, method, field or variable assignment.
Inputs: name_path (required), relative_path (required), body (required). Returns: result
insert_before_symbolInsert Before SymbolADestructive
Inserts the given content before the beginning of the definition of the given symbol (via the symbol's location). A typical use case is to insert a new class, function, method, field or variable assignment; or a new import statement before the first symbol in the file.
Inputs: name_path (required), relative_path (required), body (required). Returns: result
list_dirList DirARead-only
Lists files and directories in the given directory (optionally with recursion). Returns a JSON object with the names of directories and files within the given directory.
Inputs: relative_path (required), recursive (required), skip_ignored_files, max_answer_chars. Returns: result
list_memoriesList MemoriesARead-only
List available memories. Any memory can be read using the read_memory tool.
Inputs: no named parameters. Returns: result
onboardingOnboardingARead-only
Call this tool if onboarding was not performed yet. You will call this tool at most once per conversation. Returns instructions on how to create the onboarding information.
Inputs: no named parameters. Returns: result
prepare_for_new_conversationPrepare For New ConversationBRead-only
Instructions for preparing for a new conversation. This tool should only be called on explicit user request.
Inputs: no named parameters. Returns: result
read_fileRead FileARead-only
Reads the given file or a chunk of it. Generally, symbolic operations like find_symbol or find_referencing_symbols should be preferred if you know which symbols you are looking for. Returns the full text of the file at the given relative path.
Inputs: relative_path (required), start_line, end_line, max_answer_chars. Returns: result
read_memoryRead MemoryARead-only
Read the content of a memory file. This tool should only be used if the information is relevant to the current task. You can infer whether the information is relevant from the memory file name. You should not read the same memory file multiple times in the same conversation.
Inputs: memory_file_name (required), max_answer_chars. Returns: result
rename_symbolRename SymbolADestructive
Renames the symbol with the given name_path to new_name throughout the entire codebase.
Note: for languages with method overloading, like Java, name_path may have to include a method's
signature to uniquely identify a method. Returns result summary indicating success or failure.
Inputs: name_path (required), relative_path (required), new_name (required). Returns: result
replace_contentReplace ContentADestructive
Replaces one or more occurrences of a given pattern in a file with new content.
This is the preferred way to replace content in a file whenever the symbol-level tools are not appropriate.
VERY IMPORTANT: The "regex" mode allows very large sections of code to be replaced without fully quoting them!
Use a regex of the form "beginning.*?end-of-text-to-be-replaced" to be faster and more economical!
ALWAYS try to use wildcards to avoid specifying the exact content to be replaced,
especially if it spans several lines. Note that you cannot make mistakes, because if the regex should match
multiple occurrences while you disabled allow_multiple_occurrences, an error will be returned, and you can retry
with a revised regex.
Therefore, using regex mode with suitable wildcards is usually the best choice!.
Inputs: relative_path (required), needle (required), repl (required), mode (required), +1 more. Returns: result
replace_symbol_bodyReplace Symbol BodyADestructive
Replaces the body of the symbol with the given name_path.
The tool shall be used to replace symbol bodies that have been previously retrieved
(e.g. via find_symbol).
IMPORTANT: Do not use this tool if you do not know what exactly constitutes the body of the symbol.
Inputs: name_path (required), relative_path (required), body (required). Returns: result
search_for_patternSearch For PatternARead-only
Offers a flexible search for arbitrary patterns in the codebase, including the possibility to search in non-code files. Generally, symbolic operations like find_symbol or find_referencing_symbols should be preferred if you know which symbols you are looking for.
Pattern Matching Logic: For each match, the returned result will contain the full lines where the substring pattern is found, as well as optionally some lines before and after it. The pattern will be compiled with DOTALL, meaning that the dot will match all characters including newlines. This also means that it never makes sense to have .* at the beginning or end of the pattern, but it may make sense to have it in the middle for complex patterns. If a pattern matches multiple lines, all those lines will be part of the match. Be careful to not use greedy quantifiers unnecessarily, it is usually better to use non-greedy quantifiers like .*? to avoid matching too much content.
File Selection Logic:
The files in which the search is performed can be restricted very flexibly.
Using restrict_search_to_code_files is useful if you are only interested in code symbols (i.e., those
symbols that can be manipulated with symbolic tools like find_symbol).
You can also restrict the search to a specific file or directory,
and provide glob patterns to include or exclude certain files on top of that.
The globs are matched against relative file paths from the project root (not to the relative_path parameter that
is used to further restrict the search).
Smartly combining the various restrictions allows you to perform very targeted searches. Returns A mapping of file paths to lists of matched consecutive lines.
Inputs: substring_pattern (required), context_lines_before, context_lines_after, paths_include_glob, +4 more. Returns: result
switch_modesSwitch ModesBRead-only
Activates the desired modes, like ["editing", "interactive"] or ["planning", "one-shot"].
Inputs: modes (required). Returns: result
think_about_collected_informationThink About Collected InformationARead-only
Think about the collected information and whether it is sufficient and relevant. This tool should ALWAYS be called after you have completed a non-trivial sequence of searching steps like find_symbol, find_referencing_symbols, search_files_for_pattern, read_file, etc.
Inputs: no named parameters. Returns: result
think_about_task_adherenceThink About Task AdherenceARead-only
Think about the task at hand and whether you are still on track. Especially important if the conversation has been going on for a while and there has been a lot of back and forth.
This tool should ALWAYS be called before you insert, replace, or delete code.
Inputs: no named parameters. Returns: result
think_about_whether_you_are_doneThink About Whether You Are DoneARead-only
Whenever you feel that you are done with what the user has asked for, it is important to call this tool.
Inputs: no named parameters. Returns: result
write_memoryWrite MemoryADestructive
Write some information (utf-8-encoded) about this project that can be useful for future tasks to a memory in md format. The memory name should be meaningful.
Inputs: memory_file_name (required), content (required), max_answer_chars. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 29 tools
Most tools have distinct purposes, but there is some overlap between find_symbol, get_symbols_overview, and search_for_pattern, which could cause confusion about when to use each. The descriptions help clarify, but an agent might still hesitate between these for certain tasks.
Tool names consistently follow a verb_noun pattern (e.g., activate_project, create_text_file, execute_shell_command) with clear and descriptive verbs. There are no deviations in style, making it easy to predict tool names and their functions.
With 29 tools, the count feels heavy for a code assistant server, as it includes many overlapping or specialized tools (e.g., multiple 'think_about' tools). This could overwhelm agents and lead to inefficiency, though it's not extreme.
The tool set provides comprehensive coverage for code editing, file management, symbol manipulation, memory handling, and project onboarding. It includes all necessary CRUD operations and lifecycle steps, with no obvious gaps for the domain.
Maintenance
Related MCP Connectors
Codebase intelligence for agents: 152 structured artifacts across 21 programs, one call.
Code-map tools for AI agents: see a repo's structure first, then edit only what matters.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Token-efficient search for coding agents over public and private documentation.
Related MCP Servers
- AlicenseBqualityCmaintenanceA coding agent toolkit that transforms LLMs into coding assistants capable of working directly on your codebase with semantic code retrieval and editing tools, providing IDE-like capabilities without requiring API subscriptions.331MIT
- AlicenseAqualityNot gradedmaintenanceEnables agents to quickly find and edit code in a codebase with surgical precision. Find symbols, edit them everywhere with tools for reading code blocks, searching/replacing text, and making precise line-based modifications.311 npm-
- AlicenseBqualityDmaintenanceA coding agent toolkit that provides IDE-like semantic code retrieval and editing tools, enabling LLMs to efficiently navigate and modify codebases using symbol-level operations instead of basic file reading and string replacements.19MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI coding agents to query a pre-built semantic knowledge graph of code, reducing token usage and tool calls. Supports 16 tools for code exploration, analysis, and context building.24 npm9MIT