by erniebrodeur
Exposes the system grep utility through a Model Context Protocol (MCP) server, enabling pattern searches via MCP‑compatible clients and natural‑language prompts.
Mcp Grep provides an MCP server that wraps the local grep
binary, allowing clients to retrieve grep information and perform search operations using MCP calls or natural‑language prompts.
npx -y @smithery/cli install @erniebrodeur/mcp-grep --client claude
# or manual Python install
pip install mcp-grep
mcp-grep-server
or launch the interactive inspector with mcp-grep-inspector
.from mcp.client import MCPClient
client = MCPClient()
info = client.get_resource("grep://info")
result = client.use_tool("grep", {
"pattern": "error",
"paths": ["logs/"],
"ignore_case": True,
"recursive": True
})
Q: Do I need to have grep
installed?
A: Yes, Mcp Grep relies on the system grep
binary.
Q: Can I run the server on Windows?
A: The server works on any OS where a compatible grep
executable is available.
Q: How do I limit the number of matches?
A: Use the max_matches
parameter in the tool request.
Q: Is there a way to see available resources and tools?
A: Launch mcp-grep-inspector
to explore resources like grep://info
and the grep
tool.
A grep server implementation that exposes grep functionality through the Model Context Protocol (MCP).
To install Grep Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @erniebrodeur/mcp-grep --client claude
pip install mcp-grep
MCP-Grep runs as a server that can be used by MCP-compatible clients:
# Start the MCP-Grep server
mcp-grep-server
# Or use the MCP Inspector for interactive debugging and testing
mcp-grep-inspector
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)
MCP-Grep understands natural language prompts, making it easier to use with LLMs. Examples:
# Basic search
Search for 'error' in log.txt
# Case-insensitive search
Find all instances of 'WARNING' regardless of case in system.log
# With context lines
Search for 'exception' in error.log and show 3 lines before and after each match
# Recursive search
Find all occurrences of 'deprecated' in the src directory and its subdirectories
# Fixed string search (non-regex)
Search for the exact string '.*' in config.js
# Limited results
Show me just the first 5 occurrences of 'TODO' in the project files
# Multiple options
Find 'password' case-insensitively in all .php files, show 2 lines of context, and limit to 10 results
MCP-Grep includes an MCP Inspector integration for interactive debugging and testing:
# Start the MCP Inspector with MCP-Grep
mcp-grep-inspector
This opens a web-based UI where you can:
# 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
MIT
Please log in to share your review and rating for this MCP.
{ "mcpServers": { "mcp-grep": { "command": "npx", "args": [ "-y", "@erniebrodeur/mcp-grep" ], "env": { "API_KEY": "<YOUR_API_KEY>" } } } }
Explore related MCPs that share similar capabilities and solve comparable challenges
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.