Regex

io.github.rog0x由 GitHub 账号 rog0x 发布v1.0.1更新于 Oct 24, 2026

Regex test, explain, replace patterns for AI agents

已验证STDIO仅桌面开发者工具数据与分析

概览

AI 生成的概览

一个本地 MCP 服务器,为助手提供正则测试、替换、提取、解释和文本转换工具。

可以做什么
用正则表达式测试文本,返回所有匹配及其位置、捕获组和命名组。使用 $1、$2、$&、$ 等捕获组引用进行查找替换。将所有匹配提取为结构化数组,可只返回指定捕获组。逐项解释正则表达式及其标志的含义。应用并串联文本转换,如大小写转换、去除空白、行去重、排序以及词数、字符数、行数统计。
适用场景
适合处理正则表达式或大批文本时使用:让助手验证模式、用捕获组改写文本、从文档中提取结构化匹配,或解释不熟悉的表达式。调试正则和重复性文本清理时尤其方便,无需离开对话。
运行要求
作为本地 Node.js 进程运行,通过 npm 包 @rog0x/mcp-regex-tools 安装;README 使用 npm install 和 npm run build 构建,并用 node 注册构建后的 dist/index.js。需要配置桌面客户端。未声明任何身份验证、环境变量或请求头。
安装前请注意
传入工具的文本由本地服务器进程处理;未声明第三方服务或凭据。替换和提取只作用于你提供的文本,用于文件或代码前请先检查结果。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Regex,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

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

bash
npm installnpm 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
json
{  "mcpServers": {    "regex-tools": {      "command": "node",      "args": ["D:/products/mcp-servers/mcp-regex-tools/dist/index.js"]    }  }}

Usage with Claude Code

bash
claude mcp add regex-tools node D:/products/mcp-servers/mcp-regex-tools/dist/index.js

Or add to your .mcp.json:

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

来源:README.md,提交 b5ed2c9

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.1最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分