Gemini CLI extension for Sourcegraph — search, navigate, and understand any codebase without leaving your terminal.
Sourcegraph is a code intelligence platform that lets you search and navigate across all your repositories at scale. It understands code structure (definitions, references, symbols) and provides powerful search across your entire codebase — including open source and private code.
This extension connects Gemini CLI to your Sourcegraph instance via the official MCP server, giving Gemini's AI direct access to your code.
Sourcegraph.com users: No installation needed — Sourcegraph's MCP endpoint is already available at your instance.
Enterprise users: Connect to your own instance at sourcegraph.com/enterprise.
To install locally, run:
gemini extensions install https://github.com/erclm/sourcegraph-geminiOr link a local clone for development:
gemini extensions link .Then restart Gemini CLI.
On install, Gemini CLI will prompt you for:
SOURCEGRAPH_ENDPOINT— your Sourcegraph instance URL (e.g.https://sourcegraph.example.com)SOURCEGRAPH_ACCESS_TOKEN— a personal access token from your Sourcegraph account
Sourcegraph MCP is supported on Enterprise plans. If your instance supports OAuth dynamic client registration, you may not need a token.
- MCP tools (available to the AI automatically):
nls_search,keyword_search— natural language and keyword search across reposread_file,list_files,list_repos— explore repositories and filesgo_to_definition,find_references— code navigation and symbol lookup
- Slash commands (use directly in your prompt):
/sg:search <query>— run a Sourcegraph search/sg:file <repo> [rev] <path>— open a specific file
- Bundled agent skill:
searching-sourcegraph
Once installed, you can ask Gemini things like:
"How does authentication work in
github.com/my-org/api? Find the login flow and trace it through to token issuance."
"Find all callers of
UserService.Deleteacross my org's repos and tell me which ones don't handle the error."
"I'm new to the
payments-servicerepo. Walk me through the main request lifecycle and point me to the key files."
"Show me examples of how
@sourcegraph/codeintellifyis used in open source projects."
"Search for any usage of
eval(orexec(in thebackendrepo and summarize the risk."