语义搜索 MCP 服务器

sira-grep 是一个为 Claude Code 提供的语义搜索 MCP 服务器,将 jina-grep 封装成语义搜索、语义重排序和代码搜索工具,并与 ripgrep 进行对比基准测试,帮助开发者在规划与探索阶段按概念高效检索代码库。

  • by francois-rosselet
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 Frosselet/sira-grep

使用说明

sira-grep

Semantic search MCP server for Claude Code, wrapping jina-grep-cli with benchmarks comparing ripgrep (lexical) vs jina-grep (semantic) search.

What this project does

  1. MCP Server (src/sira_grep/mcp_server.py): Exposes jina-grep as three Claude Code tools via MCP (stdio transport):

    • semantic_search — search files by meaning
    • semantic_rerank — rerank ripgrep output by relevance
    • code_search — NL-to-code and code-to-code search
  2. Benchmarks (benchmarks/): 20-query comparison of ripgrep vs jina-grep on a real Python codebase (~23K LOC), measuring:

    • Latency (cold start, warm query)
    • Quality (precision, recall, MRR)
    • Context size (tokens consumed, relevance ratio, wasted context)
    • Exploration scenarios (simulated plan-mode sessions)

Quick start

Prerequisites

  • Apple Silicon Mac (M1+)
  • Python 3.13+
  • uv

Install

# Clone jina-grep-cli (dependency)
git clone https://github.com/jina-ai/jina-grep-cli.git ../jina-grep-cli

# Install sira-grep
uv venv .venv && source .venv/bin/activate
uv pip install -e .

Register MCP server with Claude Code

claude mcp add --transport stdio sira-grep -- \
    $(pwd)/.venv/bin/python -m sira_grep.mcp_server

Run benchmarks

python -m benchmarks.runner
# Report written to docs/04-benchmarks.md

Project structure

sira-grep/
├── src/sira_grep/
│   ├── __init__.py
│   └── mcp_server.py          # MCP server (3 tools)
├── benchmarks/
│   ├── queries.py              # 20 benchmark query definitions
│   ├── runner.py               # Benchmark orchestration
│   ├── metrics.py              # Quality metrics (P@10, R@10, MRR)
│   ├── context_analysis.py     # Token counting, context efficiency
│   └── report.py               # Markdown report generation
├── docs/
│   ├── 01-installation.md      # jina-grep-cli install guide
│   ├── 02-mcp-integration.md   # MCP setup and architecture
│   ├── 03-usage-guide.md       # CLI and tool usage
│   ├── 04-benchmarks.md        # Benchmark results (generated)
│   └── 05-conclusions.md       # Analysis and perspectives
├── pyproject.toml
├── CLAUDE.md
└── README.md

Documentation

Doc Content
Installation Complete jina-grep-cli install guide
MCP Integration Architecture, tool reference
Usage Guide CLI examples, model selection
Benchmarks Full results with metrics
Conclusions Analysis, recommendations

Key finding

Semantic search and lexical search are complementary:

  • ripgrep: instant, exact — use when you know the keyword
  • jina-grep: slower, semantic — use when you know the concept
  • Hybrid (rg | jina-grep): best of both worlds

For Claude Code plan/explore phases, semantic search can reduce the number of queries needed to understand a codebase area, potentially lowering total context consumption despite larger individual results.