克劳德·格雷普
类似Grep的工具,用于搜索Claude对话历史记录,具有强大的过滤功能、多种输出格式和项目感知上下文。
特性
- 综合搜索:按关键字、文件、错误或模式查找对话
- 多种输出格式:表格、列表、CSV、markdown、JSON
- 项目上下文:自动将搜索限制到当前项目
- 钻取能力:查看带有上下文的完整对话
- 耗尽模式:优先考虑完整性的深度搜索
- MCP集成:与Claude Desktop无缝协作
安装
NPM(推荐)
npm install -g claude-grep来源
git clone https://github.com/iamneilroberts/claude-grep.git
cd claude-grep
npm install
npm run build
npm linkMCP(模型上下文协议)配置
claude-grep通过MCP与claude Desktop集成,允许您直接在claude中搜索对话。
为Claude Desktop设置MCP
- 打开克劳德桌面设置
- 在 macOS 上: Claude → Settings → Developer → Edit Config - 在Windows上: File → Preferences → Developer → Edit Config
- 将claude grep添加到您的MCP设置中:
{
"mcpServers": {
"claude-grep": {
"command": "npx",
"args": ["claude-grep", "mcp"]
}
}
}- 重新启动克劳德桌面 以使更改生效。
替代MCP配置(本地安装)
如果您是从源代码安装的,或者想使用特定的安装:
{
"mcpServers": {
"claude-grep": {
"command": "node",
"args": ["/path/to/claude-grep/dist/mcp/server.js"]
}
}
}在claude Desktop中使用claude grep
配置后,您可以使用自然语言搜索您的对话:
- “搜索有关TypeScript错误的对话”
- “查找我们讨论身份验证系统的位置”
- “显示提及package.json的对话”
- “将对话abc123导出到文件”
MCP集成提供了以下工具:
search_conversations-使用关键字搜索search_for_files-查找提及特定文件的对话get_conversation_details-查看完整对话export_conversation-将对话导出到文件(非常适合Claude的紧凑视图)list_projects-查看您的所有项目switch_project-更改活动项目
快速开始
CLI使用情况
# Search for a keyword
claude-grep search "TypeError"
# Search with table output (default)
claude-grep search "async function" --format table
# Search in specific project
claude-grep search "bug fix" --project my-project
# Exhaustive search (slower but complete)
claude-grep search "edge case" --exhaustive在克劳德桌面
MCP设置后,在Claude中使用以下命令:
- 搜索:“搜索有关TypeScript错误的对话”
- 文件:“查找上次编辑package.json的时间”
- 深入分析:“向我展示关于该bug修复的完整对话”
输出格式
表格格式(默认)
Session Time Match Preview Files
4dK92La_conversati... 17 hours ago ...dealing with TypeScript err... src/types.ts, src/index.ts
9mN31Pb_conversati... 2 days ago ...fixed the async/await issue... lib/async.js列表格式
1. Session 4dK92La (17 hours ago)
Files: src/types.ts, src/index.ts
Match: "...when dealing with TypeScript errors in the..."
2. Session 9mN31Pb (2 days ago)
Files: lib/async.js
Match: "...successfully fixed the async/await issue by..."高级用法
Web用户界面
启动可视化搜索的web界面:
# Start web server on default port (3000)
claude-grep web
# Start on custom port
claude-grep web --port 8080
# Start without opening browser
claude-grep web --no-openweb界面提供:
- 实时搜索实时结果
- 项目切换
- 使用对话内搜索深入了解对话
- 支持多种输出格式
- 受克劳德启发的黑暗主题
安全说明:web服务器仅设计用于本地使用。你的对话数据永远不会离开你的机器。不要将web服务器暴露在互联网上,因为它不包括身份验证。
持久首选项
设置默认输出格式:
claude-grep config set format markdown发展
# Clone the repository
git clone https://github.com/iamneilroberts/claude-grep.git
cd claude-grep
# Install dependencies
npm install
# Run in development mode
npm run dev
# Run tests
npm test故障排除
MCP连接问题
如果claude grep在claude Desktop中不工作:
- 检查配置路径
- 确保配置文件保存在正确的位置 - 常见位置: - macOS: ~/Library/Application Support/Claude/claude_desktop_config.json - 窗户: %APPDATA%\Claude\claude_desktop_config.json
- 验证安装
# Check if claude-grep is installed globally
npm list -g claude-grep
# Test MCP server directly
npx claude-grep mcp- 检查克劳德桌面日志
- 在Claude Desktop中打开开发人员工具 - 在控制台中查找与MCP相关的错误
- 常见修复
- 配置更改后重新启动Claude Desktop - 确保您拥有最新版本的claude grep - 检查Node.js是否在您的系统PATH中
权限问题
如果遇到权限错误:
# On macOS/Linux
sudo npm install -g claude-grep
# Or use a Node version manager like nvm
nvm use 18
npm install -g claude-grep许可证
麻省理工学院
