Regex Le logo

Regex Le

Extracts regexes from supplied code, reports positions and flags, and returns ReDoS safety findings with witnesses.

Install Regex Le

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "regex-le": {
      "command": "npx",
      "args": [
        "-y",
        "regex-le-mcp"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

We couldn’t confirm it starts correctly

The install command started, but didn't respond the way we expected when we tried to talk to it.

npx -y regex-le-mcp

initialize succeeded but no response to tools/list.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked Today.

Overview

The regex-le MCP server accepts source content and extracts regular expressions with flags, positions, and ReDoS verdicts. Its stdio MCP tool, `extract_patterns`, supports language-aware patterns from JavaScript, TypeScript, Python, Rust, Go, Java, Ruby, PHP, and C#. Use it when an MCP-compatible agent needs to inspect regexes without reading files or making network requests. Findings that demonstrate catastrophic backtracking include a witness input for further checking.

Use cases

  • Extract regex patterns from a source file
  • Review regex locations and capture-related syntax
  • Screen code for demonstrable ReDoS behavior
  • Reproduce a ReDoS finding with its witness input
  • Add regex checks to an MCP-based code review workflow

Key features

  • Extracts regex literals and language-specific constructors
  • Returns flags and one-based source positions
  • Screens patterns for catastrophic backtracking
  • Includes witness inputs for reported ReDoS findings
  • Runs over MCP stdio with no environment variables
  • Supports content, format, filename, and result-limit inputs

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 3d ago

Recent health check succeeded.

8/8 checks healthy over the last 45d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 8h ago via OSV.dev · regex-le-mcp (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars2Stargazers on the source repository.
npm downloads1.4kPackage downloads in the last 30 days.
Last commit4d agoMost recent push to the default branch.
Install checkInconclusiveStarted but did not complete the MCP handshake in our test.

How Regex Le works

What regex-le MCP server does

The regex-le MCP server gives MCP-compatible agents a way to inspect regular expressions embedded in source code. It receives document content directly and returns detected patterns, their flags, one-based locations, and ReDoS screening results. The server does not access the filesystem or make outbound network requests, so the calling agent controls which content is analyzed.

The main use is reviewing a file or code snippet for regex inventory and potential catastrophic backtracking. A reported ReDoS result includes the input that triggered the finding, allowing a developer or agent to reproduce the observation rather than relying only on a structural warning.

How it works

The server exposes extract_patterns over MCP using stdio. Its input accepts content and optional format, filename, and maxResults values. Extraction scans the complete document, including patterns whose constructors span multiple lines.

Language-aware recognition covers JavaScript and TypeScript literals and constructors; Python compilation calls; Rust regex constructors; Go compilation calls; Java Pattern calls; Ruby literals and constructors; PHP matching functions; and C# regex usage. When the format is known, the scanner can avoid treating unrelated slash expressions as JavaScript-style literals. Unknown formats are scanned using the supported spellings without language-specific filtering.

The regex-le MCP server removes candidates in comments and strings when the language rules allow that distinction, ignores duplicate pattern-and-flag pairs, and excludes many non-pattern slash expressions such as dates and paths. It uses heuristic lexing rather than a full parser, so unusual source constructs may still affect extraction.

ReDoS analysis compiles a pattern to an automaton, explores paths resembling a backtracking engine, generates inputs at multiple lengths, and measures work against a budget. A result is reported when a supplied input demonstrably causes excessive backtracking. No result should be interpreted as proof that an unreadable or untested pattern is safe.

Setup and configuration

Run the published package with npx -y regex-le-mcp, or install it globally with npm install -g regex-le-mcp and invoke regex-le-mcp directly. MCP hosts can register either command in their server configuration. Version pinning is supported by specifying a package version with npx.

The server communicates over stdio and requires no environment variables, API key, or server-specific configuration. A basic configuration uses npx with -y and regex-le-mcp as its argument. Piping an MCP tools/list request to the command provides a simple way to confirm that extract_patterns is available.

Tools and capabilities

The regex-le MCP server provides one documented MCP tool:

The tool can identify static string and template-literal arguments in supported constructor forms, but not constructor patterns supplied through variables or template substitutions. It also recognizes language-specific forms such as Python re.compile, Rust Regex::new, Go regexp.Compile, Java Pattern.compile, PHP preg_match, and C# regex calls.

Limitations and notes

Extraction is not a parser for the supported languages. A slash inside a string can be identified incorrectly when its surrounding context resembles an expression. Unsupported or malformed syntax is generally excluded, while another language's recognized spelling may still be reported as written.

Flags are extracted directly for JavaScript literals and constructors; other languages use their own inline flags, constants, or builder methods. Dynamic constructor arguments and template substitutions are not evaluated. Comments and documentation examples are excluded only when the language is known well enough to apply those rules.

ReDoS screening reports demonstrated blow-ups rather than declaring safety from pattern shape alone. Silence is not a clearance, especially for constructs the analyzer cannot fully read, such as some advanced regex features.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Regex Le

regex-le is an MCP server that connects MCP-compatible agents to a regex extraction and ReDoS-analysis engine. Its main tool, extract_patterns, accepts source content and returns detected patterns, flags, one-based positions, and safety verdicts, including witness inputs for demonstrated catastrophic backtracking.

Install it with `npx -y regex-le-mcp`, or run `npm install -g regex-le-mcp` and invoke `regex-le-mcp` directly. Add the command to your MCP host configuration; no API key or environment variables are required.

The server provides `extract_patterns`. Pass source content and optionally a format, filename, or maximum result count to receive extracted patterns, flags, one-based positions, and ReDoS verdicts.

Yes, regex-le works with Cursor through its stdio MCP server. Configure Cursor to run `npx -y regex-le-mcp`; the same server can also be used from Windsurf, Claude Code, and other MCP hosts.

No, the MCP server reads neither files nor network resources on its own.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewRegex Le AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/regex-le?style=directory)](https://allmcps.com/mcp/regex-le)
HTML Embed
<a href="https://allmcps.com/mcp/regex-le"><img src="https://allmcps.com/api/badge/regex-le?style=directory" alt="Regex Le on AllMCPs" /></a>