mcpField
S
Sourcegraph MCP Server

Sourcegraph MCP Server

Local
github.com/E-KuerschnerDeveloper Tools0Updated 79w ago

About Sourcegraph MCP Server

Sourcegraph MCP Server connects LLMs to Sourcegraph for code search and analysis. Its tools include React prop usage searches and repository file retrieval.

Key features

  1. 01Search code with Sourcegraph
  2. 02Find React component prop usage
  3. 03Retrieve repository file contents
  4. 04Test connection and return version

Use cases

  1. 01Find usages of a React component prop
  2. 02Search repositories with a query and result limit
  3. 03Read a specific file from a repository
  4. 04Verify Sourcegraph connectivity

MCP support

Exposes Sourcegraph connection testing, code search, file retrieval, and React prop usage search tools to MCP clients.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

Sourcegraph MCP Server

An MCP (Model Context Protocol) server that integrates with Sourcegraph to provide code search and analysis capabilities to LLMs.

Sourcegraph Access Token

You will need to generate an API access token before using any of the server's tools.

  1. Visit your Sourcegraph instance (e.g., https://sourcegraph.com)
  2. Click your profile icon in the top right
  3. Navigate to Settings > Access tokens
  4. Create a new token with appropriate scopes
  5. Copy the token and set it as an environment variable
Environment Variables

The server uses two environment variables which can be set on your local environment or in the MCP server configuration.

  • SRC_ACCESS_TOKEN: Your Sourcegraph access token (see above)
  • SRC_ENDPOINT (optional): Your Sourcegraph instance URL (defaults to https://sourcegraph.com)

Installation

1. Build the server from Typescript
yarn run build
2. Configure MCP Server

There are many MCP Clients available to use, but below are two examples:

Install script

For convenience, there is an optional install script which you can run to automatically set up Cursor with the correct configuration. The script will walk you through setting up your Sourcegraph environment variables, so have your access token ready before starting.

./install_cursor.sh
3. Verify Installation

When you have completed the setup steps, confirm that the server is correctly configured with your MCP Client by prompting it to use the testSourcegraphConnection tool.

Available Tools

The server exposes the following tools to an LLM:

  1. testSourcegraphConnection: Test the connection to Sourcegraph and return version information
  2. search: Search code in Sourcegraph with a given query and limiting results
  3. getFileContent: Retrieve specific file contents from a repository
  4. searchReactPropUsage: Searches Sourcegraph for code that uses a specific prop of a specific React component

Comments

Markdown supported

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.