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.
To install MCP-Grep, run the following command:
pip install mcp-grep
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:
grep://info
- Returns information about the system grep binarygrep
- Searches for patterns in files using the system grep binaryUsing 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)
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
MCP-Grep is licensed under the MIT License.
No description or website provided.