mcp-semantic-search
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., "@mcp-semantic-search how does authentication work"
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.
MCP Semantic Search
A Model Context Protocol (MCP) server that indexes codebases using semantic embeddings for natural language search.
Features
🔍 Semantic Code Search – Find code using natural language queries instead of exact text matching
⚡ Fast Indexing – Efficient chunking and batch embedding with background processing
🧠 Smart Chunking – Language-aware code splitting:
Python: Function/class boundary detection
Others: Line-based with configurable overlap
🌐 Multi-language Support – Python, JavaScript, TypeScript, JSX, TSX, Markdown, YAML, JSON, HTML, CSS, Bash, SQL, and more
👀 Live Watch – Automatically re-index on file changes with debouncing
🔄 Incremental Updates – Reindex only changed files without full rebuild
🗑️ Deletion Handling – Automatically removes chunks for deleted files
📊 Status Tracking – Real-time indexing progress and queue monitoring
Related MCP server: Acemcp
Quick Start
Prerequisites
Python 3.12 or higher
Qdrant vector database (running locally or remotely)
Google Gemini API key
Installation
# Using uvx (recommended - no installation needed)
uvx mcp-semantic-search
# Or install with pip
pip install mcp-semantic-searchConfiguration
Set environment variables:
export GEMINI_API_KEY="your_gemini_api_key"
export QDRANT_URL="http://localhost:6333"Optional environment variables:
# Embedding model (default: text-embedding-004)
export GEMINI_EMBEDDING_MODEL="text-embedding-004"
# Chunk configuration (defaults: 50/10/5)
export CHUNK_MAX_LINES=50 # Max lines per chunk
export CHUNK_OVERLAP_LINES=10 # Overlap between chunks
export CHUNK_MIN_LINES=5 # Min lines for valid chunkOr create a .env file:
GEMINI_API_KEY=your_gemini_api_key
QDRANT_URL=http://localhost:6333Running Qdrant
# Using Docker
docker run -p 6333:6333 qdrant/qdrant
# Or using docker-compose
echo '
services:
qdrant:
image: qdrant/qdrant
ports:
- "6333:6333"
' | docker-compose -f - upUsage with Claude Code
Method 1: Using MCP Config JSON (Recommended)
Edit your Claude Code MCP configuration file (~/.claude.json or ~/.config/claude/config.json):
{
"mcpServers": {
"semantic-search": {
"type": "stdio",
"command": "uvx",
"args": ["mcp-semantic-search"],
"env": {
"GEMINI_API_KEY": "your_gemini_api_key_here",
"QDRANT_URL": "http://localhost:6333"
}
}
}
}For a local installation (after pip install mcp-semantic-search):
{
"mcpServers": {
"semantic-search": {
"type": "stdio",
"command": "mcp-semantic-search",
"env": {
"GEMINI_API_KEY": "your_gemini_api_key_here",
"QDRANT_URL": "http://localhost:6333"
}
}
}
}With optional chunk configuration:
{
"mcpServers": {
"semantic-search": {
"type": "stdio",
"command": "uvx",
"args": ["mcp-semantic-search"],
"env": {
"GEMINI_API_KEY": "your_gemini_api_key_here",
"QDRANT_URL": "http://localhost:6333",
"CHUNK_MAX_LINES": "50",
"CHUNK_OVERLAP_LINES": "10",
"CHUNK_MIN_LINES": "5"
}
}
}
}Method 2: Using CLI
claude mcp add semantic-search \
-e GEMINI_API_KEY="$GEMINI_API_KEY" \
-e QDRANT_URL="$QDRANT_URL" \
-- uvx mcp-semantic-searchAvailable Tools
Tool | Description | Returns |
| Index the codebase |
|
| Semantic search across all files |
|
| Search within a specific file |
|
| Check indexing status |
|
| Start file watching |
|
| Stop file watching |
|
| Reset the entire index |
|
Example Workflow
# Index your codebase (auto-starts on first use)
index_codebase(root_dir="/path/to/project")
# Returns: {"status": "success", "files_queued": 1234}
# Search for code using natural language
search_code("how does authentication work")
# Returns:
# {
# "query": "...",
# "count": 5,
# "results": [
# {
# "file": "src/auth/middleware.py",
# "lines": "10-25",
# "score": 0.876,
# "content": "..."
# },
# ...
# ]
# }
# Check indexing status
get_status()
# Returns:
# {
# "collection": {"total_chunks": 12345, "files_indexed": 1234},
# "queue": {"running": true, "queued": 0, "pending": 0}
# }
# Enable live watching (auto-index on file changes)
start_live_watch(root_dir="/path/to/project")Configuration
Chunking Configuration
Control how code is split into searchable chunks:
# Smaller chunks = more precise results, more storage
export CHUNK_MAX_LINES=30
# Larger chunks = more context per result
export CHUNK_MAX_LINES=100
# Adjust overlap for context continuity
export CHUNK_OVERLAP_LINES=15Variable | Default | Description |
| 50 | Maximum lines per chunk |
| 10 | Overlap between chunks |
| 5 | Minimum lines for valid chunk |
Search Configuration
# Adjust search parameters
search_code(
query="your query",
limit=20, # More results (default: 10)
score_threshold=0.3 # Lower threshold = more results (default: 0.5)
)Development
Setup
# Clone the repository
git clone https://github.com/yourusername/mcp-semantic-search.git
cd mcp-semantic-search
# Install in development mode
pip install -e .Testing
# Test with a small subset
python -c "
from mcp_semantic_search import GeminiEmbedder, QdrantCodeStore, index_repository
embedder = GeminiEmbedder()
store = QdrantCodeStore()
# Test with just 5 files
stats = index_repository(
root_dir='.',
embedder=embedder,
store=store,
max_files=5
)
print(stats)
"
# Test semantic search
python -c "
from mcp_semantic_search import GeminiEmbedder, QdrantCodeStore
embedder = GeminiEmbedder()
store = QdrantCodeStore()
query_embedding = embedder.embed_query('authentication')
results = store.search(query_embedding, limit=5)
for r in results:
print(f'{r[\"file_path\"]}:{r[\"start_line\"]} ({r[\"score\"]:.2f})')
print(r['content'][:200])
print('---')
"Technical Details
Embedding Model: Google
text-embedding-004(768 dimensions)Vector Database: Qdrant with cosine similarity
Chunking Strategy:
Python: AST-based function/class boundary detection
Others: Line-based with configurable chunk size and overlap
File Watching: Watchdog with 3-second debouncing
Deduplication: SHA256 hash-based, unchanged files are skipped
Background Processing: FIFO queue for incremental reindexing
Supported Languages
Extension | Language |
| Python |
| JavaScript |
| TypeScript |
| JSX |
| TSX |
| Markdown |
| YAML |
| JSON |
| HTML |
| CSS |
| Bash |
| SQL |
| Text |
License
MIT License - see LICENSE for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Acknowledgments
Model Context Protocol by Anthropic
Qdrant - Vector Database
Google Gemini - Embedding API
fastmcp - MCP framework
Available Tools
8 toolsclear_indexA
Clear the entire index.
Use this to start fresh or recover from errors.
Returns: Dict with confirmation status.
Inputs: no named parameters. Returns: object
get_live_watch_statusB
Get the status of the live file watcher.
Returns: Dict with current state.
Inputs: no named parameters. Returns: object
get_statusA
Get the current index status and queue progress.
Returns: Dict with collection info, statistics, and real-time queue status.
Inputs: no named parameters. Returns: object
index_codebaseA
Index the codebase for semantic search.
This operation adds files to the indexing queue immediately (no debounce). Use get_status() to track progress.
Inputs: root_dir, max_files, force_reindex. Returns: object
search_codeB
Search the codebase using natural language.
Inputs: query (required), limit, score_threshold. Returns: object
search_fileB
Search within a specific file.
Inputs: query (required), file_path (required), limit. Returns: object
start_live_watchA
Start live file watching for automatic reindexing.
When enabled, the server will automatically detect file changes and add them to the indexing queue with debouncing.
Inputs: root_dir, debounce_seconds. Returns: object
stop_live_watchA
Stop the live file watcher.
Returns: Dict with status.
Inputs: no named parameters. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
search_code and search_file are distinct (codebase vs specific file), but their names are similar and could be confused without careful reading. get_status and get_live_watch_status also target different subsystems but share a naming pattern. Other tools have clearly unique roles.
Tools follow a verb_noun pattern with consistent snake_case (search_code, clear_index, start_live_watch). Verbs vary (search, get, clear, start, stop, index) but the pattern is predictable. Minor deviation: index_codebase uses verb+noun while others use search_/get_ prefixes, but it remains consistent in style.
8 tools is well within the ideal range and each covers a necessary function for a semantic search server: indexing, searching, status, and lifecycle management. No redundant tools are present.
The server covers the core lifecycle: index (manual and watch), search (codebase and file), status (index and watcher), and clear. Missing is the ability to remove a specific file from the index or selectively reindex, but agents can clear and reindex as a workaround.
Related MCP Connectors
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Ask how your codebase works. Hosted codebase intelligence for repos indexed on repowise.dev.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Codebase intelligence for AI agents — dead code, blast radius, ownership.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables semantic code search across codebases with automatic incremental indexing. Searches return relevant code snippets with file paths and line numbers based on natural language queries.1804Apache 2.0
- AlicenseAqualityDmaintenanceProvides code repository indexing and semantic search capabilities, allowing natural language queries to find relevant code snippets with automatic incremental indexing and multi-language support.1361ISC
- 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
- AlicenseNot gradedqualityDmaintenanceEnables semantic code search for AI assistants by indexing codebases with embeddings and Tree-sitter, returning relevant snippets via natural language queries.15MIT