一键导入
grepai-mcp-claude
Integrate GrepAI with Claude Code via MCP. Use this skill to enable semantic code search in Claude Code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Integrate GrepAI with Claude Code via MCP. Use this skill to enable semantic code search in Claude Code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Reference for all GrepAI MCP tools. Use this skill to understand available MCP tools and their parameters.
Advanced search options in GrepAI. Use this skill for JSON output, compact mode, and AI agent integration.
Find function callees with GrepAI trace. Use this skill to discover what functions a specific function calls.
Find function callers with GrepAI trace. Use this skill to discover what code calls a specific function.
Build complete call graphs with GrepAI trace. Use this skill for recursive dependency analysis.
Supported programming languages in GrepAI. Use this skill to understand which languages can be indexed and traced.
| name | grepai-mcp-claude |
| description | Integrate GrepAI with Claude Code via MCP. Use this skill to enable semantic code search in Claude Code. |
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 | Find function callees | symbol (required), compact |
grepai_trace_graph | Build call graph | symbol (required), depth |
grepai_index_status | Check index health | verbose (optional) |
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!