GitHub - marvior/regentix: Regentix is an MCP proxy that transforms LLM intents into safe, policy-controlled tool executions using Rego and an AI rule engine.

4 min read Original article โ†—

Policy-driven MCP proxy for secure LLM tool execution using Rego-based governance with local AI-generated rules

Status License Architecture


โš ๏ธ Warning
This project is in early development and is not production-ready. It may contain bugs, incomplete features, or breaking changes. Use at your own risk.


Video Demo

regentix_demo_m.mp4

๐Ÿ“Œ Overview

Regentix is a security and governance system that sits between LLM clients (like Claude Desktop) and MCP (Model Context Protocol) servers.

It acts as a policy enforcement gateway, ensuring that every tool execution request generated by an LLM is validated against Rego-based policies (Regorus engine) before being executed.

The system combines:

  • MCP proxy enforcement (Rust)
  • AI-driven policy generation (Python)
  • Rego policy engine (Regorus)
  • Web UI for rule creation (Angular)

๐Ÿง  Core Idea

LLM-generated intent should never directly become execution.
Every action must pass through a governance layer.


๐Ÿšช Key Features

  • ๐Ÿ” Rego-based policy enforcement via Regorus
  • ๐Ÿค– AI-generated policies using fine-tuned Qwen2.5-Coder-1.5B-Instruct
  • ๐Ÿง  Synthetic dataset generation via Google Gemini
  • ๐Ÿšช MCP proxy integration with Claude Desktop
  • ๐Ÿงพ Fine-grained access control (e.g. Git repository restrictions)
  • ๐ŸŒ Web dashboard for policy generation (Angular UI)
  • โš™๏ธ Multi-language architecture (Rust + Python + Angular)
  • ๐Ÿ›ก๏ธ Deny-by-default execution model

๐Ÿ—๏ธ Architecture

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚   Claude Desktop     โ”‚
                    โ”‚   (MCP Client)       โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚ MCP Tool Call
                              โ–ผ
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚   Regentix MCP Proxy (Rust)  โ”‚
              โ”‚   - STDIO MCP Server         โ”‚
              โ”‚   - Enforcement layer        โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ”‚
                        โ”‚ Policy evaluation
                        โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚   Regorus Policy Engine (Rego)       โ”‚
        โ”‚   - Allow / Deny decisions           โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚                   โ”‚
        โ”‚ ALLOW             โ”‚ DENY
        โ–ผ                   โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ MCP Servers    โ”‚   โ”‚ Blocked Execution  โ”‚
โ”‚ (Git, FS, etc) โ”‚   โ”‚ Request rejected   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜


        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚ Python AI Backend                    โ”‚
        โ”‚ - Fine-tuned Qwen2.5-Coder           โ”‚
        โ”‚ - Generates Rego policies            โ”‚
        โ”‚ - Uses Gemini synthetic dataset      โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
                  โ”‚ policy generation API
                  โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚ Angular Web Dashboard                โ”‚
        โ”‚ - UI for policy creation             โ”‚
        โ”‚ - Sends requests to backend          โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”„ Request Flow

  1. Claude Desktop sends MCP tool request
  2. Rust MCP Proxy intercepts request
  3. Regorus evaluates Rego policies
  4. Decision:
    • Allow โ†’ forward to MCP server
    • Deny โ†’ block execution
  5. Python backend generates policies via AI
  6. Angular UI manages rule creation


๐Ÿง  AI Policy Generation

  • Base model: Qwen2.5-Coder-1.5B-Instruct
  • Dataset: synthetic data generated via Google Gemini
  • Output: Rego policies compatible with Regorus

Capabilities:

  • Natural language โ†’ policy generation
  • Policy refinement
  • Rule validation

๐Ÿšซ Example Use Cases

  • Block GitHub repository access via MCP Git server
  • Restrict filesystem operations
  • Prevent destructive tool actions
  • Role-based execution control

๐Ÿ› ๏ธ Tech Stack

Layer Technology
MCP Proxy Rust
Policy Engine Regorus
Backend Python
Frontend Angular
Model Qwen2.5-Coder
Dataset Gemini

๐Ÿš€ Getting Started

Rust Compiling

Alternative compiling: ./deploy_build_rust.sh ./deploy_release_rust.sh

chmod +x deploy_build_rust.sh deploy_release_rust.sh


Python Backend

cd model_ai/ python -m venv venv source venv/bin/activate pip install -r requirements.txt

Fine tuning model

for the fune tuning I've used the M4 Air

cd model_ai/rego-finetuning ./start.sh

Start Python Backend

cd model_ai/ python start_server.py


Frontend

cd regentix_frontend npm install npm start

Open: http://localhost:4200/


๐Ÿ”Œ Claude Desktop Config

{ { "mcpServers": { "regentix": { "command": "", "args": [] } }

๐Ÿ”Œ Config.json

In this file add the mcp server for example: [

{
"server_name":"filesystem",
"command":"npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", ""],
"env":{}
},
{
"server_name": "commands",
"command": "npx",
"args": ["-y", "mcp-server-fetch-typescript"],
"env": {}
},
{
"server_name": "github",
"command": "npx",
"args": [
  "-y",
    "@modelcontextprotocol/server-github"],
"env": {}
}

]


๐Ÿ” Security Model

  • Deny-by-default execution
  • All MCP calls intercepted
  • Rego policy validation required
  • Explicit allow only

๐Ÿงช AI-Assisted Development

This project was built with extensive assistance from generative AI models. Used for:

  • code generation
  • architecture design
  • Rust learning

๐Ÿง  Philosophy

LLM intent โ‰  execution
All actions must be governed


๐Ÿ“Œ Future Work

  • Improved Rego rule synthesis
  • HTTP transport support (not only STDIN MCP)
  • LLM-agnostic integration layer

๐Ÿค Acknowledgements

OPA / Regorus / Qwen / Gemini / Claude MCP / Rust / Python / Angular