Enables semantic indexing and searching of Python codebases by using tree-sitter to parse AST structures like functions, classes, and methods for precise code retrieval.
Click on "Install 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-code-mcpfind the logic for processing user authentication in /home/user/project"
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-code-mcp
Local MCP server that provides semantic code search for Claude Code. Instead of iterative grep/glob, it indexes your codebase with embeddings and returns ranked results by meaning.
Python only for now — multi-language support (JS/TS, Rust, Go) is planned.
How It Works
Chunking — tree-sitter parses Python into functions, classes, and methods
Embedding — sentence-transformers encodes each chunk (all-MiniLM-L6-v2, 384d)
Storage — vectors stored in LanceDB (embedded, like SQLite)
Search — hybrid semantic + keyword search with recency boosting
Indexing is incremental (mtime-based) and uses git ls-files for fast file discovery. The embedding model loads lazily on first query.
Installation
Claude Code Integration
Add to ~/.config/claude-code/config.json:
MCP Tools
search_code
Search code by meaning, not just text matching. Auto-indexes on first search.
Parameter | Type | Default | Description |
|
| required | Natural language description of what you're looking for |
|
| required | Absolute path to the project root |
|
|
| Maximum number of results |
Returns ranked results with file_path, line_start, line_end, name, chunk_type, content, and score.
index_codebase
Index a codebase for semantic search. Only processes new and changed files unless force=True.
Parameter | Type | Default | Description |
|
| required | Absolute path to the project root |
|
|
| Re-index all files regardless of changes |
index_status
Check indexing status for a project.
Parameter | Type | Default | Description |
|
| required | Absolute path to the project root |
Returns is_indexed, files_count, chunks_count, stale_files_count, and stale_files.
Configuration
All settings are environment variables with the SEMANTIC_CODE_MCP_ prefix (via pydantic-settings):
Variable | Default | Description |
|
| Where indexes are stored |
|
| Store index in |
|
| Sentence-transformers model |
|
| Enable debug logging |
|
| Enable pyinstrument profiling |
Tech Stack
Component | Choice | Rationale |
MCP Framework | FastMCP | Python decorators, STDIO transport |
Embeddings | sentence-transformers | Local, no API costs, good quality |
Vector Store | LanceDB | Embedded (like SQLite), no server needed |
Chunking | tree-sitter | AST-based, respects code structure |
Development
Architecture decisions are documented in docs/decisions/. Project planning lives in TODO.md.
License
MIT