Skip to content

ManSio/mscodebase-intelligence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

379 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MSCodeBase Banner

πŸ‡¬πŸ‡§ English β€’ πŸ‡·πŸ‡Ί Русский β€’ πŸ‡¨πŸ‡³ δΈ­ζ–‡

MSCodebase Intelligence

AI-powered semantic code search for Zed IDE β€” MCP-сСрвСр Π³Π»ΡƒΠ±ΠΈΠ½Π½ΠΎΠ³ΠΎ Π°Π½Π°Π»ΠΈΠ·Π° ΠΊΠΎΠ΄Π°

Python 3.10+ License: MIT MCP Zed Tests

Features β€’ Quick Start β€’ Tools β€’ Documentation β€’ Installation β€’ Architecture β€’ Contributing β€’ Security

Last updated: 2026-07-09


🎯 Positioning

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         β”‚  β”‚
β”‚  β”‚  Β· 50 tools for AI assistant                 β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

What you get

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 ❌ βœ…

Why not LSP

MSCodeBase does not use LSP. The LSP server (src/lsp_main.py) was an experimental part of the project and does not work in Zed due to architectural limitations of the editor itself (see LSP_WONTFIX.md).

Instead, all functionality is implemented through 50 MCP tools available in Zed via the MCP protocol.

Platforms

Designed and tested on Windows. macOS and Linux should work but have not been validated officially.

✨ Features

Feature Description
πŸ” Unified Search search_code(query, mode, intent_hint) β€” single tool: fast/quality/deep/context/ask/auto
🧠 Intelligence Layer 10 high-level intel_* tools: self-diagnostics, topology, 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-гСнСрация ΠΎΡ‚Π²Π΅Ρ‚Π° Ρ‡Π΅Ρ€Π΅Π· 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), 50 tools (34 class-based + 14 intel + 2 diag), 391+ tests
πŸͺŸ Multi-Window ProjectIndexerRegistry β€” isolated Indexer per project, LRU 5, ResourceMonitor throttle
βš™οΈ SYSTEM_PROFILE light (sync) / server (async with phi-4)

πŸš€ Quick Start

Π’Ρ‹Π±Π΅Ρ€ΠΈ ΠΎΠ΄ΠΈΠ½ ΠΈΠ· Ρ‚Ρ€Ρ‘Ρ… способов установки:

Бпособ ΠšΠΎΠΌΡƒ ΠΏΠΎΠ΄Ρ…ΠΎΠ΄ΠΈΡ‚ ВрСмя Π‘Π»ΠΎΠΆΠ½ΠΎΡΡ‚ΡŒ
πŸ€– One-Prompt ВсСм. ΠšΠΎΠΏΠΈΡ€ΡƒΠ΅ΡˆΡŒ тСкст β†’ АгСнт Zed всё Π΄Π΅Π»Π°Π΅Ρ‚ сам 5-10 ΠΌΠΈΠ½ 🟒 АвтоматичСски
πŸ–₯️ Install.py ΠšΡ‚ΠΎ Π»ΡŽΠ±ΠΈΡ‚ TUI-установщики 5-10 ΠΌΠΈΠ½ 🟒 ΠŸΡ€ΠΎΡΡ‚ΠΎ
πŸ› οΈ Π’Ρ€ΡƒΡ‡Π½ΡƒΡŽ ΠšΡ‚ΠΎ Ρ…ΠΎΡ‡Π΅Ρ‚ ΠΏΠΎΠ»Π½Ρ‹ΠΉ ΠΊΠΎΠ½Ρ‚Ρ€ΠΎΠ»ΡŒ 15-20 ΠΌΠΈΠ½ 🟑 Π‘Ρ€Π΅Π΄Π½Π΅

ΠŸΡ€ΠΈΠΌΠ΅Ρ‡Π°Π½ΠΈΠ΅: На Windows 11 Insider Preview (build β‰₯ 26220) llama-server.exe нСсовмСстим (отсутствуСт api-ms-win-crt-heap API Set). Установщик автоматичСски ΠΏΠ΅Ρ€Π΅ΠΊΠ»ΡŽΡ‡ΠΈΡ‚ΡΡ Π½Π° ONNX. На ΡΡ‚Π°Π±ΠΈΠ»ΡŒΠ½Ρ‹Ρ… Windows/macOS/Linux β€” llama.cpp (Π² 3x быстрСС ΠΈ Π² 2x Π»Π΅Π³Ρ‡Π΅).


πŸ€– Бпособ 1: One-Prompt (рСкомСндуСтся)

Для ΠΊΠΎΠ³ΠΎ: Для всСх. АгСнт Zed сам ΠΎΠΏΡ€Π΅Π΄Π΅Π»ΠΈΡ‚ Ρ‚Π²ΠΎΡŽ ΠΏΠ»Π°Ρ‚Ρ„ΠΎΡ€ΠΌΡƒ, CPU, скачаСт Π½ΡƒΠΆΠ½Ρ‹Π΅ Π±ΠΈΠ½Π°Ρ€Π½ΠΈΠΊΠΈ ΠΈ настроит MCP.

Π§Ρ‚ΠΎ Π΄Π΅Π»Π°Ρ‚ΡŒ:

  1. ΠžΡ‚ΠΊΡ€ΠΎΠΉ Agent Panel Π² Zed: Ctrl+Shift+P β†’ Agent Panel: Toggle
  2. Π‘ΠΊΠΎΠΏΠΈΡ€ΡƒΠΉ вСсь тСкст ΠΈΠ· AI_INSTALLATION_PROMPT.md
  3. Π’ΡΡ‚Π°Π²ΡŒ Π² Ρ‡Π°Ρ‚ АгСнта ΠΈ Π½Π°ΠΆΠΌΠΈ Enter
  4. βœ… Π“ΠΎΡ‚ΠΎΠ²ΠΎ Ρ‡Π΅Ρ€Π΅Π· 5-10 ΠΌΠΈΠ½ΡƒΡ‚
Π§Ρ‚ΠΎ ΠΏΡ€ΠΎΠΈΠ·ΠΎΠΉΠ΄Ρ‘Ρ‚:
  β”œβ”€ Диагностика: Windows/macOS/Linux, AVX2/AVX512/ARM
  β”œβ”€ ΠšΠ»ΠΎΠ½ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ рСпозитория
  β”œβ”€ Π’ΠΈΡ€Ρ‚ΡƒΠ°Π»ΡŒΠ½ΠΎΠ΅ ΠΎΠΊΡ€ΡƒΠΆΠ΅Π½ΠΈΠ΅ + pip install
  β”œβ”€ Π‘ΠΊΠ°Ρ‡ΠΈΠ²Π°Π½ΠΈΠ΅ llama-server.exe (ΠΏΠΎΠ΄ Ρ‚Π²ΠΎΡŽ Π°Ρ€Ρ…ΠΈΡ‚Π΅ΠΊΡ‚ΡƒΡ€Ρƒ CPU)
  β”œβ”€ Π‘ΠΊΠ°Ρ‡ΠΈΠ²Π°Π½ΠΈΠ΅ GGUF ΠΌΠΎΠ΄Π΅Π»Π΅ΠΉ bge-m3 + reranker (Q4_K_M)
  β”œβ”€ Настройка MCP Π² Zed (с сохранСниСм // ΠΊΠΎΠΌΠΌΠ΅Π½Ρ‚Π°Ρ€ΠΈΠ΅Π²!)
  └─ Если Π½Π΅Ρ‚ ΠΈΠ½Ρ‚Π΅Ρ€Π½Π΅Ρ‚Π° / Windows Insider / ошибка β†’ ONNX fallback
  └─ Авто-дСтСкция: ΡΡ‚Π°Π±ΠΈΠ»ΡŒΠ½Ρ‹ΠΉ Windows β†’ llama.cpp, Insider β†’ ONNX
  └─ ~750 MB с llama.cpp / ~1.9 GB с ONNX

πŸ–₯️ Бпособ 2: Install.py (TUI-установщик)

Для ΠΊΠΎΠ³ΠΎ: ΠšΡ‚ΠΎ ΠΏΡ€Π΅Π΄ΠΏΠΎΡ‡ΠΈΡ‚Π°Π΅Ρ‚ классичСскиС установщики.

git clone https://github.com/ManSio/mscodebase-intelligence.git
cd mscodebase-intelligence
python install.py

Π§Ρ‚ΠΎ Π΄Π΅Π»Π°Π΅Ρ‚:

  1. βœ… Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π²ΠΈΡ€Ρ‚ΡƒΠ°Π»ΡŒΠ½ΠΎΠ΅ ΠΎΠΊΡ€ΡƒΠΆΠ΅Π½ΠΈΠ΅ + pip install
  2. βœ… Π‘ΠΊΠ°Ρ‡ΠΈΠ²Π°Π΅Ρ‚ llama.cpp + GGUF ΠΌΠΎΠ΄Π΅Π»ΠΈ (bge-m3 + reranker)
  3. βœ… Или скачиваСт ONNX ΠΌΠΎΠ΄Π΅Π»ΠΈ (bge-m3 + reranker) β€” fallback
  4. βœ… НастраиваСт MCP-сСрвСр Π² Zed
  5. βœ… Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ дСинсталлятор

ПослС установки β†’ File β†’ Quit β†’ reopen project β†’ ΠΆΠ΄ΠΈ ΠΈΠ½Π΄Π΅ΠΊΡΠ°Ρ†ΠΈΡŽ.

Verify: Π² Agent Panel Π²Ρ‹ΠΏΠΎΠ»Π½ΠΈ:

get_index_status()

πŸ› οΈ Бпособ 3: Π’Ρ€ΡƒΡ‡Π½ΡƒΡŽ (ΠΏΠΎΠ»Π½Ρ‹ΠΉ ΠΊΠΎΠ½Ρ‚Ρ€ΠΎΠ»ΡŒ)

Для ΠΊΠΎΠ³ΠΎ: ΠšΡ‚ΠΎ Ρ…ΠΎΡ‡Π΅Ρ‚ ΠΏΠΎΠ½ΡΡ‚ΡŒ ΠΊΠ°ΠΆΠ΄Ρ‹ΠΉ шаг ΠΈΠ»ΠΈ Ρƒ ΠΊΠΎΠ³ΠΎ нСстандартная конфигурация.

  1. ΠšΠ»ΠΎΠ½ΠΈΡ€ΡƒΠΉ:

    git clone https://github.com/ManSio/mscodebase-intelligence.git
    cd mscodebase-intelligence
  2. Π‘ΠΎΠ·Π΄Π°ΠΉ venv ΠΈ установи зависимости:

    python -m venv .venv
    # Windows:
    .venv\Scripts\python.exe -m pip install -r requirements.txt
    # macOS/Linux:
    .venv/bin/python -m pip install -r requirements.txt
  3. Π‘ΠΊΠ°Ρ‡Π°ΠΉ llama.cpp (ΠΎΠΏΡ†ΠΈΠΎΠ½Π°Π»ΡŒΠ½ΠΎ, Π½ΠΎ сильно быстрСС):

    # Windows β€” скачай с GitHub:
    curl -LO https://github.com/ggml-org/llama.cpp/releases/download/b9940/llama-b9940-bin-win-cpu-x64.zip
    # Распакуй Π² ΠΏΠ°ΠΏΠΊΡƒ llama/
    
    # macOS ARM:
    curl -LO https://github.com/ggml-org/llama.cpp/releases/download/b9940/llama-b9940-bin-macos-arm64.tar.gz
    
    # Linux:
    curl -LO https://github.com/ggml-org/llama.cpp/releases/download/b9940/llama-b9940-bin-ubuntu-x64.tar.gz
  4. Π‘ΠΊΠ°Ρ‡Π°ΠΉ GGUF ΠΌΠΎΠ΄Π΅Π»ΠΈ:

    pip install huggingface_hub
    python -c "
    from huggingface_hub import hf_hub_download
    import shutil
    for repo, file in [
        ('lm-kit/bge-m3-gguf', 'bge-m3-Q4_K_M.gguf'),
        ('lm-kit/bge-m3-reranker-v2-gguf', 'Bge-M3-568M-Q4_K_M.gguf'),
    ]:
        path = hf_hub_download(repo_id=repo, filename=file)
        shutil.copy2(path, f'models/{file}')
    "
  5. Настрой MCP Π² Zed: Π”ΠΎΠ±Π°Π²ΡŒ Π² %APPDATA%/Zed/settings.json (Windows) ΠΈΠ»ΠΈ ~/.config/zed/settings.json (macOS/Linux):

    {
      "context_servers": {
        "mscodebase-intelligence": {
          "command": ".venv/Scripts/python.exe",
          "args": ["-u", "-m", "src.main"],
          "env": {
            "PYTHONPATH": ".",
            "PROJECT_PATH": "$ZED_WORKTREE_ROOT"
          }
        }
      },
      "context_servers_to_query": ["mscodebase-intelligence"]
    }
  6. Запусти ΠΈ ΠΏΡ€ΠΎΠ²Π΅Ρ€ΡŒ:

    .venv/Scripts/python.exe -u -m src.main &
    # Π’ Agent Panel: get_index_status()

⚑ ΠŸΡ€ΠΎΠ²Π°ΠΉΠ΄Π΅Ρ€Ρ‹ (Π°Π²Ρ‚ΠΎΠ²Ρ‹Π±ΠΎΡ€)

ПослС установки MCP сам Π²Ρ‹Π±Π΅Ρ€Π΅Ρ‚ Π»ΡƒΡ‡ΡˆΠΈΠΉ доступный ΠΏΡ€ΠΎΠ²Π°ΠΉΠ΄Π΅Ρ€:

LM Studio (GPU)  β†’  llama.cpp (CPU GGUF)  β†’  ONNX server (CPU)  β†’  local ONNX (fallback)
   fastest             ~523 MB RAM               ~1.7 GB RAM           ΠΌΠ΅Π΄Π»Π΅Π½Π½ΠΎ
   ~100ms embed        ~764ms embed              ~988ms embed          +544 MB Π² MCP

ΠŸΠΎΠ΄Ρ€ΠΎΠ±Π½Ρ‹Π΅ Π±Π΅Π½Ρ‡ΠΌΠ°Ρ€ΠΊΠΈ: docs/research/2026-07-09-provider-benchmark.md


πŸ“Œ Π’Π°ΠΆΠ½Ρ‹Π΅ Π·Π°ΠΌΠ΅Ρ‚ΠΊΠΈ

Π‘Ρ†Π΅Π½Π°Ρ€ΠΈΠΉ Π˜Π½ΡΡ‚Ρ€ΡƒΠΊΡ†ΠΈΡ
Windows Read docs/en/ZED_WINDOWS_QUIRKS.md
Установка Ρ‡Π΅Ρ€Π΅Π· АгСнта Copy AI_INSTALLATION_PROMPT.md into chat
LM Studio Install, run on port 1234 β€” MCP connects automatically
llama.cpp Auto-downloaded by install.py. CPU detected automatically
Π£ΠΆΠ΅ установлСно python install.py бСзопасСн β€” no-op Ссли всё ΡƒΠΆΠ΅ настроСно

πŸ“š Documentation Map

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 4 levels of graceful degradation 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 πŸ‡¬πŸ‡§

All documents are cross-referenced.


πŸ”§ MCP Tools (50 total)

Core Search

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)

Index Management

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

System & Diagnostics

Tool When to Use
get_health_report() Full self-diagnosis: index, embedder, logs, synchronization
watcher_status() Component status: embedder mode (LM Studio / Ollama / ONNX)
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)

Analytics

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
find_similar_bugs(error) Find similar bugs from history by error text

Git & History

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

Lifecycle & Verification

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
predict_eta(operation) Operation time prediction
run_health_check() Full project health check (tests + git)

Intelligence Layer (intel_*) β€” 14 High-Level Tools

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_execution_timeline(limit) Recent action timeline
intel_explain_project_state(root) Human-readable project state diagnosis

πŸ—οΈ Architecture

Clean Architecture with DI Container

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   MCP Server (~220 lines)                        β”‚
β”‚            src/mcp/server.py β€” Ρ‚ΠΎΠ»ΡŒΠΊΠΎ рСгистрация                 β”‚
β”‚                                                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚              DI Container (15 services)                   β”‚   β”‚
β”‚  β”‚  src/core/di_container.py β€” ServiceCollection              β”‚   β”‚
β”‚  β”‚                                                           β”‚   β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚   β”‚
β”‚  β”‚  β”‚ Indexer  β”‚  β”‚  Searcher  β”‚  β”‚  DebounceBatch       β”‚  β”‚   β”‚
β”‚  β”‚  β”‚ Embedder β”‚  β”‚  SymbolIdx β”‚  β”‚  CircuitBreaker      β”‚  β”‚   β”‚
β”‚  β”‚  β”‚ Parser   β”‚  β”‚  FileGuard β”‚  β”‚  RateLimiter         β”‚  β”‚   β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                           β”‚                                       β”‚
β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                         β”‚
β”‚              β–Ό                          β–Ό                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  34 Tool Classes   β”‚  β”‚  14 intel_* tools + 2 diag      β”‚  β”‚
β”‚  β”‚  src/mcp/tools/*.py β”‚  β”‚  src/core/intelligence_layer.py    β”‚  β”‚
β”‚  β”‚  ΠšΠ°ΠΆΠ΄Ρ‹ΠΉ инструмСнт  β”‚  β”‚  error_boundary decorator          β”‚  β”‚
β”‚  β”‚  β€” ΠΎΡ‚Π΄Π΅Π»ΡŒΠ½Ρ‹ΠΉ класс β”‚  β”‚  JSON status/message/detail        β”‚  β”‚
β”‚  β”‚  Constructor Inj.   β”‚  β”‚  asyncio.wait_for(timeout)        β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  RemoteEmbedder  β”‚     β”‚  LanceDB v2       β”‚
β”‚  (LM Studio /    β”‚     β”‚  (ВСкторная Π‘Π”)    β”‚
β”‚   Ollama / ONNX) β”‚     β”‚  BM25 + Vector    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

⚑ Performance

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

Environment Variables

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 Π£Ρ€ΠΎΠ²Π΅Π½ΡŒ логирования
ZED_WINDOWS_QUIRKS.md (см. Ρ„Π°ΠΉΠ») Π˜Π½ΡΡ‚Ρ€ΡƒΠΊΡ†ΠΈΠΈ для Windows

πŸ”§ Troubleshooting

MCP Server Not Responding

Symptoms: инструмСнты Π½Π΅ ΠΎΡ‚Π²Π΅Ρ‡Π°ΡŽΡ‚, Ρ‚Π°ΠΉΠΌΠ°ΡƒΡ‚.

Checklist:

  1. File β†’ Quit β†’ ΠΎΡ‚ΠΊΡ€ΠΎΠΉ ΠΏΡ€ΠΎΠ΅ΠΊΡ‚ Π·Π°Π½ΠΎΠ²ΠΎ
  2. ЗапуститС python install.py для пСрСнастройки
  3. ΠŸΡ€ΠΎΠ²Π΅Ρ€ΡŒΡ‚Π΅ Π»ΠΎΠ³ΠΈ: %LOCALAPPDATA%\Zed\extensions\mscodebase-intelligence\.codebase_indices\logs\

Index Empty (0 chunks)

Π’ Agent Panel Π²Ρ‹ΠΏΠΎΠ»Π½ΠΈΡ‚Π΅:

intel_trigger_reindex()

ПослС ΠΏΡ€ΠΎΠ²Π΅Ρ€ΡŒΡ‚Π΅: get_index_status()

LM Studio Connection Issues

# ΠŸΡ€ΠΎΠ²Π΅Ρ€ΡŒΡ‚Π΅, Ρ‡Ρ‚ΠΎ сСрвСр ΠΎΡ‚Π²Π΅Ρ‡Π°Π΅Ρ‚:
python -c "import urllib.request; print(urllib.request.urlopen('http://localhost:1234/v1/health').read())"

Π”ΠΎΠ»ΠΆΠ΅Π½ Π±Ρ‹Ρ‚ΡŒ ΠΎΡ‚Π²Π΅Ρ‚ {"status":"ok"}.


πŸ“ Project Structure

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
β”‚   β”‚   └── tools/                 # 10 files, 33 class-based + 10 intel = 43 total
β”‚   β”‚       β”œβ”€β”€ 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
β”‚   β”‚   └── ...
β”‚   └── 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/                        # 396 tests (pytest)
β”œβ”€β”€ .agents/skills/               # Skills for AI agent
β”œβ”€β”€ install.py                    # Installer
└── README.md

πŸ› οΈ Development

See docs/en/CONTRIBUTING.md for:

  • How to add new MCP tools
  • Test structure and CI pipeline
  • Commit message conventions

Quick Start for Devs

# 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"

πŸ“„ License

MIT License β€” see LICENSE for details.


πŸ™ Acknowledgments

About

High-performance, memory-safe, and native async Python MCP server for Zed IDE on Windows. Features multi-bucket RAG, hybrid LanceDB/BM25 search, dynamic re-ranking, and O(1) status caching.

Topics

Resources

License

Code of conduct

Security policy

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages