Skip to main content
Glama
zyay

mcp-rag-bridge

by zyay

๐ŸŒ‰ mcp-rag-bridge

Connect any AI agent to your document knowledge base via MCP (Model Context Protocol).

This server wraps a RAG (Retrieval-Augmented Generation) pipeline as MCP tools โ€” so Claude, Qwen Code, or any MCP client can query your documents, add new ones, and get grounded answers with citations.

Why this exists

"A RAG pipeline without an agent interface is just a search engine. An agent without RAG is just a chatbot. The bridge makes both smarter."

This project connects the two worlds: your documents become the agent's knowledge, and the agent becomes the interface to that knowledge.

Related MCP server: MinerU Document Explorer

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   MCP Client (AI)   โ”‚
โ”‚  Claude / Qwen Code โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚ stdio (JSON-RPC)
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   MCP RAG Bridge    โ”‚
โ”‚                     โ”‚
โ”‚  query_kb โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  add_document โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  list_sources โ”€โ”€โ”  โ”‚    โ”‚
โ”‚  delete_doc โ”€โ”  โ”‚  โ”‚    โ”‚
โ”‚  search โ”€โ”€โ”  โ”‚  โ”‚  โ”‚    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”ผโ”€โ”€โ”ผโ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”˜
           โ”‚  โ”‚  โ”‚  โ”‚
     โ”Œโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ–ผโ”€โ”€โ–ผโ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”
     โ”‚   ChromaDB +      โ”‚
     โ”‚   Embeddings      โ”‚
     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Tools (6)

Tool

What it does

query_knowledge_base

Search documents + optional LLM-generated answer with citations

list_sources

List all indexed documents with chunk counts

add_document

Index a file (txt, md, pdf, csv, json) into the knowledge base

add_text

Index raw text (notes, snippets, API responses)

delete_document

Remove a document from the knowledge base

search_similar

Find documents similar to a given text

Quick start

git clone https://github.com/zyay/mcp-rag-bridge.git
cd mcp-rag-bridge
python -m venv venv && venv\Scripts\activate
pip install -r requirements.txt

# Start the MCP server
python server.py

# Or test with the included client
python client_test.py

Connect an MCP client

Qwen Code

qwen mcp add rag-bridge -- python /full/path/to/mcp-rag-bridge/server.py

Claude Code

claude mcp add rag-bridge -- python /full/path/to/mcp-rag-bridge/server.py

Claude Desktop

{
  "mcpServers": {
    "rag-bridge": {
      "command": "python",
      "args": ["/full/path/to/mcp-rag-bridge/server.py"]
    }
  }
}

Usage examples

Once connected, the agent can interact with your knowledge base naturally:

User: "What documents do you know about?"
Agent: [calls list_sources()]

User: "Index the file at ./docs/architecture.md"
Agent: [calls add_document("./docs/architecture.md")]

User: "How does our authentication system work?"
Agent: [calls query_knowledge_base("authentication system", use_llm=True)]

User: "Find documents similar to 'database migration strategy'"
Agent: [calls search_similar("database migration strategy")]

LLM generation

Set use_llm=True in query_knowledge_base to get grounded answers:

  • Ollama (default): Local, free, no API key. Set OLLAMA_MODEL=llama3.2.

  • OpenAI fallback: Set LLM_PROVIDER=openai and OPENAI_API_KEY=sk-...

The bridge tries the primary provider first, then falls back automatically.

Environment variables

Variable

Default

Description

RAG_DATA_DIR

data

Document directory

RAG_CHROMA_DIR

.chroma

Vector store path

RAG_COLLECTION

docs

ChromaDB collection name

RAG_CHUNK_SIZE

600

Text chunk size (chars)

RAG_CHUNK_OVERLAP

120

Overlap between chunks

LLM_PROVIDER

ollama

LLM provider (ollama/openai)

OLLAMA_URL

http://localhost:11434

Ollama server URL

OLLAMA_MODEL

llama3.2

Ollama model name

OPENAI_API_KEY

(empty)

OpenAI API key

OPENAI_MODEL

gpt-4o-mini

OpenAI model name

Design decisions

Decision

Why

Self-contained

No dependency on rag-docs-assistant โ€” works as a standalone project

Hybrid search

70% semantic + 30% lexical for better recall

Two-step LLM

Retrieve first, then generate โ€” grounded answers with citations

ChromaDB

Zero-config, persistent, no separate server needed

stdio transport

Works with any MCP client, no HTTP server needed

Relationship to other projects

  • rag-docs-assistant โ€” Full RAG pipeline with web UI, evals, reranking. This project shares the same core concepts but is self-contained.

  • mcp-agent-tools โ€” General-purpose MCP tools (file, MySQL, web, calc). This project is the RAG-specific counterpart.

Together, these three projects demonstrate a complete AI agent ecosystem: general tools + knowledge retrieval + the bridge between them.

License

MIT

A
license - permissive license
-
quality - not tested
B
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

  • F
    license
    -
    quality
    D
    maintenance
    An MCP-based AI agent that retrieves and processes documents to answer queries using a RAG pipeline with LangChain and Claude models. It enables document indexing, context-aware retrieval, and multi-tool orchestration for research and knowledgebase applications.
    1
  • A
    license
    -
    quality
    D
    maintenance
    Enables AI agents to search, deep-read, and build knowledge bases from Markdown, PDF, DOCX, and PPTX documents via MCP tools for retrieval, document navigation, and ingestion.
    44
    613
    MIT
  • A
    license
    -
    quality
    A
    maintenance
    Provides AI agents with persistent knowledge storage, enabling them to store, search, and retrieve text, documents, and files using semantic and keyword search via MCP tools.
    32
    Apache 2.0

View all related MCP servers

Related MCP Connectors

  • Agentic search over your Dewey document collections from any MCP-compatible client.

  • Shared, peer-validated knowledge archive for AI agents โ€” search, contribute, and validate via MCP

  • Query any docs site via MCP. Submit a URL, ask questions, get cited 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/zyay/mcp-rag-bridge'

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