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
您必须重启Claude Code以加载新的MCP服务器:
1. 退出Claude Code控制台(输入exit或按Ctrl+C)
2. 运行claude --continue
3. 输入"continue"以恢复设置
重启后,我将:
- 验证Serena工具是否可访问
- 若需要则运行initial_instructions
- 为该项目执行入门引导(若尚未完成)
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可提供高级代码检索与编辑功能。
何时使用Serena:
- 基于符号的代码导航(查找定义、引用、实现)
- 在结构化代码库中进行精准代码操作
- 当可用时,优先选择基于符号的操作而非基于文件的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尚未初始化:
- 引导用户运行项目初始化命令
- 说明基于项目的工作流程与索引机制
- 如有需要,配置项目专属设置