RooCode-RAG-Lookup
Enables semantic search across documents and code repositories using RAG (Retrieval-Augmented Generation) with vector embeddings. Automatically indexes PDF documents and performs relevance-scored lookups through ChromaDB and sentence transformers.
README
RooCode-RAG-Lookup
RooCode MCP Server for performing RAG (Retrieval-Augmented Generation) lookups in documents and code repositories using vector embeddings and semantic search.
Example Usage
Ask a question: e.g. "What is the maximum number of entries* in a word document?" and prompt the LLM stating "use rag". The LLM is usally a decent judge of when it should use a tool or not and may decide to use the tool on its own.
<img width="1458" height="686" alt="image" src="https://github.com/user-attachments/assets/45bdd266-1f23-42e5-9c2f-34d1dd23a179" />
*This is related to the maximum number of XML properties and elements addressable in Word
Features
- Full RAG Implementation: Complete vector-based semantic search using ChromaDB and Haystack
- Document Indexing: Automatic text extraction and chunking from PDF documents
- Vector Embeddings: Sentence transformer embeddings for semantic similarity
- RAG Lookup Tool: Search through documents and code repositories with relevance scoring
- Test Tool: Simple hello world tool to verify MCP server connectivity
- Async MCP Protocol: Full JSON-RPC 2.0 support via stdio
Installation
- Install Python dependencies:
pip install -r requirements.txt
- Configure RooCode to use this MCP server by adding the configuration from
mcp_config.jsonto your RooCode settings.
Configuration
-
Add the
mcp_config.jsonto your RooCode MCP server settings in the edit global settings part of MCP tools. If the tool is ready to use it will show a green status. -
Set the following environment variables:
RAG_LOOKUP_PATH: Path to this project directoryPYTHON_PATH: Path to your Python executable
-
Configure parameters in
parameters.py:EMBEDDING_MODEL: Sentence transformer model (default: all-mpnet-base-v2)COLLECTION_NAME: ChromaDB collection nameCHUNK_SIZE: Text chunk size in words (default: 500)CHUNK_OVERLAP: Overlap between chunks (default: 50)DEFAULT_TOP_K: Number of results to return (default: 5)
Available Tools
1. rag_lookup
Perform semantic search using RAG in documents and code repositories. Returns relevant chunks with similarity scores and metadata.
Parameters:
query(required): The search querysource(optional): Where to search - "documents", "repos", or "both" (default: "both")
Returns:
- Relevant text chunks with similarity scores
- Source file information and metadata
- Statistics on documents searched
Example:
{
"query": "authentication implementation",
"source": "both"
}
Response Format:
{
"status": "success",
"query": "authentication implementation",
"results": [
{
"content": "...",
"score": 0.85,
"metadata": {
"file_name": "document.txt",
"source_file": "/path/to/document.txt"
}
}
],
"metadata": {
"documents_searched": 5,
"repos_searched": 3,
"total_matches": 5
}
}
2. say_hello
Simple test tool that returns a greeting message with timestamp.
Parameters:
name(optional): Name to include in greeting (default: "World")
Example:
{
"name": "RooCode"
}
Usage
1. Extract and Index Documents
Place PDF documents in the Documents/ or Repos/ folders, then run:
# Extract text from PDFs
python extraction/parse_pdf.py
# Populate the vector database
python extraction/populate_database.py
2. Query the RAG System
# Test RAG lookup directly
python query_rag.py
Or ask
3. Use via MCP Server
Once configured in RooCode, use the rag_lookup tool through the MCP interface. There is an MCP menu in RooCode settings editing the global settings will give you json settings to edit {"mcpServers":{}}, copy and paste the mcp_config.json into the global MCP settings.
Testing
Test the MCP server locally:
# Using MCP inspector
npx @modelcontextprotocol/inspector python mcp_tool.py
# Direct stdio test
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | python mcp_tool.py
Project Structure
RooCode-RAG-Lookup/
├── mcp_tool.py # Main MCP server implementation
├── query_rag.py # RAG query functions
├── parameters.py # Configuration parameters
├── run_rag_lookup.bat # Windows batch launcher
├── mcp_config.json # Example RooCode configuration
├── requirements.txt # Python dependencies
├── extraction/
│ ├── parse_pdf.py # PDF text extraction
│ └── populate_database.py # Database population and indexing
├── ExtractedText/ # Extracted text files (.txt + .meta.json)
├── chroma_db/ # ChromaDB vector database
└── README.md # This file
Technology Stack
- MCP Python SDK: Protocol implementation for RooCode integration
- Haystack: Document processing and RAG pipeline framework
- ChromaDB: Vector database for embeddings storage
- Sentence Transformers: Semantic embeddings (all-mpnet-base-v2)
- PDFPlumber: PDF text extraction with layout preservation
- Async/Await: Concurrent request handling
- JSON-RPC 2.0: Communication protocol
- Stdio Transport: RooCode integration
How It Works
- Document Extraction: PDFs are parsed using
parse_pdf.pywhich extracts text and metadata - Text Chunking: Documents are split into overlapping chunks using
DocumentSplitter - Embedding Generation: Text chunks are converted to 768-dimensional vectors using sentence transformers
- Vector Storage: Embeddings are stored in ChromaDB with metadata for retrieval
- Semantic Search: Queries are embedded and matched against stored vectors using cosine similarity
- Result Ranking: Top-K most relevant chunks are returned with scores and metadata
Requirements
See requirements.txt for full dependencies. Key packages:
mcp>=1.0.0- MCP protocol supporthaystack-ai- RAG frameworkchroma-haystack- ChromaDB integrationsentence-transformers- Embedding modelspdfplumber- PDF extraction
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。