Labsco
fondutech logo

Knowledge Vault Search

from fondutech

Search a personal knowledge vault using hybrid semantic and keyword matching.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredNeeds API keys

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

Starting the MCP Server

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

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 reranking
  • auth_token (string, optional): Authentication token (if not set via env/config)
  • keywords (string, optional): Specific terms to prioritize in keyword matching
  • top_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())

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)

Development

To contribute or modify the server:

  1. Setup Development Environment

    python3 -m venv .venv
    source .venv/bin/activate
    pip install -r requirements.txt
  2. Run Tests

    python test_mcp_server.py
    python test_tool_functionality.py
  3. Code Structure

    • mcp_fondu_search_user_context/server.py - Main server implementation
    • requirements.txt - Python dependencies
    • run.sh - Convenience script for starting server
    • config.yaml.example - Configuration template
    • claude_desktop_config.json.example - Claude Desktop setup template

Dependencies

Core dependencies:

  • fastapi>=0.109.2 - Web framework
  • uvicorn>=0.27.1 - ASGI server
  • httpx>=0.26.0 - HTTP client
  • mcp>=1.3.0 - Model Context Protocol
  • PyYAML>=6.0 - YAML configuration support

See requirements.txt for complete dependency list.