MCPcopy
hub / github.com/corsairdev/corsair

github.com/corsairdev/corsair @v0.1.0 sqlite

repository ↗ · DeepWiki ↗ · release v0.1.0 ↗
513 symbols 1,324 edges 224 files 34 documented · 7%
README

Corsair

Power your coding agents with the Vibe Coding SDK.

Equip your coding agents to build faster with natural language queries and mutations.

pnpm corsair query
  -n "published posts with engagement"
  -i "this should return published posts with author details and comment count"

What Corsair Does

Corsair turns natural language commands into fully-typed, production-ready queries and mutations. Your agents write what they want in plain English, and Corsair generates TypeScript API endpoints automatically.

Corsair handles ORM complexity, third-party API integrations, and validates everything against your schema and codebase.

When your agent writes the bash command, it can immediately use this on the client:

const posts = useCorsairQuery('published posts with engagement by author id', {
  author_id: params.author_id,
})

With Corsair, you get:

  • ✅ Full type safety - TypeScript knows exactly what shape the data is
  • ✅ Validated API routes - Can't hallucinate invalid database operations or third-party integrations
  • ✅ Readable code - Developers instantly understand intent during code review
  • ✅ Auto-fixing - When your schema changes, Corsair rewrites queries to match

Works with any stack (Next, Vite, Hono, Svelte, etc) and any ORM (Drizzle, Prisma, Kysely, Supabase, etc)

CLI Commands

Create queries:

pnpm corsair query
  -n "get all posts by author"
  -i "return posts in descending order (newest first)"

Create mutations:

pnpm corsair mutation
  -n "create post and email author"
  -i "create the post then email the author confirming it was created"

Update existing:

pnpm corsair -u
  -n "create post and email author"
  -i "also auto-like the post by the author"

List everything:

pnpm corsair list                  # all queries and mutations
pnpm corsair list -q               # queries only
pnpm corsair list -m               # mutations only
pnpm corsair list -f "author id"   # filter by string

Validate & fix:

pnpm corsair check  # validate all queries / mutations still work (like after DB schema updates)
pnpm corsair fix    # auto-fix all queries / mutations

Why Use This With Your Agent?

Agents work faster - No fumbling with ORM syntax or debugging type mismatches

Agents make fewer mistakes - CLI validates everything before generating code, preventing hallucinated queries

Agents write readable code - Natural language intent stays inline, so humans instantly understand what the agent built

Agents use less tokens - Agents start with fresh context on each Corsair command, using less tokens on full agent runs

Bash-native - Agents can do everything from terminal without navigating files

What It Looks Like In Code

The natural language prompt becomes your query identifier:

// Queries
const { data: posts } = useCorsairQuery('published posts with engagement')
//    ^? { id: number; title: string; author: { name: string }; commentCount: number }[]

// Mutations
const createPost = useCorsairMutation('create post and email author')
await createPost.mutateAsync({
  title: 'Hello World',
  authorId: 123,
  //  ^ fully typed mutation arguments
})

The intent is preserved right in the code. When you read "published posts with engagement" you know exactly what it does.

Compare to traditional ORM code where intent is buried in implementation:

// ❌ What does this do?
const { data } = useQuery(['posts'], async () => {
  return db
    .select()
    .from(posts)
    .where(eq(posts.published, true))
    .leftJoin(authors, eq(posts.authorId, authors.id))
    .groupBy(posts.id)
})

// ✅ Intent is obvious
const { data } = useCorsairQuery('published posts with engagement')

Get Started

npm install corsair
npx corsair init

Extension points exported contracts — how you extend this code

OperationInfo (Interface)
(no doc)
packages/corsair/cli/list.ts
TOCItem (Interface)
(no doc)
docs/lib/toc.ts
PageProps (Interface)
(no doc)
docs/app/[[...slug]]/page.tsx
TracksTableProps (Interface)
(no doc)
demo/nextjs-drizzle/components/tracks-table.tsx
PostCardProps (Interface)
(no doc)
demo/nextjs-prisma/components/post-card.tsx
PostCardProps (Interface)
(no doc)
demo/nextjs-drizzle-blog/components/post-card.tsx
FileWithErrors (Interface)
(no doc)
packages/corsair/cli/fix.ts
ArtistCardProps (Interface)
(no doc)
demo/nextjs-drizzle/components/artist-card.tsx

Core symbols most depended-on inside this repo

emit
called by 59
packages/corsair/watch/core/event-bus.ts
addHistoryEntry
called by 35
packages/corsair/watch/core/state-machine.ts
cn
called by 34
demo/nextjs-drizzle/lib/utils.ts
on
called by 33
packages/corsair/watch/core/event-bus.ts
transition
called by 27
packages/corsair/watch/core/state-machine.ts
cn
called by 23
demo/nextjs-prisma/lib/utils.ts
cn
called by 23
demo/nextjs-drizzle-blog/lib/utils.ts
parse
called by 20
packages/corsair/watch/handlers/schema-handler.ts

Shape

Function 274
Interface 106
Method 104
Class 27
Enum 2

Languages

TypeScript100%

Modules by API surface

packages/corsair/watch/core/state-machine.ts39 symbols
packages/corsair/watch/types/events.ts20 symbols
packages/corsair/watch/types/state.ts17 symbols
demo/nextjs-drizzle/lib/api/data.ts16 symbols
demo/nextjs-drizzle-blog/lib/api/data.ts16 symbols
packages/corsair/watch/handlers/operations-handler.ts13 symbols
packages/corsair/watch/handlers/file-write-handler.ts13 symbols
packages/corsair/cli/init.ts13 symbols
packages/corsair/watch/handlers/schema-handler.ts12 symbols
packages/corsair/watch/handlers/operation-change-handler.ts11 symbols
packages/corsair/watch/handlers/user-input-handler.ts10 symbols
packages/corsair/watch/handlers/schema-change-handler.ts10 symbols

Dependencies from manifests, versioned

@ai-sdk/openai2.0.68 · 1×
@biomejs/biome2.3.5 · 1×
@cloudflare/workers-types4.0.0 · 1×
@eslint/eslintrc3 · 1×
@inquirer/prompts7.0.1 · 1×
@prisma/client5.22.0 · 1×
@radix-ui/react-avatar1.1.10 · 1×
@radix-ui/react-dialog1.1.15 · 1×
@radix-ui/react-slot1.2.3 · 1×
@tanstack/react-query5.90.5 · 1×

For agents

$ claude mcp add corsair \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact