Adds five regex and text processing tools directly to Claude: test patterns with match indices and capture groups, replace with backreferences, extract matches as structured arrays, and get human-readable explanations of regex syntax. The text_transform tool handles case conversions (camelCase, snake_case, PascalCase, kebab-case), line operations (deduplicate, sort, remove blanks), and basic transformations like trim and reverse, with support for chaining multiple operations. Useful when you're parsing logs, cleaning data, or prototyping text manipulation without switching contexts to a regex tester or writing throwaway scripts. Runs locally via Node.js with stdio transport.
Regex and text processing tools for AI agents via the Model Context Protocol (MCP).
| Tool | Description |
|---|---|
regex_test | Test a regex pattern against text. Returns all matches with indices, captured groups, and named groups. |
regex_replace | Find and replace using regex with support for capture group references ($1, $2, $&, $<name>). |
regex_extract | Extract all matches of a pattern from text as a structured array. Optionally return only a specific capture group. |
regex_explain | Parse a regex pattern and return a human-readable explanation of each component and flag. |
text_transform | Apply common text transformations: camelCase, snake_case, kebab-case, PascalCase, UPPER, lower, title case, reverse, trim, deduplicate lines, sort lines, remove blank lines, count words/chars/lines. Chain multiple transforms in one call. |
npm install
npm run build
Add this to your Claude Desktop config file:
%APPDATA%\Claude\claude_desktop_config.json~/Library/Application Support/Claude/claude_desktop_config.json{
"mcpServers": {
"regex-tools": {
"command": "node",
"args": ["D:/products/mcp-servers/mcp-regex-tools/dist/index.js"]
}
}
}
claude mcp add regex-tools node D:/products/mcp-servers/mcp-regex-tools/dist/index.js
Or add to your .mcp.json:
{
"mcpServers": {
"regex-tools": {
"command": "node",
"args": ["D:/products/mcp-servers/mcp-regex-tools/dist/index.js"]
}
}
}
regex_test({ pattern: "(\\d{4})-(\\d{2})-(\\d{2})", text: "Today is 2026-03-19 and tomorrow is 2026-03-20" })
regex_replace({ pattern: "(\\w+)\\s(\\w+)", replacement: "$2 $1", text: "hello world" })
regex_extract({ pattern: "[\\w.]+@[\\w.]+", text: "Contact us at info@example.com or support@example.com" })
regex_explain({ pattern: "^(?:https?://)?(?:www\\.)?([\\w-]+)\\.\\w{2,}$", flags: "i" })
text_transform({ text: "hello world example", transforms: ["PascalCase"] })
text_transform({ text: "some text\nwith\nlines\nwith\nduplicates\nlines", transforms: ["deduplicate_lines", "sort_lines"] })
MIT