WS

wrxck/srag

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

21 stars 2 forks 质量 69 趋势 24GPL-3.0

语义代码搜索和RAG系统,用Rust编写,带有树基分块、用于集成开发开发环境(IDE)的MCP服务器、提示注入检测和秘密编辑功能

概览

在所有仓库中进行语义代码搜索。先索引一次你的项目,然后通过MCP查询——你的AI编码助手能即时访问你写过的每一个模式、实现和约定。 AI编码助理擅长写代码,但他们不了解你的代码。当你已经有新的认证流程时,他们会建议新的。当你的日志模式摆在那里时,他们会发明。他们会问你已经在另一个项目中回答过的问题。 Srag 解决了这个问题。索引你的仓库,你的助手可以语义上搜索所有仓库——找到相关的实现、模式和惯例,无需你解释。

概述(AI 翻译)

在所有仓库中进行语义代码搜索。先索引一次你的项目,然后通过MCP查询——你的AI编码助手能即时访问你写过的每一个模式、实现和约定。

为什么?

AI编码助理擅长写代码,但他们不了解你的代码。他们会在你已有新的认证流程时建议。当你的日志模式就在时,他们会发明。他们会问你已经在另一个项目中回答过的问题。

Srag 解决了这个问题。索引你的仓库,你的助手可以语义上搜索所有仓库——找到相关的实现、模式和惯例,无需你解释。

使用场景

重复使用你自己的实现

“Add OAuth token refresh”→ Agent 会找到你跨项目的现有实现,复制包含你已经处理过的边缘情况的模式

代码风格一致

代理在编写代码前查询 get_project_patterns,看到你用 snake_case 表示函数,PascalCase 表示类型,自动跟进

找到你写的那东西

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

srag

Semantic code search across all your repositories. Index your projects once, then query them via MCP - your AI coding assistant gains instant access to every pattern, implementation, and convention you’ve ever written.

Why?

AI coding assistants are great at writing code, but they don’t know your code. They’ll suggest a new auth flow when you already have one. They’ll invent a logging pattern when yours is right there. They’ll ask questions you’ve already answered in another project.

srag fixes this. Index your repositories, and your assistant can search across all of them semantically - finding relevant implementations, patterns, and conventions without you having to explain anything.

Use Cases

Reuse your own implementations

“Add OAuth token refresh” → Agent finds your existing implementation across projects, copies the pattern including the edge cases you already handled

Consistent code style

Agent queries get_project_patterns before writing code, sees you use snake_case for functions and PascalCase for types, follows suit automatically

Find that thing you wrote

“How did I handle rate limiting?” → Semantic search finds the relevant code even if you don’t remember which project or what you called it

Cross-project knowledge

Working on project A, need to integrate with an API you’ve used before in project B → Agent finds your previous integration, reuses the error handling and retry logic

Debug with context

“Why is this failing?” → Agent searches for similar error handling patterns in your codebase, finds how you solved the same class of problem before

Onboard yourself

Returning to an old project? Query the index to understand the architecture, find where things are defined, see the patterns that were used

Code review context

“Is this how we usually do it?” → Search for similar implementations to check consistency with established patterns

Find duplication

Pass a code snippet to find_similar_code → Discover near-duplicates across your codebase that could be refactored

The real value compounds over time. The more projects you index, the more patterns your assistant can draw from. The quality scales with the model - better models make better use of the retrieved context.

Install

You’ll need Rust and Python 3.10+ installed first.

在 GitHub 查看完整 README

安装

npx @modelcontextprotocol/inspector srag mcp
新手?先看 mcpskill.org 教程 →