Skip to content

Summary

Sourcegraph's MCP server — cross-repository keyword and semantic code search, go-to-definition, find-references, commit and diff search, and Deep Search, served from your own instance.

Features

  • keyword_search and nls_search across every indexed repository
  • go_to_definition and find_references from precise code intelligence
  • read_file with line numbers, ranges and specific revisions
  • commit_search, diff_search and compare_revisions over history
  • deepsearch: multi-step conversational questions about the codebase
  • evaluator: run Lua scripts to aggregate and compute over results
  • Three endpoint scopes (/.api/mcp, /all, /deepsearch) plus per-tool disabling
  • OAuth 2.0 Dynamic Client Registration with a dedicated mcp scope

Installation

Set up this MCP server in your favorite AI agent — copy a ready-made configuration below.

Any MCP-compatible agent

Most agents (Claude, Cursor, Windsurf, VS Code, and more) read a standard mcpServers configuration.

  1. Open your agent's MCP configuration file.
  2. Merge the snippet below into it.
  3. Restart the agent — the "Sourcegraph" tools will be available.
{
  "mcpServers": {
    "sourcegraph": {
      "type": "http",
      "url": "https://sourcegraph.example.com/.api/mcp"
    }
  }
}

Description

Most coding agents see one repository: the one checked out in front of them. Sourcegraph MCP fixes that by exposing your Sourcegraph instance's index over the Model Context Protocol, so an agent can search, navigate and read across every repository your organisation has indexed — before it writes a line of code that assumes an API it never checked.

Tools. Files and repos: read_file (with line numbers, revisions and ranges), list_files, list_repos. Search: keyword_search for exact matching with filters, nls_search for semantic search with flexible linguistic matching, and evaluator for running Lua scripts over results to aggregate and compute. Navigation: go_to_definition and find_references, backed by precise code intelligence rather than grep heuristics. History: commit_search, diff_search (search the actual code changes, not just messages), compare_revisions and get_contributor_repos. And two higher-level agents: code_finder, a fast search agent for locating relevant code, plus deepsearch and deepsearch_read for multi-step questions about a codebase.

Three endpoints on your instance. /.api/mcp for the core search and repository tools, /.api/mcp/all for the full suite, and /.api/mcp/deepsearch for Deep Search alone — pick the smallest surface that does the job so the agent's tool list stays legible. Server-side, mcp.enabled turns it on and mcp.tools.disabled removes individual tools.

Auth and clients. OAuth 2.0 via Dynamic Client Registration (on by default since the February 2026 GA release) or pre-registered OAuth clients, with Sourcegraph access tokens as the alternative; there is a dedicated mcp OAuth scope. Documented clients are Claude Code, Codex, Cursor, Copilot, OpenCode and Amp. Available on Sourcegraph Cloud and self-hosted 7.0 and later.

Worth knowing before you plan around it: the MCP server is supported on Enterprise plans, and the URL is your own instance host — there is no public multi-tenant endpoint.

Practical tip from the docs: call list_repos first to scope which repositories matter, then constrain later searches to them. It measurably improves both speed and result quality on a large index.

MCP: WorkOS

by WorkOS

WorkOS's official remote MCP server — run your WorkOS dashboard from an agent: organizations, users, SSO connections, Directory Sync, AuthKit branding and audit log streams.

Featured

Docusign's official hosted MCP server: query, send and track agreements from any MCP client using your own account permissions.

MCP: Ramp

by Ramp

Ramp's official remote MCP server for corporate spend — read transactions, bills and reimbursements, and with the right role edit, approve and lock cards.

Featured

Attio's official hosted MCP server — search, read and write your CRM records, lists, notes, tasks, meetings and emails from any MCP client over OAuth.

Browse all MCP servers →