
code search mcp
An MCP server for code search
Repository Info
About This Server
An MCP server for code search
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Sourcegraph Code Search MCP Server
This is an MCP (Model Context Protocol) server implementation for Sourcegraph's code search capabilities. It allows language models to perform code search queries against Sourcegraph instances.
Features
- Search code across any Sourcegraph instance (public or private)
- Support for literal, regexp, and structural search patterns
- Configurable search limits and parameters
- Authentication support for private Sourcegraph instances
Installation
# Clone the repository
git clone https://github.com/yourusername/code-search-mcp.git
cd code-search-mcp
# Install dependencies
npm install
# Build the project
npm run build
Usage
Running the Server
# Start the server
npm start
Or directly use the node executable:
node build/index.js
Using as MCP Tool
This MCP server exposes a search_code tool with the following parameters:
query(string, required): The search query to executesourcegraphUrl(string, optional): The Sourcegraph instance URL (defaults tohttps://sourcegraph.com)token(string, optional): Authentication token for private Sourcegraph instanceslimit(number, optional): Max number of results to return (defaults to 10)patternType(string, optional): Search pattern type (literal,regexp, orstructural, defaults toliteral)
Example Usage with Claude.ai
In Claude, you can use this MCP server by first adding it to your configuration:
# Add the MCP server (stdio transport)
claude mcp add sourcegraph-search -- path/to/code-search-mcp
# Or if you've installed it globally with npm
claude mcp add sourcegraph-search -- code-search-mcp
Then you can use Claude Code as normal and it will have access to the Sourcegraph search functionality:
claude code
Then you can ask Claude to use the code search tool:
Search for "context.WithTimeout" in the Go standard library
Development
# Run the development server (builds and starts)
npm run dev
License
ISC
Quick Start
Clone the repository
git clone https://github.com/jasonhawkharris/code-search-mcpInstall dependencies
cd code-search-mcp
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.