Stop Wasting Tokens in Claude Code and Cursor — Use Serena MCP Server

There are many ways to reduce token usage when working with AI coding agents. Today, let’s look at one of the most effective: Serena MCP Server.

Why Does Serena Save Tokens?

When you use Claude or other AI coding agents, they typically load entire files or use search tools to find relevant code. The problem? These approaches don’t understand code structure — they pull in far more context than necessary. The result is wasted tokens and slower analysis.

Serena takes a fundamentally different approach. Instead of treating your codebase as raw text, it understands the semantics and structure of your code, then selectively retrieves only what’s needed. This eliminates unnecessary token consumption at the source.

On top of that, Serena’s precise understanding of code dependencies and architecture means fewer retries and more accurate results on the first pass. When an AI agent uses Serena, it becomes dramatically more efficient.

Serena stands for “SEmantic Retrieval & Editing Noetic Agent” — a semantic code retrieval and editing intelligence agent.

Tools Provided by Serena MCP Server

Serena exposes a rich set of tools that AI agents can call on demand: file finding, directory listing, pattern matching, symbol lookup, and more. Each tool is purpose-built for navigating code with minimal token overhead.

You can find the full list of tools and their descriptions here:
https://github.com/oraios/serena?tab=readme-ov-file#list-of-tools

Setup Couldn’t Be Easier

If you have uvx installed, you can start using Serena immediately — no separate installation required. Just add the following to your MCP configuration:

{
  "serena": {
    "command": "/opt/homebrew/bin/uvx",
    "args": [
      "--from",
      "git+https://github.com/oraios/serena",
      "serena",
      "start-mcp-server"
    ],
    "env": {},
    "working_directory": null
  }
}

Don’t have uvx? Install it with:

brew install uv

No Homebrew? Install it here.

Once uv is installed, verify with uvx --version, then add the configuration above to your tool’s MCP settings. That’s it.

What It Looks Like in Action

Once configured, your AI agent will automatically call Serena’s tools when navigating and editing code. You’ll see tool invocations like symbol lookups and dependency resolution happening seamlessly in the background — all while consuming a fraction of the tokens that traditional file-loading approaches would require.

Supported Languages

Serena supports an extensive list of programming languages out of the box. Unless you’re working with something truly exotic, your language is likely covered:

  • Python
  • TypeScript / JavaScript
  • PHP — uses Intelephense LSP (set INTELEPHENSE_LICENSE_KEY for premium features)
  • Go — requires gopls
  • R — requires the languageserver R package
  • Rust — requires rustup (uses rust-analyzer)
  • C / C++ — reference finding may have issues (actively being improved)
  • Zig — requires ZLS (Zig Language Server)
  • C#
  • Ruby — uses ruby-lsp by default; specify ruby_solargraph for Solargraph
  • Swift
  • Kotlin — uses pre-alpha official Kotlin LS
  • Java — note: startup is slow, especially on first run
  • Clojure
  • Dart
  • Bash
  • Lua — auto-downloads lua-language-server if not installed
  • Nix — requires nixd
  • Elixir — requires NextLS and Elixir (Windows not supported)
  • Elm — auto-downloads elm-language-server; requires Elm compiler
  • Scala — requires manual setup; uses Metals LSP
  • Erlang — requires beam and erlang_ls (experimental)
  • Perl — requires Perl::LanguageServer
  • Fortran — requires fortls (pip install fortls)
  • Haskell — auto-locates HLS via ghcup, stack, or system PATH
  • Julia
  • AL
  • Markdown — must be explicitly specified via --language markdown

For full details on language support and semantic analysis capabilities:
https://github.com/oraios/serena?tab=readme-ov-file#programming-language-support–semantic-analysis-capabilities

댓글 남기기