erniebrodeur_mcp_grep

erniebrodeur_mcp_grep

by erniebrodeur
A grep server implementation that exposes grep functionality through the Model Context Protocol (MCP).

MCP-Grep Server for File Pattern Search

Overview

MCP-Grep is a server implementation that exposes grep functionality through the Model Context Protocol (MCP). It allows users to search for patterns in files using the system grep binary and provides information about the grep binary itself.

Installation

To install MCP-Grep, run the following command:

pip install mcp-grep

Usage

MCP-Grep runs as a server that can be used by MCP-compatible clients. Start the server with the following command:

# Start the MCP-Grep server
mcp-grep-server

The server exposes the following MCP functionality:

  • Resource: grep://info - Returns information about the system grep binary
  • Tool: grep - Searches for patterns in files using the system grep binary

Features

  • Information about the system grep binary (path, version, supported features)
  • Search for patterns in files using regular expressions
  • Support for common grep options:
  • Case-insensitive matching
  • Context lines (before and after matches)
  • Maximum match count
  • Fixed string matching (non-regex)
  • Recursive directory searching

Example API Usage

Using the MCP Python client:

from mcp.client import MCPClient

# Connect to the MCP-Grep server
client = MCPClient()

# Get information about the grep binary
grep_info = client.get_resource("grep://info")
print(grep_info)

# Search for a pattern in files
result = client.use_tool("grep", {
    "pattern": "search_pattern",
    "paths": ["file.txt", "directory/"],
    "ignore_case": True,
    "recursive": True
})
print(result)

Development

To set up the development environment, follow these steps:

# Clone the repository
git clone https://github.com/erniebrodeur/mcp-grep.git
cd mcp-grep

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

License

MCP-Grep is licensed under the MIT License.

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

Packages

  • No packages published

Languages

Features & Capabilities

Categories
mcp_server model_context_protocol python search api_integration grep

Implementation Details

Stats

0 Views
0 Favorites
1 GitHub Stars

Repository Info

erniebrodeur Organization

Similar Servers

continuedev_continue by continuedev
0
0
0