Skip to main content
Glama

codebase-rag-mcp

一个模型上下文协议(MCP)服务器,可将任何本地代码库转变为可查询、可引用溯源的知识库。它基于混合检索器(密集 FAISS + 稀疏 BM25)、可选的重新排序器,以及可替换的 LLM 提供商(NVIDIA、Groq、OpenRouter、Gemini 或任何本地 OpenAI 兼容端点)构建。

状态: 仅脚手架。软件包可安装,CLI 可运行,MCP 服务器可启动并通告一个占位 ping 工具。RAG 流水线(摄取 → 解析 → 分块 → 索引 → 检索 → 重排 → 生成)正在此骨架之上增量构建。请参阅 DECISIONS.mdFLOW.md

安装

需要 Python 3.11+

# Editable install with dev tooling (pytest, ruff, mypy)
pip install -e ".[dev]"

这将引入 tree-sitter、FAISS(CPU)、rank-bm25、sentence-transformers、langchain-huggingface / langchain-community、官方 MCP Python SDK,以及用于外部提供商调用的 httpx。

Related MCP server: Grounded Code MCP

配置

复制示例环境文件,并填写你拥有的提供商密钥:

cp .env.example .env
# then edit .env

可识别的变量(完整列表请参阅 .env.example):

变量

用途

NVIDIA_API_KEY

NVIDIA NIM / build API

GROQ_API_KEY

Groq Cloud

OPENROUTER_API_KEY

OpenRouter(多提供商代理)

GEMINI_API_KEY

Google Gemini(可选)

LOCAL_MODEL_BASE_URL

OpenAI 兼容的本地服务器(Ollama、vLLM、LM Studio 等)

LOCAL_MODEL_NAME

用于本地服务器的模型名称

LOCAL_MODEL_API_KEY

本地服务器的可选 bearer 令牌

LOG_LEVEL

DEBUG / INFO / WARNING / ERROR(默认 INFO

DATA_DIR

摄取语料库的存放位置(默认 ./data

INDEX_DIR

FAISS / BM25 工件持久化位置(默认 ./data/index

运行

# Print the version
codebase-rag --version

# Boot the MCP server over stdio (advertises a 'ping' tool today)
codebase-rag serve

开发

ruff check .            # lint
ruff format --check .   # format check
mypy                    # type-check
pytest                  # tests

位于 .github/workflows/ci.yml 的预配置 GitHub Actions 工作流会在每次推送时运行全部四项。

布局

src/codebase_rag_mcp/
  config.py                  # python-dotenv loader
  cli/main.py                # `codebase-rag` entrypoint
  mcp/server.py              # stdio MCP server (stub)
  ingestion/                 # file discovery (TBD)
  parser/                    # tree-sitter AST extraction (TBD)
  chunker/                   # AST-aware chunking (TBD)
  indexing/
    vector.py                # FAISS dense index (TBD)
    bm25.py                  # rank-bm25 sparse index (TBD)
  retrieval/                 # hybrid query routing (TBD)
  reranker/                  # cross-encoder / LLM reranker (TBD)
  generation/
    providers/               # NVIDIA / Groq / OpenRouter / Gemini / local (TBD)
  citations/                 # chunk → source citations (TBD)
  impact/                    # symbol-graph impact analysis (TBD)

许可证

MIT。请参阅 LICENSE

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    A local MCP server that provides AI coding assistants with semantic search capabilities over codebases. It indexes code using local embeddings and exposes tools for efficient code retrieval, saving tokens and improving response quality.
    31
    4
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    A local MCP server that gives AI coding assistants retrieval access to your personal knowledge base of books, standards, and docs, grounding their answers in sources you trust.
    MIT

View all related MCP servers

Related MCP Connectors

  • An MCP server that gives your AI access to the source code and docs of all public github repos

  • Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.

  • Serve a folder of Markdown notes as an MCP server: hybrid search, reading, and sourced answers.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AyushShanu/CodeBase-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server