/ Каталог / Песочница / contextplus
● Сообщество ForLoopCodes ⚡ Сразу

contextplus

автор ForLoopCodes · ForLoopCodes/contextplus

Give your coding agent a persistent semantic map of the repo — AST + embeddings + memory graph + shadow undo — so it stops re-reading the whole codebase.

Context+ (ForLoopCodes/contextplus) is a TypeScript MCP exposing 17 tools for repo understanding: tree-sitter AST trees, file skeletons, semantic identifier search, blast-radius analysis, a memory graph for long-running projects, and shadow restore points for safe edits. Works with Ollama or cloud embeddings.

Зачем использовать

Ключевые функции

Живое демо

Как выглядит на практике

contextplus.replay ▶ готово
0/0

Установка

Выберите клиент

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "contextplus": {
      "command": "npx",
      "args": [
        "-y",
        "contextplus"
      ],
      "_inferred": true
    }
  }
}

Откройте Claude Desktop → Settings → Developer → Edit Config. Перезапустите после сохранения.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "contextplus": {
      "command": "npx",
      "args": [
        "-y",
        "contextplus"
      ],
      "_inferred": true
    }
  }
}

Cursor использует ту же схему mcpServers, что и Claude Desktop. Конфиг проекта приоритетнее глобального.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "contextplus": {
      "command": "npx",
      "args": [
        "-y",
        "contextplus"
      ],
      "_inferred": true
    }
  }
}

Щёлкните значок MCP Servers на боковой панели Cline, затем "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "contextplus": {
      "command": "npx",
      "args": [
        "-y",
        "contextplus"
      ],
      "_inferred": true
    }
  }
}

Тот же формат, что и Claude Desktop. Перезапустите Windsurf для применения.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "contextplus",
      "command": "npx",
      "args": [
        "-y",
        "contextplus"
      ]
    }
  ]
}

Continue использует массив объектов серверов, а не map.

~/.config/zed/settings.json
{
  "context_servers": {
    "contextplus": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "contextplus"
        ]
      }
    }
  }
}

Добавьте в context_servers. Zed перезагружается автоматически.

claude mcp add contextplus -- npx -y contextplus

Однострочная команда. Проверить: claude mcp list. Удалить: claude mcp remove.

Сценарии использования

Реальные сценарии: contextplus

How to make a new agent productive in a large repo fast

👤 Tech leads using Cursor/Claude Code on a monorepo ⏱ ~20 min intermediate

Когда использовать: The agent wastes 30% of context reading and re-reading files.

Предварительные требования
  • Node + bun or npm — brew install bun or use npm
  • An embeddings provider (Ollama local, OpenAI, Gemini, or Groq) — ollama pull nomic-embed-text for offline
Поток
  1. Build the context tree
    Run get_context_tree on the repo root. Summarize the top-level layers.✓ Скопировано
    → AST tree with file headers
  2. Skeleton-only reads
    Use get_file_skeleton on src/auth/ to see just signatures — don't read bodies yet.✓ Скопировано
    → Function signatures without bodies
  3. Ask a semantic question
    semantic_identifier_search: 'where is JWT verification implemented and called?'✓ Скопировано
    → Ranked implementations + call sites

Итог: Agent operates with a mental model of the repo using ~5x less context.

Подводные камни
  • First-run indexing is slow — Run the initial scan once; incremental updates are fast
  • Embeddings model mismatch between index and query — Stick with one embedding model; re-index if you change it
Сочетать с: filesystem · github

How to refactor with shadow restore points

👤 Devs worried about letting agents edit code ⏱ ~15 min intermediate

Когда использовать: You want agent edits but also want a one-click undo that doesn't dirty git.

Поток
  1. Capture a restore point
    Create a restore point named 'before-auth-refactor'.✓ Скопировано
    → Point id returned
  2. Let the agent edit
    propose_commit: refactor JWT verification to use the new key rotation helper.✓ Скопировано
    → Files edited + validation passed
  3. Rollback if wrong
    undo_change back to 'before-auth-refactor'.✓ Скопировано
    → Files reverted, git history clean

Итог: Fearless refactors without polluting git history.

Подводные камни
  • Restore points live in .contextplus/ — don't check this in — Add .contextplus/ to .gitignore
Сочетать с: github

How to assess blast radius before deleting a function

👤 Engineers cleaning up dead code ⏱ ~10 min intermediate

Когда использовать: You want to know exactly who imports or uses a symbol before removing it.

Поток
  1. Ask for the blast radius
    get_blast_radius for function 'legacyFormatPrice' in src/pricing.ts.✓ Скопировано
    → Every file/line that imports or calls it
  2. Plan removal
    For each call site, suggest the replacement. Any site without a clean swap, flag as risky.✓ Скопировано
    → Migration checklist

Итог: A deletion PR with zero surprises.

Подводные камни
  • Dynamic imports (require, string refs) aren't detected — Supplement with a grep pass for the function name
Сочетать с: github

How to persist decisions across sessions with the memory graph

👤 Any agent user on a long-running project ⏱ ~15 min advanced

Когда использовать: You keep re-explaining the same architectural choices to the agent.

Поток
  1. Seed memory
    upsert_memory_node: 'We chose Postgres over MongoDB because of transactional invariants in the billing flow.'✓ Скопировано
    → Node created with embedding
  2. Create relations
    create_relation: link that decision to files src/billing/*.ts with edge type 'implements'.✓ Скопировано
    → Edge created
  3. Retrieve next session
    search_memory_graph: 'why are we using Postgres?'✓ Скопировано
    → Decision surfaces with supporting files

Итог: Durable project memory that outlives the chat.

Подводные камни
  • Memory graph grows stale — Run prune_stale_links monthly
Сочетать с: memory-service

Комбинации

Сочетайте с другими MCP — эффект x10

contextplus + github

Use blast-radius findings to populate a tracking issue

Run get_blast_radius on LegacyAuth then create a GitHub tracking issue with each call site as a checklist item.✓ Скопировано
contextplus + memory-service

Persist long-term decisions across projects using mcp-memory-service as the shared store

Whenever Context+ captures a new architectural decision, mirror it into mcp-memory-service.✓ Скопировано

Инструменты

Что предоставляет этот MCP

ИнструментВходные данныеКогда вызыватьСтоимость
get_context_tree root: str, depth?: int First call in a new repo session free
get_file_skeleton path: str Cheap file overview free
semantic_code_search query: str, k?: int Find code by meaning 1 embedding + 1 vector search
semantic_identifier_search query: str Locate a function/class 1 vector search
get_blast_radius symbol: str, file?: str Before deleting/renaming free
run_static_analysis path?: str Unused code + type errors free
propose_commit files: Edit[] Apply edits with validation free
list_restore_points See available rollbacks free
undo_change restore_point_id: str Revert a shadow edit free
upsert_memory_node content: str, tags?: str[] Save a durable fact 1 embedding
search_memory_graph query: str, traversal?: int Recall past decisions 1 vector search

Стоимость и лимиты

Во что обходится

Квота API
Depends on embedding provider: Ollama free, OpenAI ~$0.02/1M tokens
Токенов на вызов
Skeleton reads: 100-500 tokens. Full searches: 500-2000
Деньги
Free (open source) + embedding costs if using cloud providers
Совет
Use Ollama with nomic-embed-text for zero marginal cost.

Безопасность

Права, секреты, радиус поражения

Минимальные скоупы: Filesystem read/write to the indexed repo
Хранение учётных данных: Embedding provider keys via env
Исходящий трафик: Embeddings go to your chosen provider (or stay local with Ollama)
Никогда не давайте: Do not index directories with secrets like .env

Устранение неполадок

Частые ошибки и исправления

Indexing is extremely slow

Add large directories (node_modules, dist) to .contextplusignore; use Ollama locally.

Semantic search returns irrelevant results

Your query is too abstract — include a concrete symbol or filename hint.

undo_change fails with 'point not found'

Shadow points are per-session by default. Persist across sessions via the config flag.

Tree-sitter grammar missing for a language

Check the supported extensions list; files of unsupported types are skipped but indexed as plain text.

Альтернативы

contextplus в сравнении

АльтернативаКогда использоватьКомпромисс
mcp-language-serverYou want LSP semantics (rename, references) rather than embedding-based searchNo memory graph, no shadow undo
codebase-memory-mcpYou prefer a knowledge-graph view over per-file skeletonsDifferent index shape; 66 languages

Ещё

Ресурсы

📖 Читать официальный README на GitHub

🐙 Открытые задачи

🔍 Все 400+ MCP-серверов и Skills