semantic-search-mcp
Click on "Deploy 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., "@semantic-search-mcp find authentication middleware code"
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.
Semantic Search MCP Server
An MCP server that provides semantic code search using local embeddings. Search your codebase with natural language queries like "authentication middleware" or "database connection pooling".
Features
Hybrid search: Combines vector similarity (Jina code embeddings) with FTS5 keyword matching using Reciprocal Rank Fusion
165+ languages: Tree-sitter parsing for Python, TypeScript, JavaScript, Go, Rust, Java, C/C++, Ruby, PHP, and more
Incremental indexing: File watcher automatically detects additions, modifications, and deletions
Respects .gitignore: Honors your project's
.gitignorefiles (including nested ones)Auto-initialization: Model loads and codebase indexes in the background on server startup
Zero external APIs: All embeddings generated locally with FastEmbed
Related MCP server: Smart Coding MCP
Installation
uv tool install semantic-search-mcpOr with pip:
pip install semantic-search-mcpOr run directly without installing:
uvx semantic-search-mcpQuick Start
Add to Claude Code
Option A: Project-level config (recommended)
After installing with uv tool install or pip install, create .mcp.json in your project root:
{
"mcpServers": {
"semantic-search": {
"command": "semantic-search-mcp"
}
}
}Option B: CLI
claude mcp add semantic-search -- semantic-search-mcpOption C: Without installing (ephemeral)
If you prefer not to install, use uvx to run in an ephemeral environment:
{
"mcpServers": {
"semantic-search": {
"command": "uvx",
"args": ["semantic-search-mcp"]
}
}
}Use
The server auto-initializes on startup.
Available Tools
Tool | Description |
| Search codebase with natural language |
| Get server state, progress, and statistics |
| Pause file watching (events discarded) |
| Resume file watching |
| Start full reindex (runs in background) |
| Cancel running indexing job |
| Wipe all indexed data |
| Add paths to ignore (session-only) |
| Remove paths from exclusion list |
How It Works
Indexing
On startup, the server:
Scans your codebase for supported file types
Parses code into semantic chunks (functions, classes, methods) using Tree-sitter
Generates embeddings for each chunk using Jina's code embedding model
Stores everything in a local SQLite database with vector search support
File Watching
The server monitors your codebase for changes in real-time:
Event | Action |
File created | Parsed, embedded, and added to index |
File modified | Re-indexed if content hash changed |
File deleted | Removed from index |
Changes are debounced (default 1s) to batch rapid modifications.
What Gets Indexed
Included:
Files with code extensions:
.py,.js,.ts,.tsx,.jsx,.go,.rs,.java,.c,.cpp,.h,.rb,.php,.swift,.kt,.scala, and more
Excluded:
Files matching
.gitignorepatterns (all.gitignorefiles in your project are respected)Common non-code directories:
node_modules,__pycache__,.venv,build,dist,.git,vendor, etc.Binary files and non-code file types
Configuration
Environment variables:
Variable | Default | Description |
|
| Index database location |
|
| Embedding model |
|
| Minimum relevance threshold (0-1) |
|
| File watcher debounce in milliseconds |
|
| Files per batch (reduce if running out of memory) |
|
| Skip files larger than this (KB) |
|
| Texts per embedding call (reduce if OOM) |
|
| ONNX runtime threads (higher = faster on multi-core) |
|
| Use INT8 quantized model (30-40% faster) |
Performance
GPU Acceleration
GPU acceleration is auto-detected and used when available:
Platform | Provider | Installation |
NVIDIA | CUDA |
|
Apple Silicon | CoreML | Automatic (M1/M2/M3) |
AMD | ROCm | Install ROCm-enabled onnxruntime |
Windows | DirectML | Install DirectML-enabled onnxruntime |
Alternative Models
For faster indexing (with quality tradeoffs), you can use a lighter model:
Model | Dimensions | Speed | Best For |
| 768 | Baseline | Code search (default) |
| 384 | ~10x faster | General text |
| 384 | ~32x faster | Speed priority |
To use an alternative model:
export SEMANTIC_SEARCH_EMBEDDING_MODEL="sentence-transformers/all-MiniLM-L6-v2"Note: Changing models requires a full reindex (delete .semantic-search/ directory).
UniXcoder (Experimental)
Microsoft UniXcoder is a code-specific model pre-trained on code + AST + comments. It may provide better semantic understanding of code structure, but is substantially slower (~20x slower than Jina).
Model | Dimensions | Speed | Languages |
| 768 | ~20x slower | 6 (java, ruby, python, php, js, go) |
| 768 | ~20x slower | 9 (+ c, c++, c#) |
Installation (requires additional dependencies):
pip install semantic-search-mcp[unixcoder]Usage:
export SEMANTIC_SEARCH_EMBEDDING_MODEL="microsoft/unixcoder-base-nine"When to use UniXcoder:
You prioritize search quality over indexing speed
Your codebase is small to medium sized
You have GPU acceleration (CUDA or Apple Silicon MPS)
When to avoid UniXcoder:
Large codebases (10,000+ files) - indexing will take hours
You need fast initial indexing
Running on CPU without GPU acceleration
Claude Code Integration
Skills and commands are automatically installed when the MCP server first starts:
Skills →
~/.claude/skills/(AI auto-discovery)Commands →
~/.claude/commands/(user-invocable slash commands)
To manually reinstall or update:
semantic-search-mcp-install-skillsAvailable Slash Commands
Command | Description |
| Search codebase with natural language |
| Check server status and index stats |
| Trigger full codebase reindex |
| Cancel running indexing job |
| Wipe all indexed data |
| Pause file watcher |
| Resume file watcher |
Requirements
Python 3.11+
~700MB disk for embedding model (downloaded on first run, ~150MB with INT8 quantization)
~1GB RAM for embedding model
License
Available Tools
11 toolscancel_indexingA
Cancel any running indexing job.
The indexing will stop after the current file completes. Partial results are kept in the index.
Inputs: no named parameters.
clear_indexA
Clear all indexed data.
Removes all files and chunks from the index. The index will be empty until reindex is called.
Inputs: no named parameters.
exclude_pathsA
Add paths to exclude from indexing (session-only).
Patterns use glob syntax. Examples:
"node_modules" - exclude any path containing node_modules
"*.test.py" - exclude files ending in .test.py
"vendor/**" - exclude everything under vendor/
Exclusions reset when the server restarts.
Inputs: patterns (required).
get_statusA
Get comprehensive server status.
Returns server state, watcher status, indexing progress, index statistics, and current exclusion patterns.
Inputs: no named parameters.
include_pathsA
Remove paths from the exclusion list.
Reverses the effect of exclude_paths for the specified patterns.
Inputs: patterns (required).
initializeB
Initialize or re-initialize the semantic code search system.
Loads the embedding model and builds or updates the code index. Use force_reindex=True to rebuild the entire index.
Progress will be reported during indexing.
Inputs: force_reindex. Returns: Result of initialization.
pause_watcherA
Pause the file watcher.
Events that occur while paused are discarded. Use resume_watcher to start watching again.
Inputs: no named parameters.
reindexA
Start a full reindex of the codebase.
Runs in the background - use get_status to monitor progress. Use cancel_indexing to abort if needed.
Inputs: force, clear_first.
reindex_fileA
Re-index a specific file for search.
Use when a file has been modified but not yet re-indexed, or when you want to force a refresh of a file's embeddings.
Inputs: file_path (required), force.
resume_watcherA
Resume the file watcher after pausing.
Starts watching for file changes again.
Inputs: no named parameters.
search_codeA
Search the codebase using semantic similarity.
Use natural language descriptions of code you're looking for:
"function that handles user authentication"
"error handling for HTTP requests"
"database connection initialization"
"unit tests for the payment service"
Returns ranked code snippets with file locations and relevance scores. Combines vector similarity with keyword search for best results.
Best for: Finding functions/classes by purpose or behavior. Not for: Exact pattern matching or finding all occurrences of a variable. Use Grep for exact patterns; use semantic search to find relevant files first.
Inputs: query (required), language, min_score, chunk_type, +2 more. Returns: Search results container.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
initialize and reindex both appear to trigger full index builds, making their boundaries unclear and causing potential misselection. Other tools like search_code, pause_watcher, and exclude_paths are well-distinguished, but the core indexing pair introduces significant ambiguity.
Most tools follow a consistent verb_noun pattern (e.g., search_code, reindex_file, pause_watcher, get_status). However, initialize and reindex are standalone verbs that break the pattern, creating a minor but noticeable deviation.
11 tools is well within the ideal range for a domain-specific server. Each tool contributes to searching, indexing, or management, and there is no obvious redundancy or bloat.
The server covers the core search and indexing lifecycle, including search, full/partial indexing, and clearing. However, it lacks a way to remove a single file from the index, and exclude_paths does not retroactively affect already-indexed content, leaving notable gaps for handling file deletions.
Maintenance
Related MCP Connectors
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Semantic nearest-neighbour search over your datasets, plus indices and projections.
Ask a codebase what calls what: search, blast radius, paths between symbols, and diffs.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides semantic code search capabilities that run 100% locally using EmbeddingGemma embeddings. Enables finding code by meaning across 15 file extensions and 9+ programming languages without API costs or sending code to the cloud.238-
- AlicenseAqualityDmaintenanceProvides intelligent semantic code search using local AI embeddings, enabling natural language queries to find relevant code by meaning rather than exact keywords. Indexes codebases in the background with smart project detection and privacy-first local processing.6114 npm200MIT
- FlicenseNot gradedqualityDmaintenanceEnables local semantic code search across repositories using natural language, with AST-aware chunking and hybrid vector/FTS5 retrieval.-
- AlicenseNot gradedqualityDmaintenanceProvides local semantic search over files using embeddings, enabling directory indexing and natural language queries without external services.69 PyPIMIT