Search Tools MCP Server
An MCP server that enhances code analysis with advanced search and dependency mapping capabilities.
๐ Search Tools MCP Server
โก An intelligent Model Context Protocol (MCP) server that supercharges code analysis with advanced search capabilities and dependency mapping
๐ Overview
The Search Tools MCP Server is a powerful toolkit that combines traditional code search with intelligent analysis algorithms. It leverages the CodeRank algorithm (inspired by PageRank) to identify the most critical modules in your codebase and provides sophisticated search capabilities that go beyond simple text matching.
๐ฏ Key Features
๐ Smart Search Capabilities
- Contextual Keyword Search: Ripgrep-powered search with configurable context lines
- Symbol Discovery: Extract and analyze functions, classes, methods, and modules
- Usage Tracking: Find where symbols are used across your codebase
- Priority-Ranked Results: Search results ranked by code importance
๐ง Intelligence & Analysis
- CodeRank Algorithm: Identify the most critical modules using network analysis
- Dependency Mapping: Trace complex dependency chains and impact analysis
- Hotspot Detection: Find code areas that are both highly connected and frequently used
- Refactoring Impact: Analyze the potential impact of code changes
๐จ Advanced Filtering
- Symbol type filtering (functions, methods, classes)
- File inclusion/exclusion patterns
- External module dependency tracking
- Markdown documentation analysis
๐ ๏ธ Installation
Prerequisites
- Python 3.13+
uv
package managerkit
CLI tool (for symbol analysis)ripgrep
(for fast text search)
Setup
# Clone the repository
git clone <repository-url>
cd search-tools
# Install dependencies
uv sync
โ๏ธ Configuration
Adding to Cursor/Windsurf
Add the following configuration to your mcp.json
file:
{
"mcpServers": {
"search-tools": {
"command": "/path/to/uv",
"args": [
"run",
"--directory",
"/path/to/search-tools",
"main.py"
]
}
}
}
For macOS users with Homebrew:
{
"mcpServers": {
"search-tools": {
"command": "/Users/yourusername/.local/bin/uv",
"args": [
"run",
"--directory",
"/path/to/your/search-tools/directory",
"main.py"
]
}
}
}
To add to claude code:
claude mcp add-json search-tools '{"type":"stdio","command":"/Users/yourusername/.local/bin/uv","args":[ "run", "--directory", "/path/to/your/search-tools/directory", "main.py"]}'
๐ Finding Your Paths
To find the correct paths for your system:
# Find uv location
which uv
# Get absolute path to search-tools directory
pwd # (run this from the search-tools directory)
๐ Available Tools
๐ contextual_keyword_search
Search for keywords with configurable context lines around matches.
Parameters:
keyword
: Search term (case insensitive)working_directory
: Absolute path to search directorynum_context_lines
: Lines of context (default: 2)
๐๏ธ get_repo_symbols
Extract symbols (functions, classes, methods) from your codebase.
Parameters:
repo
: Repository pathworking_directory
: Command execution directorykeep_types
: Filter by symbol typesfile_must_contain/file_must_not_contain
: File filtering
๐ get_symbol_usages
Find where specific symbols are used throughout your codebase.
Parameters:
repo
: Repository pathsymbol_name_or_substring
: Symbol to search forworking_directory
: Command execution directorysymbol_type
: Optional type filter
๐ฏ coderank_analysis
Analyze repository importance using the CodeRank algorithm.
Parameters:
repo_path
: Repository to analyzeexternal_modules
: Comma-separated external dependenciestop_n
: Number of top modules to return (default: 10)analyze_markdown
: Include markdown filesoutput_format
: "summary", "detailed", or "json"
๐ฅ find_code_hotspots
Identify critical code areas combining connectivity and usage frequency.
Parameters:
repo_path
: Repository pathworking_directory
: Command execution directorymin_connections
: Minimum import connections (default: 5)include_external
: Include external dependenciestop_n
: Number of hotspots to return (default: 20)
๐ trace_dependency_impact
Trace dependency chains and analyze refactoring impact.
Parameters:
repo_path
: Repository pathtarget_module
: Module to analyzeworking_directory
: Command execution directoryanalysis_type
: "dependency", "refactoring", or "both"max_depth
: Maximum trace depth (default: 3)change_type
: "modify", "split", "merge", or "remove"
๐ช smart_code_search
Enhanced search combining ripgrep with CodeRank prioritization.
Parameters:
keyword
: Search term (supports regex)repo_path
: Repository pathworking_directory
: Command execution directoryrank_results
: Sort by module importancecontext_lines
: Context lines around matches (default: 3)max_results
: Maximum results to return (default: 20)
๐งช Development & Testing
Running the Server
# Development mode
uv run mcp dev main.py
# Testing with MCP Inspector
npx @modelcontextprotocol/inspector python main.py
๐ง Dependencies
- mcp[cli]: Model Context Protocol framework
- cased-kit: Symbol analysis toolkit
- networkx: Graph analysis for CodeRank algorithm
๐จ Algorithm Details
CodeRank Algorithm
The CodeRank algorithm treats your codebase as a directed graph where:
- Nodes: Python modules, classes, functions, methods
- Edges: Import relationships and dependencies
- Weights: Different weights for internal vs external dependencies
This creates a ranking system that identifies the most "central" and important parts of your codebase, similar to how PageRank identifies important web pages.
๐ก Use Cases
- ๐ Code Exploration: Quickly understand large codebases
- ๐๏ธ Refactoring Planning: Identify high-impact areas before changes
- ๐ Documentation: Find the most important modules to document first
- ๐ Bug Investigation: Focus on critical code paths
- ๐ฅ Code Review: Prioritize review efforts on important modules
๐ค Contributing
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
๐ License
This project is open source. Please check the license file for details.
๐ฎ Powered by the CodeRank Algorithm & Model Context Protocol
Making code search intelligent, one repository at a time
Related Servers
Biel.ai MCP Server
Connect AI tools like Cursor and VS Code to your product documentation using the Biel.ai platform.
FileScopeMCP
Analyzes your codebase identifying important files based on dependency relationships. Generates diagrams and importance scores per file, helping AI assistants understand the codebase. Automatically parses popular programming languages, Python, Lua, C, C++, Rust, Zig.
Enhanced QR Code MCP Server
Advanced QR code generation and processing with support for custom styling, multiple formats, batch processing, and analytics.
CAD-MCP
Control CAD software with natural language instructions to perform drawing operations.
Remote MCP Server (Authless)
An example of a remote MCP server deployable on Cloudflare Workers, featuring customizable tools and no authentication.
Lucide Icons
Provides access to the Lucide icon library for use in LLM and agentic applications.
Tmux MCP Server
Provides persistent shell execution through tmux sessions.
Apache SkyWalking MCP
An MCP server for integrating AI agents with the SkyWalking observability platform and its ecosystem.
Clay MCP Server
An MCP server for interacting with the Clay API, which requires a Clay API key.
Replicate Minimax Image-01
Generate images using the minimax/image-01 model on Replicate.