mcpField
R
regex

regex

Local
github.com/rog0xDeveloper Tools0Updated 32w ago

About regex

An MCP server for AI agents that tests, explains, extracts, and replaces regex matches, alongside common text transformations. It provides structured match details and supports chaining transformations in one call.

Key features

  1. 01Test patterns with match details
  2. 02Explain regex components and flags
  3. 03Extract matches and capture groups
  4. 04Replace text using capture references
  5. 05Chain common text transformations

Use cases

  1. 01Check patterns against sample text
  2. 02Explain an unfamiliar regex
  3. 03Extract or replace text matches
  4. 04Normalize and reorganize text

MCP support

Exposes regex and text-processing tools to MCP clients, including regex testing, extraction, replacement, and explanation.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"rog0x-regex": {
"command": "npx",
"args": [
"-y",
"@rog0x/mcp-regex-tools"
]
}
}
}
Run commandnpx -y @rog0x/mcp-regex-tools

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@rog0x/mcp-regex-tools1.0.1

Tools

5

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
textstringYesThe text to test the pattern against
flagsstringNoRegex flags (e.g. 'gi' for global case-insensitive). Defaults to 'g'
patternstringYesThe regular expression pattern to test

Details

From the project README

mcp-regex-tools

Regex and text processing tools for AI agents via the Model Context Protocol (MCP).

Tools

ToolDescription
regex_testTest a regex pattern against text. Returns all matches with indices, captured groups, and named groups.
regex_replaceFind and replace using regex with support for capture group references ($1, $2, $&, $<name>).
regex_extractExtract all matches of a pattern from text as a structured array. Optionally return only a specific capture group.
regex_explainParse a regex pattern and return a human-readable explanation of each component and flag.
text_transformApply 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.

Setup

npm install
npm run build

Usage with Claude Desktop

Add this to your Claude Desktop config file:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "regex-tools": {
      "command": "node",
      "args": ["D:/products/mcp-servers/mcp-regex-tools/dist/index.js"]
    }
  }
}

Usage with Claude Code

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"]
    }
  }
}

Examples

Test a regex
regex_test({ pattern: "(\\d{4})-(\\d{2})-(\\d{2})", text: "Today is 2026-03-19 and tomorrow is 2026-03-20" })
Replace with capture groups
regex_replace({ pattern: "(\\w+)\\s(\\w+)", replacement: "$2 $1", text: "hello world" })
Extract matches
regex_extract({ pattern: "[\\w.]+@[\\w.]+", text: "Contact us at [email protected] or [email protected]" })
Explain a regex
regex_explain({ pattern: "^(?:https?://)?(?:www\\.)?([\\w-]+)\\.\\w{2,}$", flags: "i" })
Transform text
text_transform({ text: "hello world example", transforms: ["PascalCase"] })
text_transform({ text: "some text\nwith\nlines\nwith\nduplicates\nlines", transforms: ["deduplicate_lines", "sort_lines"] })

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.