ContextTree MCP

ContextTree MCP

Enables AI coding assistants to perform local semantic code search using AST parsing and embeddings, finding code by meaning with exact file and line locations, plus AST-based usage lookup.

Category
Visit Server

README

ContextTree MCP 🌳

Deep semantic & hybrid code search for AI assistants β€” powered by AST parsing and local embeddings. 100% offline.

Python License: MIT MCP README (RU)

ContextTree MCP is a local Model Context Protocol server that gives your AI coding assistant structural understanding of a codebase. It combines three powerful pillars:

  • tree-sitter parses source files into an AST and extracts logical blocks β€” functions, methods, and class/struct signatures with docstrings.
  • Hybrid Search (BM25 + Dense Vectors with Reciprocal Rank Fusion) β€” combines exact keyword/identifier matches (camelCase, snake_case) with dense vector embeddings (sentence-transformers/all-MiniLM-L6-v2 in ChromaDB).
  • Watch Mode & Incremental Indexing β€” SHA-256 hash change detection and asynchronous filesystem watcher for instant updates on save.

πŸ”’ Privacy first. Everything runs on your machine: parsing, embedding model, vector index. No cloud calls, no telemetry, no code ever leaves the disk it lives on.


Supported Languages

Language Extensions AST Units Indexed
Python .py functions, decorated functions, methods, class signatures & PEP-257 docs
TypeScript / TSX .ts, .tsx, .mts, .cts functions, methods, class signatures & JSDoc
JavaScript / JSX .js, .jsx, .mjs, .cjs functions, methods, class signatures & JSDoc
Go .go functions, receiver methods, struct/interface types & comments
Rust .rs functions, impl methods, struct & trait signatures, /// docs
C# .cs methods, constructors, class & interface signatures, /// <summary> XML-docs
Java .java methods, constructors, class, interface & record signatures, Javadoc

Installation & Quick Start

Requires Python 3.12+. uv is recommended:

git clone https://github.com/chelslava/mcp-context-tree.git
cd mcp-context-tree
uv sync

Running the Server

# Standard stdio server (for MCP clients)
uv run context-tree

# Watch mode (monitors directory and incrementally indexes on save)
uv run context-tree --watch /path/to/project

Registering with MCP Clients

Example configuration (claude_desktop_config.json or Antigravity / Cursor configs):

{
  "mcpServers": {
    "context-tree": {
      "command": "uv",
      "args": ["run", "--directory", "D:/Repo/mcp-context-tree", "context-tree"]
    }
  }
}

Tools Exposed to Assistant

Tool Parameters Description
index_workspace (directory_path: str = ".") Scans workspace, diffs against index state, incrementally indexes changed files.
semantic_search (query: str, limit: int = 5, mode: str = "hybrid") Hybrid (BM25 + vectors), semantic-only, or keyword search. Returns exact line snippets.
find_ast_usages (symbol_name: str, limit: int = 50) AST lookup of real call sites / instantiations (filters out string literals & comments).

License

MIT β€” see LICENSE.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured