@atef_andrus/mcp-ripgrep

@atef_andrus/mcp-ripgrep

An MCP server that wraps ripgrep to provide powerful text search, search-and-replace, file listing, and file type listing capabilities within a defined scope.

Category
Visit Server

README

@atef_andrus/mcp-ripgrep

npm version CI License: MIT

An MCP server that provides ripgrep search capabilities.

Prerequisites

  • ripgrep (rg) installed and available on PATH
  • Node.js 22+ or Bun 1.3+

Installation

npm install @atef_andrus/mcp-ripgrep

Usage

Use as an MCP Server

Add the following to your MCP client configuration:

{
  "mcpServers": {
    "ripgrep": {
      "command": "npx",
      "args": ["@atef_andrus/mcp-ripgrep"]
    }
  }
}

Startup Options

Option Description
--allow-dir <path> Restrict search scope to the specified directory (can be specified multiple times)
--max-result-chars <number> Maximum characters in results. Truncates at line boundaries when exceeded (default: 50,000)
--max-output-bytes <number> Maximum bytes of ripgrep output. Terminates the process and truncates results when exceeded (default: 20 MB)

Configuration example with startup options:

{
  "mcpServers": {
    "ripgrep": {
      "command": "npx",
      "args": [
        "@atef_andrus/mcp-ripgrep",
        "--allow-dir", "/home/user/project",
        "--max-result-chars", "50000",
        "--max-output-bytes", "20000000"
      ]
    }
  }
}

Tools

Tool Description
search Pattern search with regex, literal strings, multiline matching, OR matching, context lines, and various filters. Prepends a summary of match count and file count to results
search-and-replace Search-and-replace preview (read-only). Supports multiline matching and capture groups ($1, ${name})
search-count Count matches per file (by line count or total matches). Supports sorting results
search-files List files that match or do not match a pattern
list-files List all files within the search scope
list-file-types List file types supported by ripgrep

Key Parameters

Parameter Description
pattern Search pattern (regex by default)
path Directory or file to search
fixedStrings Treat the pattern as a literal string
caseSensitive true = case-sensitive, false = case-insensitive, omitted = smart-case
fileType Filter by file type (e.g., "ts", ["ts", "js"]). String or array
fileTypeNot Exclude file types (e.g., "json", ["json", "md"]). String or array
glob Filter by glob pattern (e.g., "*.test.ts", ["src/**", "!vendor/**"]). String or array
includeHidden Include hidden files
followSymlinks Follow symbolic links
maxDepth Maximum directory traversal depth
noIgnore Ignore .gitignore rules and search files that are normally excluded
multiline Enable multiline matching (function signatures, import blocks, etc.)
additionalPatterns Additional patterns for OR matching (array)
sortBy Sort results. search / search-files / list-files: "path" "modified" "created". search-count: "path" "count" "count-asc"
maxCharacters Maximum characters in results. Truncates at line boundaries and appends a summary when exceeded

Parameter Support by Tool

<!-- params-table-start -->

Parameter list-file-types list-files search search-and-replace search-count search-files
pattern - - o o o o
path - o o o o o
fixedStrings - - o o o o
caseSensitive - - o o o o
wordMatch - - o o o o
multiline - - o o - -
fileType - o o o o o
fileTypeNot - o o o o o
glob - o o o o o
maxResults - - o o - -
contextLines - - o - - -
beforeContext - - o - - -
afterContext - - o - - -
invertMatch - - o - - o
includeHidden - o o o o o
followSymlinks - o o o o o
maxDepth - o o o o o
additionalPatterns - - o - - -
jsonOutput - - o - - -
maxColumns - - o - - -
noIgnore - o o o o o
sortBy - o o - o o
maxCharacters o o o o o o
replacement - - - o - -
onlyMatching - - - o - -
countMode - - - - o -
includeZero - - - - o -
<!-- params-table-end -->

Development

# Install dependencies
bun install

# Run tests
bun test

# Type check
bunx tsc --noEmit

# Lint and format
bunx biome check --write .

# Build
bunx tsc

# Start in development mode
bun run dev

Security

  • This server passes arguments as an array via spawn("rg", args) (no shell interpolation). Patterns and paths are placed after a -- separator to prevent flag injection.
  • The --allow-dir option restricts the search scope to specified directories. Paths are resolved to absolute paths using path.resolve() and validated via prefix matching.
  • Limitation: When followSymlinks is enabled, symbolic links may allow access to directories outside the allowed scope. Be aware of this when using --allow-dir together with followSymlinks.

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured