SRAG

v1.0.0Search & Data Extractionstable

Semantic code search and RAG system written in Rust with tree-sitter chunking, MCP server for IDE integration, prompt injection detection, and secret redaction

code-searchembeddingsmcpmcp-serverrag
Share:
22
Stars
0
Downloads
0
Weekly
0/5

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

Search code semantically with embeddings and tree-sitter chunking.
Build RAG systems with prompt injection detection and secret redaction.
wrxck

Maintainer

LicenseGPL-3.0
Languagerust
Versionv1.0.0
UpdatedApr 20, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx srag

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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)
1

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 srag
2

Run 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 ~/.bashrc
3

Index 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 --detailed
4

Configure 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-key
5

Start 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.
6

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 watch

SRAG 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.

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.

Quick Config Preview

{ "mcpServers": { "srag": { "command": "npx", "args": ["-y", "srag"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides