A Model Context Protocol (MCP) server for exploring Git commit history using semantic search. Search through commits with natural language commands like "Search git history to find out why was this class added?"
- π Semantic Search: Natural language queries over Git commit history
- π³ Multi-Repository Support: Automatically detects and isolates different repositories
- β‘ Zero-Config Installation: Works out of the box with SQLite + local embeddings
- π― Code-Aware Search: Hybrid embeddings optimized for code changes and technical content
- π Git Worktree Support: Handles complex Git setups including worktrees
- π Claude Code Integration: Automatic configuration for Claude Code
One-line installation (recommended for end users):
curl -sSL https://raw.githubusercontent.com/haacked/spelungit/main/install-remote.sh | bashThis command will:
- Download and install Spelungit automatically
- Set up a Python virtual environment
- Install dependencies (sentence-transformers, SQLite, numpy)
- Configure Claude Code automatically
- Test the installation
Requirements: Python 3.8+ and curl/wget
For developers or users who prefer to clone the repository:
git clone https://github.com/haacked/spelungit.git
cd spelungit
./install.sh# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Test the installation
python -m spelungit.server --testAdd to your Claude Code configuration (~/.config/claude/claude_desktop_config.json):
{
"mcpServers": {
"spelungit": {
"command": "/path/to/venv/bin/python",
"args": ["-m", "spelungit.server"],
"env": {
"PYTHONPATH": "/path/to/spelungit/src"
}
}
}
}search_commits- Search commits using natural languageindex_repository- Index a repository for searchrepository_status- Check indexing statusget_database_info- View database statisticssearch_blame- Search code blame data using natural languagewho_wrote- Find authors who wrote code matching a queryconfigure_auto_update- Configure automatic index update behaviorget_auto_update_config- Get current automatic index update configuration
# Search for authentication-related changes
search_commits(query="authentication login changes", limit=5)
# Find database migration commits
search_commits(query="database schema migration", author_filter="john")
# Look for bug fixes
search_commits(query="fix error exception handling")
# Search blame information for specific code
search_blame(query="authentication middleware setup")
# Find who wrote specific functionality
who_wrote(query="database connection pooling", limit=3)-
Index your repository:
index_repository()This processes all commits and creates embeddings for search.
-
Check status:
repository_status() -
Start searching:
search_commits(query="your search query")
- SQLite Database: No external database setup required
- Local Embeddings: Uses sentence-transformers + code pattern matching
- Automatic Detection: Discovers repositories and handles Git worktrees
- Hybrid Search: Combines semantic understanding with code-specific patterns
- Function/Class Detection: Recognizes code structure changes
- File Type Weighting: Prioritizes different file types appropriately
- Directory Analysis: Understands project structure (test/, auth/, api/, etc.)
- Co-author Support: Handles commits with multiple authors
- Pattern Extraction: Identifies meaningful code patterns in diffs
- Storage Efficient: Only stores commit SHAs + embeddings (97% space savings vs full content)
- Fast Search: Vector similarity search with cosine similarity
- Incremental Indexing: Only processes new commits after initial setup
- Memory Efficient: Streaming processing for large repositories
GIT_HISTORY_DB_PATH: Custom database locationPYTHONPATH: Should include thesrcdirectory
Default: ~/.config/spelungit/git-history.db
Configure automatic index updates to keep your search index current:
# Enable automatic updates with custom settings
configure_auto_update(
enable_auto_update=True,
background_threshold=100, # Process in background if >100 new commits
staleness_check_cache_minutes=10 # Check for staleness every 10 minutes
)
# Check current configuration
get_auto_update_config()- Embedding Model: Microsoft's all-MiniLM-L6-v2 via sentence-transformers (384 dimensions)
- Fallback: Deterministic hash-based embeddings when sentence-transformers unavailable
- Code Patterns: 50+ code-specific keywords and patterns
# Clone and set up development environment
git clone https://github.com/haacked/spelungit.git
cd spelungit
# Set up development environment (creates venv, installs deps)
bin/setup --dev
# Run tests
bin/test
# Check code quality
bin/checksrc/spelungit/
βββ lite_server.py # Main MCP server
βββ sqlite_database.py # SQLite database adapter
βββ lite_embeddings.py # Hybrid embedding system
βββ repository_utils.py # Git repository detection
βββ git_integration.py # Git operations
βββ search_engine.py # Search functionality
βββ models.py # Data models
βββ errors.py # Error definitions
βββ __init__.py # Package initialization
tests/ # Test suite
requirements.txt # Zero-config dependencies
install.sh # Automatic installer
# All tests
bin/test
# Test MCP server functionality
bin/dev server# Format code
bin/fmt
# All quality checks (format, lint, type check, security)
bin/check# Set up development environment
bin/dev setup
# Run tests
bin/dev test
# Test MCP server
bin/dev serverError: Repository 'repo-name' is not indexed. Use the 'index_repository' tool to begin indexing.
Solution: Run index_repository() tool first.
One-line install fails:
- Check internet connection
- Ensure Python 3.8+ is installed
- Verify curl or wget is available
- Try the advanced installation method below
Dependencies fail to install: You can still use the fallback mode:
# Test with fallback embeddings
python -m src.spelungit.server --testEnsure your Claude Code config includes the correct Python path and PYTHONPATH.
We welcome contributions!
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Run quality checks:
bin/check - Submit a pull request
MIT License - see LICENSE file for details.
- Uses sentence-transformers for embeddings
- Implements the Model Context Protocol
- Optimized for Claude Code integration