Personal Knowledge-Base MCP Server
Provides semantic search over a personal knowledge base by generating embeddings for documents and queries using Google Gemini.
Click on "Install 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., "@Personal Knowledge-Base MCP Serversearch my notes for Cauchy-Riemann equations"
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.
Personal Knowledge-Base MCP Server
A Personal Knowledge-Base MCP Server that provides semantic search over student-owned documents using the Model Context Protocol (MCP), Google Gemini embeddings, and Qdrant.
The project combines a reusable MCP server with a lightweight authenticated web backend for document upload and source management.
Project Overview
This project exposes a personal knowledge base as callable MCP tools.
Instead of relying on keyword matching, documents are:
Extracted page-by-page from PDF files.
Split into smaller semantic chunks.
Converted into vector embeddings using Google Gemini.
Stored in Qdrant.
Retrieved using semantic similarity search.
The MCP server exposes the knowledge base through reusable tools that can be called by an MCP-compatible client such as MCP Inspector.
Related MCP server: genai-lab
Architecture
┌──────────────────────┐
│ User / Client │
└──────────┬───────────┘
│
┌──────────────┴──────────────┐
│ │
▼ ▼
┌───────────────┐ ┌───────────────┐
│ Web Frontend │ │ MCP Client │
│ Upload/Search │ │ MCP Inspector │
└───────┬───────┘ └───────┬───────┘
│ │
▼ ▼
┌───────────────┐ ┌───────────────┐
│ FastAPI │ │ FastMCP │
│ Backend │ │ MCP Server │
│ Authentication│ │ │
│ Uploads │ │ 3 MCP Tools │
└───────┬───────┘ └───────┬───────┘
│ │
└──────────────┬──────────────┘
│
▼
┌──────────────────────┐
│ Document Processing │
│ │
│ PDF Extraction │
│ Chunking │
│ Gemini Embeddings │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ Qdrant Vector Store │
│ │
│ personal_knowledge │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ Ranked Search Results│
│ │
│ Score │
│ Source │
│ Page │
│ Text │
└──────────────────────┘Features
PDF document ingestion
Page-by-page PDF text extraction
Recursive text chunking
Google Gemini
gemini-embedding-001embeddingsQdrant vector storage
Semantic similarity search
Source and page citations
Confidence filtering for low-relevance queries
Full-document retrieval
Indexed-source listing
Authenticated backend API
PDF upload support
User document storage
MCP Inspector support
Retrieval evaluation
100% Hit@3 on the current evaluation dataset
MCP Tools
The MCP server exposes three tools.
1. search_notes
Searches the indexed knowledge base using semantic similarity.
Arguments
query
top_kReturns
Each result contains:
similarity score
source filename
page number
relevant text chunkExample
Query:
What is a complex variable?
Result:
Score: 0.7239
Source: Complex_Variables_Project_Report.pdf
Page: 2
Text: ...2. get_document
Returns the complete text of an indexed document.
Argument
doc_idExample
Complex_Variables_Project_Report.pdfThis allows an MCP client to retrieve the complete source document after identifying a relevant result through semantic search.
3. list_sources
Lists the documents currently indexed in the knowledge base.
Example output
1. Complex_Variables_Project_Report.pdfThis provides a simple way for an MCP client to discover which source documents are available.
Backend API
The project also includes a FastAPI backend used for document management and authentication.
The backend is located in:
backend/The API can be started with:
uvicorn backend.main:app --reloadThe development server runs at:
http://127.0.0.1:8000Interactive API documentation is available through FastAPI:
http://127.0.0.1:8000/docsBackend Health Check
The backend provides a health endpoint:
GET /healthA successful response confirms that the FastAPI application is running.
Example:
{
"status": "ok"
}Authentication
Protected backend endpoints require authentication using a Bearer token.
For example, attempting to access a protected endpoint without authentication returns:
401 Unauthorizedwith:
{
"detail": "Not authenticated"
}This confirms that authentication protection is active.
Document Upload
Documents can be uploaded through the backend.
Uploaded user documents are stored under:
documents/users/The ingestion pipeline processes an uploaded PDF through the following stages:
PDF Upload
↓
PDF Text Extraction
↓
Page Metadata
↓
Recursive Chunking
↓
Gemini Embeddings
↓
Qdrant
↓
Semantic SearchDocument Ingestion
The project includes an ingestion script:
ingest.pyIt can be executed with:
python ingest.pyThe ingestion pipeline performs:
PDF
↓
Page extraction
↓
Chunking
↓
Gemini embeddings
↓
Qdrant storageEach indexed chunk contains metadata including:
text
page
sourceThis metadata allows search results to provide source citations and page numbers.
Vector Database
The project uses Qdrant as its vector database.
The current collection is:
personal_knowledgeQdrant stores the generated document embeddings together with their metadata.
For local development, Qdrant can be run at:
http://localhost:6333Example Docker command:
docker run -d --name qdrant -p 6333:6333 -p 6334:6334 qdrant/qdrantEmbeddings
The project uses Google Gemini embeddings.
The configured embedding model is:
gemini-embedding-001The Gemini API key is configured through an environment variable:
GEMINI_API_KEY=your_api_key_hereThe .env file must never be committed to Git.
Semantic Search
The system performs semantic retrieval rather than simple keyword matching.
For example, a query such as:
How are complex numbers used in engineering?can retrieve content discussing:
AC circuits
control systems
signal processing
complex exponentialseven when the exact wording of the query does not appear in the document.
Search results are ranked by vector similarity score.
Confidence Filtering
The search system uses a similarity confidence threshold to reduce irrelevant results.
The current threshold is approximately:
0.60Relevant queries can produce scores such as:
0.72
0.76
0.79Low-confidence results below the configured threshold are filtered.
When no sufficiently relevant result is found, the system can return:
No confident match found.This prevents unrelated document content from being presented as a confident answer.
Retrieval Evaluation
A five-query evaluation dataset was used to measure retrieval quality.
The evaluation checks whether at least one expected relevant page appears within the top three retrieved results.
The current evaluation result is:
====================
Hit@3: 5/5
Hit@3 score: 100.00%
====================Evaluation Queries
Test 1
What is a complex variable?Expected page:
[2]Result:
Retrieved pages: [2, 2, 2]
Hit@3: YESTest 2
What are the Cauchy-Riemann equations?Expected pages:
[2, 3]Result:
Retrieved pages: [2, 3, 3]
Hit@3: YESTest 3
How does the Laplace transform help engineering systems?Expected page:
[4]Result:
Retrieved pages: [4, 4, 4]
Hit@3: YESTest 4
What is the difference between Laplace and Fourier transforms?Expected pages:
[5, 7]Result:
Retrieved pages: [7, 4, 5]
Hit@3: YESTest 5
How is FFT used for audio noise reduction?Expected page:
[6]Result:
Retrieved pages: [6, 5, 6]
Hit@3: YESFinal Evaluation
Tests: 5
Successful hits: 5
Hit@3: 100%The evaluation script can be run with:
python evaluation.pyMCP Server
The main MCP server is:
server.pyThe server uses FastMCP and exposes:
search_notes
get_document
list_sourcesThe registered tools have been verified programmatically.
Example verification:
python -c "from server import mcp; print(list(mcp._tool_manager._tools.keys()))"Expected output:
['search_notes', 'get_document', 'list_sources']Running MCP Inspector
The MCP server can be tested using MCP Inspector:
mcp dev server.pyThe MCP Inspector can then be used to:
Discover the available tools
Test
search_notesTest
get_documentTest
list_sourcesInspect tool arguments
Inspect returned results
Project Structure
The current project structure includes the MCP server, backend API, frontend, document processing services, and evaluation pipeline.
Personal-Knowledge-MCP/
│
├── backend/
│ ├── main.py
│ ├── auth.py
│ ├── models.py
│ └── database.py
│
├── frontend/
│ └── ...
│
├── services/
│ ├── chunking.py
│ ├── embedding.py
│ ├── pdf_reader.py
│ └── qdrant_service.py
│
├── documents/
│ └── users/
│ └── ...
│
├── .env
├── .gitignore
├── evaluation.py
├── ingest.py
├── requirements.txt
├── server.py
└── README.mdInstallation
1. Clone the project
git clone <repository-url>
cd Personal-Knowledge-MCP2. Create a virtual environment
python -m venv .venvActivate it:
.venv\Scripts\Activate.ps13. Install dependencies
python -m pip install -r requirements.txtMain dependencies include:
mcp
qdrant-client
google-genai
PyMuPDF
langchain-text-splitters
fastapi
uvicorn
python-multipart
python-jose
sqlalchemy
python-dotenv
email-validatorEnvironment Configuration
Create a .env file in the project root.
Example:
GEMINI_API_KEY=your_api_key_hereAdditional backend/database configuration can be stored in environment variables as required by the application.
Never commit secret API keys to Git.
Running the Backend
Activate the virtual environment:
.venv\Scripts\Activate.ps1Start FastAPI:
uvicorn backend.main:app --reloadVerify the API:
http://127.0.0.1:8000/healthOpen interactive API documentation:
http://127.0.0.1:8000/docsRunning the MCP Server
For MCP development and testing:
mcp dev server.pyAvailable MCP tools:
search_notes
get_document
list_sourcesTesting
The project has been syntax-checked across the major components.
Examples:
python -m py_compile server.py
python -m py_compile ingest.py
python -m py_compile evaluation.py
python -m py_compile backend\main.py
python -m py_compile backend\auth.py
python -m py_compile backend\models.py
python -m py_compile backend\database.py
python -m py_compile services\embedding.py
python -m py_compile services\pdf_reader.py
python -m py_compile services\qdrant_service.pyThe retrieval evaluation also passes:
Hit@3: 5/5
Hit@3 score: 100.00%Current Demonstration Corpus
The current demonstration document is:
Complex_Variables_Project_Report.pdfThe document contains:
7 pagesand the indexed collection contains approximately:
30 chunksThe document covers topics including:
Complex variables
Complex numbers
Cauchy-Riemann equations
Laplace transforms
Fourier transforms
FFT
Engineering applications
Audio signal processing
Security
The project includes authentication for protected backend endpoints.
Security practices include:
API keys stored in
.env.envexcluded through.gitignoreBearer-token authentication for protected API routes
User documents stored separately under
documents/users/Secrets are not intended to be committed to Git
A request to a protected endpoint without authentication correctly returns:
401 Unauthorizedwith:
{
"detail": "Not authenticated"
}Technologies
Python
FastMCP
Model Context Protocol (MCP)
FastAPI
Google Gemini
Gemini
gemini-embedding-001Qdrant
PyMuPDF
LangChain Text Splitters
SQLAlchemy
JWT/Bearer Authentication
Docker
MCP Inspector
Project Outcome
The project demonstrates a complete semantic knowledge-base pipeline:
User Document
↓
PDF Extraction
↓
Chunking
↓
Gemini Embeddings
↓
Qdrant Vector Database
↓
Semantic Retrieval
↓
MCP Tools
↓
MCP Client / InspectorThe system successfully retrieves relevant document content using semantic similarity and provides source/page citations.
The current retrieval evaluation achieves:
Hit@3 = 100%with all five evaluation queries successfully retrieving an expected relevant page within the top three results.
Future Improvements
Possible future improvements include:
Support Markdown and TXT documents
Improve duplicate-chunk handling
Add persistent document IDs
Expand the evaluation dataset
Add additional retrieval metrics
Support multiple document collections
Add Qdrant Cloud deployment
Add richer frontend search and document-management features
Add document deletion and re-indexing controls
Submission Summary
This project fulfills the core Personal Knowledge-Base MCP Server requirements by providing:
A real student-owned document corpus
PDF ingestion
Sensible document chunking
Gemini-based embeddings
Qdrant vector storage
Semantic search
Source and page citations
Full document retrieval
Indexed source listing
FastMCP MCP server
MCP Inspector compatibility
Retrieval evaluation
100% Hit@3 evaluation score
Authenticated backend for document management
The core MCP functionality is implemented and verified through the available tools and evaluation pipeline.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Personal knowledge base MCP server with semantic search, auto-categorization, metadata extraction
The Needle MCP server enables semantic search on documents stored in files like PDFs, DOCX, and XLSX by connecting AI applications to external data sources. It provides capabilities to create and manage document collections, perform natural language searches on stored content, and retrieve relevant information without requiring exact keyword matches.
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceMCP server that indexes a knowledge base into Chroma and provides search tools for retrieving document fragments via vector embeddings.-
- FlicenseNot gradedqualityCmaintenanceMCP server providing RAG tools (search_notes, answer_from_notes) and resources for grounded answers over a local knowledge base.-
- FlicenseNot gradedqualityAmaintenanceA local knowledge base MCP server that enables retrieval and evidence-based Q&A over Obsidian Markdown notes, with high-recall embedding search, chunked indexing, hybrid retrieval, and three STDIO MCP tools for agent-driven recollection and quality-gated recall.-
- FlicenseNot gradedqualityBmaintenanceMCP server for a shared Postgres-backed knowledge base with hybrid retrieval and agentic RAG, enabling coding agents to upload, search, and ask questions over documents with cited answers.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AmnaSarwar522/Personal-Knowledge-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server