codebase-rag-mcp

codebase-rag-mcp

An MCP server that transforms a local codebase into a queryable, citation-grounded knowledge base using hybrid FAISS and BM25 retrieval, with optional reranking and swappable LLM providers.

Category
Visit Server

README

codebase-rag-mcp

A Model Context Protocol (MCP) server that turns any local codebase into a queryable, citation-grounded knowledge base. Built on a hybrid retriever (dense FAISS + sparse BM25), an optional reranker, and a swappable LLM provider (NVIDIA, Groq, OpenRouter, Gemini, or any local OpenAI-compatible endpoint).

Status: scaffold only. The package installs, the CLI runs, and the MCP server boots and advertises a placeholder ping tool. The RAG pipeline (ingestion → parsing → chunking → indexing → retrieval → reranking → generation) is being built incrementally on top of this skeleton. See DECISIONS.md and FLOW.md.

Install

Requires Python 3.11+.

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

This pulls in tree-sitter, FAISS (CPU), rank-bm25, sentence-transformers, langchain-huggingface / langchain-community, the official MCP Python SDK, and httpx for outbound provider calls.

Configure

Copy the example env file and fill in whichever provider keys you have:

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

Recognized variables (see .env.example for the full list):

Variable Purpose
NVIDIA_API_KEY NVIDIA NIM / build API
GROQ_API_KEY Groq Cloud
OPENROUTER_API_KEY OpenRouter (multi-provider proxy)
GEMINI_API_KEY Google Gemini (optional)
LOCAL_MODEL_BASE_URL OpenAI-compatible local server (Ollama, vLLM, LM Studio, ...)
LOCAL_MODEL_NAME Model name to use against the local server
LOCAL_MODEL_API_KEY Optional bearer token for the local server
LOG_LEVEL DEBUG / INFO / WARNING / ERROR (default INFO)
DATA_DIR Where ingested corpora live (default ./data)
INDEX_DIR Where FAISS / BM25 artifacts persist (default ./data/index)

Run

# Print the version
codebase-rag --version

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

Develop

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

A preconfigured GitHub Actions workflow at .github/workflows/ci.yml runs all four on every push.

Layout

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)

License

MIT. See LICENSE.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured