# Dependency Coupling Fitness Function MCP for AI Agents MCP

> Dependency Coupling Fitness Function MCP prevents your codebase from turning into spaghetti code. It lets your AI agent check if imports follow your architectural rules, like making sure the presentation layer doesn't touch the data layer directly.

## Overview
- **Category:** devops
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_AIjFYDNp0NQuoqA4hNR7TJO7xqu86H4KlbXXlCJw/mcp
- **Tags:** clean-architecture, dependency-validation, software-design, code-quality, architectural-fitness

## Description

Keeping a clean architecture is hard once a project grows. It starts with one small, temporary import that breaks a rule, and suddenly your layers are all tangled together. This MCP acts as an automated guardrail for your software design. You can set up rules that define which parts of your code are permitted to talk to each other. When you're working in your AI client, you can ask it to scan your files to see if any new changes violate your structural boundaries. It maps your file paths to specific layers and checks every import statement against the rules you've set. Instead of manually hunting through pull requests for architectural drift, you just let your agent do the heavy lifting. Since this is part of the Vinkius catalog, you can connect it to any compatible client and immediately start enforcing these boundaries across your entire repository. It turns architecture from a static document into an active, enforceable part of your development workflow.

## Tools

### identify_layer
Tells your agent which architectural layer a file belongs to by looking at its path. This makes managing large directory structures easy.

### audit_imports
Scans every import in a file to see if they break your design rules. It catches illegal dependencies instantly.

### check_rule_compliance
Verifies if a specific connection between two layers is allowed under your current setup. It acts as an automated gatekeeper for your code.

## Prompt Examples

**Prompt:** 
```
Does my current file follow our architecture rules?
```

**Response:** 
```
I checked `src/services/user_service.ts`. All imports are within the allowed service and domain layers. No violations found.
```

**Prompt:** 
```
Which layer is this file in: src/api/routes.ts?
```

**Response:** 
```
That file belongs to the **API/Presentation** layer based on its path.
```

**Prompt:** 
```
Can the presentation layer depend on the data layer?
```

**Response:** 
```
According to your current rules, **no**. The presentation layer is restricted to interacting only with the application layer.
```

## Capabilities

### Identify architectural layers
Automatically maps file paths to your defined software layers.

### Audit file imports
Scans every import statement in a file for rule violations.

### Validate dependency rules
Checks if connections between specific layers are permitted.

### Prevent architectural drift
Catches illegal dependencies before they are merged into your codebase.

### Enforce design boundaries
Ensures your code adheres to clean architecture or hexagonal principles.

## Use Cases

### Preventing Layer Leaks
A developer tries to import a database repository into a UI component, but your agent flags it immediately using audit_imports.

### Onboarding New Engineers
Use the MCP to help new hires understand the project structure by asking questions about file responsibilities via identify_layer.

### Refactoring Legacy Code
When moving files around, ask your agent to verify that the new paths still respect the existing architectural boundaries.

### Automating PR Reviews
Have your agent scan every incoming change to ensure no prohibited dependencies were introduced via check_rule_compliance.

## Benefits

- Stop architectural drift before it reaches production by using audit_imports to catch illegal imports.
- Automate layer identification so you don't have to manually map files with identify_layer.
- Ensure strict rule adherence by running check_rule_compliance during your development loop.
- Maintain a clean codebase that stays easy to test and extend over time.
- Reduce the cognitive load of manual architecture reviews in large repositories.

## How It Works

The bottom line is you get automated enforcement of your software architecture.

1. Connect the MCP to your preferred AI client via Vinkius.
2. Define your architectural layers and dependency rules in your project configuration.
3. Ask your agent to audit files or check for specific rule violations.

## Frequently Asked Questions

**How does Dependency Coupling Fitness Function prevent bad code?**
It automatically checks if new imports violate your predefined architectural boundaries.

**Can I use Dependency Coupling Fitness and Claude?**
Yes, you can connect this MCP to any compatible client like Claude or Cursor via Vinkius.

**Does Dependency Coupling Fitness Function work for all languages?**
It works for any language where your agent can analyze file paths and import statements.

**How do I define my architecture rules in Dependency Coupling Fitness Function?**
You define your layer mappings and prohibited dependencies in your project's configuration files.

**Can Dependency Coupling Fitness Function help with refactoring?**
Yes, it ensures that moving code between directories doesn't accidentally break your architectural constraints.

**How does the server identify architectural layers?**
The `identify_layer` tool parses the file path and looks for specific directory markers to determine which layer (e.g., domain, data, or presentation) the file belongs to.

**Can I use this to prevent circular dependencies?**
Yes, by using `audit_imports` with rules that forbid specific layer-to-layer connections, you can detect and block illegal dependency paths.

**What AI clients are compatible?**
This server is accessible via Vinkius Edge and works with Cursor, VS Code, Claude Desktop, Windsurf, and any MCP-compatible client.