# Architectural Constraint Enforcer MCP for AI Agents AI Agent Connect

> Architectural Constraint Enforcer MCP keeps your codebase from turning into spaghetti. It uses AST analysis and dependency graph traversal to make sure every code change follows your specific structural rules, layer boundaries, and naming conventions. It's a deterministic way to stop architectural drift before it becomes a massive technical debt problem.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_ABN42UMDeFDMFiU7B07G2iOsvGJgfBjkHF0uHeMU/ai-agent-connect
- **Tags:** ast, dependency-graph, architecture, linting, code-integrity

## Description

Maintaining a clean architecture shouldn't feel like a constant battle against entropy. Usually, you're the one manually checking if a developer accidentally imported a database utility into a UI component or if a new module created a circular dependency that will break your build later. This MCP changes that by giving your AI client the ability to actually understand the structural logic of your project. Instead of just guessing if code looks right, your agent can perform deep analysis on the Abstract Syntax Tree to verify that every new line of code respects the boundaries you've set. It can check if specific files follow your rules, verify that module relationships stay within permitted bounds, and even give you a high-level health report on how well the entire project is holding up against your constraints. By connecting this to your workflow through the Vinkius catalog, you turn your AI from a simple code generator into a vigilant guardian of your project's structural integrity.

## Tools

### validate_file_compliance_tool
Checks if a specific file or a set of changed files adheres to your architectural rules. It ensures new code doesn't break existing structural constraints.

### check_module_relationships_tool
Determines if a specific relationship between two modules is permitted. It prevents illegal imports and layer violations.

### get_project_compliance_summary_tool
Provides a high-level overview of the entire project's health. It gives you a clear picture of how well the codebase meets your defined constraints.

## Prompt Examples

**Prompt:** 
```
Does this current file follow our architectural rules?
```

**Response:** 
```
The file is compliant with all defined layer boundaries and naming conventions.

**Compliance Details:**
- **Layer Integrity:** Passed
- **Naming Standards:** Passed
- **Dependency Check:** No illegal imports detected.
```

**Prompt:** 
```
Is there a circular dependency between the API and the Database layers?
```

**Response:** 
```
No circular dependencies were detected between the API and Database layers.

**Dependency Graph Status:**
- **API $\rightarrow$ Database:** Permitted
- **Database $\rightarrow$ API:** Blocked (Not detected in current state)
```

**Prompt:** 
```
Give me a summary of the project's compliance score.
```

**Response:** 
```
The project has an aggregate compliance score of **0.95**.

**Summary Report:**
- **Total Files Scanned:** 142
- **Violations Found:** 2 (Minor)
- **Violation Location:** `src/tests/utils.js` (Naming convention mismatch)
```

## Capabilities

### Verify file structure
Check if specific files or recent changes follow your defined architectural rules.

### Audit module dependencies
Confirm if a relationship between two specific modules is allowed by your architecture.

### Assess project health
Get a high-level summary of how well the entire codebase adheres to your constraints.

### Detect circular dependencies
Identify when modules are creating illegal loops that break structural boundaries.

### Enforce naming standards
Ensure all new code follows the specific naming conventions required by your project.

## Use Cases

### Preventing layer violations in microservices
A developer tries to call a database service directly from a frontend component. They ask their agent to check the file, and the agent blocks the change because it violates the defined layer boundaries.

### Detecting circular dependencies in large repos
As a project grows, two modules accidentally start depending on each other. The agent uses the dependency graph to flag this loop before it causes a circular import error in production.

### Onboarding new developers safely
A new hire is working on a complex codebase. They ask their agent if their proposed module structure is okay, and the agent verifies it against the project's strict architectural rules.

### Automated architectural health audits
A lead dev wants to see how much the project has drifted from the original design. They ask for a summary, and the agent provides a compliance score and a list of violations.

## Benefits

- Stop architectural drift by using validate_file_compliance_tool to catch rule violations in real time.
- Prevent spaghetti code by using check_module_relationships_tool to block illegal module imports.
- Get instant visibility into technical debt using get_project_compliance_summary_tool for project health.
- Eliminate circular dependency headaches by validating the dependency graph during development.
- Automate naming convention checks so you can focus on logic instead of formatting.
- Maintain clean layer boundaries without needing to manually audit every single pull request.

## How It Works

The bottom line is you get a deterministic way to automate architectural linting through your AI agent.

1. Connect your preferred AI client to the MCP via Vinkius.
2. Define your project's architectural rules and constraints.
3. Ask your agent to validate files or check dependencies to get immediate compliance feedback.

## Frequently Asked Questions

**How can the Architectural Constraint Enforcer MCP help my code reviews?**
It acts as an automated reviewer that catches structural errors. Instead of you manually checking if imports are correct, your agent can verify every file against your specific architectural rules instantly.

**Can I use the Architectural Constraint Enforcer MCP with Cursor or VS Code?**
Yes. You can connect this MCP to any compatible client like Cursor, VS Code, or Claude, allowing your agent to perform structural analysis directly within your development environment.

**Will the Architectural Constraint Enforcer MCP prevent circular dependencies?**
Yes. It uses dependency graph traversal to identify and block illegal relationships between modules, preventing the circular loops that often break large projects.

**How does this MCP check if my code follows my specific rules?**
It uses deterministic AST analysis. This means it looks at the actual structure of your code's syntax tree to ensure it matches the constraints you have defined for your project.

**Can I get a full report on my project's structural health?**
Yes. You can request a high-level summary that provides a compliance score and highlights specific areas where the codebase is deviating from your intended architecture.

**How does the tool detect circular dependencies?**
The tool builds a mathematical dependency graph from your source code and uses cycle detection algorithms to identify any loops where modules depend on each other.

**Can I enforce specific naming conventions?**
Yes, you can use the structural tier rules to enforce conventions like PascalCase for components or specific file-system organization.

**What is the difference between the validation tools?**
Use `validate_file_compliance_tool` for granular file checks, `check_module_relationships_tool` for testing a single dependency link, and `get_project_compliance_summary_tool` for a full project overview.