MCP Context Manager
Enables intelligent code search, symbol navigation, and context retrieval within C++ repositories using BM25 ranking and fuzzy matching.
Provides efficient code navigation, symbol location, and context extraction for JavaScript codebases to minimize token usage.
Enables high-performance code search and repository indexing for Lua projects, supporting natural language queries and fuzzy matching.
Provides advanced search capabilities for Python repositories, including symbol location, function body retrieval, and structural similarity discovery.
Offers specialized context management for Rust codebases, allowing for rapid code search, dependency tracing, and file summarization.
Supports deep indexing and natural language search for TypeScript projects, enabling efficient retrieval of functions, classes, and types.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Context Manager find the authentication middleware and its usage"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 β 85ms95% token savings + 10x faster = drastically lower API costs.
Related MCP server: CodeSense MCP
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-contextAutomatic Setup (Claude Code CLI):
The package automatically detects and configures Claude Code. After installation, run:
mcp-context-setupThis 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:83. 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 userServiceQuery Expansion
"auth" β searches: auth, authenticate, authentication, authorization
"db" β searches: db, database, data
"config" β searches: config, configuration, configure, settingsCode 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 |
| Natural language search with BM25 ranking |
| Locate specific function/class with fuzzy suggestions |
| Get complete function code |
| Get class definition (optionally filter methods) |
| Regex pattern search with relevance ranking |
| Discover structurally similar code |
| File overview without full content |
| Directory tree view |
| Trace imports and dependencies |
| 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% savingsDebug Payment Flow
You: "Show me the payment processing flow"
Claude uses: get_relevant_context("payment processing")
Returns:
- processPayment() function
- PaymentService class
- Related validation and error handling
Then: find_similar("processPayment")
Returns:
- processRefund() (87% similar)
- handlePayment() (72% similar)
Total tokens: 450 (vs 6,000+) = 93% savingsUnderstand New Codebase
You: "What are the main modules?"
Claude uses: get_repository_structure()
You: "Summarize the auth module"
Claude uses: get_file_summary("src/auth/handler.ts")
Returns structure without reading 200+ lines of code.
Tokens: 180 (vs 2,800) = 94% savingsPerformance
Metric | Performance |
Search Speed | <100ms average |
Indexing Speed | ~1s per 1000 files |
Accuracy | 95%+ on typical queries |
Token Savings | 70-90% average |
Memory Usage | 1-5MB index |
Real Example: 3,500 file TypeScript monorepo
Initial index: 45 seconds
Re-index (cached): 2 seconds
Search "auth middleware": 78ms, 15 results
Token savings: 87% average
Why It's Better
vs. Reading Files Directly
β 95% fewer tokens
β 10x faster responses
β Only relevant code returned
vs. Grep/Ripgrep
β BM25 relevance ranking
β Fuzzy matching for typos
β Natural language queries
β AI-optimized output
vs. GitHub Copilot
β 70-90% token savings
β Works locally (private)
β Free and open source
Configuration
The server automatically:
Respects
.gitignorepatternsExcludes
node_modules,dist,buildCaches index for fast re-indexing
Supports 9 programming languages
No configuration needed!
Troubleshooting
MCP server not showing up?
Run
mcp-context-setupto re-registerCheck config file path is correct
Use absolute paths (not relative)
Restart Claude after config changes
Verify with:
claude mcp list
No symbols found after indexing?
Verify file extensions are supported
Check files aren't in
.gitignoreTry:
clear_cachethen re-index
Slow indexing?
Normal for 10,000+ file repos (30-60 seconds)
Subsequent indexes use cache (much faster)
Development
git clone https://github.com/transparentlyok/mcp-context-manager
cd mcp-context-manager
npm install
npm run build
# Development mode
npm run dev
# Watch mode
npm run watchContributing
Contributions welcome! Ideas:
Add more language support
Improve search algorithms
Add semantic search with embeddings
Create web UI
See issues for planned features.
Technical Details
Search Engine:
BM25 algorithm (K1=1.5, B=0.75)
Levenshtein distance for fuzzy matching
10 parallel search strategies
Query expansion dictionary
Parsing:
Regex-based extraction (fast, lightweight)
Supports 9 languages
Extracts functions, classes, types, imports
Caching:
File hash-based validation
Stored in
.mcp-cache/Automatic invalidation on changes
License
MIT License - see LICENSE file.
Links
Built with β€οΈ for the AI development community
β Star on GitHub if this saves you tokens!
Available Tools
12 toolsclear_cacheA
Clear the cached index for a repository. Useful if cache becomes corrupted or you want to force a fresh index.
Inputs: path.
find_similarB
Find code similar to a given symbol. Useful for discovering related implementations, similar patterns, or alternative approaches.
Inputs: symbolName (required), limit.
find_symbolA
β PREFERRED FOR SYMBOLS: Use this INSTEAD OF Grep when looking for specific functions, classes, or variables. Fuzzy matching automatically handles typos ("athenticate" β "authenticate"). Returns exact file path and line number. Much faster than Grep with better accuracy.
Inputs: symbol (required), type.
get_classA
β PREFERRED OVER Read: Get class definition without reading the entire file. Optionally filter specific methods. Saves 80%+ tokens vs reading full files. Use this when you need class structure or specific class methods.
Inputs: className (required), methods, filePath.
get_dependenciesB
Find all dependencies (imports/requires) for a file or symbol. Useful for understanding what code needs.
Inputs: filePath (required), symbol.
get_file_summaryA
β PREFERRED FOR FILE OVERVIEW: Get file structure (exports, functions, classes, imports) without reading full content. Use this INSTEAD OF Read when you need to understand what's in a file without seeing implementation details. Saves 90% tokens.
Inputs: filePath (required).
get_functionA
β PREFERRED OVER Read: Get complete function code without reading the entire file. Saves 85% tokens compared to Read. Use when you need a specific function implementation instead of reading full files. Returns only the function definition with signature.
Inputs: functionName (required), filePath.
get_relevant_contextB
Get code context relevant to a natural language query. Returns minimal, targeted code snippets.
Inputs: query (required), maxTokens.
get_repository_structureA
β PREFERRED OVER ls/tree: Get clean repository structure showing directories and file types. Use this INSTEAD OF running ls, tree, or Glob for understanding project layout. No file contents, just structure.
Inputs: path, depth.
get_usage_statsA
View token usage statistics for this session. Shows how many tokens each MCP tool used vs what full file reads would have cost. Use this to verify token savings.
Inputs: reset.
index_repositoryA
π§ REQUIRED FIRST STEP: Index or re-index the repository to enable all context-manager tools. Uses cached index if files haven't changed. ALWAYS call this when starting work on a repository or if files have changed significantly. Fast (<2s for most repos).
Inputs: path, forceReindex.
search_codeA
β PREFERRED OVER Grep: Search for code patterns with regex support. Returns ranked results with minimal context. Better than Grep because it ranks by relevance and provides AI-optimized output. Use for pattern matching and text search.
Inputs: pattern (required), filePattern, maxResults.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 12 tools
Each tool has a clearly distinct purpose with no overlap: clear_cache manages indexing, index_repository builds the index, find_symbol and search_code handle different types of searches, get_class/get_function/get_file_summary provide targeted code extraction, get_dependencies analyzes imports, get_repository_structure shows layout, get_relevant_context answers natural language queries, and get_usage_stats tracks metrics. The descriptions explicitly differentiate tools (e.g., 'PREFERRED OVER Read' vs. 'PREFERRED OVER Grep'), eliminating ambiguity.
All tool names follow a consistent verb_noun pattern with snake_case: clear_cache, find_similar, find_symbol, get_class, get_dependencies, get_file_summary, get_function, get_relevant_context, get_repository_structure, get_usage_stats, index_repository, and search_code. The naming is predictable and uniform throughout the set, making it easy for agents to understand and use.
With 12 tools, the count is well-scoped for a context manager focused on code analysis and repository navigation. Each tool serves a specific, necessary function in the workflow (e.g., indexing, searching, extracting code, analyzing dependencies, tracking usage), and none appear redundant or excessive. This aligns with typical server scopes of 3-15 tools, providing comprehensive coverage without bloat.
The tool set offers complete coverage for the domain of code context management: it includes setup (index_repository, clear_cache), navigation (get_repository_structure), targeted code access (get_class, get_function, get_file_summary), search capabilities (find_symbol, search_code, find_similar), dependency analysis (get_dependencies), contextual queries (get_relevant_context), and monitoring (get_usage_stats). There are no obvious gaps; agents can perform a full lifecycle from indexing to detailed code analysis and optimization.
Related MCP Connectors
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Token-efficient search for coding agents over public and private documentation.
Provide your AI coding tools with token-efficient access to up-to-date technical documentation forβ¦
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables semantic code search across multiple repositories using natural language queries. Provides intelligent code discovery, symbol lookups, and cross-repo dependency analysis for AI coding agents.MIT
- AlicenseNot gradedqualityDmaintenanceProvides semantic code intelligence to help users search, navigate, and analyze entire codebases using plain English. It enables Claude to perform architectural overviews, bug detection, and refactor suggestions through local semantic search and keyword indexing.MIT
- AlicenseNot gradedqualityBmaintenanceIndexes codebases and lets AI agents retrieve precise code snippets (functions, classes, routes) instead of reading entire files, reducing token usage and improving accuracy.29 npm7MIT
- AlicenseAqualityDmaintenanceEnables LLMs to efficiently navigate large codebases by providing surgical access to specific code symbols via semantic search and call-graph queries.6MIT