Skip to main content
Glama
dalebrubaker

sourcegraph-mcp

by dalebrubaker

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
SOURCEGRAPH_URLYesThe URL of your SourceGraph instance (e.g., http://localhost:3370)
SOURCEGRAPH_TOKENYesYour SourceGraph access token (e.g., sgp_...)

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
find_symbol_definitionA

Find where a symbol (function, class, method, variable, constant) is DEFINED in the codebase. Returns the exact file path and line number where the symbol is declared.

This uses SourceGraph's indexed symbol search for fast lookups. Perfect for 'go to definition' or 'where is X defined?' queries.

Returns: File path, line number, and column position of the definition.

Examples:

  • Find where the ProcessOrder function is defined

  • Locate the definition of class CustomerService

  • Find where variable API_KEY is declared

  • Show me where the HandleRequest method is defined

Tips:

  • Use symbol_kind filter to narrow results (function, class, method, variable)

  • Use repo_filter to search specific repositories (e.g., 'repo:myorg/myrepo')

  • Searches are case-sensitive by default

Note: To find where a symbol is USED (not defined), use find_symbol_references instead.

find_symbol_referencesA

Find all places where a symbol is USED/REFERENCED in the codebase. Returns file paths and line numbers for each usage.

This searches for actual code references, not the definition. Use this to see where a function is called, a class is instantiated, a method is invoked, or a variable is accessed.

Returns: File paths and line numbers showing code context for each reference.

Examples:

  • Find all calls to the ProcessOrder function

  • See where CustomerService class is instantiated

  • Find all references to API_KEY variable

  • Show me everywhere HandleRequest is called

Tips:

  • Use repo_filter to search specific repositories

  • Use file_filter to narrow down to specific files or directories

  • Add lang:csharp (or other language) to filter by programming language

Note: To find where a symbol is DEFINED, use find_symbol_definition instead.

search_sourcegraphA

General code search across your SourceGraph instance. Use this for text-based searches, finding patterns, or when you need to search for more than just symbol definitions.

Supports full SourceGraph query syntax including:

  • repo:owner/name - Filter by repository

  • file:pattern - Filter by file path

  • lang:language - Filter by programming language

  • case:yes - Case-sensitive search

  • Regular expressions and literals

Examples:

  • 'PlaceOrder lang:csharp' - Find PlaceOrder in C# files

  • 'repo:myorg/myrepo TODO' - Find TODOs in a specific repo

  • 'file:.py$ import pandas' - Find pandas imports in Python files

  • 'error handling lang:java' - Search for error handling in Java

Note: For finding symbol definitions or references specifically, use find_symbol_definition or find_symbol_references for faster, more accurate results.

search_sourcegraph_regexA

Search code using regular expressions. Automatically sets patternType to 'regexp' for regex queries. Use this for complex pattern matching.

Examples:

  • 'class \w+Service' - Find all service classes

  • 'def (get|set)_\w+' - Find getter/setter methods

  • 'TODO|FIXME|HACK' - Find code comments

  • 'function \w+(.*) {' - Find function declarations

Tips:

  • Use filters parameter for additional constraints

  • Combine with repo:, file:, and lang: filters

  • Remember to escape backslashes in regex patterns

get_sourcegraph_configA

Get current SourceGraph MCP server configuration. Shows the configured URL and whether an access token is set. Useful for debugging connection issues.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dalebrubaker/sourcegraph-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server