docs

Adapter Catalog

Mimic ships 9 API mock adapters and 4 database adapters today, with 100+ more on the roadmap. Every adapter is open source (Apache 2.0) and community-contributable.

Database Adapters

AdapterPackageStatusWhat it does
PostgreSQL@mimicai/adapter-postgresShippedSeeds tables via COPY FROM STDIN, FK-aware ordering
MongoDB@mimicai/adapter-mongodbShippedSeeds collections with embedded documents
MySQL@mimicai/adapter-mysqlShippedSeeds tables with relational integrity
SQLite@mimicai/adapter-sqliteShippedFile-based database seeding, WAL mode support
Pinecone@mimicai/adapter-pineconePlannedSeeds vector embeddings for RAG testing
Redis@mimicai/adapter-redisPlannedSeeds key-value pairs, sorted sets, streams

API Mock Adapters

9 adapters shipped: All adapters below are published packages with full mock route coverage, MCP server support, and a standalone MCP binary (src/bin/mcp.ts). Each is built on @mimicai/adapter-sdk.

AdapterPackageRoutesStatusDescription
Stripe@mimicai/adapter-stripe616ShippedFull v1 + v2 coverage: customers, payment intents, charges, refunds, subscriptions, invoices, products, prices, balance, billing meters, event destinations
Plaid@mimicai/adapter-plaid10ShippedAccounts, transactions, identity, auth, balance, institutions, link tokens
Paddle@mimicai/adapter-paddle83ShippedSubscriptions, products, prices, transactions, customers, discounts, adjustments
Chargebee@mimicai/adapter-chargebee55ShippedSubscriptions, customers, invoices, plans, addons, credit notes, payment sources
GoCardless@mimicai/adapter-gocardless45ShippedMandates, payments, customers, subscriptions, bank accounts, refunds
Lemon Squeezy@mimicai/adapter-lemonsqueezy50ShippedProducts, variants, orders, subscriptions, customers, discounts, license keys
Recurly@mimicai/adapter-recurly47ShippedAccounts, subscriptions, invoices, transactions, plans, coupons, credit adjustments
RevenueCat@mimicai/adapter-revenuecat42ShippedSubscribers, entitlements, offerings, products, purchases, receipts
Zuora@mimicai/adapter-zuora54ShippedAccounts, subscriptions, invoices, payments, products, rate plans, usage records

Fintech / Payments — shipped

Stripe616 routes
Plaid10 routes
Paddle83 routes
Chargebee55 routes
GoCardless45 routes
Lemon Squeezy50 routes
Recurly47 routes
RevenueCat42 routes
Zuora54 routes

Fintech / Payments — planned

Square16 routes
Wise14 routes
Adyen12 routes
Coinbase12 routes
PayPal13 routes
Brex10 routes
Ramp10 routes
Mercury9 routes
Moov8 routes
Marqeta12 routes
Checkout.com10 routes

Communication — Roadmap

Slackplanned
Twilioplanned
SendGrid11 routes
Discord13 routes
MS Teams12 routes
WhatsApp9 routes
Telegram11 routes
Mailgun10 routes
Postmark9 routes
Vonage8 routes
MessageBird7 routes

CRM — Roadmap (7 adapters)

Salesforce16 routes
HubSpot16 routes
Pipedrive14 routes
Zoho CRM13 routes
Close14 routes
Attio12 routes
Dynamics 36511 routes

Ticketing — Roadmap (8 adapters)

Zendesk24 routes
Jira21 routes
Linear20 routes
Intercom25 routes
PagerDuty17 routes
Freshdesk18 routes
ServiceNow9 routes
Shortcut22 routes

Project Management — Roadmap (8 adapters)

Notion19 routes
Asana22 routes
Trello23 routes
Monday.com19 routes
Airtable11 routes
ClickUp20 routes
Todoist18 routes
Basecamp23 routes

Calendar / Scheduling — Roadmap (6 adapters)

Google Calendar10 routes
Calendly11 routes
Cal.com12 routes
Nylas9 routes
Cronofy10 routes
Acuity9 routes

Adapter SDK

The @mimicai/adapter-sdk package provides the base classes and utilities for building API mock adapters. It re-exports core types and adds test helpers, format helpers, and two abstract base classes.

bash
$ npm install @mimicai/adapter-sdk

Base Classes

ClassWhen to useWhat it provides
BaseApiMockAdapterSimple adapters with hand-written routesAdapter lifecycle defaults (init, apply, clean, healthcheck, dispose)
OpenApiMockAdapterRecommended. Adapters built from an OpenAPI spec via codegenEverything in Base, plus automatic CRUD scaffolding (list/create/retrieve/update/delete), cursor pagination, override system, seeding from ExpandedData, and default factories

OpenApiMockAdapter is the standard path for new adapters. Given an OpenAPI spec, a codegen script generates routes, schemas, and resource specs. The base class auto-handles CRUD for every route — you only write custom "override" handlers for state-machine endpoints (e.g., confirm, capture, cancel).

Exports

ExportTypeDescription
BaseApiMockAdapterAbstract classLow-level base. Provides lifecycle defaults. Extend directly only for non-OpenAPI adapters.
OpenApiMockAdapterAbstract classOpenAPI-driven base. Auto-scaffolds CRUD routes from generated route definitions, handles pagination, seeding, and the override system.
buildTestServer(adapter, seedData?)FunctionSpins up an in-memory Fastify instance with your adapter routes loaded. Returns { server, stateStore, close } — use server.inject() for in-process requests.
MockServerClassThe HTTP server used by mimic host. Use directly in integration tests to run a full mock server.
StateStoreClassIn-memory key-value store shared across routes for mutation tracking (e.g. created/updated resources)
generateIdFunctionGenerate prefixed IDs matching real platform formats (e.g. cus_xxx, pi_xxx)
unixNow, toDateStr, capitalizeUtilitiesFormatting helpers for response generation

Methods to implement

MethodRequiredDescription
registerRoutes(server, data, stateStore)YesMount Fastify routes. For OpenApiMockAdapter, call this.mountOverrides(store) then this.registerGeneratedRoutes(server, data, store, ns).
resolvePersona(req)YesExtract persona ID from the incoming request (auth header, body field, or query param)
getEndpoints()YesReturn EndpointDefinition[]. For OpenApiMockAdapter, just call this.endpointsFromRoutes().
registerMcpTools(mcpServer, mockBaseUrl)NoRegister MCP tools on the MCP server pointed at your mock API URL. Required if you want mcp: true in mimic.json to expose tools to agents.

Build an Adapter

Adapters are built from OpenAPI specs using a codegen-driven pipeline. A codegen script reads the spec and generates route definitions, schema defaults, and resource metadata. The OpenApiMockAdapter base class auto-scaffolds CRUD for every generated route — you only write custom handlers for state-machine endpoints.

Pipeline overview

text
OpenAPI spec (.json)
    ↓
Codegen script (pnpm generate)
    ↓
  src/generated/
    ├── routes.ts           ← HTTP route definitions (method, path, operation type)
    ├── resource-specs.ts   ← Field metadata for data generation
    ├── schemas.ts          ← Default factory functions (one per resource)
    └── meta.ts             ← Spec version + timestamp
    ↓
Adapter class (extends OpenApiMockAdapter)
    ├── CRUD scaffolding    ← Automatic from generated routes
    ├── Override handlers   ← State machines, computed endpoints
    ├── MCP tools           ← AI agent access
    └── Error helpers       ← Platform-specific error format

Package structure

text
packages/adapters/adapter-{name}/
├── adapter.json                 ← Identity: id, basePath, versions, spec URL
├── {name}-spec.json             ← OpenAPI spec (gitignored, download from source)
├── scripts/
│   └── {name}-codegen.ts        ← Reads spec → generates TypeScript files
├── src/
│   ├── index.ts                 ← Public exports + AdapterManifest
│   ├── adapter-meta.ts          ← Loads adapter.json at runtime
│   ├── config.ts                ← Zod config schema
│   ├── {name}-adapter.ts        ← Adapter class
│   ├── {name}-errors.ts         ← Platform-specific error builders
│   ├── mcp.ts                   ← MCP tool registration
│   ├── bin/mcp.ts               ← Standalone MCP binary
│   ├── generated/               ← Auto-generated (never hand-edit)
│   │   ├── routes.ts
│   │   ├── resource-specs.ts
│   │   ├── schemas.ts
│   │   └── meta.ts
│   ├── overrides/               ← Custom route handlers
│   └── __tests__/
└── package.json                 ← Scripts: build, generate, test

Step 1: adapter.json

jsonadapter.json
{
  "id": "my-platform",
  "name": "My Platform API",
  "description": "My Platform mock adapter",
  "type": "api-mock",
  "basePath": "/my-platform",
  "versions": ["2025-01-01", "2026-01-01"],
  "specUrl": "https://example.com/openapi/spec.json",
  "specFile": "my-platform-spec.json",
  "mcp": {
    "serverName": "mimic-my-platform",
    "serverVersion": "0.5.0",
    "description": "Mimic MCP server for My Platform"
  }
}
FieldPurpose
idUnique identifier. Used as StateStore namespace prefix ({id}:{resource})
basePathURL prefix for all routes (e.g., /my-platform). Routes become /{basePath}/v1/{path}
versionsAPI versions this adapter supports
specFileOpenAPI spec filename (gitignored — download from specUrl)
mcpMCP server metadata for Claude/AI tool registration

Step 2: Codegen script

The codegen script reads the OpenAPI spec and generates four TypeScript files. Each API has different conventions, so the codegen is adapter-specific.

bash
$ pnpm --filter @mimicai/adapter-my-platform generate

The script must:

  1. Extract resources from OpenAPI schemas (via x-resourceId, tags, or schema names)
  2. Extract routes from paths, converting {param} to :param for Fastify
  3. Detect operation type for each route: list, create, retrieve, update, delete, or action
  4. Map fields with semantic metadata: ID prefixes, timestamps, amount formats, enums, refs
  5. Generate default factories — one function per resource that returns a spec-faithful default object

Key codegen concerns:

Step 3: Generated files

All generated files go in src/generated/ with the banner // !! AUTO-GENERATED — do not edit.

FileExportsUsed by
routes.tsGENERATED_ROUTES: GeneratedRoute[]OpenApiMockAdapter CRUD scaffolding, endpoint listing
resource-specs.tsAdapterResourceSpecsBlueprint engine for data generation
schemas.tsSCHEMA_DEFAULTS: Record<string, DefaultFactory>Create handlers and seeding
meta.tsSpec version + timestampInformational

Each DefaultFactory returns a full object with spec-faithful defaults, merging any overrides:

typescriptschemas.ts (generated)
export function defaultCustomer(overrides = {}) {
  return {
    id: generateId("cus_", 14),
    object: "customer",
    created: unixNow(),
    email: null,
    metadata: {},
    // ... every field from the schema
    ...overrides,
  };
}

Step 4: Adapter class

typescriptsrc/my-platform-adapter.ts
import { OpenApiMockAdapter } from '@mimicai/adapter-sdk';
import meta from './adapter-meta.js';
import { myPlatformResourceSpecs } from './generated/resource-specs.js';
import { SCHEMA_DEFAULTS } from './generated/schemas.js';
import { GENERATED_ROUTES } from './generated/routes.js';
​
function ns(resource: string): string {
  return `myplatform:${resource}`;
}
​
export class MyPlatformAdapter extends OpenApiMockAdapter {
  readonly id = meta.id;
  readonly name = meta.name;
  readonly basePath = meta.basePath;
  readonly versions = meta.versions;
  readonly resourceSpecs = myPlatformResourceSpecs;
​
  protected readonly generatedRoutes = GENERATED_ROUTES;
  protected readonly defaultFactories = SCHEMA_DEFAULTS;
​
  async registerRoutes(server, data, store) {
    this.mountOverrides(store);  // Override handlers FIRST
    await this.registerGeneratedRoutes(server, data, store, ns);  // CRUD scaffolding
  }
​
  getEndpoints() { return this.endpointsFromRoutes(); }
​
  resolvePersona(req) {
    // Match platform auth pattern (API key, Bearer token, etc.)
    const auth = req.headers.authorization;
    if (!auth) return null;
    const match = auth.match(/^Bearer\s+test_([a-z0-9-]+)_/);
    return match ? match[1] : null;
  }
​
  private mountOverrides(store) {
    // Register state-machine handlers BEFORE registerGeneratedRoutes()
    this.registerOverride('POST', '/my-platform/v1/orders/:order/confirm',
      orderOverrides.buildConfirmHandler(store));
  }
}

Step 5: Override handlers

Overrides replace auto-generated CRUD for endpoints that need custom logic — state transitions, cross-resource side effects, computed responses, or singletons.

Use caseExample
State machine transitionPOST /orders/:id/confirm (draft → confirmed)
Cross-resource side effectCreating a refund updates charge.amount_refunded
Computed responseGET /balance computed from charges − refunds
Singleton resourceGET /account (no ID param, not a list)
Non-standard createSubscription create converts items array to list format
Non-standard deleteSubscription delete returns updated object, not deleted stub
typescriptsrc/overrides/orders.ts
export function buildConfirmHandler(store: StateStore): OverrideHandler {
  return async (req, reply) => {
    const { order } = req.params as { order: string };
    const existing = store.get('myplatform:orders', order);
    if (!existing) return reply.code(404).send(notFoundError(order));
    if (existing.status !== 'draft')
      return reply.code(400).send(stateError(`Cannot confirm: ${existing.status}`));
​
    const updated = { ...existing, status: 'confirmed', confirmed_at: unixNow() };
    store.set('myplatform:orders', order, updated);
    return reply.code(200).send(updated);
  };
}

What you get for free from OpenApiMockAdapter

OperationAuto-generated behavior
List (GET /resource)Cursor pagination (starting_after, ending_before, limit), query filtering by declared params
Create (POST /resource)Uses DefaultFactory, generates ID + timestamp, merges request body
Retrieve (GET /resource/:id)Lookup by idParam, 404 with platform error format if missing
Update (POST /resource/:id)Fetch + merge body (deep-merges metadata)
Delete (DELETE /resource/:id)Remove from store, return { id, object, deleted: true }
Action (POST /resource/:id/verb)Returns 501 unless overridden
SeedingMaps ExpandedData.apiResponses into StateStore, enriches with factories
EndpointsendpointsFromRoutes() builds EndpointDefinition[] from generated routes

You can customize behavior by overriding protected methods: wrapList(), paginate(), mergeUpdate(), deleteResponse(), notFoundError(), parseBody().

Build workflow

bash
# Download the OpenAPI spec (gitignored)
$ curl -o packages/adapters/adapter-{name}/{name}-spec.json {SPEC_URL}
​
# Generate routes, schemas, resource-specs from the spec
$ pnpm --filter @mimicai/adapter-{name} generate
​
# Build
$ pnpm --filter @mimicai/adapter-{name} build
​
# Test
$ pnpm --filter @mimicai/adapter-{name} test

Key guidelines

Submission checklist

PRs are reviewed within 48 hours.