# Sourcegraph MCP Server

Connects an agent to Sourcegraph code search and navigation. Use it when an MCP client needs repository discovery, symbol lookup, or change inspection.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 14
- Author: sourcegraph-community
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/sourcegraph-community/mcpregistry
- Updated: 2026-03-26
- HTML: https://affpapa.org/en/nevibecode/mcp/sourcegraph-mcp-server

## What it does

Sourcegraph MCP Server exposes Sourcegraph code intelligence through MCP. An agent can discover repositories, read files, run keyword or semantic searches, jump to symbol definitions, find references, and inspect code changes.

The server connects to Sourcegraph Cloud or a private deployment through `https://{sourcegraph_hostname}/.api/mcp`. Sourcegraph handles authentication with browser OAuth or an access token, while the supplied configuration defaults to OAuth. A private deployment requires its own hostname, so the endpoint must be changed before the connection can work.

The registry lists Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, and Gemini CLI as supported clients. Setup is client-specific; the Claude Code commands register HTTP endpoints named `mcp` and `sourcegraph-mcp-server`.

## Requirements
- Remote server: `https://{sourcegraph_hostname}/.api/mcp`

## Install

### Claude Code (native platform)

1. **Template address**
- The server address is a template: replace {…} or […] with your own values

2. **Platform CLI: remote server**
```bash
claude mcp add --transport http mcp https://{sourcegraph_hostname}/.api/mcp
```

### Codex

1. **Template address**
- The server address is a template: replace {…} or […] with your own values

2. **Platform CLI: remote server**
```bash
codex mcp add sourcegraph-mcp-server --url https://{sourcegraph_hostname}/.api/mcp
```

### Cursor

1. **Template address**
- The server address is a template: replace {…} or […] with your own values

2. **Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "sourcegraph-mcp-server": {
            "url": "https://{sourcegraph_hostname}/.api/mcp"
        }
    }
}
```

### GitHub Copilot

1. **Template address**
- The server address is a template: replace {…} or […] with your own values

2. **Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "sourcegraph-mcp-server": {
            "type": "http",
            "url": "https://{sourcegraph_hostname}/.api/mcp"
        }
    }
}
```

### Gemini CLI

1. **Template address**
- The server address is a template: replace {…} or […] with your own values

2. **Platform CLI: remote server**
```bash
gemini mcp add -t http sourcegraph-mcp-server https://{sourcegraph_hostname}/.api/mcp
```

## When to use it
- discover a repository by topic or keyword
- search for symbols and their references
- read selected files through an agent
- trace a call to its definition
- inspect code changes across a repository

## Example prompts
- Find repositories that implement OAuth authentication.
- Show the definition of `getUser` and every place that calls it.
- Review the changes in this repository and identify the affected files.

## Similar
- [searching-sourcegraph](https://affpapa.org/en/nevibecode/skills/searching-sourcegraph.md) — skill · 1400 installs
- [setup-serena-mcp](https://affpapa.org/en/nevibecode/skills/setup-serena-mcp.md) — skill · 1200 installs
- [ccc](https://affpapa.org/en/nevibecode/skills/ccc.md) — skill · 5900 installs
- [jevgrep](https://affpapa.org/en/nevibecode/skills/jevgrep.md) — skill · 1300 installs
- [grepai-search-basics](https://affpapa.org/en/nevibecode/skills/grepai-search-basics.md) — skill · 905 installs
- [grepai-search-tips](https://affpapa.org/en/nevibecode/skills/grepai-search-tips.md) — skill · 778 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
