Sourcegraph MCP Server
RemoteAbout Sourcegraph MCP Server
Sourcegraph MCP Server exposes Sourcegraph code search and code intelligence to agents and applications, for Sourcegraph Cloud or private deployments. Clients can discover repositories, search code, and navigate symbols through MCP.
Key features
- 01Code and semantic search
- 02Repository discovery and file reads
- 03Go to symbol definitions
- 04Find code references
- 05Search code changes
Use cases
- 01Find implementations across repositories
- 02Locate relevant code with semantic search
- 03Navigate symbol definitions and references
- 04Explore code changes
MCP support
The MCP server connects to Sourcegraph Cloud or a private instance at `https://{sourcegraph_hostname}/.api/mcp`. Sourcegraph handles authentication, typically through browser OAuth or an access token.
Configuration
Remote servers need no local install. Pick your client, then copy the config or install in one click.
https://{sourcegraph_hostname}/.api/mcpclaude mcp add --transport http sourcegraph https://{sourcegraph_hostname}/.api/mcp{"mcpServers":{"sourcegraph":{"type":"http","url":"https://{sourcegraph_hostname}/.api/mcp"}}}Open in Cursor{"servers":{"sourcegraph":{"type":"http","url":"https://{sourcegraph_hostname}/.api/mcp"}}}Open in VS Code{"mcpServers":{"sourcegraph":{"type":"http","url":"https://{sourcegraph_hostname}/.api/mcp"}}}{"mcpServers":{"sourcegraph":{"serverUrl":"https://{sourcegraph_hostname}/.api/mcp"}}}Run commands in a terminal; paste JSON into the client’s MCP config and restart. Servers that need sign-in will prompt on first connect.
Tools
Details
From the project READMESourcegraph MCP Server
This registry entry represents the Sourcegraph MCP server for a Sourcegraph instance. It can be configured against Sourcegraph Cloud or a private Sourcegraph deployment, so users can connect MCP-compatible clients to their own Sourcegraph server.
At a high level, the Sourcegraph MCP server gives agents and applications access to Sourcegraph code search and code intelligence capabilities through a standard MCP interface. That includes common workflows such as repository discovery, file reads, keyword and semantic search, symbol navigation, references, and code-change exploration.
Configuration
Configure the server with the hostname of your Sourcegraph instance. This entry uses the standard Sourcegraph MCP endpoint:
https://{sourcegraph_hostname}/.api/mcp
For private Sourcegraph instances, set sourcegraph_hostname to your internal or company-hosted Sourcegraph server hostname.
Authentication is handled by Sourcegraph. Depending on the MCP client, this is typically done with browser-based OAuth or a Sourcegraph access token. This MCP config defaults to OAuth.
Notes
This README intentionally keeps client-specific setup details light because MCP integration steps can change over time. For the current Sourcegraph MCP server behavior, supported authentication modes, and client-specific setup instructions, see the official Sourcegraph documentation:
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.