ContraktContrakt
DocsRegistryGitHub
LoginGet started
MCP tool generation — now available→ Read the docs

Turn your API into
tools agents trust.

Contrakt scans your Next.js routes, generates a live contract, detects schema drift, and outputs MCP tools — all from your existing code.

Get started View on GitHub
contrakt scan ./src/app/apiscanning
route.tslayout.tsxpage.tsx
// app/api/orders/route.ts
 
import { NextRequest } from 'next/server'
import { db } from '@/lib/db'
 
export async function POST(
req: NextRequest
) {
const body = await req.json()
const {
product_id, quantity, currency
} = body
 
const order = await db.orders
.create({ product_id, quantity,
currency })
 
return Response.json({ order })
}
contract.jsonopenapi.yaml
{
"method": "POST",
"path": "/api/orders",
"input": {
"product_id": { "type": "string", "required": true },
"quantity": { "type": "integer", "min": 1 },
"currency": { "type": "string", "format": "iso-4217" }
},
"output": {
"order": { "type": "Order", "status": 201 }
},
"auth": "none"
}
✓ contract.json✓ openapi.yaml✓ mcp-manifest.json12 endpoints · 0 errors
Works withNext.js App RouterPages RouterClaudeCursorCodex

01 — Scan

Your code is the documentation.

Point Contrakt at your Next.js project. It reads your route handlers and infers every type, param, and response — no annotations, no decorators, no separate schema file.

Read the docs
terminal
❯ contrakt scan ./src
Detected: Next.js App Router
Scanning app/api/**
app/api/users/[id]/route.ts
GET→ User
app/api/orders/route.ts
GET POST→ Order[]
app/api/products/[id]/route.ts
GET PUT DELETE→ Product
✓ 12 endpoints · contract.json written
✓ openapi.yaml written
✓ mcp-manifest.json — 12 tools

02 — MCP

One command. Every agent.

Run contrakt mcp and get a machine-readable tool manifest. Agents using Claude, Cursor, or Codex can call your endpoints directly — without you writing a single wrapper.

View MCP docs
mcp-manifest.json
❯ contrakt mcp
{
  "schema_version": "1.0",
  "name": "storefront-api",
  "tools": [
    {
      "name": "create_order",
      "description": "Place a new order",
      "inputSchema": {
        "required": ["product_id"],
        "properties": {
          "product_id": { "type": "string" },
          "quantity":   { "type": "integer" },
          "currency":   { "type": "string" }
        }
      }
    }
  ]
}
✓ mcp-manifest.json — 12 tools
Works with Claude · Cursor · Codex · GPT

03 — Drift

Break it in code. Not in production.

Run contrakt check in CI. Every deploy is compared against the last contract. New required fields, renamed params, changed shapes — caught before agents encounter them.

CI integration guide
terminal
❯ contrakt check
Comparing v1.0.3 → HEAD
GET /api/users/[id]unchanged
GET /api/ordersunchanged
POST /api/ordersunchanged
PUT /api/products/[id]CHANGED
- "price": { "type": "number" }
+ "amount": { "type": "number" } ← renamed
+ "currency": { "type": "string", "required": true }
✗ 2 breaking changes
2 consumers subscribed · notifying now

04 — Registry

Publish once. Discovered forever.

Push your contract to the registry. Agents and developers find your API, inspect its schema, and subscribe to change notifications — without asking you.

Browse registry
registry.contrakt.dev
❯ contrakt publish
Publishing storefront-api@1.0.4...
storefront-apiMCP
Version1.0.4
Endpoints12
Consumers3 subscribed
Drift events0
✓ registry.contrakt.dev/you/storefront-api
Agents can now discover this API

Agent-ready.
Available today.

Get started free Star on GitHub
ContraktContrakt

Open-source API contract layer for the age of agents.

Product

DocsChangelogRegistryPricing

Features

Contract ScanMCP GeneratorDrift DetectionRegistry

Company

AboutBlogCareersBrand

Connect

GitHubX / TwitterDiscordContact

© 2025 Contrakt. MIT License.

PrivacyTermsSecurity