# Business Logic Gatekeeper MCP for AI Agents AI Agent Connect

> Business Logic Gatekeeper MCP prevents code changes from breaking core business rules. It uses regex-based validation to ensure that even if your code is syntactically perfect, it still respects critical logical invariants like financial integrity or security constraints during the development process.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_OykB2vB5FvUo9SWJUU5escy9LnJfpn7ColoWx1qw/ai-agent-connect
- **Tags:** validation, compliance, invariants, regex, testing

## Description

Writing code that runs is easy; writing code that actually follows your business rules is the hard part. This MCP acts as a logical watchdog for your development workflow. It sits between your implementation and your actual business intent, catching mistakes that standard compilers and linters miss. While a compiler checks if your syntax is right, this tool checks if your logic is right. It ensures that a change meant to update a UI doesn't accidentally bypass a security check or mess with a financial calculation. By connecting this to your preferred AI client through the Vinkius catalog, you can turn your agent into a specialized auditor that understands your specific business invariants. It keeps your core logic intact even when you're moving fast and iterating constantly, preventing those expensive, late-stage bugs that happen when code technically works but logically fails.

## Tools

### check_compliance
Validates your recent file changes against your registered business rules. It catches logical errors that standard testing might miss.

### query_rules
Fetches a filtered list of your existing business rules. Use this to see what constraints are currently active.

### register_rule
Adds a new business rule or invariant to the registry. This defines the logic your agent will enforce.

## Prompt Examples

**Prompt:** 
```
Does my current code change violate any of our financial integrity rules?
```

**Response:** 
```
I've checked your recent changes against the registered rules. 

**Status: Non-Compliant**

* **Rule Violated:** `max_transfer_limit` 
* **Details:** The new `process_payment` function allows transfers up to $50,000, but the registered limit is $10,000.
* **Recommendation:** Update the constant in `config.py` or adjust the logic in the payment service.
```

**Prompt:** 
```
Can you list all the security rules I have registered?
```

**Response:** 
```
Here are the active security invariants currently in the registry:

| Rule Name | Description |
| :--- | :--- |
| `no_unauthenticated_admin_access` | Ensures all `/admin` routes require a valid session. |
| `pii_encryption_required` | Mandates AES-256 encryption for all fields marked as PII. |
| `strict_cors_policy` | Restricts origin headers to the approved domain list. |
```

**Prompt:** 
```
Register a rule that ensures user emails must always follow a standard format.
```

**Response:** 
```
I have successfully added the new rule to the registry.

**Rule Registered:** `valid_email_format` 
**Logic:** `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$` 

Your agent will now flag any code changes that attempt to bypass this regex validation.
```

## Capabilities

### Enforce logical invariants
Prevents code updates from violating specific business rules or security constraints.

### Audit file changes
Checks your recent code modifications against a set of registered business rules.

### Manage rule registries
Adds or updates the specific logical constraints your agent must check against.

### Filter business constraints
Retrieves specific subsets of rules to focus on particular logic areas.

## Use Cases

### Preventing negative account balances
A developer uses register_rule to set a constraint that user balances cannot drop below zero, and the agent catches a logic error in a new withdrawal function.

### Securing API access patterns
An engineer uses check_compliance to ensure new routing changes don't accidentally expose sensitive endpoints to unauthorized users.

### Validating financial transaction limits
A fintech dev registers a rule for maximum transaction amounts and uses the agent to verify that a new batch processing script stays within those limits.

### Enforcing data privacy constraints
A backend dev uses the gatekeeper to ensure that new database schema changes don't violate PII handling rules.

## Benefits

- Catch logical errors early by using check_compliance to validate code against business rules.
- Maintain strict financial integrity by using register_rule to set balance constraints.
- Automate security auditing by having your agent check every change against security invariants.
- Keep your rules organized by using query_rules to manage your logic registry.
- Prevent regression bugs that pass unit tests but violate core business logic.

## How It Works

The bottom line is that it turns your business requirements into automated logical checks that your agent can run against every change.

1. Register your specific business rules or logical invariants into the registry.
2. Submit your recent code changes to the gatekeeper for validation.
3. Receive a compliance report confirming if the logic meets your requirements.

## Frequently Asked Questions

**How does Business Logic Gatekeeper prevent production bugs?**
It catches logical errors that standard tests miss by checking your code against specific business invariants, like financial limits or security constraints, before you merge.

**Can I use Business Logic Gatekeeper with my existing testing suite?**
Yes. Think of it as a specialized layer of defense that works alongside your unit tests to ensure your code follows business intent, not just syntax.

**What makes Business Logic Gatekeeper different from a linter?**
Linters check for code style and syntax. This MCP checks for business logic, ensuring your code doesn't violate the actual rules of your specific industry or application.

**How do I add new rules to Business Logic Gatekeeper?**
You can simply ask your agent to register a new rule, defining the logical constraint you want to enforce across your codebase.

**Is Business Logic Gatekeeper compatible with Cursor and VS Code?**
Yes, it works with any MCP-compatible client, including Cursor, VS Code, and Windsurf, allowing your agent to audit your code directly in your editor.

**How does the gatekeeper validate code?**
It uses the `check_compliance` tool to match file contents against registered `validationRegex` patterns defined in business rules.

**Can I add custom business rules?**
Yes, you can use the `register_rule` tool to add new invariants with specific severity levels and affected file paths.

**What is a compliance score?**
The compliance score is a value between 0 and 1 representing the ratio of satisfied rules to total applicable rules.