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.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。