Connect SDK

Connect SDK

Use the Connect SDK to authorize a collection and call typed mdbase operations.

@mdbase-dev/connect is the browser and native-shell SDK for applications that operate on one user-approved local or hosted mdbase collection. The application asks for exact operations. Connect selects the route and the collection authority checks the current grant.

Choose the first result you need

Learn the Connect client boundary

Run typed reads and revision-safe changes against an in-memory collection. This source-built sandbox needs no account or service.

Run the source-built sandbox
Connect a real application

Add a manifest, authorize one compatible collection, complete the browser callback, and use the approved connection.

Open the Connect guide
Implement the open specification

Build a conforming collection tool or use the versioned TypeScript and Rust implementations without the managed Connect service.

Open the specification
Private-beta release status

The production service and protocol 1 are deployed for beta accounts. The npm packages await their first public release. Current developers build or pack the versioned artifacts from the Connect repository.

Versioned implementation evidence

The current site records mdbase specification 0.3.0 claims for the TypeScript 0.3.0-rc.4 and Rust 0.4.0-rc.3 implementations, with evidence dated 29 July 2026. Review conformance resources.

SDK surfaces

SurfaceUse it forDepends on
MdbaseConnectApplication-level manager for web, native-shell, and portable-file authorizationBrowser APIs or adapters supplied by a native shell
MdbaseConnectionOne collection's operations, renewal, routing, notifications, and provider-neutral syncBrowser APIs or adapters supplied by a native shell
MdbaseBrowserLocationBookmarkable collection selection, authorization return URLs, and browser navigationA stable MdbaseConnect manager and browser history APIs
MdbaseCollectionClientDomain and feature logic that should be independent of OAuth and hostingA small MdbaseCollectionTransport
createSandbox()Fast frontend tests for CRUD, revisions, pagination, defaults, and change cursors@mdbase-dev/connect-dev
OfflineReplicaOffline-first applications backed by any sync-capable authority@mdbase-dev/connect-sync

Application structure

Create one MdbaseConnect manager at the application boundary. Pair it with one MdbaseBrowserLocation at the browser application boundary. Resolve its active connection, then pass that MdbaseConnection into feature code. The location helper owns bookmark selection and OAuth return cleanup; the manager owns saved authorizations. A bound connection never changes collections underneath a repository, and feature code written against MdbaseCollectionClient can also run against the developer sandbox or another conforming transport.

A downloaded HTML file supplies distribution: "portable" in its inline manifest. The same manager then uses short-code approval and session-only credentials. See the portable HTML application guide.

tasks.ts
import type { MdbaseCollectionClient } from "@mdbase-dev/connect";

export async function listOpenTasks(client: MdbaseCollectionClient<Task>) {
  return client.queryAll({
    types: ["task"],
    where: 'status == "open"',
    order_by: [{ field: "due", direction: "asc" }]
  });
}
The operation envelope is part of the contract.

Record operations return { valid, result, diagnostics }. Use unwrapOperation() when exceptions suit the calling code, or inspect the envelope when the interface should present validation diagnostics inline.

Package map

PackagePurpose
@mdbase-dev/connectAuthorization, routes, operations, notifications, and authority-neutral sync handoff
@mdbase-dev/connect-devManifest validation, contract validation, and deterministic sandbox transport
@mdbase-dev/connect-protocolShared TypeScript types and canonical JSON Schemas
@mdbase-dev/connect-syncAuthority-neutral replication state machine, IndexedDB replica, conflicts, and offline mutations
@mdbase-dev/connect-webhooksServer-side verification for signed notification webhooks