# Sourcegraph MCP server

> Search your Sourcegraph code, jump to definitions, and ask Deep Search questions in plain English.

## Server URL

`https://sourcegraph.com/.api/mcp` (Streamable HTTP)

- Sign-in: Sign in with Sourcegraph
- Connect in RevampKey: https://revampkey.com/marketplace/sourcegraph

## Agent skills (3)

- [Sourcegraph MCP connector: how to use it well with AI](https://revampkey.com/marketplace/sourcegraph/skills/essentials.md): Guides an AI assistant through searching a Sourcegraph instance: it confirms the instance, repository and revision first, picks the right search or navigation tool, and reads the actual code before claiming anything. It stays read-only.
- [Sourcegraph Change History Investigation with AI: Find When Code Changed](https://revampkey.com/marketplace/sourcegraph/skills/change-history-investigation.md): Works out when a behaviour changed and which commit caused it, by comparing release tags, searching commits and diffs, and reading the code at each revision. It is read-only and asks before changing the active instance or workspace.
- [Sourcegraph code search audit with AI](https://revampkey.com/marketplace/sourcegraph/skills/code-search-audit.md): Sweeps many repositories for a pattern, reads each hit in context to confirm it, and reports verified counts with a clear statement of what was covered. It is read-only and never changes code.

All skills: https://revampkey.com/marketplace/sourcegraph/skills.md

Sourcegraph is a code search and code intelligence platform for large codebases. It indexes all of your repositories so you can search them together. Sourcegraph says more than 200 enterprise engineering teams trust it. Engineering teams use it to understand and oversee code. Sourcegraph says support and go-to-market teams use it too.

Click Connect in RevampKey and approve access on Sourcegraph's own sign-in page. Then ask in plain English. The agent can run keyword searches across your repositories, ask Deep Search questions, jump from a symbol to its definition and its references, and browse repositories, folders and files. It can also search commits and diffs, compare two revisions, and list the repositories a contributor has worked in.

Access follows Sourcegraph's rules. You can only read repositories your account is already allowed to see. Admins can turn off individual tools by name, or limit MCP use to certain roles with the MCP access permission. Admins can also turn off the MCP server for the whole instance. Admins set these controls on your Sourcegraph instance.

## What you can do

### Finding where a function is defined and used

You plan to change a function in a shared service, but you don't know who calls it. Ask the agent where the function is defined. It jumps to the definition, lists the places in your repositories that reference it, and reads the surrounding files so you can see how each call is used.

### Getting a cited answer about how code works

A support engineer needs to know how database migrations work across services. They ask the question in plain English. The agent runs a Deep Search, reads the results, and returns an answer with the citations Sourcegraph provides, so you can see where each point came from.

### Reviewing what changed between two versions

A release branch has drifted from main, and you need a summary. Give the agent the two revisions. It compares them, searches the commits for the changes that matter, and reads the diffs. Then it lists what changed and which commits made each change.

## Things to ask

- Which repos have 'billing' in their name?
- Where is parseInvoice defined, and where is it called?
- Find every file that contains the string legacy_auth across all repos.
- Ask Deep Search how we handle database migrations across services.
- Show me the commits that changed the retry logic in the payments code last month.

## What the agent can do

### Code search

Search across your indexed repositories for exact text with keyword search. Keyword search returns exact, deterministic results. You can also ask questions in plain English with natural language search.

`keyword_search`, `nls_search`

### Deep Search

Ask complex questions in plain English and get grounded answers with citations. The agent can also read the results of a Deep Search to pull out the relevant parts.

`deepsearch`, `deepsearch_read`

### Code navigation

Jump from a symbol to its definition. List the places in your repositories that reference it. Use this to trace a function before you change code.

`go_to_definition`, `find_references`

### Repositories and files

List repositories whose names match a substring, browse folders, and read file contents. You can read a file at a given revision or a specific line range.

`list_repos`, `list_files`, `read_file`

### Commits, diffs and contributors

Search commit history and code changes in diffs. Compare two revisions. List the repositories a given contributor has worked in.

`commit_search`, `diff_search`, `compare_revisions`, `get_contributor_repos`

## FAQ

### What do I need to connect Sourcegraph to RevampKey?

You need a Sourcegraph account on an instance where the MCP server is enabled. Sourcegraph's docs say the MCP server is supported on Enterprise plans. Click Connect in RevampKey, then approve access on Sourcegraph's own sign-in page. Your account also needs the MCP access permission. The built-in User role grants it by default unless an admin removes it.

### What can the agent do in Sourcegraph, and what can't it do?

The agent can search code, read files, follow definitions and references, and look through commits and diffs. All 13 Sourcegraph tools find and read information. None of them edits, creates, sends or deletes anything in Sourcegraph. The agent asks before it changes anything.

### Who can see my code through the agent?

The agent only reads what your own Sourcegraph account can already read. Repository permissions still apply. Admins can turn off the MCP server, disable single tools, or limit MCP access by role. Check the agent's answers against the code it cites before you act on them.

### What is Deep Search in Sourcegraph?

Deep Search is a Sourcegraph feature that takes complex questions in natural language. It returns grounded answers with citations. Keyword search works differently. It returns exact, deterministic and exhaustive matches, so you can find every place a string appears in your code.

### What is the Sourcegraph MCP server URL?

The Sourcegraph MCP server URL is https://sourcegraph.com/.api/mcp. It uses the Streamable HTTP transport, so any client that supports remote MCP servers can connect to it.

### How does the Sourcegraph MCP server authenticate?

With Sourcegraph's own sign-in (OAuth). You approve access in your browser; no password is shared with the client.

### What can an AI agent do with the Sourcegraph MCP server?

It exposes 13 tools: 13 that read and 0 that create or change things. In RevampKey the agent asks before it runs any tool that changes data.

### Are there agent skills for Sourcegraph?

Yes. 3 SKILL.md playbooks teach an agent how to do real Sourcegraph work step by step. RevampKey installs them when you connect Sourcegraph; for Claude Code, Cursor or Codex you can copy them into your project.

## Tools (13)

- `commit_search`
- `compare_revisions`
- `deepsearch`
- `deepsearch_read`
- `diff_search`
- `find_references`
- `get_contributor_repos`
- `go_to_definition`
- `keyword_search`
- `list_files`
- `list_repos`
- `nls_search`
- `read_file`

## Details

- Maker: Sourcegraph
- Setup: Sign in with your account
- Category: Developer tools
- Documentation: https://sourcegraph.com/docs/api/mcp#sourcegraph-mcp-server

Page: https://revampkey.com/marketplace/sourcegraph
