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.
Safe staging for this asset
This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.
npx -y tokrepo@latest install bf876394-1dbf-4b0a-9d41-179ea6522616 --target codexStages files first; activation requires review of the staged README and plan.
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.
Discussion
Related Assets
Serena — Semantic Code Agent via MCP
Serena is a coding agent MCP server with semantic code retrieval and editing. 22K+ stars. Understands classes, functions, symbols for precise context-aware edits. MIT.
Codebase Memory MCP — Code Knowledge Graph Server
High-performance MCP server that indexes codebases into persistent knowledge graphs. Supports 66 languages, sub-millisecond queries, and claims 99% fewer tokens than raw file context. 1,100+ stars.
Figma Context MCP — Design-to-Code for AI Agents
MCP server that gives AI coding agents access to Figma design context. Provides layout, styles, and component info so agents like Cursor and Claude Code can generate pixel-perfect code. 14K+ stars.
Claude Context — Semantic Code Search MCP
Claude Context is an MCP server for semantic code search, so agents can retrieve relevant code without stuffing whole folders into the prompt.