The Mesa TypeScript SDK is the ergonomic client for Mesa in Node.js and JavaScript runtimes. It wraps the generatedDocumentation Index
Fetch the complete documentation index at: https://docs.mesa.dev/llms.txt
Use this file to discover all available pages before exploring further.
@mesadev/rest client, resolves the default organization for you, 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
Client options
API key used as a bearer token. If omitted in Node.js, the SDK reads
MESA_API_KEY from the environment. If neither is present, construction throws MissingApiKeyError.REST API base URL. Defaults to
https://api.mesa.dev/v1. http and https are accepted. Trailing slashes are stripped.VCS service URL used by
mesa.fs.mount(...). Defaults to https://vcs.mesa.dev. Set this when using a non-default API deployment with MesaFS.Default organization slug. When provided, SDK calls skip
/whoami for organization resolution.Custom fetch implementation for REST requests.
Appended to the SDK user agent. Node.js uses
User-Agent; browser-like runtimes use X-Mesa-User-Agent.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 oneMesa instance where practical.
mesa.fs.mount(...) creates a temporary scoped API key for each mounted filesystem. The SDK attempts to revoke those keys on process shutdown and garbage collection.
Organization resolution
The SDK chooses an organization in this order:| Source | When it applies |
|---|---|
Per-call org | The method input includes org: '...'. |
Constructor org | The client was created with new Mesa({ org: '...' }). |
mesa.whoami() | No per-call or constructor org was supplied. The result is cached. |
Resource namespaces
| Namespace | Purpose |
|---|---|
mesa.repos | Create, read, update, delete, pull, and push repositories. |
mesa.content | Read files, symlinks, and directory listings without mounting. |
mesa.changes | Create, patch, and inspect Mesa changes. |
mesa.diffs | Inspect diffs and conflicts between changes. |
mesa.bookmarks | Manage branch-like bookmark refs. |
mesa.apiKeys | Create, list, and revoke Mesa API keys. |
mesa.webhookTargets | Manage outbound webhook targets. |
mesa.webhooks | Verify incoming webhook requests and dispatch typed handlers. |
mesa.fs | Mount repos as a virtual filesystem and run Bash commands. |
mesa.org | Fetch organization metadata. |
mesa.raw.
Response objects
High-level SDK methods return response data directly. They do not return generated HTTP wrapper objects.GetRepoResponse live in @mesadev/rest.
Common types
Import SDK-owned types from@mesadev/sdk.
| Type | Purpose |
|---|---|
MesaOptions | Constructor options for new Mesa(...). |
FsMountOptions | Options for mesa.fs.mount(...). |
RepoConfig | Pin a mounted repo to a bookmark or change. |
MesaFileSystem | Native filesystem implementation returned by mesa.fs.mount(...). |
ChangeInfo | Change metadata returned by mounted filesystem change operations. |
ExecResult | Output from fs.bash().exec(...), re-exported from just-bash. |
WebhookEvent | Discriminated union of webhook event payloads. |
@mesadev/rest.
Error model
SDK-owned setup and webhook errors extendMesaError and expose a stable code field.
| Exception | Code | Meaning |
|---|---|---|
MissingApiKeyError | MISSING_API_KEY | No API key was provided and MESA_API_KEY was unavailable. |
InvalidApiUrlError | INVALID_API_URL | apiUrl or vcsUrl is malformed or uses a protocol other than http or https. |
InvalidOptionsError | INVALID_OPTIONS | Local options are invalid, such as mounting zero repositories. |
OrgResolutionError | ORG_RESOLUTION_FAILED | The SDK could not resolve the default organization through /whoami. |
MissingWebhookSecretError | MISSING_WEBHOOK_SECRET | mesa.webhooks.receive(...) was called without a constructor webhookSecret. |
MesaWebhookVerificationError | WEBHOOK_VERIFICATION_FAILED | Webhook signature, timestamp, JSON parsing, or payload validation failed. |
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.
path, query, body) and return response data directly.

