MCP Knowledge Vault Search Tool
Enables searching personal knowledge vaults using hybrid semantic and keyword matching through the Fondu Knowledge Vault API. Retrieves and reranks relevant information from personal knowledge bases with flexible authentication options.
README
MCP Knowledge Vault Search Tool
This tool provides an MCP (Model Context Protocol) server that allows you to search your personal knowledge vault using hybrid semantic and keyword matching. The server connects to the Fondu Knowledge Vault API to retrieve relevant information from your personal knowledge base.
Features
- Hybrid Search: Combines semantic vector search with keyword matching
- Reranking: Uses reranking models to prioritize the most relevant results
- Flexible Authentication: Multiple authentication methods with priority-based resolution
- Production Ready: Comprehensive error handling and logging
- MCP Compatible: Works with Claude Desktop and other MCP clients
- SSE Transport: Server-Sent Events for real-time communication
Prerequisites
- Python 3.8+
- Access to Fondu Knowledge Vault API
- Valid authentication token
Installation
- Clone this repository:
git clone <repository-url>
cd mcp_tools
- Set up virtual environment and install dependencies:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Authentication Setup
The server supports multiple authentication methods with the following priority order:
1. Explicit Parameter (Highest Priority)
Pass the token directly when calling the tool.
2. Environment Variables
Set one of these environment variables:
export FONDU_AUTH_TOKEN="your-token-here"
# or
export FONDU_API_TOKEN="your-token-here"
3. Configuration Files
Create a config file at one of these locations:
~/.fondu/config.yaml(recommended)~/.config/fondu/config.yamlconfig.yaml(in project directory)
Example config file:
fondu:
auth_token: "your-token-here"
base_url: "https://api.youfondu.com"
server:
host: "127.0.0.1"
port: 8080
debug: true
4. Token Files
Save your token in one of these files:
~/.fondu/token~/.config/fondu/token.fondu_token
Starting the MCP Server
Method 1: Direct Python (Recommended)
source .venv/bin/activate
python mcp_fondu_search_user_context/server.py --host 127.0.0.1 --port 8080
Method 2: Using the run script
./run.sh
The server will start on http://127.0.0.1:8080 with the following endpoints:
/- Homepage/health- Health check/sse- Server-Sent Events endpoint for MCP/messages/- Message handling endpoint
Claude Desktop Configuration
To use with Claude Desktop, add this to your ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"knowledge_vault": {
"command": "python",
"args": ["/absolute/path/to/mcp_tools/mcp_fondu_search_user_context/server.py"],
"env": {
"FONDU_AUTH_TOKEN": "your-auth-token-here"
}
}
}
}
Alternative using the run script:
{
"mcpServers": {
"knowledge_vault": {
"command": "/absolute/path/to/mcp_tools/run.sh",
"env": {
"FONDU_AUTH_TOKEN": "your-auth-token-here"
}
}
}
}
Available Tools
gather_relevant_user_knowledge
Search your knowledge vault using hybrid semantic and keyword matching.
Parameters:
query(string, required): Natural language query for semantic search and rerankingauth_token(string, optional): Authentication token (if not set via env/config)keywords(string, optional): Specific terms to prioritize in keyword matchingtop_k(integer, optional): Number of results to return (default: 10)
Returns: A formatted string containing the most relevant results from your knowledge vault, including source information and metadata when available.
Example Response:
Found 3 relevant results in your knowledge vault:
1. Quantum computing uses quantum mechanical phenomena like superposition and entanglement to perform calculations...
Source: quantum_computing_notes.md
Metadata: {'tags': ['physics', 'computing'], 'date': '2024-01-15'}
2. The fundamental principle behind quantum algorithms is the ability to exist in multiple states simultaneously...
Source: research_papers/quantum_algorithms.pdf
Metadata: {'author': 'Dr. Smith', 'year': 2023}
Testing
Server Health Test
curl http://127.0.0.1:8080/health
Tool Functionality Test
Create a test script to verify the tool works:
import asyncio
import sys
sys.path.append('mcp_fondu_search_user_context')
from server import gather_relevant_user_knowledge
async def test_tool():
result = await gather_relevant_user_knowledge(
query="machine learning algorithms",
auth_token="your-token-here",
top_k=5
)
print(result)
asyncio.run(test_tool())
Configuration Examples
Example configuration files are provided:
config.yaml.example- Server configuration templateclaude_desktop_config.json.example- Claude Desktop setup template
Copy these files and customize with your settings:
cp config.yaml.example ~/.fondu/config.yaml
# Edit with your auth token and preferences
Error Handling and Logging
The server provides comprehensive error handling:
- Missing Auth Token: Clear error message with setup instructions
- API Errors: Graceful handling of network issues and API failures
- Invalid Tokens: Proper 403 error handling
- Debug Logging: Detailed logs for troubleshooting
Logs are written to:
- Standard error output (visible when running the server)
/tmp/error_log.txt(fallback error logging)
API Configuration
The server connects to:
- Production API:
https://api.youfondu.com/v1/knowledge/search_knowledge_vault - Protocol: HTTPS with Bearer token authentication
- Timeout: 30 seconds for API requests
- Format: JSON request/response
Troubleshooting
Common Issues
-
Authentication Errors
- Verify your token is valid and not expired
- Check token is properly set via environment variable or config file
- Ensure no extra whitespace in token files
-
Connection Issues
- Verify internet connectivity
- Check if API endpoint is accessible:
curl -I https://api.youfondu.com - Ensure no firewall blocking outbound HTTPS
-
MCP Client Issues
- Restart Claude Desktop after configuration changes
- Check that absolute paths are used in configuration
- Verify Python virtual environment is properly activated
-
Server Startup Issues
- Ensure all dependencies are installed:
pip install -r requirements.txt - Check port 8080 is not already in use
- Verify Python 3.8+ is being used
- Ensure all dependencies are installed:
Debug Mode
To enable debug logging, set the environment variable:
export PYTHONPATH=/path/to/mcp_tools
export DEBUG=1
python mcp_fondu_search_user_context/server.py
Testing Authentication Methods
You can test different authentication methods:
# Test with environment variable
export FONDU_AUTH_TOKEN="your-token"
python test_auth.py
# Test with config file
echo "fondu:\n auth_token: your-token" > ~/.fondu/config.yaml
python test_auth.py
# Test with token file
echo "your-token" > ~/.fondu/token
python test_auth.py
Development
To contribute or modify the server:
-
Setup Development Environment
python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt -
Run Tests
python test_mcp_server.py python test_tool_functionality.py -
Code Structure
mcp_fondu_search_user_context/server.py- Main server implementationrequirements.txt- Python dependenciesrun.sh- Convenience script for starting serverconfig.yaml.example- Configuration templateclaude_desktop_config.json.example- Claude Desktop setup template
Dependencies
Core dependencies:
fastapi>=0.109.2- Web frameworkuvicorn>=0.27.1- ASGI serverhttpx>=0.26.0- HTTP clientmcp>=1.3.0- Model Context ProtocolPyYAML>=6.0- YAML configuration support
See requirements.txt for complete dependency list.
Deployment
AWS App Runner
This server is ready for deployment to AWS App Runner. See DEPLOYMENT.md for detailed deployment instructions.
Quick Deploy:
- Push code to your Git repository
- Create App Runner service pointing to your repository
- Set
FONDU_AUTH_TOKENenvironment variable - Deploy!
The server includes:
- ✅ App Runner configuration (
apprunner.yaml) - ✅ Docker support (
Dockerfile) - ✅ Health check endpoint (
/health) - ✅ Environment variable configuration
- ✅ Production-ready logging
- ✅ Auto-scaling support
Other Cloud Platforms
The server can be deployed to any platform that supports:
- Python 3.8+
- Environment variables
- HTTP/HTTPS traffic on port 8080
Tested platforms:
- AWS App Runner ✅
- Docker containers ✅
- Traditional VPS hosting ✅
License
[Add your license information here]
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
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.
E2B
Using MCP to run code via e2b.