setup-serena-mcp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUser Input:
text
$ARGUMENTS用户输入:
text
$ARGUMENTSGuide for setup Serena MCP server
Serena MCP服务器搭建指南
1. Determine setup context
1. 确定搭建环境
Ask the user where they want to store the configuration:
Options:
-
Project level (shared via git) - Configuration tracked in version control, shared with team
- CLAUDE.md updates go to:
./CLAUDE.md
- CLAUDE.md updates go to:
-
Project level (personal preferences) - Configuration stays local, not tracked in git
- CLAUDE.md updates go to:
./CLAUDE.local.md - Verify these files are listed in , add them if not
.gitignore
- CLAUDE.md updates go to:
-
User level (global) - Configuration applies to all projects for this user
- CLAUDE.md updates go to:
~/.claude/CLAUDE.md
- CLAUDE.md updates go to:
Store the user's choice and use the appropriate paths in subsequent steps.
询问用户希望将配置存储在何处:
选项:
-
项目级别(通过Git共享) - 配置纳入版本控制,与团队共享
- CLAUDE.md更新路径:
./CLAUDE.md
- CLAUDE.md更新路径:
-
项目级别(个人偏好) - 配置仅保存在本地,不纳入Git追踪
- CLAUDE.md更新路径:
./CLAUDE.local.md - 确认这些文件已在中列出,若未列出则添加
.gitignore
- CLAUDE.md更新路径:
-
用户级别(全局) - 配置适用于该用户的所有项目
- CLAUDE.md更新路径:
~/.claude/CLAUDE.md
- CLAUDE.md更新路径:
记录用户的选择,并在后续步骤中使用对应的路径。
2. Check if Serena MCP server is already setup
2. 检查Serena MCP服务器是否已搭建
Check whether you have access to Serena MCP server by attempting to use one of its tools (e.g., or ).
find_symbolget_symbols_overviewIf no access, proceed with setup.
通过尝试使用其工具(如或)来检查是否可访问Serena MCP服务器。
find_symbolget_symbols_overview若无法访问,则继续进行搭建。
3. Load Serena documentation
3. 加载Serena文档
Read the following documentation to understand Serena's capabilities and setup process:
- Load https://raw.githubusercontent.com/oraios/serena/refs/heads/main/README.md to understand what Serena is and its capabilities
- Load https://oraios.github.io/serena/02-usage/020_running.html to learn how to run Serena
- Load https://oraios.github.io/serena/02-usage/030_clients.html to learn how to configure your MCP client
- Load https://oraios.github.io/serena/02-usage/040_workflow.html to learn how to setup Serena for your project
阅读以下文档以了解Serena的功能和搭建流程:
- 加载https://raw.githubusercontent.com/oraios/serena/refs/heads/main/README.md以了解Serena是什么及其功能
- 加载https://oraios.github.io/serena/02-usage/020_running.html以学习如何运行Serena
- 加载https://oraios.github.io/serena/02-usage/030_clients.html以学习如何配置MCP客户端
- 加载https://oraios.github.io/serena/02-usage/040_workflow.html以学习如何为项目搭建Serena
4. Guide user through setup process
4. 引导用户完成搭建流程
Based on the loaded documentation:
- Check prerequisites: Verify that is installed (required for running Serena)
uv - Identify client type: Determine which MCP client the user is using (Claude Code, Claude Desktop, Cursor, VSCode, etc.)
- Provide setup instructions: Guide through the configuration specific to their client if it not already configured
- Setup project: Guide through the project setup process if it not already setup
- Start indexing project: Guide through the project indexing process if it was just setup
- If MCP was just setup, ask user to restart Claude Code to load the new MCP server, write to user explisit instructions, including "exit claude code console, then run 'claude --continue' and then write "continue" to continue setup process"
- Test connection: Verify that Serena tools are accessible after setup
- If not yet, run initial_instructions
- Check if onboarding was performered, if not then run it.
- Then try to read any file
After adding MCP server, but before testings connection write to user this message EXACTLY:
markdown
You must restart Claude Code to load the new MCP server:
1. Exit Claude Code console (type exit or press Ctrl+C)
2. Run claude --continue
3. Type "continue" to resume setup
After restart, I will:
- Verify Serena tools are accessible
- Run initial_instructions if needed
- Perform onboarding for this project (if not already done)
基于加载的文档:
- 检查前置条件:确认已安装(运行Serena的必备工具)
uv - 确定客户端类型:判断用户使用的MCP客户端(Claude Code、Claude Desktop、Cursor、VSCode等)
- 提供搭建说明:若客户端未配置,则提供针对该客户端的配置指引
- 项目搭建:若项目未搭建,则引导用户完成项目搭建流程
- 启动项目索引:若项目刚完成搭建,则引导用户完成项目索引流程
- 若MCP刚完成搭建,请明确告知用户需重启Claude Code以加载新的MCP服务器,具体指令为:“退出claude code控制台,然后运行'claude --continue',之后输入'continue'以继续搭建流程”
- 测试连接:搭建完成后验证Serena工具是否可访问
- 若不可访问,运行initial_instructions
- 检查是否已完成入门引导,若未完成则执行
- 尝试读取任意文件
在添加MCP服务器后、测试连接前,请向用户发送以下精确消息:
markdown
You must restart Claude Code to load the new MCP server:
1. Exit Claude Code console (type exit or press Ctrl+C)
2. Run claude --continue
3. Type "continue" to resume setup
After restart, I will:
- Verify Serena tools are accessible
- Run initial_instructions if needed
- Perform onboarding for this project (if not already done)
5. Update CLAUDE.md file
5. 更新CLAUDE.md文件
Use the path determined in step 1. Once Serena is successfully set up, update the appropriate CLAUDE.md file with the following content EXACTLY:
markdown
undefined使用步骤1中确定的路径。Serena搭建成功后,将以下精确内容更新至对应的CLAUDE.md文件:
markdown
undefinedUse Serena MCP for Semantic Code Analysis instead of regular code search and editing
使用Serena MCP进行语义代码分析,替代常规代码搜索与编辑
Serena MCP is available for advanced code retrieval and editing capabilities.
When to use Serena:
- Symbol-based code navigation (find definitions, references, implementations)
- Precise code manipulation in structured codebases
- Prefer symbol-based operations over file-based grep/sed when available
Key tools:
- - Find symbol by name across the codebase
find_symbol - - Find all symbols that reference a given symbol
find_referencing_symbols - - Get overview of top-level symbols in a file
get_symbols_overview - - Read file content within the project directory
read_file
Usage notes:
- Memory files can be manually reviewed/edited in
.serena/memories/
Add this section, if server setup at user level (global):
```markdown
**Project setup (per project):**
1. Run `serena project create --index` in your project directory
2. Serena auto-detects language; creates `.serena/project.yml`
3. First use triggers onboarding and creates memory files in `.serena/memories/`Serena MCP可提供高级代码检索与编辑功能。
使用场景:
- 基于符号的代码导航(查找定义、引用、实现)
- 在结构化代码库中进行精准代码操作
- 优先使用基于符号的操作,而非基于文件的grep/sed(若可用)
核心工具:
- - 在整个代码库中按名称查找符号
find_symbol - - 查找所有引用指定符号的符号
find_referencing_symbols - - 获取文件中顶级符号的概览
get_symbols_overview - - 读取项目目录内的文件内容
read_file
使用说明:
- 内存文件可在中手动查看/编辑
.serena/memories/
若服务器为用户级别(全局)搭建,需添加以下部分:
```markdown
**项目级搭建(每个项目单独配置):**
1. 在项目目录中运行`serena project create --index`
2. Serena会自动检测语言;创建`.serena/project.yml`文件
3. 首次使用会触发入门引导,并在`.serena/memories/`中创建内存文件6. Project initialization (if needed)
6. 项目初始化(若需)
If this is a new project or Serena hasn't been initialized:
- Guide user to run project initialization commands
- Explain project-based workflow and indexing
- Configure project-specific settings if needed
若为新项目或Serena尚未初始化:
- 引导用户运行项目初始化命令
- 解释基于项目的工作流程与索引机制
- 若需,配置项目特定设置