Skip to main content
The Mesa TypeScript SDK is the ergonomic client for Mesa in Node.js and JavaScript runtimes. It wraps the generated @mesadev/rest client, reads the organization from the private key, verifies webhooks, and exposes a native virtual filesystem for repo I/O and shell execution. Node.js 18 or newer is required.

Installation

Create a client

Set MESA_PRIVATE_KEY in a trusted Node.js environment to call new Mesa() without an argument.

Client options

string | undefined
Ed25519 private key. Omit it to read MESA_PRIVATE_KEY in Node.js.
string
REST API base URL. Defaults to https://api.mesa.dev/v1. http and https are accepted. Trailing slashes are stripped.
typeof globalThis.fetch | undefined
Custom fetch implementation for REST requests.
string | undefined
Appended to the SDK user agent. Node.js uses User-Agent; browser-like runtimes use X-Mesa-User-Agent.
string | undefined
Signing secret used by mesa.webhooks.receive(...).

Lifecycle

The TypeScript client does not hold an HTTP session and does not need to be closed. Reuse one Mesa instance where practical. Mounts sign one short-lived, layout-scoped access token locally from the client’s private key and use it for the mount’s whole lifetime. Definitions default to a 15 minute ttl and can run up to 4 hours. Set ttl on the definition: mesa.fs({ layout, ttl, authors }).mount().

Organization resolution

The client reads its organization from the private key. Resource methods always use that organization and do not accept an org value.
Use mesa.org.get() when you need organization metadata from the API.

Resource APIs

Bulk repository tag updates are available through mesa.raw.

Response objects

High-level SDK methods return response data directly. They do not return generated HTTP wrapper objects.
Generated response aliases such as GetRepoResponse live in @mesadev/rest.

Common types

Import SDK-owned types from @mesadev/sdk.
High-level REST method input types are inferred from the method signatures. If you need named REST schema types, import them from @mesadev/rest.

Error model

SDK-owned setup and webhook errors extend MesaError and expose a stable code field. API operations throw Mesa API error payloads directly when the server returns an error response. These payloads are not MesaError instances.

Raw generated client

mesa.raw exposes generated REST operations with authentication, base URL, fetch, and user-agent already wired in. Use it when the high-level SDK does not expose an operation or option yet.
Raw calls use the generated REST request shape (path, query, body) and return response data directly.

Complete example