Add Serena MCP Integration #8901

Closed
opened 2026-02-16 18:11:07 -05:00 by yindo · 2 comments
Owner

Originally created by @victorseara on GitHub (Feb 9, 2026).

Originally assigned to: @thdxr on GitHub.

Serena MCP Integration

Overview

Add support for Serena - a powerful coding agent toolkit providing semantic retrieval and editing capabilities. Serena provides IDE-like tools for LLMs, enabling precise code navigation and editing at the symbol level.

Configuration

Add the following to your ~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "serena": {
      "type": "local",
      "command": [
        "uvx",
        "--from",
        "git+https://github.com/oraios/serena",
        "serena",
        "start-mcp-server"
      ],
      "enabled": true
    }
  }
}

Prerequisites

  1. Install uv:

    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  2. Ensure your project has a .serena directory with configuration (Serena will guide you through setup on first run)

Language Support

Serena supports 30+ programming languages via LSP:

  • Python, JavaScript, TypeScript, Java
  • Go, Rust, C/C++, C#
  • Ruby, PHP, Swift, Kotlin
  • And many more (see full list)

When to Use

Use Serena when you need to:

  • Navigate large codebases - Find symbols and their references efficiently
  • Refactor code - Make precise edits at the symbol level, not just text replacement
  • Understand code structure - Get semantic understanding of code relationships
  • Work with complex projects - Handle large, strongly-structured codebases
  • Token-efficient coding - Avoid reading entire files; work with relevant symbols only

Key Tools Available

  • find_symbol - Locate symbols by name
  • find_referencing_symbols - Find all references to a symbol
  • insert_after_symbol - Insert code after specific symbols
  • replace_symbol - Replace symbol definitions
  • delete_symbol - Remove symbols safely
  • get_symbol_info - Get detailed symbol information
  • list_symbols - List symbols in a file or scope

Example Usage

Find the definition of the User class and all its methods
Insert a new method after the validate_email method in the User class
Find all places where the authenticate function is called
Replace the old logging function with the new implementation across the codebase

Alternative: JetBrains Plugin

If you use JetBrains IDEs (IntelliJ, PyCharm, etc.), consider the Serena JetBrains Plugin for even more robust integration.

Notes

  • Requires a project-based workflow with .serena configuration
  • Best for medium-to-large codebases; may be overkill for small scripts
  • Significantly improves token efficiency for complex tasks
  • Works alongside your existing coding agent to enhance capabilities
Originally created by @victorseara on GitHub (Feb 9, 2026). Originally assigned to: @thdxr on GitHub. ## Serena MCP Integration ### Overview Add support for [Serena](https://github.com/oraios/serena) - a powerful coding agent toolkit providing semantic retrieval and editing capabilities. Serena provides IDE-like tools for LLMs, enabling precise code navigation and editing at the symbol level. ### Configuration Add the following to your `~/.config/opencode/opencode.json`: ```json { "$schema": "https://opencode.ai/config.json", "mcp": { "serena": { "type": "local", "command": [ "uvx", "--from", "git+https://github.com/oraios/serena", "serena", "start-mcp-server" ], "enabled": true } } } ``` ### Prerequisites 1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/): ```bash curl -LsSf https://astral.sh/uv/install.sh | sh ``` 2. Ensure your project has a `.serena` directory with configuration (Serena will guide you through setup on first run) ### Language Support Serena supports 30+ programming languages via LSP: - Python, JavaScript, TypeScript, Java - Go, Rust, C/C++, C# - Ruby, PHP, Swift, Kotlin - And many more (see [full list](https://oraios.github.io/serena/01-about/020_programming-languages.html)) ### When to Use Use Serena when you need to: - **Navigate large codebases** - Find symbols and their references efficiently - **Refactor code** - Make precise edits at the symbol level, not just text replacement - **Understand code structure** - Get semantic understanding of code relationships - **Work with complex projects** - Handle large, strongly-structured codebases - **Token-efficient coding** - Avoid reading entire files; work with relevant symbols only ### Key Tools Available - `find_symbol` - Locate symbols by name - `find_referencing_symbols` - Find all references to a symbol - `insert_after_symbol` - Insert code after specific symbols - `replace_symbol` - Replace symbol definitions - `delete_symbol` - Remove symbols safely - `get_symbol_info` - Get detailed symbol information - `list_symbols` - List symbols in a file or scope ### Example Usage ``` Find the definition of the User class and all its methods Insert a new method after the validate_email method in the User class Find all places where the authenticate function is called Replace the old logging function with the new implementation across the codebase ``` ### Alternative: JetBrains Plugin If you use JetBrains IDEs (IntelliJ, PyCharm, etc.), consider the [Serena JetBrains Plugin](https://plugins.jetbrains.com/plugin/28946-serena/) for even more robust integration. ### Notes - Requires a project-based workflow with `.serena` configuration - Best for medium-to-large codebases; may be overkill for small scripts - Significantly improves token efficiency for complex tasks - Works alongside your existing coding agent to enhance capabilities
yindo closed this issue 2026-02-16 18:11:07 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 9, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #6263: Feature Request: Integrate Serena for Semantic Code Understanding

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 9, 2026): This issue might be a duplicate of existing issues. Please check: - #6263: Feature Request: Integrate Serena for Semantic Code Understanding Feel free to ignore if none of these address your specific case.
Author
Owner

@R44VC0RP commented on GitHub (Feb 9, 2026):

Dupe of #6263. OpenCode already supports MCP servers — you can use the config you provided today without any changes to OpenCode itself. The original issue has some discussion about whether Serena actually delivers on its token-saving claims, so check that thread.

Closing this one.

@R44VC0RP commented on GitHub (Feb 9, 2026): Dupe of #6263. OpenCode already supports MCP servers — you can use the config you provided today without any changes to OpenCode itself. The original issue has some discussion about whether Serena actually delivers on its token-saving claims, so check that thread. Closing this one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8901