π¬π§ English β’ π·πΊ Π ΡΡΡΠΊΠΈΠΉ β’ π¨π³ δΈζ
AI-powered semantic code search for Zed IDE β deep code analysis MCP server
Features β’ Quick Start β’ Tools β’ Documentation β’ Installation β’ Architecture β’ Contributing β’ Security
Last updated: 2026-07-12
MSCodeBase Intelligence is an MCP server for Zed IDE that gives AI assistants deep understanding of the entire codebase: semantic search, call graph, project memory, diagnostics.
This is not an LSP server or a replacement for the editor's built-in autocomplete. It's a "code intelligence" layer on top of the editor:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Zed IDE β
β βββββββββββββββββββββββββββββββββββββββββββββββββ β
β β LSP (built-in autocomplete, β β
β β inline hints, diagnostics) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββ β
β β MSCodeBase (MCP server) β β
β β Β· Semantic search across the codebase β β
β β Β· Call graph & impact analysis β β
β β Β· Project memory (ADR, tech debt) β β
β β Β· Self-diagnostics and self-healing β β
β β Β· 59 tools for AI assistant β
β βββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Feature | MSCodeBase | Standard LSP (pyright/pylsp) |
|---|---|---|
| π Semantic search (BM25 + Vector + Reranker) | β | β |
| π§ Call graph + impact analysis | β | β |
| ποΈ Project memory (ADR, known issues) | β | β |
| π₯ Self-diagnosis + self-healing | β | β |
| π Cross-repo search | β | β |
| π€ RAG answer generation (mode=ask) | β | β |
| βοΈ Inline autocomplete | β | β |
| π·οΈ Inlay hints | β | β |
MSCodeBase uses LSP only for rename_symbol β the LSP client (src/core/lsp_client.py) spawns pyright-langserver for precise cross-file rename, with graceful fallback to SymbolIndex (Tree-sitter) on timeout. All other functionality is implemented through 59 MCP tools.
The standalone LSP server (src/lsp_main.py) was experimental and does not work in Zed β see LSP_WONTFIX.md.
Designed and tested on Windows. macOS and Linux should work but have not been validated officially.
| Language | Parsing | Call Graph | Data Flow (ASSIGNED_FROM) |
|---|---|---|---|
| Python | β | β | β |
| TypeScript | β | β | β |
| TSX | β | β | β |
| Rust | β | β | β |
| Go | β | β | β |
| JavaScript | β | β | β |
| Java | β | β | β |
| C# | β | β | β |
| Ruby | β | β | β |
| PHP | β | β | β |
| Kotlin | β | β | β |
| Swift | β | β | β |
| C | β | β | β |
| C++ | β | β | β |
| Scala | β | β | β |
| Dart | β | β | β |
| Feature | Description |
|---|---|
| π Unified Search | search_code(query, mode, intent_hint) β single tool: fast/quality/deep/context/ask/auto |
| π§ Intelligence Layer | 14 high-level intel_* tools: self-diagnostics, topology, memory, error prediction |
| ποΈ Project Memory | ADR, known issues, tech debt β automatically persisted between sessions |
| π Cross-repo Search | Search across multiple projects with @mention syntax |
| π³ Call Graph | Full call graph: definition + callers + callees + impact analysis |
| π Structural Search | 13 AST patterns (class_inheritance, async_function, decorator, etc.) |
| π Context Search | Find similar code β paste a fragment, get semantic duplicates |
| πͺ£ Multi-Bucket RAG | Code/docs buckets, soft weighting, intent_hint (code/docs/auto) |
| π€ mode=ask | RAG answer generation via phi-4 (server profile) |
| πΎ LanceDB v2 | Vector DB with per-project isolation (incremental BM25 reindex) |
| π‘ Rate Limiting | DebounceBatch + CircuitBreaker β protection against VFS loops |
| π₯ Self-Diagnosis | get_health_report + index_health β full check and recovery |
| π§ͺ Clean Architecture | DI Container (15+ services), 59 tools (41 class-based + 15 intel + 3 diag), 494+ tests |
| πͺ Multi-Window | ProjectIndexerRegistry β isolated Indexer per project, LRU 5, ResourceMonitor throttle |
| βοΈ Write Tools | 6 write tools + 1 graph query (query_graph) with Cypher engine |
| β‘ Meta-Patching | LanceDB move_chunks_metadata β file_path rename without re-embedding (50ms vs 5s) |
| π Data Flow Graph | ASSIGNED_FROM edges track variable assignments. Unified Walker + Conditional Flow (if/for/while/try). 3,337 edges on MSCodeBase (81% conditional). |
| βοΈ SYSTEM_PROFILE | light (sync) / server (async with phi-4) |
Install the mscodebase-intelligence extension in Zed, then:
cd D:\Project\MSCodeBase
python install.py
# Restart Zed (File β Quit β reopen)
# Verify: intel_get_runtime_status()install.py does:
- Copies 39+ source files to the extension directory
- Installs Python dependencies
- Downloads llama-server.exe + GGUF models (E5-base embed + reranker)
- Configures MCP in Zed's settings.json
See also: AI_INSTALLATION_PROMPT.md, docs/en/INSTALL.md
MCP auto-selects the best available provider:
llama.cpp GGUF (GPU) β ONNX Runtime (CPU) β LM Studio (if running) β BM25 only
~1.0 GB RAM ~1.7 GB RAM ~6 GB RAM no embeddings
2Γ llama-server in-process ONNX external API
Benchmarks: docs/research/2026-07-10-final-benchmark.md
| Document | Description | Audience | Languages |
|---|---|---|---|
| docs/en/INSTALL.md | Installation, setup, uninstall | Users | π¬π§ π·πΊ π¨π³ |
| docs/en/ARCHITECTURE.md | Clean Architecture, Layers, DI | Developers | π¬π§ π·πΊ π¨π³ |
| docs/en/ARCHITECTURE_DEEP.md | Deep architecture: pipeline, lifecycle, comparison | Architects | π¬π§ π·πΊ π¨π³ |
| docs/en/SEARCH_PIPELINE.md | Search pipeline: BM25 β RRF β Reranker | Developers | π¬π§ |
| docs/en/GRACEFUL_DEGRADATION.md | 5 levels of graceful degradation (llama.cpp β ONNX β BM25) | DevOps | π¬π§ |
| docs/en/ARCHITECTURE_LAYERS.md | 10 runtime layers | Architects | π¬π§ π·πΊ π¨π³ |
| docs/en/FAQ.md | Frequently Asked Questions | All | π¬π§ π·πΊ π¨π³ |
| docs/en/TELEMETRY.md | Metrics, ETA, data collection | DevOps | π¬π§ π·πΊ π¨π³ |
| docs/en/investigations/ONNX_SESSION_REPORT.md | Full ONNX migration, 7 fixes, benchmarks | Support | π¬π§ |
| docs/en/investigations/LSP_WONTFIX.md | LSP on Windows investigation (WONTFIX) | Support | π¬π§ π¨π³ |
| docs/en/ZED_WINDOWS_QUIRKS.md | Windows specifics, Restricted Mode | Windows users | π¬π§ π·πΊ π¨π³ |
| docs/en/CHANGELOG.md | Version history | All | π¬π§ π·πΊ π¨π³ |
| docs/en/CONTRIBUTING.md | How to contribute, PRs | Contributors | π¬π§ π·πΊ π¨π³ |
| docs/en/SECURITY.md | Security policy, vulnerabilities | Security | π¬π§ π·πΊ π¨π³ |
| AGENTS.md | AI Agent system rules | AI Agent | π¬π§ |
| SECURITY.md | Security policy, reporting vulnerabilities | Security | π¬π§ |
| CODE_OF_CONDUCT.md | Community standards | Contributors | π¬π§ |
| docs/KNOWN_ISSUES.md | Known issues & technical debt registry | All | π¬π§ |
All documents are cross-referenced. Available in 3 languages: English, Π ΡΡΡΠΊΠΈΠΉ, δΈζ.
| Tool | When to Use |
|---|---|
search_code(query, mode, filter_layer, intent_hint) |
Main search tool. mode="auto" / "fast" / "quality" / "deep" / "context" / "ask". intent_hint="code" / "docs" / "auto" β soft bucket weighting. filter_layer="core" β search within specific architecture layer |
structural_search(pattern) |
AST search: class_inheritance, async_function, function_with_decorator and more |
cross_repo_search(query @repo) |
Search across multiple projects (mono-repo) |
cross_project_deps(action) |
Cross-project dependency graph: graph / deps / cycles / impact |
get_symbol_info(query) |
Call Graph: callers, callees, impact files |
impact_analysis(symbol) |
Symbol change impact analysis (risk score, depth) |
| Tool | When to Use |
|---|---|
get_index_status() |
Index status: chunks, files, symbols |
get_index_progress() |
Indexing progress (phase, percent) |
index_project_dir(path) |
Start full project indexing |
get_index_timeline() |
Indexing history by date |
index_health(project_root) |
Index diagnostics and self-recovery |
notify_change(file_path) |
Force index update for a file (via DebounceBatch) |
generate_chunk_summaries(root) |
LLM-generated descriptions for code chunks |
scan_changes(project_root) |
Architectural diff β analyze changes since last baseline |
| Tool | When to Use |
|---|---|
get_health_report() |
Full self-diagnosis: index, embedder, logs, synchronization |
watcher_status() |
Component status: embedder mode, indexing, health |
get_logs(project_root) |
Latest errors and warnings from project logs |
get_repo_map(project_root) |
Project map: file tree + key symbols |
read_live_file(path) |
Read file from LSP memory (including unsaved changes) |
predict_eta(operation) |
Predict operation duration based on history |
run_health_check() |
Full project health check (tests + git + index) |
| Tool | When to Use |
|---|---|
get_hotspots(project_root) |
Hotspots β files with high bug rate |
get_repo_rank(project_root, top_k) |
Symbol importance ranking (PageRank on call graph) |
get_bug_correlation(project_root) |
Bug-change correlation analysis |
get_related_files(project_root, path) |
Files related via co-change / bug correlation |
graph_query(query_type, target) |
Knowledge graph queries: impact / feature / deps / tests |
query_graph(query) (new v3.2) |
Cypher-like graph queries: MATCH (f:Function)-[:CALLS]->(g) WHERE f.name = 'main' RETURN g.name |
find_similar_bugs(error) |
Find similar bugs from history by error text |
| Tool | When to Use |
|---|---|
get_commit_history(root, limit) |
Semantic commit history |
get_file_history(root, path) |
Change history for a specific file |
get_branch_info(project_root) |
Branch info + index status |
| Tool | When to Use |
|---|---|
submit_background_task(type, root) |
Run long tasks: bug_correlation / build_knowledge_graph / full_analysis |
get_task_status(task_id) |
Background task status |
verify_action(action_type) |
Verification: file_write / git_commit / git_push / index_sync |
| Tool | When to Use |
|---|---|
rename_symbol(old, new, apply) |
Rename symbol across all files (preview/apply, collision check) |
move_symbol(symbol, to_file, apply) |
Move symbol to another file (preview/apply, import updates) |
safe_delete(symbol, force, apply) |
Safe delete with reference check (force mode) |
replace_symbol(symbol, new_code, apply) |
Replace function/class body (preview/apply) |
insert_before_symbol(anchor, new_code, apply) |
Insert code before anchor symbol (preview/apply) |
insert_after_symbol(anchor, new_code, apply) |
Insert code after anchor's body (preview/apply) |
ack_impact(file_path) |
Acknowledge impact for modification guard |
| Tool | What it does |
|---|---|
intel_get_runtime_status() |
Aggregated health status: embedder, index, resource usage |
intel_trigger_reindex() |
Fire-and-forget reindexing (does not block Zed) |
intel_get_job_status(job_id) |
Background task progress |
intel_code_topology(symbol) |
Call graph + module topology (< 2 sec) |
intel_get_project_memory() |
Project memory map: ADR, known_issues, tech_debt |
intel_log_incident(...) |
Log an incident to project history |
intel_analyze_incident(error) |
Find similar incidents + ready-made solutions |
intel_add_memory_node(section, data) |
Add a record to project memory |
intel_get_hotspots() |
Top-5 files with highest bug load |
intel_predict_root_cause(error) |
Predict root cause from logs + history |
intel_get_telemetry(days) |
Per-tool telemetry, resource usage, LLM stats |
intel_tool_health() |
Tool success rates, latency, confidence |
intel_explain_project_state(root) |
Human-readable project state diagnosis |
intel_get_project_context(root) |
Single snapshot: state, index, health, memory |
| Tool | What it does |
|---|---|
debug_runtime_passport() |
Process passport: RUN_ID, PID, build info |
get_runtime_counters() |
Runtime counters: calls, blocks, warnings |
intel_execution_timeline(limit) |
Recent action timeline with durations |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP Server (~220 lines) β
β src/mcp/server.py β registration only β
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β DI Container (15 services) β β
β β src/core/di_container.py β ServiceCollection β β
β β β β
β β ββββββββββββ ββββββββββββββ ββββββββββββββββββββββββ β β
β β β Indexer β β Searcher β β DebounceBatch β β β
β β β Embedder β β SymbolIdx β β CircuitBreaker β β β
β β β Parser β β FileGuard β β RateLimiter β β β
β β ββββββββββββ ββββββββββββββ ββββββββββββββββββββββββ β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β ββββββββββββββ΄βββββββββββββ β
β βΌ βΌ β
β ββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββ β
β 41 Tool Classes β β 14 intel_* tools + 3 diag β
β β src/mcp/tools/*.py β β src/core/intelligence_layer.py β β
β β One class per tool β β error_boundary decorator β
β β Constructor Inj. β β JSON status/message/detail β β
β β Constructor Inj. β β asyncio.wait_for(timeout) β β
β ββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββ βββββββββββββββββββββ
β RemoteEmbedder β β LanceDB v2 β
β (LM Studio / β β (Vector DB) β
β Ollama / ONNX) β β BM25 + Vector β
βββββββββββββββββββ βββββββββββββββββββββ
| Mode | Latency | Best For |
|---|---|---|
search_code(query, mode="fast") |
~300ms | Simple keyword / exact name |
search_code(query, mode="quality") |
~1200ms | Semantic search with reranker |
search_code(query, mode="deep") |
~2-5s | Complex research across modules |
search_code(query, mode="context") |
~500ms | Find similar code by fragment |
cross_repo_search(query @repo) |
~500ms-2s | Cross-project search |
| Variable | Default | Description |
|---|---|---|
LM_STUDIO_URL |
http://localhost:1234/v1 |
LM Studio API endpoint |
LM_STUDIO_PORT |
1234 |
LM Studio port |
OLLAMA_URL |
http://localhost:11434 |
Ollama API endpoint |
LOG_LEVEL |
INFO |
Logging verbosity level |
ZED_WINDOWS_QUIRKS.md |
(see file) | Windows-specific instructions |
Symptoms: tools timeout, no response.
Checklist:
- File β Quit β reopen the project
- Run
python install.pyto reconfigure - Check logs:
%LOCALAPPDATA%\Zed\extensions\mscodebase-intelligence\.codebase_indices\logs\
Run in Agent Panel:
intel_trigger_reindex()
Then verify: get_index_status()
# Verify the server responds:
python -c "import urllib.request; print(urllib.request.urlopen('http://localhost:1234/v1/health').read())"Expected: {"status":"ok"}.
mscodebase-intelligence/
βββ src/
β βββ main.py # MCP server entry point (~220 lines)
β βββ lsp_main.py # LSP server (DI-based, for didSave indexing)
β βββ mcp/
β β βββ server.py # DI routing β only imports + registration
β β βββ write_tools.py # rename/move/delete/replace/insert symbols
β βββ tools/ # 11 files, 41 class-based tools
β β βββ search_tools.py # search_code, get_symbol_info, impact_analysis
β β βββ indexing_tools.py # notify_change, index_project_dir, index_health
β β βββ git_tools.py # get_branch_info, get_commit_history
β β βββ system_tools.py # get_index_status, watcher_status, read_live_file
β β βββ analysis_tools.py # structural_search, get_repo_map, scan_changes
β β βββ graph_tools.py # cross_repo_search, graph_query, get_related_files
β β βββ investigation_tools.py # get_bug_correlation, get_hotspots
β β βββ lifecycle_tools.py # submit_background_task, verify_action
β βββ core/
β β βββ di_container.py # β
DI Container (15 services, ServiceCollection)
β β βββ error_handler.py # β
error_boundary + ToolError
β β βββ rate_limiter.py # β
SlidingWindowRateLimiter + DebounceBatch + CircuitBreaker
β β βββ indexer.py # LanceDB vector storage
β β βββ searcher.py # Hybrid search (BM25 + Dense + RRF)
β β βββ symbol_index.py # Call Graph (BFS, impact analysis)
β β βββ intelligence_layer.py # intel_* tools (14 high-level)
β β βββ llama_runner.py # llama.cpp lifecycle manager β
β β βββ remote_embedder.py # LM Studio / Ollama / llama.cpp / ONNX client
β β βββ reranker.py # Multi-Provider Reranker (HTTP to providers)
β β βββ parser.py # Tree-sitter AST
β β βββ health_report.py # Self-diagnosis engine
β β βββ lsp_client.py # Thin LSP client (pyright JSON-RPC 2.0)
β β βββ modification_guard.py # @modification_guard decorator (ack + TTL)
β β βββ ...
β βββ utils/
β βββ paths.py # SafePathManager, to_win_long_path
β βββ zed_config.py # Auto-configure Zed settings
βββ docs/
β βββ en/ # English docs
β βββ ru/ # Russian docs
β βββ zh/ # Chinese docs
βββ tests/ # 494 tests (pytest)
βββ .agents/skills/ # Skills for AI agent
βββ install.py # Installer
βββ README.md
See docs/en/CONTRIBUTING.md for:
- How to add new MCP tools
- Test structure and CI pipeline
- Commit message conventions
# Setup
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
# Run MCP server directly (test)
python -m src.main
# Run tests
pytest tests/ -m "not integration and not benchmark"MIT License β see LICENSE for details.
- Zed IDE β code editor
- LM Studio β local LLM inference
- LanceDB β vector database
- Model Context Protocol β MCP standard