Regex Le logo

Regex Le

Extracts regex patterns from source text and returns locations, flags, and ReDoS safety verdicts through MCP.

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.

Install not yet sandbox-tested— we haven't run this command through our automated sandbox yet. Not a red flag; we're working through the catalog.

Overview

regex-le MCP server exposes the `extract_patterns` tool for finding regular expressions in supplied source content. It identifies language-specific literals and constructor forms, returning each pattern's flags, 1-based location, and ReDoS verdict; risky findings include a witness input. The server communicates over stdio, reads no files, makes no network requests, and requires no API key or environment variables. Use it when an agent needs to inspect regexes in a file or source snippet without running a separate CLI workflow.

Use cases

  • Scan source content for embedded regular expressions
  • Review extracted patterns for potential ReDoS behavior
  • Return regex locations and flags to an AI coding agent
  • Inspect multiline constructors across supported languages

Key features

  • MCP stdio server with the extract_patterns tool
  • Language-aware regex extraction
  • 1-based positions and pattern flags
  • ReDoS verdicts with witness inputs
  • Duplicate pattern and flag suppression
  • No files, network access, or API keys required

Security & health

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

ActiveLast checked

Recent health check succeeded.

13/13 checks healthy over the last 62d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 2d 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 downloads534Package downloads in the last 30 days.
Last commit15d agoMost recent push to the default branch.
Directory activity1 viewsConfig copies, upvotes, and views on AllMCPs.

How Regex Le works

What regex-le MCP server does

regex-le MCP server extracts regular expressions from source text and presents them as structured MCP results. Its main tool is extract_patterns, which accepts the content to inspect and can also receive an optional format, filename, and result limit. Returned patterns include their flags, 1-based position, and a ReDoS safety verdict.

The extractor recognizes several language conventions. These include JavaScript and TypeScript literals and RegExp calls, Python re.compile forms, Rust and Go regex constructors, Java pattern APIs, Ruby forms, PHP matching functions, and C# regex APIs. It scans the full document, including patterns whose constructors span multiple lines. Repeated pattern-and-flag combinations are reported once.

A verdict indicating catastrophic backtracking includes a witness input that triggered the finding. This gives an agent concrete data to inspect rather than only a boolean warning.

How it works

The server receives source content directly in an MCP request and returns extracted data. It does not open files or make outbound network requests, so the calling agent or host is responsible for reading a file and passing its contents to the tool.

Communication uses MCP over standard input and output. A typical request supplies content and may provide a filename or format to improve language detection. The server is published as the regex-le-mcp npm package and can be started with npx.

Extraction is based on language-aware lexical heuristics rather than a complete parser for each supported language. Known-language handling helps avoid treating ordinary division, dates, paths, comments, or strings as regexes. Static string and template-literal constructor arguments can be read, while dynamic constructor arguments are excluded.

Setup and configuration

Run the package through npx:

Terminal
npx -y regex-le-mcp

For an MCP host that accepts JSON configuration, add a stdio entry such as:

config.json
{
  "mcpServers": {
    "regex-le": {
      "command": "npx",
      "args": ["-y", "regex-le-mcp"]
    }
  }
}

Alternatively, install the package globally and configure the regex-le-mcp executable as the command. Claude Code can add it with claude mcp add regex-le -- npx -y regex-le-mcp. VS Code 1.101 and later can register the tool through the Regex-LE extension's agent mode; Cursor and Windsurf can point their MCP configuration at the same npx command.

No environment variables, API key, or server-specific settings are required. Sending a tools/list JSON-RPC request through the command provides a basic startup check.

Tools and capabilities

  • extract_patterns(content, format?, filename?, maxResults?)
  • Finds regex literals and supported constructor or API forms.
  • Returns pattern text, flags, and 1-based source positions.
  • Reports ReDoS findings with a triggering witness when one is found.
  • Handles multiline constructors and removes duplicate pattern-and-flag pairs.
  • Accepts source text without accessing the surrounding filesystem.

The MCP server focuses on extraction. Regex testing against file content and the broader validate workflow are available through the Regex-LE editor extension and command-line tools, while the MCP interface exposes extract_patterns.

Limitations and notes

The extractor does not parse all programming languages exhaustively. A file whose language is unknown is scanned using the supported spellings, which can make heuristic matches less precise. In recognized languages, it avoids candidates in comments and strings, but slash-based detection can still mistake a string-contained slash for a regex when the surrounding context resembles an expression.

Constructor calls that use variables or template substitutions are not extracted. Invalid or duplicate flags and malformed candidates are excluded. Regex syntax is reported according to the detected source form, so another language's spelling is not automatically treated as an error.

ReDoS screening is part of the returned verdict, but the server does not run the original pattern against arbitrary files. Its analysis compiles the expression to an automaton, explores backtracking-like paths, builds candidate attack strings, and measures behavior against a step budget. The result is therefore tied to the tool's analysis rather than a full runtime test in every regex engine.

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 AI agents to Regex-LE's source-code regex extractor through stdio. Its main tool, `extract_patterns`, finds supported regex literals and constructors, then returns pattern text, flags, 1-based locations, and ReDoS safety verdicts, including witness inputs for detected catastrophic backtracking.

Install it by running `npx -y regex-le-mcp` or by adding that command to your MCP host configuration. You can also install the npm package globally and point the host at the `regex-le-mcp` executable. No environment variables or API key are required.

Run `claude mcp add regex-le -- npx -y regex-le-mcp`. This registers the stdio MCP server with Claude Code and makes its `extract_patterns` tool available to the agent.

Yes, Cursor and Windsurf can use the server through an MCP configuration that launches `npx regex-le-mcp`. The Regex-LE extension is also available for Cursor and Windsurf through Open VSX, while the MCP server itself accepts source content supplied by the host.

No, the MCP server reads no files and makes no network requests of 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>