grepai-mcp-claude
Integrate GrepAI with Claude Code via MCP. Use this skill to enable semantic code search in Claude Code.
By yoanbernabeu · 599 installs
npx skills add yoanbernabeu/grepai-skills --skill grepai-mcp-claude
Source repository · Upstream listing
GrepAI MCP Integration with Claude Code
This skill covers integrating GrepAI with Claude Code using the Model Context Protocol (MCP).
When to Use This Skill
Setting up GrepAI in Claude Code
Enabling semantic search for AI coding assistant
Configuring MCP server for Claude
Troubleshooting Claude Code integration
What is MCP?
Model Context Protocol (MCP) allows AI assistants to use external tools. GrepAI provides an MCP server that gives Claude Code:
Semantic code search
Call graph analysis
Index status monitoring
Prerequisites
1. GrepAI installed
2. Ollama running (or other embedding provider)
3. Project indexed ( grepai watch )
4. Claude Code installed
Quick Setup
One command to add GrepAI to Claude Code:
That's it! Claude Code can now use GrepAI tools.
Manual Configuration
If you prefer manual setup, add to Claude Code's MCP config:
Location
macOS/Linux: ~/.claude/mcp.json
Windows: %APPDATA%\Claude\mcp.json
Configuration
With Working Directory
If you want GrepAI to always use a specific project:
Verifying Installation
Check MCP Server
You should see:
In Claude Code
Ask Claude:
"Search the codebase for authentication code"
Claude should use the grepai search tool.
Available Tools
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)
Tool Usage Examples
Semantic Search
Claude request:
"Find code related to user authentication"
Claude uses:
Trace Analysis
Claude request:
"What functions call the Login function?"
Claude uses:
Index Status
Claude request:
"Is the code index up to date?"
Claude uses:
Compact Mode
By default, MCP tools return compact JSON to minimize tokens:
This reduces token usage by ~80% compared to full content.
Working Directory
The MCP server uses the current working directory. Ensure:
1. GrepAI is initialized in your project
2. Index exists (run grepai watch first)
3. Start Claude Code from your project directory
Option 1: Start Claude from Project Directory
Option 2: Configure CWD in MCP Config
Multiple Projects
For multiple projects, you can:
Option 1: Multiple MCP Servers
Option 2: Use Workspaces
Troubleshooting
Tool Not Available
❌ Problem: Claude doesn't see GrepAI tools
✅ Solutions:
1. Restart Claude Code after config changes
2. Check MCP config syntax (valid JSON)
3. Verify grepai is in PATH
4. Test: grepai mcp serve manually
Search Returns No Results
❌ Problem: Searches return empty
✅ Solutions:
1. Ensure grepai watch has run
2. Check working directory has .grepai/
3. Verify index exists: grepai status
Connection Refused
❌ Problem: MCP server won't start
✅ Solutions:
1. Check Ollama is running: curl http://localhost:11434/api/tags
2. Verify config: cat .grepai/config.yaml
3. Run grepai mcp serve manually to see errors
Wrong Project Indexed
❌ Problem: Results from wrong codebase
✅ Solutions:
1. Check cwd in MCP config
2. Start Claude from correct directory
3. Verify with grepai index status tool
Best Practices
1. Keep index updated: Run grepai watch background
2. Use compact mode: Reduces token usage
3. Set working directory: Explicit cwd in config
4. Check status first: Use grepai index status
5. Restart after config: Claude needs restart for MCP changes
Removing Integration
To remove GrepAI from Claude Code:
Or manually edit ~/.claude/mcp.json and remove the grepai entry.
Output Format
Successful MCP setup: