Skip to main content
Glama

MCP-Grep

MCP(Model Context Protocol)를 통해 grep 기능을 제공하는 grep 서버 구현입니다.

설치

지엑스피1

Related MCP server: cve-search_mcp

용법

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

이렇게 하면 다음 작업을 수행할 수 있는 웹 기반 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

특허

MIT

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

Latest Blog Posts

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