Skip to main content
Watch: I Built an AI App Without Leaving Databricks

Developer platforms - official Sourcegraph server

Sourcegraph MCP server

MCP server built into a Sourcegraph instance that gives AI agents code search, file and repository reading, code navigation, commit and diff history, Code Finder and Deep Search tools over the instance's indexed code. It is served from your own instance at https://<your-sourcegraph-instance>/.api/mcp with OAuth or API key auth.

Last verified 15 tools2 sources

Install

Terminal
claude mcp add --transport http sourcegraph https://sourcegraph.example.com/.api/mcp
TOML
[mcp_servers.sourcegraph]
url = "https://sourcegraph.example.com/.api/mcp"
scopes = ["mcp"]
JSON
{
	"mcpServers": {
		"sourcegraph": {
			"url": "https://sourcegraph.example.com/.api/mcp"
		}
	}
}

VS Code

JSON
{
	"servers": {
		"sourcegraph": {
			"type": "http",
			"url": "https://sourcegraph.example.com/.api/mcp"
		}
	},
	"inputs": []
}

Tools

read_file
Read file contents with line numbers, ranges and revisions
list_files
List files and directories in a repository path
list_repos
Search and list repositories by name substring
list_refs
List a repository's Git branches and tags
keyword_search
Perform exact keyword code searches
nls_search
Semantic code search with flexible linguistic matching
evaluator
Run sandboxed Lua scripts over search results for aggregation and cross-referencing
go_to_definition
Find the definition of a symbol from a usage location
find_references
Find all references to a symbol from its definition
commit_search
Search commits by message, author, content, files and date range
diff_search
Search code changes for patterns across repositories
compare_revisions
Compare changes between two revisions
get_contributor_repos
Find repositories where a contributor has made commits
code_finder
Agentic search that returns relevant file paths and line ranges for a task
deepsearch
Create a Deep Search conversation to answer complex codebase questions

As documented on October 17, 2026. A running server reports its current list through tools/list.

Notes and caveats

  • Supported on Sourcegraph Enterprise plans; served per instance, so replace sourcegraph.example.com with your instance hostname.
  • Three endpoints: /.api/mcp (core tools), /.api/mcp/all (full suite) and /.api/mcp/deepsearch (Deep Search only); tool availability differs by endpoint (deepsearch_read is also available).
  • Auth is OAuth 2.0 via Dynamic Client Registration or pre-registered clients, or a Sourcegraph access token (Authorization: token ...).
  • Codex needs scopes = ["mcp"] then codex mcp login sourcegraph.
  • Admins can disable it with mcp.enabled, disable tools with mcp.tools.disabled, and gate it with the MCP#ACCESS RBAC permission.
  • Code Finder usage is metered against the instance entitlement.
  • This is code search over your own repositories, not web search.
  • The registry entry points at sourcegraph-community/mcpregistry, which is registry metadata, not server source.

FAQ

What does the Sourcegraph MCP server do?

MCP server built into a Sourcegraph instance that gives AI agents code search, file and repository reading, code navigation, commit and diff history, Code Finder and Deep Search tools over the instance's indexed code. The vendor documents 15 tools, including read_file, list_files, list_repos and list_refs.

How do I add the Sourcegraph MCP server to Claude Code?

Run claude mcp add --transport http sourcegraph https://sourcegraph.example.com/.api/mcp, copied from Sourcegraph's docs. This page also has snippets for Codex, Cursor and VS Code.

Does the Sourcegraph MCP server need authentication?

Yes, OAuth or API key. Transport: Streamable HTTP. Status: Unlabelled, last checked October 17, 2026.

Sources

Last verified against 2 Sourcegraph pages, then re-checked independently.

Newsletter

New MCP servers, the week they ship

One email per week. New official MCP servers, the coding tools that support them and how developers wire them up.