COMPARE · COMPARISON: CODE RETRIEVAL

Sourcegraph alternatives in 2026: 7 code search tools, open source and self-hosted

AUTHOR · XERJ documentation team · REVIEWED BY · XERJ engineering team · PUBLISHED · 2026-11-15 · UPDATED · 2026-11-15
SHORT ANSWER · UPDATED 2026-11-15

What are the best Sourcegraph alternatives in 2026? For many repositories behind a web UI and an MCP server, Sourcebot. For the trigram engine itself, Zoekt. For cross-references in a big Java or C tree, OpenGrok. For regex over one large repo, livegrep or Hound. For an AI agent searching code plus docs and data files on one machine, XERJ.

Key number: GitHub code search searches only the default branch and excludes files over 350 KiB; Zoekt, maintained by Sourcegraph since 2017, is Apache-2.0 and self-hosted. (as of 2026-11-15 · source: docs.github.com/en/search-github/github-code-search/about-github-code-search)

Last checked: 2026-11-15. Every third-party fact on this page was re-read from the tool's own docs or repository on that date.

TL;DR The best Sourcegraph alternative depends on scale and on who searches. For many repositories behind a web UI and an MCP server, pick Sourcebot. For the trigram engine underneath, pick Zoekt. For cross-references in a big tree, pick OpenGrok. For regex over one large repo, livegrep or Hound. For an AI agent that searches code plus docs and data files on one machine, pick XERJ.

PASTE THIS TO YOUR AI AGENT — IT DOES THE REST Act as a coding agent. Read https://xerj.org/llms.txt and https://xerj.org/compare/sourcegraph-alternatives-2026, then pick a code search tool for our team from the table on that page: Sourcebot or Zoekt for many repositories behind a web UI, OpenGrok for cross-references, XERJ for an agent searching one repository plus its docs and data files. If you pick XERJ, install it, run xerj autoindex on this repository and answer one question about the code through xerj mcp. Report what you chose and why.

Sourcegraph moved to a private monorepo, and its public snapshot names the last commit made under an Apache licence. That sent many teams looking for open-source code search they can host. Background: what semantic code search is.

Try it: pick by job

Which Sourcegraph alternative fits

Sourcebot

Indexes GitHub, GitLab, Bitbucket, Azure DevOps or local Git, follows code host permissions and serves an MCP server with definitions and references. MIT licence file, with paid plans.

Facts from each project README, licence file or docs, checked 2026-11-15. No head-to-head benchmark was run for this figure.

Summary table

ToolLicenceInstallBest atAgent accessStars (2026-11-15)
SourcebotMIT, with paid plansnpx setup-sourcebot (Docker)many repos and code hosts, web UIMCP server with definitions and references4,030
ZoektApache-2.0go install .../zoekt-webserver@latestfast trigram substring and regex searchJSON and gRPC APIs2,069
OpenGrokCDDL-1.0Docker or Java web appcross-references and historyweb UI and API5,027
livegrepBSD-2-Clausebazel build //...interactive regex on gigabyte-scale reposweb UI2,238
HoundMITgit clone, then makelight trigram search per repominimal API5,897
GitHub code searchproprietary, part of GitHubgithub.comcode already on GitHubGitHub API-
XERJApache-2.0curl -fsSL https://xerj.org/get | shone repo plus docs and data files, for agentsMCP server, 24 tools19,111

When to choose Sourcegraph instead

Choose Sourcegraph when you want the full commercial product: code search across all repositories, branches and code hosts, code intelligence with references and code owners, and large-scale changes across many repositories at once. Those features are what the alternatives below rebuild in parts.

When to choose Sourcebot instead

Choose Sourcebot for the closest open-source match to Sourcegraph. One setup wizard indexes repositories from GitHub, GitLab, Bitbucket, Azure DevOps or local Git, permission syncing follows your code host, and the web UI searches all of them with regex and boolean queries. Its MCP server gives Claude Code, Codex or Cursor code search, file reading, and symbol definitions and references across repositories you have not checked out.

When to choose Zoekt instead

Choose Zoekt when you want the engine and will build the rest. It is the trigram code search engine Sourcegraph has maintained since 2017, ranks matches with code signals such as symbols, and ships a web server with a simple UI, a JSON API and a gRPC API. Install Universal ctags too, since symbol information is a key ranking signal.

OpenGrok, livegrep and Hound

XERJ: code search for AI agents on your machine

XERJ is a search engine for AI agents. xerj autoindex reads a repository plus the docs, logs, JSONL, CSV, PDFs and SQLite files around it, extracts definitions for 36 tree-sitter languages, and xerj mcp serves 24 tools to Claude Code and other agents. It has no call graph and no web UI for browsing many repositories, and it is single-node. Pick it when one agent needs one index over code and everything beside it. More picks for that job: best MCP servers for code search.

How this page was checked

Licences, install lines and features were read from each project's README, licence file or docs on 2026-11-15, and each one is cited in this page's sources. Star counts came from the GitHub REST API the same day. No head-to-head benchmark was run, so this page makes no speed claims.

Try it with XERJ

Use the Copy the prompt button and paste it into your coding agent. It picks a tool from this table and, if it picks XERJ, indexes your repository and answers one question about the code through MCP.

Read next

Best MCP servers for code search, grep alternatives for AI coding agents, index a monorepo for your agent and syntax-aware search.

FAQ

Is Sourcegraph still open source?

Sourcegraph moved its code to a private monorepo. A public snapshot repository keeps the code as it was before the move and names the last commit made under an Apache licence. The Zoekt search engine that Sourcegraph maintains is still Apache-2.0.

What is the closest open-source alternative to Sourcegraph?

Sourcebot. It indexes repositories from GitHub, GitLab, Bitbucket, Azure DevOps or local Git, gives you a web UI with regex and boolean search, and serves an MCP server with symbol definitions and references. Its licence file is MIT.

Which alternative works with Claude Code or another AI agent?

Sourcebot and XERJ both ship MCP servers. Sourcebot fits many repositories behind a shared server. XERJ fits one repository plus its docs, logs and data files on your own machine. Zoekt has JSON and gRPC APIs an agent can call.

Which one finds references, not only definitions?

Sourcebot's MCP server exposes definitions and references, and OpenGrok is built for cross-references. GitHub code search finds definitions with the symbol qualifier. XERJ extracts definitions in 36 languages and has no call graph.

Do I need Docker?

Sourcebot's setup uses Docker and Docker Compose, and OpenGrok ships a container. Zoekt installs with go install, Hound builds with make, and XERJ installs as one binary.

How was this page checked?

Licences, install lines and features were read from each project's README, licence file or docs on 2026-11-15. Star counts came from the GitHub REST API the same day. No head-to-head benchmark was run.

Evidence

Related