MCP server for Sourcegraph codesearch
Config is the same across clients — only the file and path differ.
{
"mcpServers": {
"sourcegraph": {
"url": "http://localhost:8080/sourcegraph/mcp/"
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
A Model Context Protocol (MCP) server that provides AI-enhanced code search capabilities using Sourcegraph.
No automated test available for this server. Check the GitHub README for setup instructions.
Five weighted categories — click any category to see the underlying evidence.
No known CVEs.
No package registry to scan.
Click any tool to inspect its schema.
Be the first to review
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Others in developer-tools / search
Web and local search using Brave Search API
A Model Context Protocol (MCP) server and CLI that provides tools for agent use when working on iOS and macOS projects.
XcodeBuildMCP provides tools for Xcode project management, simulator management, and app utilities.
Production ready MCP server with real-time search, extract, map & crawl.
MCP Security Weekly
Get CVE alerts and security updates for Sourcegraph Mcp and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
A Model Context Protocol (MCP) server that provides AI-enhanced code search capabilities using Sourcegraph.
This MCP server integrates with Sourcegraph, a universal code search platform that enables searching across multiple repositories and codebases. It provides powerful search capabilities with advanced query syntax, making it ideal for AI assistants that need to find and understand code patterns across large codebases.
# Install dependencies
uv sync
# Run the server
uv run python -m src.main
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install package
pip install -e .
# Run the server
python -m src.main
# Build the image
docker build -t sourcegraph-mcp .
# Run the container with default ports
docker run -p 8000:8000 -p 8080:8080 \
-e SRC_ENDPOINT=https://sourcegraph.com \
-e SRC_ACCESS_TOKEN=your-token \
sourcegraph-mcp
# Or run with custom ports
docker run -p 9000:9000 -p 9080:9080 \
-e SRC_ENDPOINT=https://sourcegraph.com \
-e SRC_ACCESS_TOKEN=your-token \
-e MCP_SSE_PORT=9000 \
-e MCP_STREAMABLE_HTTP_PORT=9080 \
sourcegraph-mcp
SRC_ENDPOINT: Sourcegraph instance URL (e.g., https://sourcegraph.com)SRC_ACCESS_TOKEN: Authentication token for private Sourcegraph instancesMCP_SSE_PORT: SSE server port (default: 8000)MCP_STREAMABLE_HTTP_PORT: HTTP server port (default: 8080)After running the MCP server, add the following to your .cursor/mcp.json file:
{
"mcpServers": {
"sourcegraph": {
"url": "http://localhost:8080/sourcegraph/mcp/"
}
}
}
This server provides three powerful tools for AI assistants:
Search across codebases using Sourcegraph's advanced query syntax with support for regex, language filters, and boolean operators.
Generate a context-aware guide for constructing effective search queries based on your specific objective.
Retrieve file contents or explore directory structures from repositories.
# Check code style
uv run ruff check src/
# Format code
uv run ruff format src/