How to Add serena MCP Servers in Claude Code

Here are two common methods to configure them permanently — both survive restarts and will always auto-load when Claude Code launches.


Method 1: Command Line (Recommended)

Run the following command in your project directory:

claude mcp add serena -- uvx --from git+https://github.com/oraios/serena serena start-mcp-server --context ide-assistant --project $(pwd)
  • Automatically updates ~/.claude/settings.json
  • Adds the serena MCP server into the configuration
  • Will auto-connect each time Claude Code starts

Method 2: Manual Configuration File Edit

  1. Open ~/.claude/settings.json
  2. Add a new MCP server block, for example:
{
  "mcpServers": {
    "fujisoft-code-agent": {
      "command": "cmd.exe",
      "args": ["/c", "code-agent", "server"]
    },
    "serena": {
      "command": "uvx",
      "args": [
        "--from", "git+https://github.com/oraios/serena",
        "serena", "start-mcp-server",
        "--context", "ide-assistant",
        "--project", "/your/project/path"
      ]
    }
  }
}
  • You can add multiple MCP servers here
  • Save the file and restart Claude Code → the servers will auto-connect

Verify Your Configuration

To check your current MCP servers:

cat ~/.claude/settings.json

Or inside Claude Code:

/status

This will display the list of configured MCP servers and their status.


✅ Conclusion

  • Command Line Method → Quickest and easiest, auto-writes to config
  • Manual File Edit → More flexible, can add multiple servers at once
  • Result is the same → Both are persistent and survive restarts

Pro Tip:
On Windows, replace $(pwd) with %cd% when running the command.
Example:

claude mcp add serena -- uvx --from git+https://github.com/oraios/serena serena start-mcp-server --context ide-assistant --project %cd%

👉 With this setup, you can extend Claude Code with custom MCP servers like Serena and streamline your coding workflow!


🔹 Additional Knowledge: Execution Status & Management

After Adding Serena with --project

  • When you run: claude mcp add serena --project $(pwd)
    • Serena will only auto-start when you run Claude Code inside that project directory.
    • Other directories will not see Serena.

Manage and Modify MCP Servers

  1. List configured MCP servers: claude mcp list
  2. Remove Serena from config: claude mcp remove serena
  3. Re-add as a global configuration (visible everywhere): claude mcp add serena -- uvx --from git+https://github.com/oraios/serena serena start-mcp-server --context ide-assistant
  4. Add Serena to another project (project-level): cd /path/to/other/project claude mcp add serena -- uvx --from git+https://github.com/oraios/serena serena start-mcp-server --context ide-assistant --project $(pwd)

Config File Locations

  • Project-level config → created inside the project directory
  • Global config → stored in ~/.claude/settings.json

If you want to switch Serena from project-level to global:

  1. Remove the existing entry claude mcp remove serena
  2. Add it again without --project.

留下评论

通过 WordPress.com 设计一个这样的站点
从这里开始