grepai-mcp-claude by yoanbernabeu/grepai-skills
npx skills add https://github.com/yoanbernabeu/grepai-skills --skill grepai-mcp-claude此技能涵盖使用模型上下文协议(MCP)将 GrepAI 与 Claude Code 集成。
模型上下文协议(MCP)允许 AI 助手使用外部工具。GrepAI 提供了一个 MCP 服务器,为 Claude Code 提供:
grepai watch)一条命令即可将 GrepAI 添加到 Claude Code:
claude mcp add grepai -- grepai mcp-serve
就这样!Claude Code 现在可以使用 GrepAI 工具了。
如果您更喜欢手动设置,请添加到 Claude Code 的 MCP 配置中:
~/.claude/mcp.json广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
%APPDATA%\Claude\mcp.json{
"mcpServers": {
"grepai": {
"command": "grepai",
"args": ["mcp-serve"]
}
}
}
如果您希望 GrepAI 始终使用特定项目:
{
"mcpServers": {
"grepai": {
"command": "grepai",
"args": ["mcp-serve"],
"cwd": "/path/to/your/project"
}
}
}
# 手动启动 MCP 服务器进行测试
grepai mcp-serve
您应该看到:
GrepAI MCP Server started
Listening for requests...
询问 Claude:
"在代码库中搜索身份验证代码"
Claude 应该会使用 grepai_search 工具。
连接后,Claude Code 可以访问以下工具:
| 工具 | 描述 | 参数 |
|---|---|---|
grepai_search | 语义代码搜索 | query(必需),limit,compact |
grepai_trace_callers | 查找函数调用者 | symbol(必需),compact |
grepai_trace_callees | 查找函数被调用者 | symbol(必需),compact |
grepai_trace_graph | 构建调用图 | symbol(必需),depth |
grepai_index_status | 检查索引健康状况 | verbose(可选) |
Claude 请求:
"查找与用户身份验证相关的代码"
Claude 使用:
{
"tool": "grepai_search",
"parameters": {
"query": "user authentication",
"limit": 5,
"compact": true
}
}
Claude 请求:
"哪些函数调用了 Login 函数?"
Claude 使用:
{
"tool": "grepai_trace_callers",
"parameters": {
"symbol": "Login",
"compact": true
}
}
Claude 请求:
"代码索引是最新的吗?"
Claude 使用:
{
"tool": "grepai_index_status",
"parameters": {
"verbose": true
}
}
默认情况下,MCP 工具返回紧凑的 JSON 以最小化令牌使用:
{
"q": "authentication",
"r": [
{"s": 0.92, "f": "src/auth/middleware.go", "l": "15-45"},
{"s": 0.85, "f": "src/auth/jwt.go", "l": "23-55"}
],
"t": 2
}
与完整内容相比,这减少了约 80% 的令牌使用量。
MCP 服务器使用当前工作目录。请确保:
grepai watch)cd /path/to/your/project
claude # Claude Code 现在使用此目录
{
"mcpServers": {
"grepai": {
"command": "grepai",
"args": ["mcp-serve"],
"cwd": "/path/to/your/project"
}
}
}
对于多个项目,您可以:
{
"mcpServers": {
"grepai-frontend": {
"command": "grepai",
"args": ["mcp-serve"],
"cwd": "/path/to/frontend"
},
"grepai-backend": {
"command": "grepai",
"args": ["mcp-serve"],
"cwd": "/path/to/backend"
}
}
}
grepai workspace create my-workspace
grepai workspace add my-workspace /path/to/frontend
grepai workspace add my-workspace /path/to/backend
{
"mcpServers": {
"grepai": {
"command": "grepai",
"args": ["mcp-serve", "--workspace", "my-workspace"]
}
}
}
❌ 问题: Claude 看不到 GrepAI 工具
✅ 解决方案:
grepai 是否在 PATH 中grepai mcp-serve❌ 问题: 搜索返回空结果
✅ 解决方案:
grepai watch.grepai/ 文件夹grepai status❌ 问题: MCP 服务器无法启动
✅ 解决方案:
curl http://localhost:11434/api/tagscat .grepai/config.yamlgrepai mcp-serve 查看错误信息❌ 问题: 结果来自错误的代码库
✅ 解决方案:
cwdgrepai_index_status 工具验证grepai watch --backgroundcwdgrepai_index_status要从 Claude Code 中移除 GrepAI:
claude mcp remove grepai
或者手动编辑 ~/.claude/mcp.json 并删除 grepai 条目。
成功的 MCP 设置:
✅ GrepAI MCP Integration Configured
Claude Code: ~/.claude/mcp.json
Server: grepai mcp-serve
Status: Connected
Available tools:
- grepai_search (semantic code search)
- grepai_trace_callers (find callers)
- grepai_trace_callees (find callees)
- grepai_trace_graph (call graphs)
- grepai_index_status (index health)
Claude can now search your code semantically!
每周安装次数
241
仓库
GitHub 星标数
15
首次出现
2026 年 1 月 28 日
安全审计
安装于
opencode194
codex187
gemini-cli171
github-copilot170
claude-code169
kimi-cli157
This skill covers integrating GrepAI with Claude Code using the Model Context Protocol (MCP).
Model Context Protocol (MCP) allows AI assistants to use external tools. GrepAI provides an MCP server that gives Claude Code:
grepai watch)One command to add GrepAI to Claude Code:
claude mcp add grepai -- grepai mcp-serve
That's it! Claude Code can now use GrepAI tools.
If you prefer manual setup, add to Claude Code's MCP config:
~/.claude/mcp.json%APPDATA%\Claude\mcp.json{
"mcpServers": {
"grepai": {
"command": "grepai",
"args": ["mcp-serve"]
}
}
}
If you want GrepAI to always use a specific project:
{
"mcpServers": {
"grepai": {
"command": "grepai",
"args": ["mcp-serve"],
"cwd": "/path/to/your/project"
}
}
}
# Start MCP server manually to test
grepai mcp-serve
You should see:
GrepAI MCP Server started
Listening for requests...
Ask Claude:
"Search the codebase for authentication code"
Claude should use the grepai_search tool.
Once connected, Claude Code has access to these tools:
| Tool | Description | Parameters |
|---|---|---|
grepai_search | Semantic code search | query (required), limit, compact |
grepai_trace_callers | Find function callers | symbol (required), compact |
grepai_trace_callees |
Claude request:
"Find code related to user authentication"
Claude uses:
{
"tool": "grepai_search",
"parameters": {
"query": "user authentication",
"limit": 5,
"compact": true
}
}
Claude request:
"What functions call the Login function?"
Claude uses:
{
"tool": "grepai_trace_callers",
"parameters": {
"symbol": "Login",
"compact": true
}
}
Claude request:
"Is the code index up to date?"
Claude uses:
{
"tool": "grepai_index_status",
"parameters": {
"verbose": true
}
}
By default, MCP tools return compact JSON to minimize tokens:
{
"q": "authentication",
"r": [
{"s": 0.92, "f": "src/auth/middleware.go", "l": "15-45"},
{"s": 0.85, "f": "src/auth/jwt.go", "l": "23-55"}
],
"t": 2
}
This reduces token usage by ~80% compared to full content.
The MCP server uses the current working directory. Ensure:
grepai watch first)cd /path/to/your/project
claude # Claude Code now uses this directory
{
"mcpServers": {
"grepai": {
"command": "grepai",
"args": ["mcp-serve"],
"cwd": "/path/to/your/project"
}
}
}
For multiple projects, you can:
{
"mcpServers": {
"grepai-frontend": {
"command": "grepai",
"args": ["mcp-serve"],
"cwd": "/path/to/frontend"
},
"grepai-backend": {
"command": "grepai",
"args": ["mcp-serve"],
"cwd": "/path/to/backend"
}
}
}
grepai workspace create my-workspace
grepai workspace add my-workspace /path/to/frontend
grepai workspace add my-workspace /path/to/backend
{
"mcpServers": {
"grepai": {
"command": "grepai",
"args": ["mcp-serve", "--workspace", "my-workspace"]
}
}
}
❌ Problem: Claude doesn't see GrepAI tools
✅ Solutions:
grepai is in PATHgrepai mcp-serve manually❌ Problem: Searches return empty
✅ Solutions:
grepai watch has run.grepai/grepai status❌ Problem: MCP server won't start
✅ Solutions:
curl http://localhost:11434/api/tagscat .grepai/config.yamlgrepai mcp-serve manually to see errors❌ Problem: Results from wrong codebase
✅ Solutions:
cwd in MCP configgrepai_index_status toolgrepai watch --backgroundcwd in configgrepai_index_statusTo remove GrepAI from Claude Code:
claude mcp remove grepai
Or manually edit ~/.claude/mcp.json and remove the grepai entry.
Successful MCP setup:
✅ GrepAI MCP Integration Configured
Claude Code: ~/.claude/mcp.json
Server: grepai mcp-serve
Status: Connected
Available tools:
- grepai_search (semantic code search)
- grepai_trace_callers (find callers)
- grepai_trace_callees (find callees)
- grepai_trace_graph (call graphs)
- grepai_index_status (index health)
Claude can now search your code semantically!
Weekly Installs
241
Repository
GitHub Stars
15
First Seen
Jan 28, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode194
codex187
gemini-cli171
github-copilot170
claude-code169
kimi-cli157
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
140,500 周安装
| Find function callees |
symbol (required), compact |
grepai_trace_graph | Build call graph | symbol (required), depth |
grepai_index_status | Check index health | verbose (optional) |