Semantic Search MCP
Enables semantic search over markdown files to find related notes by meaning rather than keywords, and automatically detect duplicate content before creating new notes.
README
Semantic Search
Semantic search over markdown files. Find related notes by meaning, not just keywords. Detect duplicates before creating new notes.
Supports two server modes:
- MCP mode — For Claude Code integration
- REST mode — For OpenClaw, scripts, and HTTP clients
Features
- Semantic search using sentence-transformers
- Duplicate/similar note detection
- Auto-updating index with file watcher
- Multi-directory support
- Inline tag extraction (
#tag-name)
Installation
Permanent install (recommended)
# Install as a tool (creates ~/.local/bin/semantic-search-mcp)
uv tool install git+https://github.com/bborbe/semantic-search
💡 No GPU? Use CPU-only PyTorch
The default install includes CUDA support (~7GB). If you don't have a dedicated GPU, install with CPU-only PyTorch to save ~5GB disk space:
uv tool install --index https://download.pytorch.org/whl/cpu \ git+https://github.com/bborbe/semantic-searchPerformance is identical for typical vault sizes — embedding models run fine on CPU.
One-off usage
# Run directly with uvx (no install needed)
uvx --from git+https://github.com/bborbe/semantic-search semantic-search-mcp serve
From PyPI (when published)
pip install semantic-search-mcp
Server Modes
MCP Mode (for Claude Code)
claude mcp add -s project semantic-search \
--env CONTENT_PATH=/path/to/vault \
-- \
uvx --from git+https://github.com/bborbe/semantic-search semantic-search-mcp serve
Tools available:
search_related(query, top_k=5)— Find semantically related notescheck_duplicates(file_path)— Detect duplicate/similar notes
REST Mode (for OpenClaw/HTTP)
# Start server
CONTENT_PATH=/path/to/vault semantic-search-mcp serve --mode rest --port 8321
# Or with uvx
CONTENT_PATH=/path/to/vault uvx --from git+https://github.com/bborbe/semantic-search \
semantic-search-mcp serve --mode rest --port 8321
Endpoints:
| Endpoint | Method | Description |
|---|---|---|
/search?q=...&top_k=5 |
GET | Semantic search |
/duplicates?file=...&threshold=0.85 |
GET | Find duplicate notes |
/health |
GET | Health check with index stats |
/reindex |
GET/POST | Force index rebuild |
Example queries:
# Search
curl 'http://localhost:8321/search?q=kubernetes+deployment'
# Find duplicates
curl 'http://localhost:8321/duplicates?file=notes/my-note.md'
# Health check
curl 'http://localhost:8321/health'
CLI Commands
One-shot commands without running a server:
# Search
CONTENT_PATH=/path/to/vault semantic-search-mcp search "kubernetes deployment"
# Find duplicates
CONTENT_PATH=/path/to/vault semantic-search-mcp duplicates path/to/note.md
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
CONTENT_PATH |
Directory to index (comma-separated for multiple) | ./content |
LOG_LEVEL |
Logging level (DEBUG, INFO, WARNING, ERROR) | INFO |
Multiple Directories
Index multiple directories by separating paths with commas:
CONTENT_PATH=/path/to/vault1,/path/to/vault2,/path/to/docs
All directories are indexed together and searched as one unified index.
How It Works
First run downloads a small embedding model (~90MB) and indexes your markdown files (<1s for typical vaults). The index auto-updates when files change via filesystem watcher.
Indexed Content
Each markdown file is indexed with weighted components:
| Component | Weight | Notes |
|---|---|---|
| Filename | 3x | |
Frontmatter title |
3x | |
Frontmatter tags |
2x | Merged with inline tags |
Frontmatter aliases |
2x | |
Inline tags (#tag) |
2x | Extracted from body |
| First H1 heading | 2x | |
| Body content | 1x | First 500 words |
Development
# Clone
git clone https://github.com/bborbe/semantic-search
cd semantic-search
# Install dev dependencies
make install
# Run checks
make check
# Run tests
make test
License
BSD 2-Clause License — see LICENSE.
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.
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.