The smartest code search for Claude.
MCP Context Manager
The smartest code search for Claude. Reduces token usage by 70-90% with BM25 ranking, fuzzy matching, and natural language queries.
What is this?
An MCP (Model Context Protocol) server that gives Claude superhuman code navigation. Instead of reading entire files (thousands of tokens), Claude queries for exactly what it needs (tens of tokens).
The difference:
- Claude reads 3 files → 5,400 tokens → 5 seconds
+ Claude queries "auth middleware" → 230 tokens → 85ms
95% token savings + 10x faster = drastically lower API costs.
Features
- 🎯 Natural Language Search - "authentication middleware" finds all auth code
- 🔍 BM25 Ranking - Industry-standard relevance algorithm (like Elasticsearch)
- ✨ Fuzzy Matching - Handles typos automatically ("athenticate" → "authenticate")
- 🧠 Smart Tokenization - Understands camelCase, snake_case, paths
- 🚀 Blazing Fast - <100ms searches on 10,000+ file repos
- 🌐 Multi-Language - TypeScript, JavaScript, Python, Go, Rust, Java, C/C++, C#, Lua
- 💰 Token Savings - 70-90% reduction in typical usage
Quick Start
Installation
npm install -g claude-mcp-context
Automatic Setup (Claude Code CLI):
The package automatically detects and configures Claude Code. After installation, run:
mcp-context-setup
This will:
- ✅ Build the server (if needed)
- ✅ Verify server functionality
- ✅ Register with Claude Code automatically
- ✅ Confirm registration
Manual Configuration (Claude Desktop or troubleshooting):
If automatic setup doesn't work or you're using Claude Desktop, add to your config file:
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"context-manager": {
"command": "claude-mcp-context"
}
}
}
Claude Code (~/.claude/mcp.json):
{
"mcpServers": {
"context-manager": {
"command": "claude-mcp-context"
}
}
}
Verify Installation:
claude mcp list # Should show "context-manager"
Usage
Restart Claude and try:
"Index this repository"
"Find the authentication middleware"
"Show me all payment-related functions"
"What does the UserService class do?"
That's it! Claude will now use intelligent search instead of reading entire files.
How It Works
1. Index Your Repository (One Time)
You: "Index this repository"
MCP Context Manager parses all code and builds a searchable index (~1 second per 1000 files).
2. Natural Language Queries
You: "Find authentication middleware"
Returns:
📍 authMiddleware (function) - Score: 892.3
src/middleware/auth.ts:15
📍 AuthService (class) - Score: 654.2
src/services/AuthService.ts:8
3. Massive Token Savings
Instead of 5,400 tokens to read 3 files, you get exactly what you need in 230 tokens.
Search Intelligence
Multi-Word Queries
"payment validation" → finds validatePayment(), PaymentValidator, checkPayment()
"user auth service" → finds UserAuthService, authenticateUser(), etc.
Fuzzy Matching
"athenticate" → suggests authenticate
"usrService" → suggests userService
Query Expansion
"auth" → searches: auth, authenticate, authentication, authorization
"db" → searches: db, database, data
"config" → searches: config, configuration, configure, settings
Code Body Search
Searches inside function implementations, not just names:
"jwt token" → finds code that uses JWT, even if function isn't named jwt*
Available Tools
| Tool | What It Does |
|---|---|
get_relevant_context |
Natural language search with BM25 ranking |
find_symbol |
Locate specific function/class with fuzzy suggestions |
get_function |
Get complete function code |
get_class |
Get class definition (optionally filter methods) |
search_code |
Regex pattern search with relevance ranking |
find_similar |
Discover structurally similar code |
get_file_summary |
File overview without full content |
get_repository_structure |
Directory tree view |
get_dependencies |
Trace imports and dependencies |
index_repository |
Build/refresh code index |
Claude automatically chooses the best tool based on your query.
Examples
Find Authentication Code
You: "Find all authentication-related code"
Claude uses: get_relevant_context("authentication")
Returns:
- authMiddleware() in middleware/auth.ts
- authenticate() in auth/handler.ts
- AuthService class in services/auth.ts
- validateToken() in utils/jwt.ts
Tokens: 340 (vs 4,200 reading all files) = 92% savings
Debug Payment Flow
You: "Show me the payment processing flow"
Claude uses: get_rel
Tools (10)
get_relevant_contextNatural language search with BM25 rankingfind_symbolLocate specific function/class with fuzzy suggestionsget_functionGet complete function codeget_classGet class definition (optionally filter methods)search_codeRegex pattern search with relevance rankingfind_similarDiscover structurally similar codeget_file_summaryFile overview without full contentget_repository_structureDirectory tree viewget_dependenciesTrace imports and dependenciesindex_repositoryBuild/refresh code indexConfiguration
{"mcpServers": {"context-manager": {"command": "claude-mcp-context"}}}