regex
MCP server for testing, explaining, and generating regular expressions. Use regex from Claude, Cursor, VS Code Copilot, or any MCP client.
claude mcp add --transport stdio muhammadalishahzad-regex-mcp node build/index.js
How to use
The regex-mcp server provides a set of tooling for working with regular expressions directly from your MCP-enabled editor or client. It exposes a suite of commands that let you test patterns against text, explain and break down regex tokens, validate syntax and common pitfalls, perform replacements with capture group references, debug visual matches, and generate regex snippets from natural language descriptions. All operations run locally (via the Node.js server) and rely on the built-in JavaScript RegExp engine, so there are no external API calls or keys required. This makes it ideal for use inside editors like Claude Code, Cursor, VS Code Copilot, Windsurf, and other MCP-enabled environments.
To use it, connect your MCP client to the local server (as configured in your editor’s MCP.json or equivalent) and select the relevant tool (regex_test, regex_explain, regex_validate, regex_debug, regex_replace, or regex_generate). Each tool will prompt or accept inputs (pattern, input text, and options) and return structured results such as matches, highlights, breakdowns, warnings, or generated patterns that you can apply directly in your workflow.
How to install
Prerequisites:
- Node.js and npm installed on your system
- Git access to clone the repository (optional if you publish via npm)
Install from npm (recommended):
- npm install -g @muhammadalishahzad/regex-mcp
- This will install the MCP server package and its CLI if exposed by the package.
If you prefer to run from source:
- Clone the repository: git clone https://github.com/MuhammadAliShahzad/regex-mcp.git
- Install dependencies: cd regex-mcp npm install
- Build the project (if a build script is provided): npm run build
- Run the server directly: node build/index.js
Usage when running locally:
- The server will start on the default localhost port (check console output for the actual port).
- Connect your MCP client/editor to the server and begin using the available tools (regex_test, regex_explain, regex_validate, regex_debug, regex_replace, regex_generate).
Additional notes
Tips and caveats:
- All operations use the native JavaScript RegExp engine; behavior may differ from engines in other languages for edge cases.
- When using regex_generate, results are generated patterns for common categories (email, URL, date, etc.); you can customize or tweak the produced patterns to your needs.
- If you integrate with editors, ensure your MCP.json or equivalent configuration points to the local server (as shown in the README examples).
- For complex patterns, enable verbose explanations (regex_explain) to understand token-level structure and grouping.
- If you encounter port conflicts, check the server logs to identify the port and adjust your client connection accordingly.
- No API keys are required; this server operates entirely locally.
Related MCP Servers
Mantic.sh
A structural code search engine for Al agents.
Pare
Dev tools, optimized for agents. Structured, token-efficient MCP servers for git, test runners, npm, Docker, and more.
mongo
MCP server that provide tools to LLMs such as claude in cursor to interact with MongoDB
shodan
Shodan MCP server for Claude, Cursor & VS Code. 20 tools for passive reconnaissance, CVE/CPE intelligence, DNS analysis, and device search. 4 tools work free without an API key. OSINT and vulnerability research from your IDE.
vscode-context
MCP Server to Connect with VS Code IDE
mermaid-live
MCP server from iishyfishyy/mermaid-live-mcp