Skip to main content
Glama

MCP-Grep

Una implementación de servidor grep que expone la funcionalidad grep a través del Protocolo de contexto de modelo (MCP).

Instalación

pip install mcp-grep

Uso

MCP-Grep se ejecuta como un servidor que puede ser utilizado por clientes compatibles con MCP:

# Start the MCP-Grep server mcp-grep-server # Or use the MCP Inspector for interactive debugging and testing mcp-grep-inspector

El servidor expone la siguiente funcionalidad MCP:

  • Recurso: grep://info - Devuelve información sobre el binario grep del sistema
  • Herramienta: grep - Busca patrones en archivos utilizando el binario grep del sistema

Características

  • Información sobre el binario grep del sistema (ruta, versión, funciones compatibles)
  • Buscar patrones en archivos usando expresiones regulares
  • Compatibilidad con opciones comunes de grep:
    • Coincidencia sin distinción entre mayúsculas y minúsculas
    • Líneas de contexto (antes y después de los partidos)
    • Número máximo de coincidencias
    • Coincidencia de cadenas fijas (no expresiones regulares)
    • Búsqueda recursiva de directorios
  • Comprensión de indicaciones en lenguaje natural para un uso más sencillo con LLM
  • Depuración y pruebas interactivas a través de MCP Inspector

Ejemplo de uso de la API

Usando el cliente Python de MCP:

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)

Indicaciones en lenguaje natural

MCP-Grep comprende indicaciones en lenguaje natural, lo que facilita su uso con LLM. Ejemplos:

# 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

Integración de MCP Inspector

MCP-Grep incluye una integración de MCP Inspector para depuración y pruebas interactivas:

# Start the MCP Inspector with MCP-Grep mcp-grep-inspector

Esto abre una interfaz de usuario basada en web donde puedes:

  • Explorar los recursos y herramientas disponibles
  • Pruebe las operaciones grep con diferentes parámetros
  • Ver resultados formateados
  • Problemas de depuración con sus consultas grep

Desarrollo

# 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

Licencia

Instituto Tecnológico de Massachusetts (MIT)

-
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.

Una implementación de servidor que expone la funcionalidad grep a través del Protocolo de Contexto de Modelo, permitiendo a los clientes compatibles con MCP buscar patrones en archivos usando expresiones regulares.

  1. Instalación
    1. Uso
      1. Características
        1. Ejemplo de uso de la API
          1. Indicaciones en lenguaje natural
            1. Integración de MCP Inspector
              1. Desarrollo
                1. Licencia

                  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