Context+ — Semantic Code Intelligence MCP Server
MCP server combining RAG, Tree-sitter AST parsing, and spectral clustering to turn large codebases into searchable feature graphs. 99% accuracy on monorepos. 1,700+ GitHub stars.
What it is
Context+ is an MCP server that combines RAG (Retrieval-Augmented Generation), Tree-sitter AST parsing, and spectral clustering to transform large codebases into searchable feature graphs. It gives AI coding agents deep understanding of code structure, dependencies, and feature boundaries.
Context+ targets teams using AI coding assistants on large monorepos where standard file search is insufficient. By clustering related code into semantic features, it helps agents find relevant code faster and understand architectural patterns.
How it saves time or tokens
Without semantic code intelligence, AI agents grep through entire codebases to find relevant code, consuming tokens on irrelevant files. Context+ pre-indexes the codebase into a feature graph, so agents query by concept ('authentication flow') rather than by file name.
The spectral clustering groups related functions, classes, and modules into features. An agent asking about 'payment processing' gets the relevant controllers, services, models, and tests without searching every directory.
How to use
- Install Context+ as an MCP server:
npm install -g context-plus
context-plus init
- Index your codebase:
context-plus index --path ./src
- Connect to your AI coding tool via MCP:
{
"mcpServers": {
"context-plus": {
"command": "context-plus",
"args": ["serve"]
}
}
}
- The AI agent can now query the feature graph:
Agent: Find all code related to user authentication
Context+: Returns clustered results from auth controller, middleware, models, and tests
Example
# Query the feature graph via CLI
context-plus query 'payment processing'
# Output:
# Feature: Payment Processing (confidence: 0.94)
# Files:
# src/controllers/payment.ts (score: 0.97)
# src/services/stripe.ts (score: 0.95)
# src/models/transaction.ts (score: 0.92)
# tests/payment.test.ts (score: 0.89)
Related on TokRepo
- AI Tools for Coding — AI coding assistants and code intelligence tools
- MCP Integrations — MCP server implementations for AI agents
Common pitfalls
- Not re-indexing after significant code changes. The feature graph becomes stale as code evolves. Set up automatic re-indexing on git push or as a CI step.
- Expecting instant indexing on large monorepos. Initial indexing of a 100K+ file codebase can take minutes. Subsequent incremental updates are faster.
- Trusting cluster boundaries blindly. Spectral clustering groups related code statistically. Review and adjust cluster assignments for domain-specific accuracy.
- Failing to review community discussions and changelogs before upgrading. Breaking changes in major versions can disrupt existing workflows. Pin versions in production and test upgrades in staging first.
Frequently Asked Questions
A feature graph maps code elements (functions, classes, modules) to semantic features (authentication, payment, notification). It is built by analyzing code structure with AST parsing, semantic similarity with embeddings, and relationship patterns with spectral clustering.
Context+ uses Tree-sitter to parse source code into Abstract Syntax Trees (ASTs). This provides structural understanding of functions, classes, imports, and dependencies without executing the code. Tree-sitter supports most programming languages.
Context+ supports languages that Tree-sitter can parse, which includes most popular languages: TypeScript, Python, Go, Java, Rust, C/C++, Ruby, and more. The RAG embeddings work with any text-based source code.
Context+ runs as an MCP server that exposes tools for querying the feature graph, searching code by concept, and retrieving relevant code snippets. Any MCP-compatible client (Claude Code, Claude Desktop) can connect to it.
Spectral clustering is a graph-based clustering algorithm that groups code elements by their relationships (imports, calls, type references). Unlike simple directory-based grouping, it discovers cross-directory feature boundaries that reflect actual code architecture.
Citations (3)
- Context+ GitHub— Context+ combines RAG, Tree-sitter, and spectral clustering for code intelligenc…
- Tree-sitter Documentation— Tree-sitter incremental parsing library
- MCP Specification— MCP server implementation patterns
Related on TokRepo
Source & Thanks
Created by ForLoopCodes. Licensed under MIT.
contextplus — ⭐ 1,700+
Thanks for bringing deep semantic code intelligence to MCP.