# API Contract Breaker Detector MCP for AI Agents AI Agent Connect

> API Contract Breaker Detector identifies breaking changes in your API signatures and endpoints. It scans your codebase to catch modified paths, changed parameter types, or removed endpoints before they hit production and crash your distributed systems.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_YeJgQHCnSbmKU0xSykEdZnqaw5Tkqwkw63mRpiGy/ai-agent-connect
- **Tags:** api, contract, testing, ast, validation

## Description

Maintaining stable APIs in a fast-moving codebase is a constant battle against accidental breakage. When a developer changes a single parameter type or renames an endpoint, it can trigger a cascade of runtime failures across your entire distributed system. This MCP stops those failures by acting as a watchful eye over your API agreements. It uses deep code analysis to understand the structure of your FastAPI, Express, GraphQL, or TypeScript definitions. By establishing a baseline of what your APIs are supposed to look like, your agent can compare new code changes against that known truth. It flags exactly where a contract has been violated, whether it's a missing field or a subtle type mismatch. Instead of waiting for a production alert or a failed integration test, you catch these discrepancies during the development phase. You can manage all your contract definitions through the Vinkius catalog, making it easy to keep your agent informed about the current state of your services.

## Tools

### check_for_breaking_changes
Compares your current code against the stored registry to find contract violations. It flags removed endpoints or changed types immediately.

### query_contract_details
Retrieves the full definition of a specific contract from your registry. Use this to inspect exact parameter requirements or return objects.

### register_api_contracts
Saves your current API definitions into the registry to create a baseline. You can specify framework types to prioritize the scan.

## Prompt Examples

**Prompt:** 
```
Did my recent changes break any existing API contracts?
```

**Response:** 
```
I've analyzed your current codebase against the registered baseline. 

**Breaking Changes Detected:**

| Endpoint | Change Type | Details |
| :--- | :--- | :--- |
| `POST /v1/orders` | **Type Mismatch** | `quantity` expected `integer`, found `string` |
| `GET /users/{id}` | **Removed Parameter** | `include_metadata` parameter has been deleted |

Please revert these changes or update the downstream consumers.
```

**Prompt:** 
```
What are the requirements for the user profile endpoint?
```

**Response:** 
```
Here are the contract details for the `GET /users/profile` endpoint:

*   **Path:** `/users/profile`
*   **Method:** `GET`
*   **Required Parameters:**
    *   `user_id` (string, UUID format)
    *   `auth_token` (string)
*   **Response Body:**
    *   `username` (string)
    *   `email` (string)
    *   `is_active` (boolean)
```

**Prompt:** 
```
Register the current API definitions in this directory.
```

**Response:** 
```
I have successfully scanned the directory and registered the API contracts.

**Registration Summary:**
* **Frameworks detected:** FastAPI, TypeScript
* **Endpoints registered:** 14
* **Status:** Baseline established successfully.
```

## Capabilities

### Catch breaking API changes
Identify modifications that violate existing endpoint agreements before they cause runtime errors.

### Establish a source of truth
Create a persistent registry of all current API definitions to use as a baseline for future comparisons.

### Inspect endpoint definitions
Get detailed information about specific API paths, required parameters, and return types.

### Scan diverse frameworks
Analyze codebases using FastAPI, Express, GraphQL, or TypeScript to extract API structures.

## Use Cases

### Preventing accidental endpoint deletion
A developer removes an unused-looking endpoint, but your agent uses check_for_breaking_changes to warn that a legacy service still relies on it.

### Validating type changes during refactoring
You change an integer ID to a string UUID; your agent flags the mismatch against the registry before the code is even committed.

### Onboarding to a new microservice
A new engineer uses query_contract_details to quickly understand the exact shape of the data required for a specific API path.

### Ensuring GraphQL schema stability
Your agent scans your GraphQL definitions to ensure new mutations don't break existing queries used by the frontend.

## Benefits

- Stop runtime failures by catching signature mismatches before they deploy.
- Automate API validation using register_api_contracts to build a reliable baseline.
- Reduce debugging time by using check_for_breaking_changes to pinpoint exact contract violations.
- Maintain high service reliability by ensuring all endpoints follow established rules.
- Get instant clarity on endpoint requirements through query_contract_details.

## How It Works

The bottom line is you stop breaking downstream services by catching API mismatches during development.

1. Scan your codebase to capture the current state of all API definitions.
2. Save these definitions into a persistent registry to serve as your baseline.
3. Compare new code changes against the registry to flag any contract violations.

## Frequently Asked Questions

**How can I prevent API breaking changes with this MCP?**
You use this MCP to compare your current code against a saved baseline of your API definitions. It flags any mismatches in paths, parameters, or types before they cause issues.

**Does the API Contract Breaker Detector work with Express or FastAPI?**
Yes, it is designed to scan codebases using FastAPI, Express, GraphQL, and TypeScript to extract and validate your API structures.

**Can I use this to check my GraphQL schemas?**
Yes, the MCP can scan GraphQL definitions to ensure that changes to your schema don't break existing queries or mutations.

**How do I set up a baseline for my API contracts?**
You simply instruct your agent to register the current API definitions. This creates a source of truth in the registry that all future checks will be measured against.

**What happens if I change a parameter type in my code?**
The MCP will detect the discrepancy between your new code and the registered contract, alerting you that the parameter type no longer matches the established baseline.

**How do I start using this tool?**
First, run `register_api_contracts` to scan your codebase and create a baseline registry of your current API definitions.

**What is considered a breaking change?**
A breaking change includes removing an endpoint, changing a URL path, renaming a parameter, changing a parameter type, or removing a field from a response body.

**Does adding a new endpoint trigger a breaking change alert?**
No, adding new endpoints or adding optional parameters are not considered breaking changes.