faq-rag
Provides vector storage and similarity search for FAQ document chunks using MongoDB's $vectorSearch, enabling efficient retrieval of relevant context for question answering.
Powers the answer generation step by using retrieved context from FAQ chunks to produce grounded, cited answers via OpenAI's GPT-4o-mini model.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
FAQ RAG + MCP Tool
A RAG prototype that answers natural-language questions from FAQ documents using vector search and LLM generation, exposed as an MCP tool.
What We Built
A three-stage RAG pipeline:
Ingest — FAQ markdown files are chunked (~200 chars), embedded with VoyageAI, and stored in MongoDB
Retrieve — User questions are embedded and matched against stored chunks using MongoDB
$vectorSearch(cosine similarity)Generate — Top matching chunks are passed as context to an LLM, which generates a cited answer
The whole thing is wrapped as an MCP tool (ask_faq) so any MCP-compatible client can call it directly.
Related MCP server: doc-mcp
Architecture
Component | Choice | Why |
Embeddings | VoyageAI | Purpose-built for retrieval; outperforms OpenAI ada-002 on search benchmarks |
Vector Store | MongoDB | Persistent, scalable, production-realistic — vs in-memory numpy which loses data on restart |
LLM | OpenAI | Cost-efficient, fast, plenty capable for FAQ Q&A |
MCP | stdio transport | Standard for local MCP tools |
How It Works
Question → VoyageAI embed → MongoDB $vectorSearch → Top-K chunks → OpenAI generate → Cited answerChunking: Fixed ~200 character splits. Simple and predictable for a small corpus.
Retrieval: Cosine similarity via MongoDB vector search index (HNSW). Returns top 4 chunks by default.
Generation: System prompt enforces grounded answers — no hallucination, must cite source filenames, infers intent (e.g. "locked out" → password reset).
Lazy client init: API clients connect on first query, not at server startup — so the MCP server registers tools cleanly before any API calls.
How to Run
1. Configure environment
cp .env.example .envSet VOYAGE_API_KEY, OPENAI_API_KEY, and MONGODB_URI. That’s all that’s required.
2. Ingest the FAQ corpus
uv run ingest.py3. Test via CLI
uv run rag_core.py4. Run as MCP tool in Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"faq-rag": {
"type": "stdio",
"command": "uv",
"args": ["run", "python", "${workspaceFolder}/mcp_server.py"],
"envFile": "${workspaceFolder}/.env"
}
}
}Example Questions
These show the system understands intent, not just keywords:
Question | What it tests |
"How do I reset my password?" | Direct keyword match (faq_auth.md) |
"I'm locked out of my account" | Semantic inference — no "password" or "reset" in query |
"Can I take 3 weeks off in a row?" | Retrieves the 2-week approval rule from PTO policy |
"When do my shares kick in?" | Maps "shares" → equity vesting schedule |
"I want to use one login for everything" | Maps to SSO without mentioning it |
"What do new employees need to know?" | Cross-document retrieval from multiple FAQ files |
Deviations from Starter Skeleton
The starter used OpenAI embeddings + in-memory numpy for cosine similarity. We replaced both:
VoyageAI instead of OpenAI embeddings — Voyage models are purpose-built for retrieval and rank higher on search benchmarks (MTEB). Using a separate embedding provider also decouples retrieval quality from the LLM choice.
MongoDB instead of numpy — A real vector database with persistence, indexing (HNSW), and
$vectorSearchaggregation. Data survives restarts, and the same approach scales to millions of documents without code changes.Lazy client initialization — API clients connect on first tool call, not at import. This lets the MCP server start and register tools cleanly.
Kept everything else simple — no LangChain, no caching layers, no retry logic. Clean Python with direct API calls.
Files
ingest.py # Build the index: read faqs/ → chunk → embed → store in MongoDB → ensure vector index
rag_core.py # Query path only: embed question → vector search → generate answer (no ingestion)
mcp_server.py # MCP server (exposes ask_faq, calls rag_core)
faqs/ # FAQ markdown corpusTool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Query any docs site via MCP. Submit a URL, ask questions, get cited answers.
Query your own PDFs and documents from any MCP client. Every answer cites the page it came from.
Search and manage your team's knowledge from MCP clients.
MCP server for querying Forkast documentation
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables semantic search and question-answering over FAQ documents using RAG (Retrieval-Augmented Generation) with OpenAI embeddings and in-memory vector similarity.-
- FlicenseNot gradedqualityDmaintenanceEnables semantic search and AI-powered Q&A over ingested GitHub documentation repositories via MCP tools.-
- AlicenseNot gradedqualityCmaintenanceEnables document-based Q&A with multi-modal RAG, hybrid retrieval, knowledge graph reasoning, and multi-agent orchestration via MCP tools.4MIT
- FlicenseNot gradedqualityDmaintenanceEnables querying company knowledge base using RAG, providing accurate answers from internal documents via MCP.-