Document Q&A MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Document Q&A MCP ServerWhat are the main conclusions from the uploaded research paper?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Document Q&A MCP Server
A medium-complexity MCP server that lets an MCP client (like Claude Desktop) ingest documents (PDF / DOCX / TXT / MD) and answer questions about them using retrieval-augmented generation (RAG).
How it works:
add_documentextracts text, splits it into overlapping chunks, embeds each chunk locally withsentence-transformers, and stores it in a ChromaDB collection persisted to disk.ask_questionembeds your question, retrieves the most similar chunks from Chroma, and sends them + your question to a Groq-hosted LLM, which answers grounded only in that context.
1. Install
cd mcp-doc-qa
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txtThe first run will download the small local embedding model
(all-MiniLM-L6-v2, ~80MB) from HuggingFace — needs internet once, then it's
cached locally.
Related MCP server: Local RAG
2. Configure
cp .env.example .envEdit .env and set GROQ_API_KEY (free key at
https://console.groq.com/keys). Defaults for everything else are sensible.
3. Test it standalone (optional but recommended)
python server.pyThis starts the server on stdio and will just sit there waiting for an MCP
client — that's expected, it's not a web server. Press Ctrl+C to stop.
If you'd rather sanity-check the pieces without an MCP client, open a Python
shell and call store.add_document(...) / generate_answer(...) directly.
4a. Run it as a REST API (FastAPI)
Instead of (or alongside) the MCP server, you can run the same logic as a regular web backend:
uvicorn api:app --reload --port 8000Then open http://127.0.0.1:8000/docs for interactive Swagger UI, or hit it directly:
# Upload a document
curl -X POST http://127.0.0.1:8000/documents/upload \
-F "file=@/path/to/report.pdf"
# Ask a question
curl -X POST http://127.0.0.1:8000/ask \
-H "Content-Type: application/json" \
-d '{"question": "What was the Q3 revenue?"}'
# List documents
curl http://127.0.0.1:8000/documents
# Delete one document
curl -X DELETE http://127.0.0.1:8000/documents/<doc_id>Endpoint | Method | Description |
| POST | Upload + ingest a file (multipart form) |
| POST |
|
| GET | List ingested documents |
| DELETE | Delete one document |
| DELETE | Wipe everything |
| GET | Health check |
Both server.py (MCP) and api.py (FastAPI) call into the same
qa_service.py module, so ingestion/retrieval/answer logic lives in one
place — pick whichever interface fits your use case, or run both.
4b. Connect it to Claude Desktop
Add this to your Claude Desktop config
(~/Library/Application Support/Claude/claude_desktop_config.json on macOS,
%APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"document-qa": {
"command": "/absolute/path/to/mcp-doc-qa/venv/bin/python",
"args": ["/absolute/path/to/mcp-doc-qa/server.py"]
}
}
}Restart Claude Desktop. You should see the document-qa server's five tools
available in a new chat.
Tools exposed
Tool | Description |
| Ingest a PDF/DOCX/TXT/MD file |
| Get a grounded answer from ingested docs |
| See what's stored |
| Remove one document |
| Wipe everything |
(The FastAPI app exposes the equivalent operations as REST endpoints — see section 4a above.)
Notes & things to tune later
Chunking: character-based with paragraph/sentence-aware breaks (
document_loader.py). Swap in a smarter splitter (e.g. token-based) if you hit weird cuts.Embedding model:
all-MiniLM-L6-v2is small and fast. For better recall, tryall-mpnet-base-v2(slower, bigger) via.env.Groq model: defaults to
llama-3.3-70b-versatile. Check https://console.groq.com/docs/models for current options.Persistence: the Chroma DB lives in
./chroma_db— delete that folder to fully reset, or just callclear_all_documents.Scanned PDFs: this uses
pypdftext extraction, which won't work on image-only/scanned PDFs. Add OCR (e.g.pytesseract) if you need that.
This server cannot be deployed
Maintenance
Related MCP Connectors
Ingest, manage, and retrieve documents for RAG-powered AI applications
Parse, extract, split, and ask over digital PDFs (text layer, no OCR) from Cursor and Claude.
Your private knowledge base: upload documents (.md, .txt, .docx, PDF, images), the platform indexes
Extract PDFs to Markdown, RAG chunks and cited tables; publish tracked Doc Links with read stats.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to search and query PDF documents through a local RAG system with vector embeddings. Provides semantic document search capabilities while keeping all data stored locally without external dependencies.-
- AlicenseAqualityAmaintenancePrivacy-first local document search using semantic search. Runs entirely on your machine with no cloud services, supporting PDF, DOCX, TXT, and Markdown files.2293,151390MIT
- FlicenseNot gradedqualityDmaintenanceConverts documents (PDF, DOCX, XLSX, PPTX, HTML, TXT, MD) to Markdown and stores them locally with search and retrieval capabilities.-
- FlicenseAqualityDmaintenanceEnables indexing local documents (PDF, Markdown, text, code) into a knowledge base and querying them via semantic search using local embeddings, all running privately on your machine.4-