Serena is a powerful MCP (Model Context Protocol) server that transforms large language models like Claude into full-featured coding agents with deep code understanding capabilities. It provides semantic code retrieval and editing tools that allow LLMs to work directly on your codebase, similar to what IDE capabilities would offer.
Setting up Serena requires the uv
package manager:
# Install uv first if you don't have it
# Follow instructions at https://docs.astral.sh/uv/getting-started/installation/
# Clone the repository (optional)
git clone https://github.com/oraios/serena
cd serena
# Create a config file (optional)
cp src/serena/resources/serena_config.template.yml serena_config.yml
Alternatively, you can use Serena directly without cloning by using uvx
:
uvx --from git+https://github.com/oraios/serena serena-mcp-server
To use Serena with Claude Desktop (available for Windows and macOS):
{
"mcpServers": {
"serena": {
"command": "/abs/path/to/uv",
"args": ["run", "--directory", "/abs/path/to/serena", "serena-mcp-server"]
}
}
}
For Windows paths with backslashes, be sure to escape them properly (e.g., C:\\Users\\name
).
Ask the LLM to activate a project by providing an absolute path:
Please activate the project at /path/to/my/project
For previously activated projects, you can refer to them by name:
Please activate the my-project project
The first time you activate a project, Serena will perform an onboarding process to analyze your codebase and create project memories.
Serena creates a .serena
directory in your project with configuration files:
.serena/project.yml
- Project-specific settings.serena/memories/
- Directory containing project memoriesSerena provides different modes and contexts to adapt its behavior to different scenarios:
Contexts define the environment in which Serena operates and are set at startup:
serena-mcp-server --context ide-assistant
Available contexts:
desktop-app
(default): Optimized for desktop applications like Claude Desktopide-assistant
: For integration with IDEs like VSCode or Cursoragent
: For more autonomous agent scenariosModes refine Serena's behavior for specific tasks and can be changed during a session:
Please switch to planning and one-shot modes
Available modes:
planning
: For analysis and planning tasksediting
: For direct code modificationinteractive
: For conversational back-and-forthone-shot
: For tasks to be completed in a single responseno-onboarding
: Skips the initial onboarding processSerena provides various tools for code navigation, analysis, and editing:
Start from a clean state: Begin with a clean git state for easier tracking of changes.
For Windows users: Set git config core.autocrlf true
to avoid line ending issues.
Plan before implementing: For complex tasks, start with a planning session before implementation.
Use project memories: After completing onboarding, continue in a new conversation and leverage the created memories.
Handling context limits: For long tasks, use the prepare_for_new_conversation
tool to create a summary and continue in a fresh session.
Structured code works best: Serena performs best with well-structured, modular codebases with good type annotations.
Enable the dashboard: The web dashboard (http://localhost:24282/dashboard/index.html by default) shows logs and allows shutting down the server.
If you experience issues with the standard stdio
protocol, try using SSE mode:
uv run serena-mcp-server --transport sse --port 9121
Check for hanging processes if Serena seems to crash or disappear.
Use the web dashboard to monitor logs and properly shut down the server.
Restart the language server if edits made outside of Serena aren't being detected.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.