File Search MCP
Enables blazingly fast file and content searching in large codebases using ripgrep, with intelligent filtering, fuzzy finding, and directory tree visualization while respecting .gitignore and avoiding common bloat directories.
README
file-search-mcp
A blazingly fast MCP server for searching files in large codebases and monorepos.
Why This Exists
Standard tools like grep and find are painfully slow on large codebases. They don't respect .gitignore, they follow symlink loops, and they flood your terminal with irrelevant results from node_modules.
file-search-mcp fixes all that:
| Problem | Solution |
|---|---|
grep is slow on big repos |
Uses ripgrep (100x faster) |
find follows symlink loops |
Built-in loop detection |
| Results flood the terminal | Smart token-based truncation |
| Binary files pollute results | Auto-detected and skipped |
| Need to remember complex flags | Simple, intuitive parameters |
| No context for matches | Configurable context lines |
| Case sensitivity confusion | Smart case by default |
Installation
Prerequisites
- Node.js 18+
- ripgrep (for content search)
# Install ripgrep
brew install ripgrep # macOS
apt install ripgrep # Ubuntu
choco install ripgrep # Windows
Quick Start (npx)
No installation required! Just add to your MCP client config:
{
"mcpServers": {
"file-search": {
"command": "npx",
"args": ["-y", "file-search-mcp"]
}
}
}
Global Install
npm install -g file-search-mcp
Then use in your config:
{
"mcpServers": {
"file-search": {
"command": "file-search-mcp"
}
}
}
Usage with Claude Desktop
Add to your Claude Desktop config:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"file-search": {
"command": "npx",
"args": ["-y", "file-search-mcp"]
}
}
}
Usage with OpenCode
Add to your OpenCode config (~/.config/opencode/config.json):
{
"mcp": {
"file-search": {
"type": "local",
"command": ["npx", "-y", "file-search-mcp"]
}
}
}
Tools
search_files
Find files by name or glob pattern.
"Find all TypeScript files"
→ search_files(pattern: "*.ts")
"Find config files modified today"
→ search_files(pattern: "*.config.*", modified_within: "24h")
"Find large log files"
→ search_files(pattern: "*.log", min_size: "10MB")
Parameters:
reasoning(required) - Why you're searchingpattern(required) - Glob pattern like*.ts,src/**/*.jspath- Directory to search (default: current dir)include_hidden- Include dotfiles (default: true)ignore_gitignore- Respect .gitignore (default: true)exclude- Extra patterns to skipdetail_level-minimal|standard|fullmodified_within- Only recent files, e.g.,24h,7dmin_size- Only large files, e.g.,1MB
search_content
Find text or regex patterns inside files.
"Find all TODO comments"
→ search_content(query: "TODO")
"Find API endpoints"
→ search_content(query: "app\.(get|post|put|delete)", file_pattern: "*.ts")
"Find hardcoded secrets"
→ search_content(query: "apiKey|secret|password")
Parameters:
reasoning(required) - Why you're searchingquery(required) - Text or regex to findpath- Directory to search (default: current dir)file_pattern- Only search matching filesinclude_hidden- Include dotfiles (default: true)ignore_gitignore- Respect .gitignore (default: true)exclude- Extra patterns to skipdetail_level-minimal|standard|fullcontext_lines- Lines around matches (default: 2)
fuzzy_find
Fuzzy search when you don't remember exact names.
"Find the user controller"
→ fuzzy_find(query: "usrctrl")
"Find that API routes file"
→ fuzzy_find(query: "apirts")
Parameters:
reasoning(required) - Why you're searchingquery(required) - Fuzzy search termspath- Directory to search (default: current dir)include_hidden- Include dotfiles (default: true)detail_level-minimal|standard|full
tree
Visualize directory structure.
"Show me the project structure"
→ tree(depth: 3)
"What's in the src folder?"
→ tree(path: "src", depth: 2)
Parameters:
reasoning(required) - Why you need this viewpath- Directory to show (default: current dir)depth- How deep to traverse (default: 3)include_hidden- Show dotfiles (default: false)dirs_only- Only show directories (default: false)
Detail Levels
| Level | What You Get |
|---|---|
minimal |
Just paths - fast, low tokens |
standard |
Paths + size + modified date |
full |
Everything + content preview/matches |
Smart Features
Smart Case
Searches are case-insensitive by default, but become case-sensitive if your query contains uppercase letters. This matches how VS Code, ripgrep, and most modern tools work.
Token Limiting
Results are automatically truncated to ~100k tokens to prevent overwhelming responses. You'll see a warning if truncation occurred.
Binary Detection
Binary files (images, executables, archives, etc.) are automatically skipped to keep results clean and relevant.
Symlink Safety
Symlinks are followed, but loops are detected and prevented. No more infinite traversal!
Default Excludes
These directories are always skipped unless you override:
node_modules.gitdist,buildcoverage.next,.nuxt__pycache__,.pytest_cachevenv,.venvtarget(Rust)vendor(Go)
Development
# Run in development mode
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run tests
npm test
npm run test:watch # Watch mode
Metrics
All tool calls are tracked locally for development analysis. Metrics include:
- Tool usage counts
- Search patterns and queries
- Response times
- Error and truncation rates
- Reasoning text for understanding use cases
# View metrics summary
npm run metrics
# View last 50 raw calls
npm run metrics:raw
# Clear all metrics
npm run metrics:clear
Metrics are stored at ~/.file-search-mcp/metrics.json
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。