# Type Definition Consistency Checker MCP for AI Agents MCP

> Type Definition Consistency Checker keeps your frontend and backend in sync. It audits TypeScript interfaces, Zod schemas, and Pydantic models to catch mismatches before they break your production environment. No more runtime errors caused by silent schema changes.

## Overview
- **Category:** productivity
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/undefined/mcp
- **Tags:** typescript, zod, pydantic, schema-validation, ast-parsing

## Description

Keeping your frontend and backend in sync is a nightmare when you are manually updating interfaces across different languages. You change a field in a Python model, forget to update the Zod schema, and suddenly your production app is crashing on a null pointer. This MCP acts as an automated auditor for your data structures. It looks at your TypeScript, Zod, and Pydantic definitions and flags exactly where they have drifted apart. Whether it is a missing field, a type mismatch like a string becoming an integer, or an optionality misalignment, you will see it immediately. Instead of hunting through files, you just ask your agent to check the consistency across your codebase. It pulls everything together into a single source of truth, making sure your API contracts actually mean what they say they do. You can find this and thousands of other specialized tools in the Vinkius catalog, all ready to plug into your existing workflow.

## Tools

### compare_definitions
Compares two specific type definitions to find differences. It is great for reviewing a single pull request change.

### inspect_structure
Breaks down a single definition into its raw metadata. Use this to see exactly what fields and types are parsed.

### sync_definitions
Runs a full audit across multiple definitions at once. This is your primary tool for catching drift across the whole stack.

## Prompt Examples

**Prompt:** 
```
Are my Zod schemas and TypeScript interfaces still in sync?
```

**Response:** 
```
| Field | Status |
| :--- | :--- |
| `user_id` | ✅ Match |
| `email` | ❌ Type Mismatch (String vs Number) |
| `is_active` | ⚠️ Optionality Drift |
```

**Prompt:** 
```
What fields are inside this Pydantic model?
```

**Response:** 
```
The parsed structure contains the following fields:
* `user_id` (String, required)
* `email` (String, required)
* `is_active` (Boolean, optional)
```

**Prompt:** 
```
Check if the new interface matches the existing one.
```

**Response:** 
```
The comparison identified one change: Field `last_login` was **Added** to the target definition.
```

## Capabilities

### Catch type mismatches
Identify when a Python field type does not match its TypeScript counterpart.

### Detect missing fields
Find where Zod schemas are missing properties present in your backend models.

### Audit optionality changes
Spot when a field has changed from required to optional across your stack.

### Verify structural integrity
Ensure your entire API contract remains consistent during refactors.

### Inspect parsed metadata
View the raw structure of any type definition through your agent.

## Use Cases

### Breaking changes in API updates
You added a required field to a Pydantic model but forgot the Zod schema. Your agent flags the mismatch immediately.

### Verifying frontend/backend parity
After a large refactor, you run an audit to ensure no interfaces were left behind in the migration.

### Auditing TypeScript interface drift
A teammate changed an interface type from string to number; your agent catches it before the PR is merged.

## Benefits

- Stop runtime crashes by catching type mismatches between Python and TypeScript before they hit production.
- Reduce manual debugging time when updating Zod schemas or Pydantic models.
- Ensure your API contracts are always accurate during large refactors.
- Easily spot missing fields or changed optionality across your entire codebase.
- Maintain a single source of truth for all data structures in your stack.

## How It Works

The bottom line is you stop shipping broken API contracts.

1. Connect the MCP to your preferred client like Cursor or Claude.
2. Point your agent toward your schema files or directories.
3. Review the audit results for any structural mismatches found.

## Frequently Asked Questions

**How does Type Definition Consistency Checker prevent production errors?**
It catches type mismatches and missing fields in your schemas before you deploy, preventing runtime crashes caused by unexpected data shapes.

**Can I use Type Definition Consistency Checker with Zod and Pydantic?**
Yes. It is specifically designed to audit the synchronization between Zod, Pydantic, and TypeScript definitions.

**Does Type Definition Consistency Checker work for TypeScript interfaces?**
Absolutely. It parses TypeScript interfaces to ensure they align with your backend models.

**How do I find mismatches using Type Definition Consistency Checker?**
You simply ask your agent to run an audit across your schema files, and it will report any discrepancies found.

**What happens if my schemas are out of sync?**
The MCP identifies the exact fields where the types or optionality markers do not match, allowing you to fix them immediately.

**What types of definitions can I check?**
The tool supports `typescript_interface`, `zod_schema`, and `pydantic_model` formats.

**How does the tool detect errors?**
It uses deterministic AST parsing to extract field names, types, and optionality markers, then performs set comparison across your provided definitions.

**Can I use this for a single Pull Request review?**
Yes, you can use the `compare_definitions` tool to perform a targeted comparison between a base definition and a target definition.