MCPGex

A Python MCP server to define, test, and refine regex patterns against test cases with automated iteration.
  • python

5

GitHub Stars

python

Language

5 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "patzedi-mcpgex": {
      "command": "python3",
      "args": [
        "-m",
        "mcpgex"
      ]
    }
  }
}

MCPGex is a Python-based MCP server that helps you define, test, and refine regex patterns by running test cases and iterating patterns until they meet all requirements. It enables automated validation of your expressions so you can trust them before using them in real applications.

How to use

Connect to MCPGex with an MCP client and use its four core tools to build robust regex patterns: add_test_case to create test inputs and expected outputs, test_regex to run patterns against all test cases, get_test_cases to review current inputs, and clear_test_cases to start fresh.

Practical workflow:

  • Define a goal by adding one or more test cases that describe the expected matches your regex should produce.
  • Try one or more regex patterns using test_regex to see which tests pass or fail.
  • Iterate by refining your pattern and re-running tests until all cases pass.
  • Validate your final pattern by confirming there are no failing test cases and that the examples cover representative scenarios.

How to install

Prerequisites: you need Python 3.8+ installed on your system.

Install the MCPGex package via pip.

Run the MCP server locally.

Configuration

You can configure MCPGex to run as a local MCP server by specifying the standard stdio command that starts the server. Use the following example to add a configuration entry that points to the Python module you installed.

{
  "mcpServers": {
    "mcpgex": {
      "command": "python3",
      "args": ["-m", "mcpgex"]
    }
  }
}

Notes on usage and tests

The server exposes four main tools you can invoke from your MCP client to manage and evaluate regex patterns: add_test_case, test_regex, get_test_cases, and clear_test_cases. Use clear_test_cases only when you want to remove all existing inputs and start anew.

Security and maintenance

Ensure that you run the server in a controlled environment and manage test data responsibly. Keep dependencies up to date and monitor for any early-stage instability as noted in the project status.

Troubleshooting and tips

If the server does not start, verify that Python 3.8+ is installed and that the mcpgex module is available for execution with python3 -m mcpgex. Check that the command and arguments exactly match the configuration example to avoid startup errors.

Available tools

add_test_case

Add a new test case with an input string and expected matches. You provide the input_string, the array of expected_matches, and an optional description.

test_regex

Test a regex pattern against all defined test cases. Provide the pattern and optional flags to adjust matching behavior.

get_test_cases

Retrieve the list of all currently defined test cases so you can review inputs and expected results.

clear_test_cases

Remove all test cases to start fresh and prepare for a new testing session.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational