npx skills add ...
npx skills add yoanbernabeu/grepai-skills --skill grepai-mcp-claude
Integrate GrepAI with Claude Code via MCP. Use this skill to enable semantic code search in Claude Code.
npx skills add yoanbernabeu/grepai-skills --skill grepai-mcp-claude
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:
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.jsonIf you want GrepAI to always use a specific project:
You should see:
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:
Claude request:
"What functions call the Login function?"
Claude uses:
Claude request:
"Is the code index up to date?"
Claude uses:
By default, MCP tools return compact JSON to minimize tokens:
This reduces token usage by ~80% compared to full content.
The MCP server uses the current working directory. Ensure:
grepai watch first)For multiple projects, you can:
❌ 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:
Or manually edit ~/.claude/mcp.json and remove the grepai entry.
Successful MCP setup:
{
"mcpServers": {
"grepai": {
"command": "grepai",
"args": ["mcp-serve"],
"cwd": "/path/to/your/project"
}
}
}{
"mcpServers": {
"grepai": {
"command": "grepai",
"args": ["mcp-serve"],
"cwd": "/path/to/your/project"
}
}
}# Start MCP server manually to test
grepai mcp-serveGrepAI MCP Server started
Listening for requests...{
"tool": "grepai_search",
"parameters": {
"query": "user authentication",
"limit": 5,
"compact": true
}
}{
"tool": "grepai_trace_callers",
"parameters": {
"symbol": "Login",
"compact": true
}
}{
"tool": "grepai_index_status",
"parameters": {
"verbose": true
}
}{
"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
}cd /path/to/your/project
claude # Claude Code now uses this directory{
"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 mcp remove grepai✅ 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!