MCP-Grep
MCP-Grep
モデル コンテキスト プロトコル (MCP) を通じて grep 機能を公開する grep サーバー実装。
インストール
pip install mcp-grepRelated MCP server: Greply MCP Server
使用法
MCP-Grep は、MCP 互換クライアントが使用できるサーバーとして実行されます。
# Start the MCP-Grep server
mcp-grep-server
# Or use the MCP Inspector for interactive debugging and testing
mcp-grep-inspectorサーバーは次の MCP 機能を公開します。
リソース:
grep://info- システム grep バイナリに関する情報を返しますツール:
grep- システムの grep バイナリを使用してファイル内のパターンを検索します
特徴
システム grep バイナリに関する情報 (パス、バージョン、サポートされている機能)
正規表現を使用してファイル内のパターンを検索する
一般的な grep オプションのサポート:
大文字と小文字を区別しないマッチング
コンテキスト行(一致の前後)
最大一致数
固定文字列マッチング(非正規表現)
再帰ディレクトリ検索
LLM での使いやすさを向上させる自然言語プロンプトの理解
MCP Inspectorによるインタラクティブなデバッグとテスト
APIの使用例
MCP Python クライアントの使用:
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 は自然言語プロンプトを理解するため、LLM での使用が容易になります。例:
# 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 resultsMCPインスペクター統合
MCP-Grep には、対話型のデバッグとテストのための MCP Inspector 統合が含まれています。
# Start the MCP Inspector with MCP-Grep
mcp-grep-inspectorこれにより、Web ベースの UI が開き、次の操作を実行できます。
利用可能なリソースとツールを調べる
異なるパラメータでgrep操作をテストする
フォーマットされた結果を表示
grepクエリの問題をデバッグする
発達
# 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ライセンス
マサチューセッツ工科大学
This server cannot be deployed
Maintenance
Related MCP Connectors
Search and browse every MCP server in the Model Context Protocol registry.
Repository knowledge graph MCP server for codebase understanding and debugging.
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol server that provides tools to find regex pattern positions in files and list allowed directories, enabling text analysis with LSP-like functionality.22 npm1MIT
- AlicenseBqualityCmaintenanceEnables file and directory searching through the greply CLI tool with configurable search options like context lines, case sensitivity, and pattern matching. Provides direct access to powerful grep-like functionality from MCP-compatible clients.212 npmMIT
- FlicenseAqualityDmaintenanceA Model Context Protocol server that enables keyword search within files, returning matching lines with line numbers.11-
- AlicenseNot gradedqualityDmaintenanceA grep server implementation that exposes grep functionality through the Model Context Protocol (MCP), supporting natural language prompts and common grep options such as case-insensitive matching, context lines, and recursive searching.GPL 3.0