Skip to main content
Glama

Filesystem MCP Server

grep

Search for text patterns in files using regular expressions. Specify directory, pattern, and optional exclusion criteria. Returns matches with file path, line number, and matching line, respecting .gitignore and directory restrictions.

Instructions

Search for text patterns inside files using regular expressions.

Args: dir (str): Directory to search in (absolute or relative to allowed directories) pattern (str): Regular expression pattern to search for in file contents exclude (str, optional): File pattern to exclude from search

Returns: str: Newline-separated matches in format 'path: line', or error message if failed

Note: - Directory must be within allowed directory roots - Searches recursively through subdirectories - Only searches UTF-8 text files - Respects .gitignore files and skips common lock files - Each match shows file path, line number, and the matching line - Uses Python regular expression syntax

Input Schema

NameRequiredDescriptionDefault
dirYes
excludeNo
patternYes

Input Schema (JSON Schema)

{ "properties": { "dir": { "title": "Dir", "type": "string" }, "exclude": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Exclude" }, "pattern": { "title": "Pattern", "type": "string" } }, "required": [ "dir", "pattern" ], "type": "object" }
Install Server

Other Tools from Filesystem MCP Server

Related Tools

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/Preston-Harrison/fs-mcp-py'

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