SRAG
Semantic code search and RAG system written in Rust with tree-sitter chunking, MCP server for IDE integration, prompt injection detection, and secret redaction
What is SRAG?
SRAG is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to semantic code search and rag system written in rust with tree-sitter chunking, mcp server for ide integration, prompt injection detection, and secret redaction
Semantic code search and RAG system written in Rust with tree-sitter chunking, MCP server for IDE integration, prompt injection detection, and secret redaction
This server falls under the Search & Data Extraction and Data Science & ML categories on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Semantic code search and RAG system written in Rust with tre
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx sragConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use SRAG
SRAG (Semantic RAG) is a Rust-based semantic code search and retrieval-augmented generation system that indexes your local code repositories and exposes them to AI assistants via an MCP server. It uses tree-sitter for language-aware AST chunking, a HNSW vector index backed by SQLite for hybrid vector and full-text search, and a Python sidecar for embedding and reranking. The MCP server gives AI coding tools like Claude Code and Cursor instant cross-project knowledge, enabling them to reuse your existing patterns, find similar implementations, trace call graphs, and search by symbol name — rather than inventing new solutions to problems you have already solved.
Prerequisites
- Rust toolchain (cargo) installed — see rustup.rs
- Python 3.10 or higher for the ML sidecar (embeddings, reranking, LLM inference)
- Linux or macOS (Windows is supported via WSL only)
- An MCP client such as Claude Code or Cursor
- Optional: an Anthropic or OpenAI API key for external LLM providers (a fully local option is also available)
Clone the repository
Clone the srag repository from GitHub. The installation scripts handle building the Rust binary and setting up the Python ML backend.
git clone https://github.com/wrxck/srag
cd sragRun the install script
On Linux, the install script builds the binary to ~/.local/bin/srag and sets up the Python environment. On macOS it installs to /usr/local/bin and will prompt for sudo. Ensure ~/.local/bin is in your PATH on Linux.
./install.sh
# If ~/.local/bin is not in PATH (Linux):
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrcIndex your first repository
Run srag index against a local code repository. Srag performs AST-aware chunking using tree-sitter and builds a hybrid vector + full-text index.
srag index /path/to/your/project
# Check what was indexed
srag status --detailedConfigure an LLM provider (optional)
If you want to use external LLM inference (Anthropic or OpenAI), drop your API key into the config directory. The config lives at ~/.config/srag/config.toml on Linux or ~/Library/Application Support/srag/config.toml on macOS.
# For Anthropic:
echo 'your-api-key' > ~/.config/srag/api_key.txt
# Or set as environment variable
export ANTHROPIC_API_KEY=your-api-keyStart the MCP server and connect to Claude Code
Run `srag mcp` to start the stdio MCP server. The install script automatically configures Claude Code's MCP settings. Verify the integration with the MCP inspector.
# Test with the MCP inspector
npx @modelcontextprotocol/inspector srag mcp
# The install script sets up Claude Code automatically.
# To verify, open Claude Code and check for srag MCP tools.Keep indexes up to date
Use srag sync to re-index all projects incrementally (skipping unchanged files), or srag watch to start a file watcher that re-indexes automatically on changes.
# Incremental re-index of all projects
srag sync
# Or start the file watcher
srag watchSRAG Examples
Client configuration
Claude Code MCP configuration to use the srag binary as an stdio MCP server. The install script configures this automatically; the JSON below shows the equivalent manual setup.
{
"mcpServers": {
"srag": {
"command": "srag",
"args": ["mcp"]
}
}
}Prompts to try
Use these prompts in Claude Code or Cursor after srag has indexed your projects. The agent will call the srag MCP tools to search your codebase.
- "Search my indexed projects for how I handle OAuth token refresh"
- "Find code similar to this rate limiting snippet: [paste snippet]"
- "What naming conventions and patterns does my project use? Check get_project_patterns"
- "Find all callers of the authenticate() function across my projects"
- "Search for functions related to error retry logic in my repositories"Troubleshooting SRAG
srag command not found after installation
On Linux, ~/.local/bin must be in your PATH. Add `export PATH="$HOME/.local/bin:$PATH"` to ~/.bashrc and run `source ~/.bashrc`. On macOS, the binary installs to /usr/local/bin which is typically already in PATH.
Indexing fails or produces no results for certain file types
Srag supports AST-aware chunking for 9 languages via tree-sitter (including Python, JavaScript, TypeScript, Rust, Go, C/C++, Java, Ruby, C#) and falls back to line-based chunking for others. Check `srag status --detailed` to see which files were processed. Review ~/.config/srag/config.toml for file ignore patterns that may be excluding your files.
MCP server produces no output in the terminal when started directly
This is expected behavior. The MCP server communicates via JSON-RPC on stdin/stdout and does not write to the terminal. Use `npx @modelcontextprotocol/inspector srag mcp` to interact with it through an inspector UI, or connect it via your MCP client configuration.
Frequently Asked Questions about SRAG
What is SRAG?
SRAG is a Model Context Protocol (MCP) server that semantic code search and rag system written in rust with tree-sitter chunking, mcp server for ide integration, prompt injection detection, and secret redaction It connects AI assistants to external tools and data sources through a standardized interface.
How do I install SRAG?
Follow the installation instructions on the SRAG GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with SRAG?
SRAG works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is SRAG free to use?
Yes, SRAG is open source and available under the GPL-3.0 license. You can use it freely in both personal and commercial projects.
SRAG Alternatives — Similar Search & Data Extraction Servers
Looking for alternatives to SRAG? Here are other popular search & data extraction servers you can use with Claude, Cursor, and VS Code.
TrendRadar
★ 58.0kA real-time hotspot monitoring and news aggregation assistant that provides AI-powered analysis of trending topics across multiple platforms via the Model Context Protocol. It enables users to track news and receive automated notifications through va
Scrapling
★ 52.7k🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!
PDF Math Translate
★ 33.9k[EMNLP 2025 Demo] PDF scientific paper translation with preserved formats - 基于 AI 完整保留排版的 PDF 文档全文双语翻译,支持 Google/DeepL/Ollama/OpenAI 等服务,提供 CLI/GUI/MCP/Docker/Zotero
GPT Researcher
★ 27.2kAn autonomous agent that conducts deep research on any data using any LLM providers
Agent Reach
★ 20.1kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
Xiaohongshu
★ 13.7kMCP for xiaohongshu.com
Browse More Search & Data Extraction MCP Servers
Explore all search & data extraction servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up SRAG in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use SRAG?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.