# Corsair

> One integration layer for your agents, your backend and your users' dashboards

- Category: Agents & Automation / Agent Frameworks & Builders
- Language: TypeScript
- Licence: Apache-2.0
- Repository: https://github.com/corsairdev/corsair
- Website: https://corsair.dev
- Canonical page: https://ai-tldr.dev/tools/corsair/

## In short

Corsair is an open-source product integration platform for connecting an application's users to the third-party apps they already use. You install a core package plus a plugin per service, and Corsair handles the OAuth handshake, token storage and the request plumbing behind a single consistent syntax. It sits in the Agent Frameworks & Builders category of the Agents & Automation tools and is open-source, written in TypeScript and licensed Apache-2.0.

## Overview

Corsair is an open-source product integration platform for connecting an application's users to the third-party apps they already use. You install a core package plus a plugin per service, and Corsair handles the OAuth handshake, token storage and the request plumbing behind a single consistent syntax. Its own description of the job is short: connect your users to their apps.

The design choice that separates it from most agent tooling is that it is built on a REST API rather than being MCP-only. The project's reasoning is that the same integration layer then works for three very different callers — an agent deciding to act, a backend service running a job, and the multi-tenant dashboard where your customers connect their own accounts — instead of only the agent path. The more third-party APIs you touch, the more glue code that saves, because each integration is reached through the same syntax and the adapters behind it are maintained upstream.

It is open core. You can self-host the whole thing and keep your users' tokens on infrastructure you control, or use the hosted Hub if you would rather have OAuth refresh and webhook delivery handled for you. Credentials are encrypted with a key encryption key you generate and hold; the docs are blunt that losing that key means losing access to every stored credential.

## What it does

- One syntax across every integration, with the per-service adapters maintained by the project rather than by you
- Built on a REST API, so agents, backend services and end-user dashboards all use the same layer instead of an MCP-only path
- Managed OAuth: create a connection link, redirect the user, and call the service's endpoints once they return
- Multi-tenant by design — connections are scoped to a tenant id, for products where each customer connects their own accounts
- Self-host with your own database and key encryption key, or use the hosted Hub for OAuth refresh and webhooks
- Plugin-per-service packages (for example `@corsair-dev/github`, `@corsair-dev/slack`), with community PRs for new integrations

## Getting started

Corsair is a Node/TypeScript package. You install the core plus one plugin per service you want to reach, point it at a database and a key encryption key, then mount its handler in your framework's route file. This walkthrough follows the project's quick-start.

1. Install the core package and a plugin

   Add `corsair` plus the plugin for each service. GitHub is the quick-start's example; yarn, pnpm and bun work the same way.

```bash
npm install corsair @corsair-dev/github
```

2. Generate a key encryption key and set your environment

   The KEK encrypts stored credentials — generate it locally and keep a backup, because losing it means losing access to every stored credential. The API key and signing secret come from a project you create in the Hub dashboard.

```bash
openssl rand -base64 32

# .env
CORSAIR_KEK=your-generated-kek
CORSAIR_API_KEY=ck_dev_...
CORSAIR_SIGNING_SECRET=...
```

3. Create the database tables

   Corsair needs its own tables. The quick-start uses SQLite for a first run; the schema ships with the docs.

```bash
npm install better-sqlite3
sqlite3 corsair.db < migration.sql
```

4. Initialise Corsair

   Create the instance with your plugins, database, KEK and Hub credentials, then mount the handler in your framework's route file — for Next.js, `app/api/corsair/[[...path]]/route.ts`.

```ts
import Database from 'better-sqlite3';
import { createCorsair } from 'corsair';
import { github } from '@corsair-dev/github';

const corsair = createCorsair({
  plugins: [github({ authType: 'managed' })],
  database: new Database('corsair.db'),
  kek: process.env.CORSAIR_KEK!,
  multiTenancy: true,
  hub: {
    projectApiKey: process.env.CORSAIR_API_KEY!,
    signingSecret: process.env.CORSAIR_SIGNING_SECRET!,
  },
});
```

5. Connect a user, then call the service

   Create a connection link for a tenant and redirect the user through it. Once they are connected, call the service's endpoints directly off the Corsair instance.

```ts
const { connectUrl } = await corsair.manage.connect.createLink({
  plugin: 'github',
  tenantId: 'acme',
});

// after the user connects
const repos = await corsair.github.api.repositories.list({});
```

## When to use it

- Give an agent the ability to act across a user's own GitHub, Slack and other accounts without writing a bespoke OAuth flow for each one
- Ship a multi-tenant dashboard where each customer connects their own third-party accounts, scoped by tenant id
- Reach the same integration from an agent, a scheduled backend job and your UI without maintaining three different client paths
- Self-host the integration layer when your users' tokens and data must stay on infrastructure you can inspect
