npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ceregrep

v0.2.4

Published

Headless agent framework with Bash, Ripgrep, and MCP support - invocable via TypeScript SDK, Python SDK, and CLI

Readme

Ceregrep Client

npm version npm downloads license

A modular, headless agent framework with support for Bash, Ripgrep, and MCP (Model Context Protocol). Can be invoked via TypeScript SDK, Python SDK, or CLI. Now available on npm!

Features

  • Headless Architecture: No UI dependencies, pure SDK/CLI
  • Modular Tools: Bash execution, Ripgrep search, extensible via MCP
  • Multiple Interfaces: TypeScript SDK, Python SDK (planned), CLI
  • Multi-Provider LLM: Support for Anthropic Claude and Cerebras (Qwen 3 Coder 480B)
  • MCP Support: Connect to Model Context Protocol servers for additional tools
  • Automatic Provider Routing: Seamlessly switch between LLM providers via config

Installation

From npm

npm install ceregrep

Or install globally for CLI usage:

npm install -g ceregrep

From source (development)

# Clone the repository
git clone https://github.com/swarmcode/ceregrep-client.git
cd ceregrep-client

# Install dependencies
npm install

# Build
npm run build

# Install globally from source
npm link

After running npm link, you can use the ceregrep command anywhere in your system.

Quick Start

TypeScript SDK

import { CeregrepClient } from 'ceregrep';

const client = new CeregrepClient({
  model: 'claude-sonnet-4-20250514',
  apiKey: process.env.ANTHROPIC_API_KEY,
});

// Query the agent
const result = await client.query('List all TypeScript files in the current directory');

console.log('Agent response:', result.messages);

CLI

# Query the agent
ceregrep query "List all TypeScript files"

# List available tools
ceregrep list-tools

# Show configuration
ceregrep config

Configuration

Ceregrep supports both global and project-specific configuration:

  • Global config: ~/.ceregrep.json or ~/.swarmrc (applies to all projects)
  • Project config: .ceregrep.json or .swarmrc in project directory (overrides global)

Create a global config for system-wide defaults, or project configs to override settings per-project.

Anthropic Claude (Default)

{
  "model": "claude-sonnet-4-20250514",
  "apiKey": "your-anthropic-api-key",
  "mcpServers": {
    "filesystem": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/directory"]
    }
  },
  "verbose": false,
  "debug": false
}

Cerebras (Qwen 3 Coder 480B)

Global config (recommended for Cerebras):

cat > ~/.ceregrep.json << 'EOF'
{
  "model": "qwen-3-coder-480b",
  "provider": {
    "type": "cerebras",
    "apiKey": "csk-your-cerebras-api-key",
    "baseURL": "https://api.cerebras.ai/v1",
    "temperature": 0.7,
    "top_p": 0.8
  },
  "verbose": true,
  "debug": false
}
EOF

Project config (alternative):

{
  "model": "qwen-3-coder-480b",
  "provider": {
    "type": "cerebras",
    "apiKey": "csk-your-cerebras-api-key",
    "baseURL": "https://api.cerebras.ai/v1",
    "temperature": 0.7,
    "top_p": 0.8
  },
  "verbose": false,
  "debug": false
}

Environment Variables

You can also set API keys via environment variables:

# For Anthropic
export ANTHROPIC_API_KEY=your-key-here

# For Cerebras
export CEREBRAS_API_KEY=your-key-here

Available Tools

Built-in Tools

  • Bash: Execute shell commands in a persistent shell session
  • Grep: Search for patterns in files using ripgrep

MCP Tools

Connect to any MCP server to extend functionality. Configure servers in .ceregrep.json:

{
  "mcpServers": {
    "server-name": {
      "type": "stdio",
      "command": "node",
      "args": ["path/to/server.js"]
    }
  }
}

API Reference

CeregrepClient

class CeregrepClient {
  constructor(options?: QueryOptions);

  // Query the agent
  async query(prompt: string, options?: QueryOptions): Promise<QueryResult>;

  // Get conversation history
  getHistory(): Message[];

  // Clear history
  clearHistory(): void;

  // Compact history (summarize with LLM)
  async compact(): Promise<void>;

  // Set custom tools
  setTools(tools: Tool[]): void;

  // Set model
  setModel(model: string): void;
}

QueryOptions

interface QueryOptions {
  model?: string;
  apiKey?: string;
  tools?: Tool[];
  maxThinkingTokens?: number;
  verbose?: boolean;
  debug?: boolean;
  dangerouslySkipPermissions?: boolean;
}

Architecture

The framework consists of several modular components:

  • Core: Agent execution loop, message handling, tool interface
  • Tools: Bash, Grep, and tool registry
  • LLM: Anthropic client with tool formatting
  • MCP: Model Context Protocol integration
  • Config: Configuration loading and validation
  • SDK: TypeScript (and Python) client libraries
  • CLI: Command-line interface

MCP Server

Ceregrep can also be exposed as an MCP server, allowing other agents to use it as a tool for querying and analyzing codebases. Now available on PyPI!

What is the MCP Server?

The MCP server (mcp-server/) turns ceregrep into a context-finding tool that other agents can call. Instead of manually using bash and grep, agents can ask ceregrep (which has its own LLM-powered analysis) to find context.

This creates a recursive agent pattern where agents can delegate complex context-finding to specialized sub-agents.

Quick Setup

Prerequisites:

# Install ceregrep CLI first
npm install -g ceregrep

Option 1: Using Claude MCP CLI (Easiest)

claude mcp add ceregrep uvx ceregrep-mcp

Option 2: Using uvx (No Installation Required)

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "ceregrep": {
      "command": "uvx",
      "args": ["ceregrep-mcp"]
    }
  }
}

Option 3: Install via pip

pip install ceregrep-mcp

# Then add to Claude Desktop:
{
  "mcpServers": {
    "ceregrep": {
      "command": "ceregrep-mcp"
    }
  }
}

Available MCP Tools

  • ceregrep_query: Query ceregrep to find context in codebases
    • Parameters: query (required), cwd, model, verbose
    • Example queries:
      • "Find all async functions in this codebase"
      • "Explain how the authentication system works"
      • "Show me all API endpoints"

See mcp-server/README.md for full documentation.

Development

# Install dependencies
npm install

# Build
npm run build

# Development mode (watch)
npm run dev

Requirements

  • Node.js >= 18.0.0
  • Anthropic API key
  • ripgrep (rg) installed for Grep tool

License

MIT