@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
访问服务器

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选