Claude Code MCP: How to Add Servers, and 6 Codebase Indexing Options

Raghav ChamadiyaUpdated 9 min read
Compared in this post: repowise and
  • Serena
  • Graphify
  • cocoindex-code
On this page

To add an MCP server to Claude Code, run claude mcp add --transport http <name> <url> for a remote server, or claude mcp add <name> -- <command> for a local one. For codebases the servers worth adding are CodeGraph or code-review-graph for a fast call graph, Serena for language-server symbols, cocoindex-code for semantic search, Graphify for a knowledge graph, and repowise for graph plus git history, generated docs, decisions and health. Claude Code keeps no index of its own; it greps and reads files each session, which costs tokens on large repos.

ToolWhat it indexesLocal onlyLicense
repowiseCall graph, git history, generated docs, decisions, health, embeddingsYes (hosted optional)AGPL-3.0
CodeGraphSymbol and call graph in SQLite with full-text searchYesMIT
SerenaLive symbols through language servers (no stored graph)YesGPL-3.0 (Serena), MIT (SolidLSP)
GraphifyKnowledge graph from AST, plus docs and PDFs through your modelCode yes; docs go to your modelApache-2.0
code-review-graphTree-sitter graph of calls, imports and tests in SQLiteYesMIT
cocoindex-codeAST-chunked embeddings for semantic searchYes with local embeddingsApache-2.0

Scroll the table sideways to see every column.

Measured results are in what we measured below, from our August 2026 benchmark on django/django. Setup commands and licenses were checked on each project's own page on 12 and 29 October 2026; the claude mcp commands below were checked against Anthropic's MCP documentation on 29 October 2026.

We build repowise, so weigh our entry accordingly. The measurements we publish about it, with their methods, are on the benchmarks page.

How do you add an MCP server to Claude Code?

Use claude mcp add with the transport that matches the server: http for a remote URL, stdio for a command that runs on your machine. The -- separates Claude's own options from the server's command.

bash
# Remote server over HTTP (SSE is deprecated)
claude mcp add --transport http <name> <url>
claude mcp add --transport http secure-api https://api.example.com/mcp \
  --header "Authorization: Bearer your-token"

# Local stdio server
claude mcp add --env API_KEY=YOUR_KEY <name> -- npx -y some-mcp-server

claude mcp list            # servers and health
claude mcp get <name>      # one server's details
claude mcp remove <name>

Inside a session, /mcp shows each server's status and tool count and lets you enable, disable or reconnect it. Where the config lands depends on the scope flag:

ScopeFlagLoads inShared with the teamStored in
local (default)--scope localThis project onlyNo~/.claude.json
project--scope projectThis project onlyYes, through version control.mcp.json in the repo root
user--scope userAll your projectsNo~/.claude.json

Scroll the table sideways to see every column.

A project-scoped server is a plain file you can commit:

json
{
  "mcpServers": {
    "shared-server": { "type": "http", "url": "https://example.com/mcp" }
  }
}

Claude Code asks each person to approve project-scoped servers the first time. Tool output over 10,000 tokens triggers a warning, and output is capped at 25,000 tokens unless you raise MAX_MCP_OUTPUT_TOKENS. Tool definitions are deferred, so a connected server costs little context until its tools are used.

What does Cursor-style indexing mean for Claude Code?

Cursor-style indexing means the tool read the repository before you asked, so "where do we validate webhooks?" does not start with ten rounds of searching. Cursor's current search docs describe a local "Instant Grep" index built on your machine and say Cursor "does not store embeddings of your codebase for search."

Claude Code takes the plain route. It has tools to grep, glob and read files, and nothing persists between sessions. On a small repo that is cheap. On a large one, each session repeats the same exploration: list folders, grep a name, open five files, find four were wrong, open three more. That exploration is most of the token bill.

An MCP server fixes this by doing the expensive reading once, offline, and answering from the result. The six below differ in what they read and what they can answer.

The six options

repowise

repowise parses the repo into a call and import graph, mines git history (hotspots, owners, files that change together), writes a documentation page per module, extracts architectural decisions, scores code health and builds search embeddings. Agents get ten tools, among them get_overview, get_context, get_risk, search_codebase and get_answer, across 28 AST-parsed languages. Updates after the first index are incremental.

bash
uv tool install repowise
cd your-repo
repowise init --yes --no-prose   # no API key, no spend; writes .mcp.json for Claude Code

Disclosure: we build it. On django, a --no-prose index takes 366.8s; a call-graph-only tool is faster because it builds less (the benchmarks page lists every build time).

CodeGraph

CodeGraph builds a symbol and call graph into a local SQLite database with full-text search and keeps it current with a file watcher (a 2-second debounce by default). It advertises a single tool, which keeps its schema small. It was the fastest indexer we measured and second on output tokens on Codex.

bash
npm i -g @colbymchenry/codegraph
codegraph install

Serena

Serena stores no graph. It drives real language servers (the engines behind go-to-definition in your editor) and exposes symbol-level tools for reading and editing, across 40+ languages. That makes it the strongest option here for precise refactors. On how-the-code-works questions it made more tool calls than the bare agent while still reducing output tokens.

bash
uv tool install -p 3.13 serena-agent
claude mcp add serena -- serena start-mcp-server --context claude-code --project "$(pwd)"

Graphify

Graphify builds a knowledge graph from tree-sitter parsing with no API calls for code, plus an interactive HTML view and a markdown report. Docs, PDFs and images go to whatever model your assistant runs unless you pass --code-only. It can serve the graph over MCP, and a git hook rebuilds it after commits. It is the most visual of the six.

bash
uv tool install graphifyy
graphify install          # then type /graphify . in Claude Code

code-review-graph

code-review-graph maps calls, imports, inheritance and test coverage with tree-sitter into one SQLite file, aimed at review: given a change, which code is affected. It covers 40+ languages and accepts extra parsing rules without forking.

bash
pip install code-review-graph
code-review-graph install --platform claude-code

cocoindex-code

cocoindex-code is the closest to classic semantic search. It chunks code along the syntax tree, embeds the chunks (locally with a small default model, or through a cloud provider) and re-indexes only changed files. It was in our retrieval benchmark, not the agent loop.

bash
pipx install 'cocoindex-code[full]'   # [full] includes local embeddings
claude mcp add cocoindex-code -- ccc mcp

Claude Context from Zilliz is also common in lists. Its documented setup uses a Zilliz Cloud or Milvus vector database and an OpenAI key for embeddings, so it is not local-only by default. We did not benchmark it.

What we measured

We ran each tool against the same django questions in an agent loop, with a fresh index on one pinned commit and byte-identical prompts. Output tokens are the metric, because cached input tokens make dollar costs depend on which arm ran first.

Every question in django's question set, six arms, byte-identical prompts, each tool's full advertised surface, and a freshly built index on the same pinned commit. Every tool was called on every question, so this is like for like.

ToolAgent used itOutput tokensvs bare agentTool callsLeaner onp
repowise44 / 441,250-31.6%3.837 of 44<0.0001
CodeGraph44 / 441,383-24.4%4.037 of 44<0.0001
Serena43 / 431,550-14.8%10.135 of 43<0.0001
Graphify43 / 431,658-8.9%7.431 of 430.003
code-review-graph43 / 431,710-6.0%7.226 of 430.046
bare agent (control)0 / 441,828baseline7.2n/an/a

Scroll the table sideways to see every column.

Codex (gpt-5.6-sol) on django/django at one pinned commit. Correcting for testing five tools at once, three reductions are solid and two are marginal. 5 of the 48 questions are missing from every arm equally because the run hit an API usage cap, so the figures are over the 43 questions all six arms completed; because all arms lost the same 5, the paired comparisons are unaffected.

On Codex, repowise cut output tokens 31.6% and needed 3.8 tool calls per answer, leaner than the bare agent on 37 of 44 questions. CodeGraph was a clear second at 24.4%, so more than one tool in this field works.

On Claude Code (Sonnet), repowise cut output tokens 15.9% across 15 questions. There the agent decides whether to call an MCP tool at all: code-review-graph was called 0 of 15 even though it had built a 40,904 nodes graph. Our own adoption read 15 of 15, then 4 of 15, then 3 of 15 on identical reruns, so treat adoption as a property of tool, harness and day together.

Retrieval is measured separately. On ContextBench (42 held-out bug reports in Python and Go), get_answer found 0.876 of the files each real fix touched, search_codebase 0.742 and CodeGraph 0.610.

File coverage on 42 ContextBench instances pinned before any of this work started and kept sealed until the final measurement. Grading is deterministic and no LLM judge is involved.

ToolFile coveragePrecisionFiles served
repowise (get_answer)0.8760.08719.2
repowise (search_codebase)0.7420.1688.2
CodeGraph0.6100.09314.0
Graphify0.5460.03334.5
code-review-graph0.4450.2405.4
cocoindex0.3610.0927.1

Scroll the table sideways to see every column.

n = 42 sealed instances (41 for cocoindex, measured 2026-08-09 on the same instances and grading; one instance never answered and is excluded, not scored zero). Head to head against CodeGraph, get_answer wins 19, loses 1, ties 22, sign test p = 0.00004. The pooled 112-instance figure would be 0.835 and is deliberately not quoted: averaging the halves loses the only number that matters, which is how the tool does on instances it has never seen.

How do you get the agent to call the tool?

Whichever server you install, tell Claude Code to use it. A line in CLAUDE.md such as "Use the repowise tools before grepping for architecture questions" tells the model when the tool applies. We cover this in your MCP server is probably not being called.

Method and scope

The agent-loop runs used django/django at one pinned commit: Codex (gpt-5.6-sol) on the 43 questions all six arms completed, and Claude Code (claude-sonnet-5) on 15 questions. Versions: CodeGraph 1.5.0, Graphify 0.9.31, Serena 1.6.2.dev0, code-review-graph 2.3.7, each with its full advertised tool list. One repository, one language and questions of four to nine turns means your repo, model and prompt will move these numbers. Raw data, including failed runs, is in the public benchmark repository linked from the benchmarks page.

Which one should you pick?

  • CodeGraph for the quickest build and a cheap first improvement.
  • Serena for precise symbol-level edits, ideally next to one of the graph tools.
  • Graphify for a picture of the codebase you can read as well as the agent.
  • code-review-graph if your main use is PR review.
  • cocoindex-code to find code by meaning ("find code that does X").
  • repowise if the agent should also know history, owners, risk, decisions and health, or you want one index in Claude.ai, ChatGPT, Cursor and Claude Code through a hosted MCP address. For Claude Code: claude mcp add --transport http repowise https://api.repowise.dev/mcp/OWNER/REPO --header "Authorization: Bearer YOUR_API_KEY". The setup guide covers Cursor and other editors.

FAQ

How do I add an MCP server to Claude Code?
Run claude mcp add --transport http <name> <url> for a remote server or claude mcp add <name> -- <command> for a local one. Add --scope project to write it to a .mcp.json your team can commit, or --scope user to load it in every project. Check it with claude mcp list or /mcp inside a session.
Does Claude Code index my codebase like Cursor?
No. Claude Code has no persistent index and uses grep, glob and file reads in each session. To get an index built ahead of time, add an MCP server that indexes the repo and answers the agent's questions from it.
What is the best codebase MCP server for Claude Code?
It depends on the job. In our django agent-loop run on Codex, repowise cut output tokens the most and CodeGraph was second with a faster build. Serena is strongest for symbol-level edits. Instruct the agent to use whichever server you install.
Is there a semantic code search MCP that runs locally?
Yes. cocoindex-code embeds code locally with a small default model when you install the [full] variant. Claude Context also does semantic search but, as documented, needs a Milvus or Zilliz Cloud database and an OpenAI key.
How do I make Claude Code index a repo?
Install an indexing MCP server and register it. For repowise, run uv tool install repowise, then repowise init --yes --no-prose inside the repo. That builds the index without an API key and writes .mcp.json so Claude Code picks it up.
Why does my agent ignore the MCP server I installed?
The model decides when to call a tool, and many default to built-in grep. Adoption varied from none to every question across tools in our Claude Code runs. Add a line to CLAUDE.md telling the agent when to use the server.