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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。