SE

Serena

⭐ 27,000•TypeScript•Code Intelligence

Semantic code retrieval MCP toolkit for AI coding agents with repository-level intelligence.

MCPTypeScriptSemantic SearchCode IntelligenceKnowledge Graph

Overview

Serena is a powerful MCP toolkit that provides semantic code retrieval and repository-level intelligence for AI coding agents. It builds a knowledge graph of symbols, types, and relationships across the entire codebase, enabling agents to answer questions about code structure with precision. With 27K+ stars, it is a top choice for codebase-aware AI agents.

Features

  • ✓Semantic code retrieval beyond text matching
  • ✓MCP integration with Claude Code, Cursor
  • ✓Symbol-level indexing across the codebase
  • ✓Relationship mapping (callers, callees, dependencies)
  • ✓Codebase summarization for agent context
  • ✓Incremental indexing for large projects

Installation

npm install -g serena-mcp

Pros

  • +Deep semantic understanding of codebases
  • +Seamless MCP integration
  • +Symbol and relationship-level indexing
  • +Optimized for AI agent context windows
  • +Incremental indexing for large projects

Cons

  • −Indexing can be slow on very large codebases
  • −Requires LLM access for semantic analysis
  • −Semantic quality depends on the underlying model
  • −MCP-specific — less useful outside MCP ecosystems

Alternatives

Documentation

Serena — Powerful MCP Toolkit for Coding Agents

Overview

Serena is a powerful Model Context Protocol (MCP) toolkit for coding agents that provides semantic code retrieval and repository-level intelligence. With approximately 27,000 GitHub stars, Serena has become a top choice for AI coding agents that need deep codebase understanding.

Serena bridges the gap between generic code search and true semantic understanding. Rather than simple text matching, it builds a knowledge graph of symbols, types, and relationships across the entire codebase, enabling agents to answer questions like "where is the authentication logic?" or "what calls this function?" with precision and context.

Available at github.com/nikhil-iii/serena.

Features

  • Semantic Code Retrieval: Understands code intent, not just text patterns
  • MCP Integration: Fully compatible with Claude Code, Cursor, and other MCP clients
  • Symbol-Level Indexing: Indexes classes, functions, types, and variables across the entire codebase
  • Relationship Mapping: Maps caller-callee relationships, dependencies, and imports
  • Codebase Summarization: Generates concise summaries of large codebases for agent context
  • Cross-File Navigation: Finds related code across files without manual searching
  • Architecture Understanding: Identifies patterns, layers, and architectural structures
  • Incremental Indexing: Efficiently updates indexes as code changes

Installation

# Install via npm
npm install -g serena-mcp

# Or use npx directly
npx serena-mcp init

# Configure in MCP settings (Claude Desktop)
# claude_desktop_config.json:
{
  "mcpServers": {
    "serena": {
      "command": "npx",
      "args": ["serena-mcp"],
      "cwd": "/path/to/your/project"
    }
  }
}

Quick Start

# Initialize Serena in a project
npx serena-mcp init

# Index the current codebase
npx serena-mcp index .

# Start the MCP server
npx serena-mcp serve

Using Serena via MCP

# Serena provides tools accessible through MCP
# find_symbol: Find a class, function, or variable
# get_symbol_info: Get detailed information about a symbol
# find_callers: Find all callers of a function
# find_callees: Find all functions called by a symbol
# summarize_file: Get a summary of a file's purpose
# codebase_summary: Get an overview of the entire codebase

Core Concepts

Semantic Indexing

Serena builds a semantic index of the codebase using LLM-powered analysis. This goes beyond AST parsing to understand the intent and purpose of code, enabling natural-language queries about code structure.

Relationship Graph

Every symbol in the codebase is a node in a graph, with edges representing calls, imports, extends, and implements relationships. This graph enables powerful queries about code dependencies and architecture.

Agent-Ready Context

Serena formats its output as context optimized for AI agent consumption, providing just enough information for the agent to understand and act without overwhelming the context window.

Examples

Find All Callers of a Function

# Via MCP tool call
serena-find-callers --symbol "processPayment" --project ./src

Codebase Architecture Summary

# Get an overview of the project's structure
serena-codebase-summary --project . --depth 3

Semantic Search

# Find code related to a concept, not just text
serena-search --query "user authentication flow" --project .

Pros

  • ✅ Deep semantic understanding of codebases, not just text search
  • ✅ Seamless MCP integration with Claude Code, Cursor, and more
  • ✅ Symbol-level and relationship-level indexing
  • ✅ Optimized for AI agent context windows
  • ✅ Incremental indexing for large projects
  • ✅ Strong community with 27K+ stars

Cons

  • ❌ Indexing can be slow on very large codebases
  • ❌ Requires LLM access for semantic analysis
  • ❌ Semantic quality depends on the underlying model
  • ❌ Newer project with evolving features
  • ❌ MCP-specific — less useful outside MCP ecosystems

When to Use

  • Large Codebase Navigation: Understanding complex projects with AI agents
  • Code Refactoring: Identifying dependencies before making changes
  • Onboarding New Developers: Using AI to understand unfamiliar codebases
  • Architecture Analysis: Mapping system structure and relationships
  • MCP-Powered Coding: Enhancing any MCP-compatible coding agent with code intelligence

Resources