Krep MCP server

Provides a high-performance string search utility that automatically selects optimal algorithms and leverages hardware acceleration for significantly faster pattern matching than traditional tools like grep.
Back to servers
Setup instructions
Provider
Barton Rhodes
Release date
Mar 20, 2025
Language
TypeScript

This MCP server provides a high-performance string search utility that integrates with AI assistants through the Model Context Protocol. It wraps around the "krep" tool, which significantly outperforms traditional search utilities like grep by using optimized algorithms and multi-threading capabilities.

Installation

Prerequisites

Ensure you have the krep binary installed:

cd /path/to/krep-native
make

MCP Server Configuration

Configure the MCP server in your MCP settings file:

{
  "mcpServers": {
    "krep": {
      "command": "node",
      "args": [
        "/path/to/krep-mcp-server/src/index.js"
      ],
      "env": {
        "CLAUDE_MCP": "true",
        "KREP_PATH": "/path/to/krep-native/krep",
        "DEBUG": "true"
      },
      "description": "High-performance string search utility with unified interface",
      "disabled": false,
      "autoApprove": [
        "krep"
      ]
    }
  }
}

Usage

The krep MCP server exposes a single unified function:

<use_mcp_tool>
<server_name>krep</server_name>
<tool_name>krep</tool_name>
<arguments>
{
  "pattern": "search pattern",
  "target": "file path or string to search",
  "mode": "file|string|count",
  "caseSensitive": true|false,
  "threads": null
}
</arguments>
</use_mcp_tool>

Parameters

  • pattern (required): The pattern to search for
  • target (required): File path or string to search in
  • mode (optional): Search mode
    • file (default): Search in a file
    • string: Search in a string
    • count: Count occurrences only
  • caseSensitive (optional): Whether the search is case-sensitive (default: true)
  • threads (optional): Number of threads to use (default: auto-detected based on CPU cores)

How It Works

The server functions by:

  1. Receiving requests through the Model Context Protocol
  2. Parsing the request parameters
  3. Building the appropriate krep command based on the mode and parameters
  4. Executing the command using the krep binary
  5. Parsing the results and returning them in a structured format

Performance Features

Krep provides high-performance pattern searching through:

  • Intelligent Algorithm Selection: Automatically selects the best algorithm based on pattern length
    • KMP for very short patterns (< 3 characters)
    • Boyer-Moore-Horspool for medium-length patterns (3-16 characters)
    • Rabin-Karp for longer patterns (> 16 characters)
  • Hardware Acceleration: Leverages SIMD instructions when available
  • Dynamic Multi-Threading: Automatically utilizes all available CPU cores

Cline VSCode Extension Integration

Installation with Cline

# Install the integration
./install-cline-integration.sh

# Test the integration
./run-cline-test.sh

Using krep in Cline

Once integrated, use krep directly in Cline conversations:

/krep krep pattern="function" target="/path/to/search" mode="file"

Environment Variables

  • CLAUDE_MCP: Set to "true" to run in MCP mode
  • KREP_PATH: Path to the krep binary
  • DEBUG: Set to "true" for verbose logging
  • KREP_TEST_MODE: Set to "true" to run in test mode
  • KREP_SKIP_CHECK: Set to "true" to skip checking if the krep binary exists

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "krep" '{"command":"node","args":["/path/to/krep-mcp-server/src/index.js"],"env":{"CLAUDE_MCP":"true","KREP_PATH":"/path/to/krep-native/krep","DEBUG":"true"},"description":"High-performance string search utility with unified interface","disabled":false,"autoApprove":["krep"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "krep": {
            "command": "node",
            "args": [
                "/path/to/krep-mcp-server/src/index.js"
            ],
            "env": {
                "CLAUDE_MCP": "true",
                "KREP_PATH": "/path/to/krep-native/krep",
                "DEBUG": "true"
            },
            "description": "High-performance string search utility with unified interface",
            "disabled": false,
            "autoApprove": [
                "krep"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your 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

2. Add this to your configuration file:

{
    "mcpServers": {
        "krep": {
            "command": "node",
            "args": [
                "/path/to/krep-mcp-server/src/index.js"
            ],
            "env": {
                "CLAUDE_MCP": "true",
                "KREP_PATH": "/path/to/krep-native/krep",
                "DEBUG": "true"
            },
            "description": "High-performance string search utility with unified interface",
            "disabled": false,
            "autoApprove": [
                "krep"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later