mcp-codebase-rag
MCP server for code retrieval from a fully indexed codebase using CocoIndex
Documentation
Codebase RAG MCP Server
This MCP server provides semantic codebase search and file retrieval using embeddings and a PostgreSQL database. It exposes tools for searching code, listing files, and retrieving file contents.
Features
- Semantic Code Search: Uses Voyage embedding model to convert queries into vectors and search code snippets by similarity.
- File Listing: Lists all tracked files in the codebase.
- File Content Retrieval: Fetches the full content of a file by filename.
Tools
- search_codebase
- Returns code snippets relevant to the query.
- Inputs:
- `query` (string): Search terms
- get_files
- Lists all files in the codebase.
- get_file_content
- Returns the content of the specified file.
- Inputs:
- `filename` (string): Filename
Configuration
Getting a Voyage API Key
1. Sign up for a Voyage API account
2. Generate your API key from the dashboard
Environment Variables
- `DATABASE_URL`: PostgreSQL connection string.
- `VOYAGE_API_KEY`: API key for embedding model.
- `EMBEDDING_TABLE`: Table name for code embeddings.
- `TRACKING_TABLE`: Table name for file tracking.
Docker
{
"mcpServers": {
"codebase-rag": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"DATABASE_URL",
"-e",
"VOYAGE_API_KEY",
"-e",
"EMBEDDING_TABLE",
"-e",
"TRACKING_TABLE",
"-p",
"8080:8080",
"allentcm/mcp-codebase-rag:1.0.0"
],
"env": {
"DATABASE_URL": "postgres://cocoindex:cocoindex@localhost/cocoindex",
"VOYAGE_API_KEY": "voyage_api_key",
"EMBEDDING_TABLE": "codebase__code_embeddings",
"TRACKING_TABLE": "codebase__cocoindex_tracking"
}
}
}
}License
This MCP server is licensed under the MIT License. You are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
Frequently asked questions
What is mcp-codebase-rag?
mcp-codebase-rag is MCP server for code retrieval from a fully indexed codebase using CocoIndex
How do I install mcp-codebase-rag?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is mcp-codebase-rag open source?
Yes — it is hosted on GitHub at https://github.com/allentcm/mcp-codebase-rag and has 6 stars.
Related MCP tools
🙌 OpenHands: Code Less, Make More for the Model Context Protocol. Enhance AI assistants with powerful integrations. Python-based implementation.
Universal memory layer for AI Agents; Announcing OpenMemory MCP - local and secure memory management. Python-based implementation.
基于大模型搭建的聊天机器人,同时支持 微信公众号、企业微信应用、飞书、钉钉 等接入,可选择ChatGPT/Claude/DeepSeek/文心一言/讯飞星火/通义千问/ Gemini/GLM-4/Kimi/LinkAI,能处理文本、语音和图片,访问操作系统和互联网,支持基于自有知识库进行定制企业智能客服。
An LLM agent that conducts deep research (local and web) on any given topic and generates a long report with citations. Built for the Model Context Protocol to
🚀 The fast, Pythonic way to build MCP servers and clients Trusted by 19900+ developers. Trusted by 19900+ developers. Trusted by 19900+ developers.
🔥 MaxKB is an open-source platform for building enterprise-grade agents. MaxKB 是强大易用的开源企业级智能体平台。 for the Model Context Protocol. Enhance AI assistants with po
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP