Skip to main content
Glama

MCP-Grep

モデル コンテキスト プロトコル (MCP) を通じて grep 機能を公開する grep サーバー実装。

インストール

pip install mcp-grep

使用法

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 results

MCPインスペクター統合

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

ライセンス

マサチューセッツ工科大学

-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

モデル コンテキスト プロトコルを通じて grep 機能を公開するサーバー実装。これにより、MCP 互換クライアントは正規表現を使用してファイル内のパターンを検索できるようになります。

  1. インストール
    1. 使用法
      1. 特徴
        1. APIの使用例
          1. 自然言語プロンプト
            1. MCPインスペクター統合
              1. 発達
                1. ライセンス

                  Related MCP Servers

                  • -
                    security
                    A
                    license
                    -
                    quality
                    A Model Context Protocol (MCP) server that enables semantic search and retrieval of documentation using a vector database (Qdrant). This server allows you to add documentation from URLs or local files and then search through them using natural language queries.
                    Last updated -
                    14
                    74
                    JavaScript
                    Apache 2.0
                    • Apple
                  • A
                    security
                    F
                    license
                    A
                    quality
                    Provides integration with Everything Search Engine allowing powerful file search capabilities through the Model Context Protocol with advanced search options like regex, case sensitivity, and sorting.
                    Last updated -
                    1
                    3
                    JavaScript
                  • A
                    security
                    F
                    license
                    A
                    quality
                    A MCP server that allows searching for files in the filesystem based on path fragments, returning file metadata including name, path, size, and creation date.
                    Last updated -
                    1
                    Python
                    • Apple
                  • -
                    security
                    A
                    license
                    -
                    quality
                    A 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.
                    Last updated -
                    TypeScript
                    MIT License

                  View all related MCP servers

                  MCP directory API

                  We provide all the information about MCP servers via our MCP API.

                  curl -X GET 'https://glama.ai/api/mcp/v1/servers/erniebrodeur/mcp-grep'

                  If you have feedback or need assistance with the MCP directory API, please join our Discord server