A Model Context Protocol (MCP) server for Claude Code that provides semantic search across codebases using MongoDB and Ollama embeddings.
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Claude Code β β Web Browser β β File System β
β β β β β β
β - Context AI β β - Project Mgmt β β - Source Code β
β - Code Search β β - Live Logs β β - Delta Check β
βββββββββββ¬ββββββββ βββββββββββ¬ββββββββ βββββββββββ¬ββββββββ
β β β
β stdio/MCP β HTTP API β fs.watch
β β β
βΌ βΌ βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Vector MCP Server β
β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β MCP Handler β β Web Server β β Job Manager β β
β β β β β β β β
β β - Tools β β - REST API β β - Async Ops β β
β β - Resources β β - Static UI β β - Progress β β
β βββββββ¬ββββββββ βββββββ¬ββββββββ βββββββ¬ββββββββ β
β β β β β
β ββββββββββββββββββΌβββββββββββββββββ β
β β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β File Indexer β β
β β β β
β β - Code Chunking - File Hashing - Delta Logic β β
β β - Content Filter - Pattern Match - Change Track β β
β βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ β
β β β
ββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββ βββββββββββββββ βββββββββββββββ
β Ollama β β MongoDB β β Logger β
β β β β β β
β - llama2 β β - Vectors β β - Live Feed β
β - Embedding β β - Metadata β β - Job Logs β
β - Local AI β β - Projects β β - File Log β
βββββββββββββββ βββββββββββββββ βββββββββββββββ
- π Semantic Code Search - Search your codebase using natural language queries
- π Project Management - Index multiple projects with isolated namespaces
- π Delta Indexing - Only re-index files that have changed, saving time and resources
- π¨ Web UI - Easy-to-use interface for managing indexes and testing searches
- π§ MCP Integration - Works seamlessly with Claude Code/OpenCode
- π³ Docker Ready - Simple setup with Docker Compose for mongodb (vector store)
- π¦ Ollama Support - Local embeddings using Ollama with llama2 model
- β‘ Async Job System - Background processing with real-time progress tracking
- π§ Docker - https://www.docker.com/ (for MongoDB)
- π¦ Ollama - https://ollama.com/download (for embeddings)
- π§΅ Yarn - Package manager
-
Clone the repository:
git clone <repository-url> cd vector-mcp
-
Start MongoDB:
yarn run setup # or manually: docker-compose up -d -
Install and configure Ollama:
# Install Ollama (macOS) brew install ollama # Start Ollama service ollama serve # Pull the llama2 model ollama pull llama2
-
Install dependencies:
yarn install
-
Start the web UI server:
yarn start
Visit http://localhost:3000 to access the web interface.
-
For Claude Code integration, start the MCP server:
yarn run mcp
- Open http://localhost:3000
- Create a new index by providing:
- Project ID (unique identifier)
- Directory path to index
- Optional exclude patterns
- Use the search interface to test queries
- Manage existing projects (view stats, delete)
The project includes a pre-configured MCP setup in the dist/ folder.
Option 1: Use the provided configuration (Recommended)
- Copy
dist/.mcp.jsonto your Claude Code config directory - Edit
dist/mcp.shto update the absolute path:#!/bin/bash # Update this path to your actual project location cd /path/to/your/vector-mcp node mcp-server.js
- Make the script executable:
chmod +x dist/mcp.sh
Option 2: Manual configuration Add this to your Claude Code configuration:
{
"mcpServers": {
"vector-mcp": {
"command": "node",
"args": ["mcp-server.js"],
"cwd": "/path/to/vector-mcp",
"env": {
"MONGODB_URI": "mongodb://root:examplepassword@localhost:27017",
"OLLAMA_HOST": "http://localhost:11434",
"OLLAMA_MODEL": "llama2"
}
}
}
}search_code- Search through indexed code using semantic similarityindex_codebase- Index a new project directoryupdate_project- Update an existing project with delta changes onlylist_projects- List all indexed projectsdelete_project- Delete a project and its dataget_project_stats- Get detailed project statistics
The project supports intelligent delta indexing that only processes files that have changed since the last index update. This provides significant performance benefits for large codebases.
-
File Tracking - Each indexed file stores metadata including:
- File size, modification time, and content hash
- File path and chunk information
-
Change Detection - During delta updates:
- Compares current file hash with stored hash
- Checks file modification time and size
- Only processes files that have actually changed
-
Efficient Updates - Delta indexing will:
- β Skip unchanged files (fastest)
- π Update modified files by removing old chunks and adding new ones
- β Add newly created files
- ποΈ Remove chunks for deleted files
Web UI: Click the orange "Update" button next to any project to run a delta update.
MCP Tool: Use the update_project tool with your project ID and directory path.
API: POST to /api/projects/{projectId}/update with directory path and exclude patterns.
- Large codebases: Instead of re-indexing 1000+ files, typically only 1-10 files change
- Development workflow: Quick updates during active development
- CI/CD integration: Efficient incremental indexing in automated pipelines
Example delta update results:
Delta stats: 847 skipped, 3 updated, 1 added, 0 deleted
Files processed: 4/851 files
Time saved: ~95% compared to full re-index
All indexing operations now run asynchronously with real-time progress monitoring:
- Immediate Response: APIs return immediately with a job ID
- Progress Monitoring: Real-time status updates every 3-5 seconds
- Job History: View recent and active jobs in the web UI
- Non-blocking: Browser doesn't freeze during long indexing operations
- Detailed Logs: Per-job logging and statistics
Before (blocking):
POST /api/projects -> waits for completion, returns final resultAfter (async):
POST /api/projects -> returns immediately with jobId
GET /api/jobs/{jobId} -> poll for status and progress
GET /api/jobs -> list all jobspending- Job created, waiting to startrunning- Currently processing files with real-time progress trackingcompleted- Successfully finishedfailed- Error occurred during processing
Jobs now show data-driven progress percentages:
- 5-15%: Directory scanning and metadata loading
- 15-85%: File processing (incremental based on files processed)
- 85-95%: Database operations and cleanup
- 95-100%: Final metadata saving and completion
Progress Display:
- Visual progress bars in job cards
- Percentage indicators for running jobs
- File counters: "45/192 files processed"
- Fallback to status-only if progress unavailable
- Real-time Progress: See live updates as files are processed
- Job Dashboard: Monitor active and recent jobs
- Auto-refresh: Jobs list updates every 10 seconds
- Progress Indicators: Visual feedback during operations
- Live Log Streaming: Real-time logs via Server-Sent Events
- Modal Forms: Professional UI instead of browser alerts
- Project Memory: Stores directory paths and settings for easy updates
- File-based Logging: All logs written to
server.logfile - Server-Sent Events: Real-time streaming from actual log file
- Historical Logs: Shows recent log entries on connection
- Automatic Connection: Starts streaming immediately on page load
- Auto-reconnection: Handles connection drops gracefully
- Persistent Storage: Logs survive server restarts
- Path Memory: Directory paths stored in database after first index
- Settings Persistence: Exclude patterns remembered per project
- Smart Defaults: Update forms pre-filled with previous settings
- Backward Compatible: Works with existing projects
- Modal Interface: Clean, professional forms instead of browser prompts
- Pre-filled Data: Forms populate with existing project settings
- Validation: Client-side validation before submission
- Contextual Help: Helpful placeholders and tips
GET /api/logs/stream- Server-Sent Events for real-time logsGET /api/projects/{id}/metadata- Get stored project settingsGET /api/jobs/active- Get only currently running jobs
Projects now store metadata in project_metadata collection:
{
"projectId": "my-project",
"directoryPath": "/path/to/project",
"excludePatterns": ["*.log", "node_modules/**"],
"createdAt": "2025-01-06T...",
"lastIndexed": "2025-01-06T...",
"updatedAt": "2025-01-06T..."
}MONGODB_URI=mongodb://root:examplepassword@localhost:27017
OLLAMA_HOST=http://localhost:11434
OLLAMA_MODEL=llama2
PORT=3000vector-mcp/
βββ index.js # Express web server + REST API
βββ mcp-server.js # MCP protocol server for Claude
βββ utils/
β βββ vector-store/
β β βββ mongovs.js # MongoDB vector storage
β β βββ embeddings.js # Ollama embedding provider
β βββ indexer/
β β βββ xr.js # File indexing and chunking
β βββ jobs/
β β βββ manager.js # Async job management
β βββ logger/
β β βββ logger.js # Structured logging with emojis
β βββ sh/
β βββ setup.sh # Environment setup script
βββ public/
β βββ index.html # Web UI interface
βββ dist/ # MCP server distribution
βββ docker-compose.yml # MongoDB container setup
# Start all services
docker-compose up -d
# Stop all services
docker-compose down
# View all service logs
docker-compose logs -f# Check service status
docker-compose ps
# Check individual service health
curl http://localhost:3000/health # Vector MCP
curl http://localhost:11434/api/tags # Ollama# Backup MongoDB data
docker-compose exec mongodb mongodump --uri="mongodb://root:examplepassword@localhost:27017"
# Clear all data (destructive!)
docker-compose down -vMIT