mcp ripgrep

Local 2025-08-31 23:34:11 0

Provides ripgrep search capabilities to MCP clients like Claude, allowing high-performance text searches across files on your system.


An MCP server that provides ripgrep (rg) search capabilities to any MCP client such as Claude.

Overview

This server provides a Model Context Protocol (MCP) interface for the powerful ripgrep search tool. It enables Claude AI and other MCP-compatible clients to perform high-performance text searches across files on your system.

Prerequisites

  • Node.js (v18 or higher)
  • ripgrep (rg) command installed and available in your PATH. Install it with brew install ripgrep on macOS.

Usage with Claude for Desktop

To use this MCP server with Claude for Desktop:

  1. Edit your Claude for Desktop configuration file:
  2. macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  3. Windows: %APPDATA%Claudeclaude_desktop_config.json

  4. Add the following to your configuration:

    {
      "mcpServers": {
        "ripgrep": {
          "command": "npx",
          "args": ["-y", "mcp-ripgrep@latest"]
        }
      }
    }

Replace /path/to/mcp-ripgrep with the absolute path to where you cloned this repository.

  1. Restart Claude for Desktop.

Available Tools

Basic search with ripgrep:

Pattern: error
Path: ./src

More advanced search with additional options:

Pattern: function
Path: ./src
FixedStrings: true
FileType: ts
IncludeHidden: false

count-matches

Count occurrences of a pattern:

Pattern: TODO
Path: ./src
CountLines: true

list-files

List files that would be searched without actually searching them:

Path: ./src
FileType: js

list-file-types

List all supported file types in ripgrep.

Security Considerations

This MCP server executes shell commands using the ripgrep tool. While efforts have been made to safely escape arguments, use caution when providing input as it runs commands on your machine.

License

MIT

[
  {
    "description": "Search files for patterns using ripgrep (rg)",
    "inputSchema": {
      "properties": {
        "caseSensitive": {
          "description": "Use case sensitive search (default: auto)",
          "type": "boolean"
        },
        "context": {
          "description": "Show N lines before and after each match",
          "type": "number"
        },
        "filePattern": {
          "description": "Filter by file type or glob",
          "type": "string"
        },
        "maxResults": {
          "description": "Limit the number of matching lines",
          "type": "number"
        },
        "path": {
          "description": "Directory or file(s) to search.",
          "type": "string"
        },
        "pattern": {
          "description": "The search pattern (regex by default)",
          "type": "string"
        },
        "useColors": {
          "description": "Use colors in output (default: false)",
          "type": "boolean"
        }
      },
      "required": [
        "pattern",
        "path"
      ],
      "type": "object"
    },
    "name": "search"
  },
  {
    "description": "Advanced search with ripgrep with more options",
    "inputSchema": {
      "properties": {
        "caseSensitive": {
          "description": "Use case sensitive search (default: auto)",
          "type": "boolean"
        },
        "context": {
          "description": "Show N lines before and after each match",
          "type": "number"
        },
        "filePattern": {
          "description": "Filter by file type or glob",
          "type": "string"
        },
        "fileType": {
          "description": "Filter by file type (e.g., js, py)",
          "type": "string"
        },
        "fixedStrings": {
          "description": "Treat pattern as a literal string, not a regex",
          "type": "boolean"
        },
        "followSymlinks": {
          "description": "Follow symbolic links",
          "type": "boolean"
        },
        "includeHidden": {
          "description": "Search in hidden files and directories",
          "type": "boolean"
        },
        "invertMatch": {
          "description": "Show lines that Do not match the pattern",
          "type": "boolean"
        },
        "maxResults": {
          "description": "Limit the number of matching lines",
          "type": "number"
        },
        "path": {
          "description": "Directory or file(s) to search.",
          "type": "string"
        },
        "pattern": {
          "description": "The search pattern (regex by default)",
          "type": "string"
        },
        "showFilenamesOnly": {
          "description": "Only show filenames of matches, not content",
          "type": "boolean"
        },
        "showLineNumbers": {
          "description": "Show line numbers",
          "type": "boolean"
        },
        "useColors": {
          "description": "Use colors in output (default: false)",
          "type": "boolean"
        },
        "wordMatch": {
          "description": "Only show matches surrounded by word boundaries",
          "type": "boolean"
        }
      },
      "required": [
        "pattern",
        "path"
      ],
      "type": "object"
    },
    "name": "advanced-search"
  },
  {
    "description": "Count matches in files using ripgrep",
    "inputSchema": {
      "properties": {
        "caseSensitive": {
          "description": "Use case sensitive search (default: auto)",
          "type": "boolean"
        },
        "countLines": {
          "description": "Count matching lines instead of total matches",
          "type": "boolean"
        },
        "filePattern": {
          "description": "Filter by file type or glob",
          "type": "string"
        },
        "path": {
          "description": "Directory or file(s) to search.",
          "type": "string"
        },
        "pattern": {
          "description": "The search pattern (regex by default)",
          "type": "string"
        },
        "useColors": {
          "description": "Use colors in output (default: false)",
          "type": "boolean"
        }
      },
      "required": [
        "pattern",
        "path"
      ],
      "type": "object"
    },
    "name": "count-matches"
  },
  {
    "description": "List files that would be searched by ripgrep without actually searching them",
    "inputSchema": {
      "properties": {
        "filePattern": {
          "description": "Filter by file type or glob",
          "type": "string"
        },
        "fileType": {
          "description": "Filter by file type (e.g., js, py)",
          "type": "string"
        },
        "includeHidden": {
          "description": "Include hidden files and directories",
          "type": "boolean"
        },
        "path": {
          "description": "Directory or file(s) to search.",
          "type": "string"
        }
      },
      "required": [
        "path"
      ],
      "type": "object"
    },
    "name": "list-files"
  },
  {
    "description": "List all supported file types in ripgrep",
    "inputSchema": {
      "properties": {},
      "type": "object"
    },
    "name": "list-file-types"
  }
]