Ceregrep MCP Server
MCP (Model Context Protocol) server that exposes ceregrep query capabilities to other agents.
What is This?
This MCP server allows any MCP-compatible agent (like Claude Desktop) to use ceregrep as a tool for querying and analyzing codebases. Instead of the agent manually using bash and grep, it can ask ceregrep (which has its own LLM-powered analysis) to find context.
Features
- ceregrep_query: Query ceregrep to find context in codebases
- Natural language queries (e.g., "Find all async functions", "Explain the auth flow")
- Automatic code exploration using ceregrep's bash + grep tools
- LLM-powered analysis and context gathering
Prerequisites
-
Ceregrep CLI installed globally:
npm install -g ceregrep
-
Python ≥ 3.10 (for pip installation) or uvx (for no-install usage)
Installation
Option 1: Using uvx (Recommended - No Installation Required)
# No installation needed! Just use uvx to run it
uvx ceregrep-mcp
Option 2: Install via pip
pip install ceregrep-mcp
Option 3: Install from source (Development)
cd mcp-server
pip install -e .
Usage
Using with uvx (Recommended)
The easiest way to use ceregrep-mcp is with uvx, which runs the package without installation:
uvx ceregrep-mcp
Add to Claude Desktop
Method 1: Using Claude MCP CLI (Easiest)
claude mcp add ceregrep uvx ceregrep-mcp
This automatically adds ceregrep-mcp to your Claude configuration.
Method 2: Manual Configuration
Edit your Claude Desktop MCP configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Add this configuration:
{
"mcpServers": {
"ceregrep": {
"command": "uvx",
"args": ["ceregrep-mcp"]
}
}
}
If you installed via pip:
{
"mcpServers": {
"ceregrep": {
"command": "ceregrep-mcp"
}
}
}
Add to Other MCP Clients
For any MCP-compatible client, add to your mcp.json or equivalent config file:
{
"mcpServers": {
"ceregrep": {
"command": "uvx",
"args": ["ceregrep-mcp"],
"env": {}
}
}
}
Add to Ceregrep Itself (Recursive Pattern)
You can even use ceregrep's own MCP client to connect to this server! Add to .ceregrep.json or ~/.ceregrep.json:
{
"mcpServers": {
"ceregrep-context": {
"type": "stdio",
"command": "uvx",
"args": ["ceregrep-mcp"]
}
}
}
Now ceregrep can delegate context-finding to another instance of itself!
Available Tools
ceregrep_query
Query ceregrep to find context in a codebase.
Parameters:
query(required): Natural language querycwd(optional): Working directory to run ceregrep inmodel(optional): LLM model to useverbose(optional): Enable verbose output
Example queries:
- "Find all async functions in this codebase"
- "Explain how the authentication system works"
- "Show me all API endpoints"
- "Find files that handle database connections"
- "Analyze the project architecture"
Agent Tools (7 Specialized Agents)
All ceregrep agents are automatically exposed as MCP tools! External systems like Claude Code can invoke specialized agents directly.
Available agents:
-
agent_debug_agent - Debugging expert
- Analyzes error messages and stack traces
- Identifies root causes of bugs
- Suggests fixes with explanations
-
agent_context_agent - Context discovery specialist
- Explores codebases systematically
- Maps architecture and code flows
- Provides comprehensive context
-
agent_postgres_agent - PostgreSQL specialist
- Database schema analysis
- Query optimization
- SQL best practices
-
agent_review_agent - Code review expert
- Reviews code for quality and best practices
- Identifies security vulnerabilities
- Suggests improvements
-
agent_test_agent - Test writing specialist
- Writes comprehensive unit/integration tests
- Identifies test coverage gaps
- Follows testing best practices
-
agent_docs_agent - Documentation expert
- Generates API documentation
- Writes README files and guides
- Creates clear, comprehensive docs
-
agent_orchestrator_agent - Meta-agent coordinator
- Coordinates multiple specialized agents
- Breaks down complex problems
- Synthesizes responses from agents
Parameters (all agents):
prompt(required): The prompt/query to send to the agentcwd(optional): Working directory to run inmodel(optional): LLM model to useverbose(optional): Enable verbose output
Example usage:
agent_debug_agent: "Why is my authentication failing with a 401 error?"agent_context_agent: "Explain the payment processing system architecture"agent_review_agent: "Review the authentication middleware for security issues"
Example: Using Agents from Claude Code
Once you've added ceregrep-mcp to Claude Code, you can ask Claude to use specialized agents:
User: "Use the debug-agent to investigate why login is returning 401 errors"
Claude Code: (Sees agent_debug_agent as available tool, invokes it)
The debug agent will:
- Explore your authentication code
- Check error handling patterns
- Analyze JWT validation logic
- Provide specific debugging guidance
Response format:
## Debug Agent Response
**Prompt:** Investigate why login is returning 401 errors
I've analyzed your authentication system. Here's what I found:
1. JWT Token Validation (src/auth/middleware.ts:45)
- The token expiration check is failing
- Issue: Clock skew between server and client
2. Suggested Fix:
- Add a 30-second leeway to token validation
- Update JWT_VERIFY_OPTIONS to include clockTolerance
[... detailed debugging context ...]
How It Works
- Agent sends a natural language query to ceregrep_query tool
- MCP server invokes the ceregrep CLI with the query
- Ceregrep uses its own LLM + bash + grep tools to explore the codebase
- Results are returned to the requesting agent
This creates a recursive agent pattern where agents can delegate complex context-finding to specialized sub-agents.
Configuration
The MCP server uses the ceregrep CLI, which reads configuration from:
.ceregrep.jsonin the working directory~/.config/ceregrep/config.json(global config)- Environment variables (
ANTHROPIC_API_KEY,CEREBRAS_API_KEY)
Development
Project Structure
mcp-server/
├── mcp_server.py # Main MCP server
├── tool_discovery.py # Auto-discovery system
├── tools/
│ ├── base_tool.py # Base tool class
│ └── ceregrep_query_tool.py # Ceregrep query tool
├── pyproject.toml # Dependencies
└── README.md # This file
Adding New Tools
- Create a new file in
tools/ - Inherit from
BaseTool - Implement
name,description,input_schema, andexecute() - Restart server - tool is auto-discovered!
Agent Discovery and Caching
The MCP server automatically discovers agents by running ceregrep agent list --json. To optimize performance:
- Agent list is cached for 5 minutes - New agents will be visible within 5 minutes without restarting the MCP server
- Cache refreshes automatically - After 5 minutes, the agent list is refreshed on the next tool list request
- Manual refresh - Restart the MCP server to immediately refresh the agent list
This means you can:
- Create a new agent with
ceregrep agent initorceregrep agent import - Use it in Claude Code within 5 minutes (or restart the MCP server for immediate availability)
Troubleshooting
"ceregrep command not found"
Run npm link in the ceregrep-client directory to install the CLI globally.
MCP connection errors
Ensure Python ≥ 3.10 and uv are installed:
python --version # Should be ≥ 3.10
uv --version # Should be installed
Query failures
Check ceregrep configuration:
ceregrep config # View current config
Ensure API keys are set:
ANTHROPIC_API_KEYfor ClaudeCEREBRAS_API_KEYfor Cerebras
License
AGPL-3.0-or-later
Metadata
Release files for scout-mcp 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| scout_mcp-0.2.3.tar.gz | 11.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scout_mcp-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.5 kB
Release files / scout_mcp-0.2.3.tar.gz
| Download URL | scout_mcp-0.2.3.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9bc539c623d56f2de5cf4a37f36af86174e2f377e0b36537749b5f0bfc6b44fa
|
|
BLAKE2b-256 checksum How to use checksums |
54b8ed5795c81b6f0e5a4e013217c34078cef0b1ec6fdfef744b86269c0569f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / scout_mcp-0.2.3-py3-none-any.whl
| Download URL | scout_mcp-0.2.3-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7945cf018f320276324b9f2193d5e341c03e32b7a28f8405ee8de09e7869b407
|
|
BLAKE2b-256 checksum How to use checksums |
3a4293c8919dca613f2ef0500404dde089b2f0cbc953a1281c168946af9b9164
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|