Personal Knowledge-Base MCP Server
A Personal Knowledge-Base MCP Server that provides semantic search over a student-owned document collection using MCP, Gemini embeddings, and Qdrant. It exposes tools for searching notes, retrieving full documents, and listing indexed sources.
README
Personal Knowledge-Base MCP Server
A Personal Knowledge-Base MCP Server that provides semantic search over a student-owned document collection using the Model Context Protocol (MCP), Gemini embeddings, and Qdrant.
Project Overview
This project exposes a personal knowledge base as callable MCP tools.
Instead of relying on keyword matching, the system converts user queries into vector embeddings and retrieves semantically relevant document chunks from Qdrant.
Architecture
User / MCP Client
|
v
MCP Server (FastMCP)
|
+----------------------+
| |
v v
search_notes() get_document()
|
v
Gemini Embedding API
|
v
Qdrant Vector Database
|
v
Ranked Chunks
|
v
Source + Page + Score + Text
## Features
* PDF document ingestion
* Page-by-page text extraction
* Recursive text chunking
* Gemini `gemini-embedding-001` embeddings
* Qdrant vector storage
* Semantic similarity search
* Source and page citations
* Confidence threshold for low-relevance queries
* Full-document retrieval
* Indexed-source listing
* MCP Inspector support
## MCP Tools
### `search_notes`
Searches the knowledge base using semantic similarity.
Arguments:
* `query`: search question or topic
* `top_k`: maximum number of results
Returns:
* similarity score
* source filename
* page number
* relevant text chunk
### `get_document`
Returns the complete text of an indexed PDF document.
Argument:
* `doc_id`: document filename
Example:
```text
Complex_Variables_Project_Report.pdf
list_source_documents
Lists all indexed source documents.
Example output:
1. Complex_Variables_Project_Report.pdf
Project Structure
Personal-Knowledge-MCP/
├── documents/
│ └── Complex_Variables_Project_Report.pdf
├── services/
│ ├── chunking.py
│ ├── embedding.py
│ ├── pdf_reader.py
│ └── qdrant_service.py
├── .env
├── .gitignore
├── evaluation.py
├── ingest.py
├── requirements.txt
└── server.py
Setup
1. Create and activate virtual environment
python -m venv .venv
.venv\Scripts\Activate.ps1
2. Install dependencies
pip install -r requirements.txt
3. Configure Gemini API key
Create a .env file in the project root:
GEMINI_API_KEY=your_api_key_here
Never commit .env to Git.
4. Start Qdrant
The project uses local Qdrant at:
http://localhost:6333
Example Docker command:
docker run -d --name qdrant -p 6333:6333 -p 6334:6334 qdrant/qdrant
Document Ingestion
Place the PDF inside:
documents/
Run:
python ingest.py
The ingestion pipeline performs:
PDF
↓
Page extraction
↓
Chunking
↓
Gemini embeddings
↓
Qdrant storage
Each stored chunk contains:
text
page
source
Running the MCP Server
Start the MCP Inspector:
mcp dev server.py
The MCP server uses STDIO transport.
Available tools:
search_notes
get_document
list_source_documents
Retrieval Evaluation
A small evaluation set of five queries was used to check whether at least one expected relevant page appeared within the top three retrieved results.
Evaluation result:
Tests: 5
Successful hits: 5
Hit@3: 100%
Example evaluation queries included:
- What is a complex variable?
- What are the Cauchy-Riemann equations?
- How does the Laplace transform help engineering systems?
- What is the difference between Laplace and Fourier transforms?
- How is FFT used for audio noise reduction?
Confidence Filtering
The search tool uses an initial similarity threshold of:
0.60
For example, relevant queries produced scores around:
0.79
0.76
0.75
while an unrelated query produced scores around:
0.52
Therefore low-scoring results are filtered and the tool returns:
No confident match found.
Technologies
- Python
- FastMCP
- Model Context Protocol (MCP)
- Google Gemini Embeddings
- Qdrant
- PyMuPDF
- LangChain Text Splitters
- Docker
- MCP Inspector
Current Knowledge Source
The current demonstration corpus is:
Complex_Variables_Project_Report.pdf
The document contains 7 pages and was split into 30 chunks for the indexed personal_knowledge collection.
Security
- API keys are stored in
.env .envis excluded through.gitignore- Secrets should never be committed to source control
Future Improvements
- Support Markdown and TXT documents
- Add document-level persistent IDs
- Improve duplicate-chunk handling
- Expand the evaluation dataset
- Add more retrieval metrics
- Support multiple document collections
- Add optional Qdrant Cloud deployment
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.