mcpField
R
regex-test-mcp

regex-test-mcp

Local
github.com/MukundaKattaDeveloper Tools0Updated 20w ago

About regex-test-mcp

regex-test-mcp is an MCP server for checking JavaScript regular expressions with the actual JS regex engine. It is for agents and developers who need exact match offsets, groups, and replacement behavior.

Key features

  1. 01Test the first regex match
  2. 02Find all non-overlapping matches
  3. 03Replace text with regex captures
  4. 04Return offsets and named groups
  5. 05Handle zero-width matches safely

Use cases

  1. 01Verify whether a pattern matches text
  2. 02Inspect match positions and capture groups
  3. 03Find every match without zero-width loops
  4. 04Check regex-based replacement results

MCP support

Exposes `test_regex`, `find_all`, and `replace` tools to MCP clients for JavaScript regex testing.

Configuration

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

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

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@mukundakatta/regex-test-mcp0.1.0

Tools

3

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
textstringYes
flagsstringNoJS regex flags, e.g. 'i', 'gm', 'isu'.
patternstringYesJS regex pattern (no surrounding slashes).

Details

From the project README

@mukundakatta/regex-test-mcp

MCP server for trustworthy regex testing. Three tools: test_regex, find_all, replace. All use the actual JS regex engine, so you get exact semantics for lookahead, anchors, named groups, and Unicode escapes.

Why this exists

LLMs reliably hallucinate regex behavior. Common ways they're wrong:

  • Confidently stating a pattern matches when it doesn't (or vice versa)
  • Wrong group indices when there are nested capture groups
  • Forgetting that . excludes newlines without the s flag
  • Hand-rolling replace results that miss edge cases ($& semantics, named-group syntax)

Routing the actual test through this MCP server avoids all of those.

Tools

ToolReturns
test_regex(pattern, text, flags?){matched, match, start, end, groups, named_groups} for the first match
find_all(pattern, text, flags?)All non-overlapping matches (always behaves as g); zero-width safe
replace(pattern, text, replacement, flags?)New string + replaced boolean; supports $1, $<name>, $&

Install — Claude Desktop

{
  "mcpServers": {
    "regex-test": { "command": "npx", "args": ["-y", "@mukundakatta/regex-test-mcp"] }
  }
}

Same shape for Cursor / Cline / Windsurf / Zed.

License

MIT OR Apache-2.0.

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.