Code RAG MCP Server
MCP (Model Context Protocol) server for semantic code search. Replace grep/ripgrep with understanding-based code search.
🚀 Features
- ✅ Semantic Search: Find code by concept, not just by text
- ✅ : Uses LM Studio (no OpenAI required)
接入你的智能体
从发布者处安装。不是 PlugMCP 端点。
远程 URL 还是本机命令? 两种安装方式的区别
来自发布者
MCP (Model Context Protocol) server for semantic code search. Replace grep/ripgrep with understanding-based code search.
MCP (Model Context Protocol) server for semantic code search. Replace grep/ripgrep with understanding-based code search.
Go 1.22+
brew install go
Qdrant (Vector Database)
docker run -d --name qdrant \
-p 6333:6333 -p 6334:6334 \
-v $(pwd)/qdrant_data:/qdrant/storage \
qdrant/qdrant
LM Studio with an embedding model
nomic-ai/nomic-embed-text-v1.5-GGUF# 1. Clone the repo
git clone <your-repo>
cd code-rag-mcp
# 2. Install dependencies
go mod download
# 3. Build
go build -o code-rag-mcp
# 4. Configure
cp config.yaml ~/.config/code-rag-mcp/config.yaml
# Edit config.yaml with your code paths
# 5. Install globally (optional)
sudo cp code-rag-mcp /usr/local/bin/
Edit ~/.config/code-rag-mcp/config.yaml:
embedding_type: "local"
embedding_model: "nomic-ai/nomic-embed-text-v1.5-GGUF"
embedding_base_url: "http://localhost:1234/v1"
embedding_dim: 768
code_paths:
- "/Users/you/projects" # Your code directory
File: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
File: ~/.config/Claude/claude_desktop_config.json (Linux)
{
"mcpServers": {
"code-rag": {
"command": "/usr/local/bin/code-rag-mcp",
"env": {
"LM_STUDIO_URL": "http://localhost:1234/v1"
}
}
}
}
After modification, fully restart Claude Desktop (Quit + relaunch).
Option A: Via CLI (Recommended) 🚀
# Add the code-rag MCP server
claude mcp add code-rag \
--type stdio \
--command /usr/local/bin/code-rag-mcp \
--scope user
# Verify installation
claude mcp list
claude mcp get code-rag
Option B: Manual configuration
Claude Code uses the same file as Claude Desktop:
~/Library/Application Support/Claude/claude_desktop_config.json~/.config/Claude/claude_desktop_config.json{
"mcpServers": {
"code-rag": {
"command": "/usr/local/bin/code-rag-mcp",
"env": {
"LM_STUDIO_URL": "http://localhost:1234/v1"
}
}
}
}
Complete copy-paste command (after building):
# 1. Install the binary
sudo cp code-rag-mcp /usr/local/bin/
sudo chmod +x /usr/local/bin/code-rag-mcp
# 2. Add to Claude Code
claude mcp add code-rag \
--type stdio \
--command /usr/local/bin/code-rag-mcp \
--scope user \
--env LM_STUDIO_URL=http://localhost:1234/v1
# 3. Verify
claude mcp list
File: ~/.config/zed/settings.json
{
"context_servers": {
"code-rag": {
"source": "custom",
"command": {
"path": "/usr/local/bin/code-rag-mcp",
"args": [],
"env": {
"LM_STUDIO_URL": "http://localhost:1234/v1"
}
}
}
}
}
Complete copy-paste command:
# 1. Install the binary (if not already done)
sudo cp code-rag-mcp /usr/local/bin/
sudo chmod +x /usr/local/bin/code-rag-mcp
# 2. Add configuration to Zed
cat << 'EOF' >> ~/.config/zed/settings.json
{
"context_servers": {
"code-rag": {
"source": "custom",
"command": {
"path": "/usr/local/bin/code-rag-mcp",
"args": [],
"env": {
"LM_STUDIO_URL": "http://localhost:1234/v1"
}
}
}
}
}
EOF
# 3. Restart Zed
Note: For Zed, you can also use the "Add Custom Server" button in the Agent Panel.
# Terminal 1: Qdrant
docker start qdrant
# Terminal 2: LM Studio
# Open LM Studio UI and start the server
# Terminal 3: Test the server
./code-rag-mcp
Claude: Hi! Let me check the index status.
[Calls: get_index_stats]
You: Index my Terraform project
Claude: [Calls: index_codebase /path/to/terraform]
You: Where is the VPC configuration?
Claude: [Calls: semantic_code_search "VPC network configuration"]
Semantic search:
"authentication middleware"
"database connection logic"
"error handling patterns"
"terraform AWS VPC modules"
"API rate limiting"
Similar code:
"Find code similar to: func (s *Server) HandleAuth()"
Explanation with context:
"Explain handlers/auth.go with related dependencies"
semantic_code_searchPrimary semantic search. Use instead of grep.
{
"query": "authentication logic",
"limit": 5,
"min_score": 0.7,
"language": "go"
}
find_similar_codeFind code similar to a given snippet.
{
"code_snippet": "func HandleError(err error) { ... }",
"limit": 5
}
explain_code_with_contextExplain a file with its context.
{
"file_path": "/path/to/file.go",
"focus": "dependencies"
}
index_codebaseIndex a directory. Run this first.
{
"path": "/Users/you/projects/myapp",
"extensions": [".go", ".py"]
}
get_index_statsCheck index status.
# Test embeddings
go run scripts/test_embeddings.go
# Test indexing
go run scripts/test_indexing.go /path/to/code
# Test searches
go run scripts/test_search.go "authentication"
nomic-ai/nomic-embed-text-v1.5-GGUF (Q8)# Check index
get_index_stats
# Re-index
index_codebase /path/to/code
# Lower minimum score
semantic_code_search "query" min_score=0.5
# Check if LM Studio is running
curl http://localhost:1234/v1/models
# Check logs
./code-rag-mcp --config config.yaml
# Restart Qdrant
docker restart qdrant
# Check logs
docker logs qdrant
Contributions are welcome! See CONTRIBUTING.md
MIT License - see LICENSE
MCP (Model Context Protocol) server for semantic code search. Replace grep/ripgrep with understanding-based code search.
工具
暂无工具列表。远程服务器在首次健康检查后会获得工具列表。
常见问题
在本页复制适用于 Cursor、Claude Desktop、Claude Code 或 VS Code 的 stdio 配置。它使用发布者的安装方式,而不是 PlugMCP 代理。
此记录未列出必需的环境变量。
Code Rag 通过 stdio 在本地运行。
上次检查时间:2026-10-28。 MCP (Model Context Protocol) server for semantic code search. Replace grep/ripgrep with understanding-based code search.