1.4 KiB
1.4 KiB
FAQ Bot – ChromaDB + MCP-tool
This project implements a simple FAQ bot that uses ChromaDB as the sole vector store and a single Minimal Context‑Aware Prompt (MCP) tool for prompt generation.
Stack
- ChromaDB – vector database for storing and querying embeddings.
- MCP-tool – a lightweight function that creates a prompt from a user question.
- Node.js – runtime environment.
- readline-sync – simple CLI input.
How it works
-
Vector Store
src/vectorStore.jswraps ChromaDB.- Documents are embedded using a deterministic 768‑dimensional vector derived from word hashes.
- The collection is created (or fetched) on startup.
-
MCP-tool
src/bot.jscontainsgeneratePromptwhich formats the user question into a prompt.- The prompt is embedded and queried against the vector store.
-
Bot Loop
src/index.jsloads a small FAQ dataset, populates the collection, and starts a REPL loop.- User input is processed, the best matching FAQ answer is returned.
Running the bot
npm install
npm start
Type a question and press Enter. Type exit to quit.
Notes
- Only ChromaDB is used for vector operations; no other vector store libraries are present.
- Only one MCP-tool (
generatePrompt) is integrated. - The code is fully self‑contained and can be extended with real embeddings or a larger dataset.