open-index/open-npm huggingface dataset:
npm package: @mastra/auth-auth0
Description: Mastra Auth0 Auth integration
Latest version: 1.0.1

# @mastra/auth-auth0

A Mastra authentication provider for Auth0 integration. This package provides seamless authentication and authorization using Auth0's JWT tokens.

## Requirements

- Node.js 22.13.0 or later
- Auth0 account and configured application
- Valid Auth0 domain and API identifier

## Installation

```bash
npm install @mastra/auth-auth0
# or
yarn add @mastra/auth-auth0
# or
pnpm add @mastra/auth-auth0
```

## Usage

```typescript
import { Mastra } from '@mastra/core/mastra';
import { MastraAuthAuth0 } from '@mastra/auth-auth0';

// Initialize with options
const auth0Provider = new MastraAuthAuth0({
  domain: 'your-tenant.auth0.com',
  audience: 'your-api-identifier',
});

// Or use environment variables
const auth0Provider = new MastraAuthAuth0();

// Enable auth in Mastra
const mastra = new Mastra({
  ...
  server: {
    auth: auth0Provider,
  },
});
```

## Configuration

The package can be configured either through constructor options or environment variables:

### Constructor Options

```typescript
interface MastraAuthAuth0Options {
  domain?: string; // Your Auth0 domain
  audience?: string; // Your Auth0 API identifier
}
```

### Environment Variables

- `AUTH0_DOMAIN`: Your Auth0 domain (e.g., 'your-tenant.auth0.com')
- `AUTH0_AUDIENCE`: Your Auth0 API identifier

## Features

- JWT token verification using Auth0's JWKS
- Automatic token validation against Auth0's issuer
- Audience validation
- Type-safe user payload

## Example

```typescript
import { MastraAuthAuth0 } from '@mastra/auth-auth0';

const auth0Provider = new MastraAuthAuth0({
  domain: 'your-tenant.auth0.com',
  audience: 'your-api-identifier',
});

// Authenticate a token
const user = await auth0Provider.authenticateToken('your-jwt-token');

// Authorize a user
const isAuthorized = await auth0Provider.authorizeUser(user);
```
npm package: @mastra/auth-clerk
Description: Mastra Clerk Auth integration
Latest version: 1.0.2

# @mastra/auth-clerk

A Mastra authentication provider for Clerk, enabling seamless integration of Clerk authentication with Mastra applications.

## Installation

```bash
npm install @mastra/auth-clerk
# or
yarn add @mastra/auth-clerk
# or
pnpm add @mastra/auth-clerk
```

## Usage

```typescript
import { Mastra } from '@mastra/core/mastra';
import { MastraAuthClerk } from '@mastra/auth-clerk';

// Initialize the Clerk auth provider
const clerkAuth = new MastraAuthClerk({
  jwksUri: 'your-jwks-uri',
  secretKey: 'your-secret-key',
  publishableKey: 'your-publishable-key',
});

// Or use environment variables
const clerkAuth = new MastraAuthClerk();

// Enable auth in Mastra
const mastra = new Mastra({
  ...
  server: {
    auth: clerkAuth,
  },
});
```

## Configuration

The package can be configured either through constructor options or environment variables:

### Environment Variables

- `CLERK_JWKS_URI`: The JWKS URI for your Clerk instance
- `CLERK_SECRET_KEY`: Your Clerk secret key
- `CLERK_PUBLISHABLE_KEY`: Your Clerk publishable key

### Constructor Options

```typescript
interface MastraAuthClerkOptions {
  jwksUri?: string;
  secretKey?: string;
  publishableKey?: string;
}
```

## Features

- JWT token verification using Clerk's JWKS
- User authentication and authorization
- Organization membership verification
- Seamless integration with Mastra's authentication system

## API

### `authenticateToken(token: string): Promise<ClerkUser | null>`

Verifies a JWT token and returns the associated user if valid.

### `authorizeUser(user: ClerkUser): Promise<boolean>`

Checks if a user is authorized by verifying their organization membership.
npm package: @mastra/auth-firebase
Description: Mastra Firebase Auth integration
Latest version: 1.0.0

# @mastra/auth-firebase

A Firebase authentication integration package for Mastra applications. This package provides seamless integration with Firebase Authentication and Firestore for user authentication and authorization.

## Installation

```bash
npm install @mastra/auth-firebase
# or
yarn add @mastra/auth-firebase
# or
pnpm add @mastra/auth-firebase
```

## Features

- Firebase Authentication integration
- Firestore-based user authorization
- Support for service account credentials
- Automatic token verification
- User access control through Firestore

## Usage

```typescript
import { Mastra } from '@mastra/core/mastra';
import { MastraAuthFirebase } from '@mastra/auth-firebase';

// Initialize with default configuration
const firebaseAuth = new MastraAuthFirebase();

// Or with custom options
const firebaseAuth = new MastraAuthFirebase({
  serviceAccount: 'path/to/service-account.json',
  databaseId: 'your-database-id',
});

// Enable auth in Mastra
const mastra = new Mastra({
  ...
  server: {
    auth: firebaseAuth,
  },
});
```

## Configuration

The package can be configured through constructor options or environment variables:

### Constructor Options

- `serviceAccount`: Path to Firebase service account JSON file
- `databaseId`: Firestore database ID

### Environment Variables

- `FIREBASE_SERVICE_ACCOUNT`: Path to Firebase service account JSON file
- `FIRESTORE_DATABASE_ID` or `FIREBASE_DATABASE_ID`: Firestore database ID

## User Authorization

The package uses Firestore to manage user access. It expects a collection named `user_access` with documents keyed by user UIDs. The presence of a document in this collection determines whether a user is authorized.
npm package: @mastra/auth-supabase
Description: Mastra Supabase Auth integration
Latest version: 1.0.0

# @mastra/auth-supabase

A Supabase authentication integration for Mastra, providing seamless authentication and authorization capabilities using Supabase's authentication system.

## Requirements

- Node.js 22.13.0 or later
- Supabase project with authentication enabled
- Supabase URL and anonymous key

## Installation

```bash
npm install @mastra/auth-supabase
# or
yarn add @mastra/auth-supabase
# or
pnpm add @mastra/auth-supabase
```

## Usage

```typescript
import { Mastra } from '@mastra/core/mastra';
import { MastraAuthSupabase } from '@mastra/auth-supabase';

// Initialize with environment variables
const supabaseAuth = new MastraAuthSupabase();

// Or initialize with explicit configuration
const supabaseAuth = new MastraAuthSupabase({
  url: 'your-supabase-url',
  anonKey: 'your-supabase-anon-key',
});

// Enable auth in Mastra
const mastra = new Mastra({
  ...
  server: {
    auth: supabaseAuth,
  },
});
```

## Configuration

The package can be configured in two ways:

1. **Environment Variables**:
   - `SUPABASE_URL`: Your Supabase project URL
   - `SUPABASE_ANON_KEY`: Your Supabase anonymous key

2. **Constructor Options**:
   ```typescript
   interface MastraAuthSupabaseOptions {
     url?: string;
     anonKey?: string;
   }
   ```

## Features

- **Authentication**: Verifies user tokens and retrieves user information from Supabase
- **Authorization**: Checks user permissions based on their role in Supabase
- **Type Safety**: Full TypeScript support with proper type definitions
- **Environment Variable Support**: Easy configuration through environment variables

## API

### `authenticateToken(token: string)`

Authenticates a user token and returns the user information if valid.

### `authorizeUser(user: User)`

Checks if a user has the required permissions (currently checks for admin status).
npm package: @mastra/cloud
Description: Official Mastra Cloud integration package for telemetry
Latest version: 0.1.23

# @mastra/cloud

The official integration package for Mastra Cloud services - seamlessly connect your Mastra applications with cloud-based capabilities and telemetry.

## Installation

```bash
npm install @mastra/cloud
# or
yarn add @mastra/cloud
# or
pnpm add @mastra/cloud
```

## Features

#### API Reference

##### `MastraCloudAITracingExporter`

A custom AI tracing exporter that sends AI span data to Mastra Cloud for observability and monitoring.

###### Constructor Options

- `accessToken` (required): Your Mastra Cloud access token
- `endpoint` (optional): Custom endpoint URL for sending AI tracing data (defaults to `https://api.mastra.ai/ai/spans/publish`)
- `maxBatchSize` (optional): Maximum number of spans to batch before sending (default: 1000)
- `maxBatchWaitMs` (optional): Maximum time to wait before sending a batch in milliseconds (default: 5000)
- `maxRetries` (optional): Maximum number of retry attempts for failed requests (default: 3)
- `logger` (optional): Logger instance compatible with the Mastra Logger interface

### Telemetry

The package currently provides OpenTelemetry integration with Mastra Cloud for instrumenting and collecting telemetry data from your applications.

```typescript
import { PinoLogger } from '@mastra/loggers';
import { MastraCloudExporter } from '@mastra/cloud';

// Initialize the exporter with your access token
const exporter = new MastraCloudExporter({
  accessToken: process.env.MASTRA_CLOUD_ACCESS_TOKEN, // Your Mastra Cloud access token
  logger: yourLoggerInstance, // Optional logger
  endpoint: 'https://mastra-cloud-endpoint.example.com', // Mastra cloud endpoint
});

// Use with Mastra instance
export const mastra = new Mastra({
  agents: { agent },
  logger: new PinoLogger({
    name: 'Mastra',
    level: 'info',
  }),
  telemetry: {
    serviceName: 'My-Agent',
    enabled: true,
    sampling: {
      type: 'always_on',
    },
    export: {
      type: 'custom',
      exporter: new MastraCloudExporter({
        accessToken: process.env.MASTRA_CLOUD_ACCESS_TOKEN,
      }),
    },
  },
});
```

#### API Reference

##### `MastraCloudExporter`

A custom OpenTelemetry exporter that sends telemetry data to Mastra Cloud.

###### Constructor Options

- `accessToken` (required): Your Mastra Cloud access token
- `endpoint` (optional): Custom endpoint URL for sending telemetry data
- `logger` (optional): Logger instance compatible with the Mastra Logger interface

## Support

For questions, issues, or feature requests, please reach out through the official Mastra support channels.
npm package: @mastra/cloud-storage
Description: Mastra Cloud storage provider - LibSQL-based storage for Mastra Cloud deployments
Latest version: 0.0.0-cloud-storage-adapter-20251106204059

# @mastra/mastra-cloud

Mastra Cloud storage provider - LibSQL-based storage for Mastra Cloud deployments.

This package provides a simplified interface for setting up storage and vector stores for Mastra Cloud deployments. It wraps `@mastra/libsql` to provide a consistent configuration interface.

## Installation

```bash
npm install @mastra/mastra-cloud
# or
pnpm add @mastra/mastra-cloud
```

## Usage

```typescript
import { createCloudStorage } from '@mastra/mastra-cloud';
import { Mastra } from '@mastra/core';

const { storage, vector } = createCloudStorage({
  url: process.env.MASTRA_STORAGE_URL!,
  authToken: process.env.MASTRA_STORAGE_AUTH_TOKEN,
});

// Initialize storage
await storage.init();

// Use with Mastra
const mastra = new Mastra({
  storage,
  // ... other config
});
```

## API

### `createCloudStorage(config: CloudStorageConfig): CloudStorageInstances`

Creates storage and vector instances configured for Mastra Cloud.

#### Parameters

- `config.url` (string, required): The URL of the Mastra Cloud storage database
- `config.authToken` (string, optional): Authentication token for the database
- `config.storageId` (string, optional): ID for the storage instance (default: 'mastra-cloud-storage-libsql')
- `config.vectorId` (string, optional): ID for the vector instance (default: 'mastra-cloud-storage-libsql-vector')

#### Returns

An object containing:

- `storage`: LibSQLStore instance
- `vector`: LibSQLVector instance

## Environment Variables

When deploying to Mastra Cloud, the following environment variables are typically provided:

- `MASTRA_STORAGE_URL`: The URL of your cloud storage database
- `MASTRA_STORAGE_AUTH_TOKEN`: Authentication token for the database

## License

Apache-2.0
npm package: @mastra/docusaurus-plugin-algolia
Description: Algolia search plugin for Mastra's Docusaurus sites
Author: LekoArts
Latest version: 1.0.1

# @mastra/docusaurus-plugin-algolia

Custom Algolia search plugin for Docusaurus. Replaces the default search with a modal-based search UI featuring keyboard navigation, virtual scrolling, recent searches, and suggested links.

## Installation

```bash
npm install @mastra/docusaurus-plugin-algolia
```

Also install the required peer dependencies:

```bash
npm install @docusaurus/types clsx lucide-react react react-dom
```

## Usage

Register the plugin in `docusaurus.config.ts`:

```ts
import type { Config } from '@docusaurus/types'
import type { AlgoliaPluginOptions } from '@mastra/docusaurus-plugin-algolia'

const config: Config = {
	plugins: [
		[
			'@mastra/docusaurus-plugin-algolia',
			{
				algoliaAppId: process.env.ALGOLIA_APP_ID,
				algoliaSearchApiKey: process.env.ALGOLIA_SEARCH_API_KEY,
				indexName: 'docs_v1_crawler',
				hitsPerPage: 20,
				suggestedLinks: [
					{
						label: 'Quickstart',
						description: 'Get up and running',
						link: '/docs/get-started/overview',
					},
				],
			} satisfies AlgoliaPluginOptions,
		],
	],
}

export default config
```

### Options

| Option                | Type              | Required | Default          | Description                                |
| --------------------- | ----------------- | -------- | ---------------- | ------------------------------------------ |
| `algoliaAppId`        | `string`          | Yes      | —                | Algolia application ID                     |
| `algoliaSearchApiKey` | `string`          | Yes      | —                | Algolia search-only API key                |
| `indexName`           | `string`          | No       | `'docs_crawler'` | Algolia index name                         |
| `hitsPerPage`         | `number`          | No       | `20`             | Results per page                           |
| `suggestedLinks`      | `SuggestedLink[]` | No       | `[]`             | Links shown when the search input is empty |

Each `SuggestedLink` has `label`, `description`, and `link` fields.

## Features

- **Search modal** — Opens with `Cmd+K` / `Ctrl+K`, built on Radix UI Dialog
- **Virtual scrolling** — Efficiently renders large result sets via `@tanstack/react-virtual`
- **Section grouping** — Results grouped by section (Docs, Guides, Reference, Examples) with sticky headers
- **Keyboard navigation** — Arrow keys, Enter, Escape, Tab
- **Recent searches** — Last 5 searches persisted in `localStorage`
- **Suggested links** — Configurable links shown in the empty state
- **Result highlighting** — Matched terms highlighted in results
- **Load more** — Paginated results with on-demand loading
- **Dark mode** — Fully themed with CSS variables from `@mastra/docusaurus-theme`

## How It Works

The plugin provides a `SearchBar` theme component via `getThemePath()`. Configuration is passed to the frontend through Docusaurus's `setGlobalData()` / `usePluginData()` pattern, so API keys never appear in client bundles beyond what Algolia's search-only key allows.
npm package: @mastra/docusaurus-plugin-common
Description: Common plugins that every Mastra docs site needs
Author: LekoArts
Latest version: 1.0.3

# @mastra/docusaurus-plugin-common

A collection of Docusaurus plugins for Mastra's projects. They are commonly used across Mastra's documentation sites. This package contains:

- `/tailwind`: A plugin to add `@tailwindcss/postcss` to Docusaurus
- `/llms-txt`: A plugin to generate `llms.txt` files for each document and a root `llms.txt` file for the entire site.

## Installation

```bash
npm install @mastra/docusaurus-plugin-common
```

## Usage

```ts
import type { Config } from '@docusaurus/types'

const config: Config = {
	plugins: [
		require.resolve('@mastra/docusaurus-plugin-common/tailwind'),
		require.resolve('@mastra/docusaurus-plugin-common/llms-txt'),
	],
}

export default config
```
npm package: @mastra/docusaurus-theme
Description: Mastra's Docusaurus theme, built on top of the default Docusaurus theme.
Author: LekoArts
Latest version: 1.0.10

# @mastra/docusaurus-theme

Mastra's Docusaurus theme, built on top of the default Docusaurus theme. This package contains:

- Custom components used inside MDX
- Custom theme and CSS styles
- Overrides for the default Docusaurus theme components

## Installation

```bash
npm install @mastra/docusaurus-theme
```

Also install the required peer dependencies:

```bash
npm install @docusaurus/plugin-content-docs @docusaurus/theme-classic @docusaurus/theme-common @docusaurus/types @radix-ui/react-accordion @radix-ui/react-dropdown-menu clsx lucide-react react react-dom tailwindcss
```

## Usage

```ts
import type { Config } from '@docusaurus/types'

const config: Config = {
	themes: ['@mastra/docusaurus-theme'],
}

export default config
```

## Code Highlighting (Shiki)

The theme uses [Shiki](https://shiki.style/) for syntax highlighting instead of Prism. All Shiki dependencies (`shiki`, `@shikijs/rehype`, `@shikijs/transformers`) are bundled with the theme — no extra installs needed.

### Configure `docusaurus.config.ts`

```ts
import { shikiPlugin } from '@mastra/docusaurus-theme/shiki'
```

Then add `shikiPlugin` to every docs plugin instance via `beforeDefaultRehypePlugins`:

```ts
const config: Config = {
	presets: [
		['classic', {
			docs: {
				beforeDefaultRehypePlugins: [shikiPlugin],
			},
		}],
	],
	plugins: [
		['@docusaurus/plugin-content-docs', {
			beforeDefaultRehypePlugins: [shikiPlugin],
		}],
	],
}
```

The theme provides CSS variables for Shiki token colors (`--shiki-foreground`, `--shiki-background`, `--shiki-token-*`) that automatically adapt to light/dark mode. These are defined in the theme's `vars.css`.

### Features

- **Title bar**: Use ` ```ts title="src/main.ts" ` to show a header with language icon, file path, and copy button
- **Line highlighting**: Use `// [!code highlight]` at the end of a line to highlight it

### CSS features

LightningCSS is used to compile the CSS files. You can use all the features supported by LightningCSS, including:

- CSS nesting
- Custom media queries
- `light-dark()` function for color values

Read the `tsdown.config.ts` file for more details on the CSS configuration.
npm package: @mastra/node-audio
Description: Cross-platform mic/audio recording + playback for Mastra in Node.js
Latest version: 0.1.7

# @mastra/node-audio

Cross-platform audio I/O toolkit for Node.js — play audio, stream microphone input, and record to disk. Designed for use with voice-enabled agents like Mastra.

## 🎧 Features

- ✅ Play audio from file, URL, or stream
- 🎤 Get microphone stream with sane defaults
- 📼 Record audio to disk using `ffmpeg`
- 🔄 Unified `createHuddle` API for mic/speaker coordination
- 🧰 Built on `node-mic`, `@mastra/node-speaker`, and `fluent-ffmpeg`

## 🚀 Getting Started

### 1. Install

```bash
npm install @mastra/node-audio
```

### 2. System Requirements

This package wraps native audio libraries. You may need additional system dependencies:

#### 🖥 Speaker
- Docs: [node-speaker - Audio selection](https://github.com/TooTallNate/node-speaker?tab=readme-ov-file#audio-backend-selection)

#### 🎙 Microphone Input
- Docs: [node-mic](https://github.com/Symbitic/node-mic)

#### 💾 Recording Audio
- Docs: [fluent-ffmpeg](https://www.npmjs.com/package/fluent-ffmpeg)
- You must have `ffmpeg` installed and available in your system path

```bash
# macOS
brew install ffmpeg

# Debian/Ubuntu
sudo apt-get install ffmpeg

# Windows
choco install ffmpeg
```

## 📚 API Reference

### `playAudio(input: string | Readable, options?: Speaker.Options): void`
Plays a local file, URL, or raw audio stream.

```ts
import { playAudio } from "@mastra/node-audio";

playAudio("./response.wav");
```

You can also pass a stream:

```ts
const stream = fs.createReadStream("./hello.wav");
playAudio(stream);
```

### `getMicrophoneStream(options?: MicOptions): Readable`
Starts recording from the default system mic and returns a stream.

```ts
import { getMicrophoneStream } from "@mastra/node-audio";

const micStream = getMicrophoneStream({ rate: 24100 });
micStream.pipe(fs.createWriteStream("raw_input.pcm"));
```

### `recordAudioToFile(stream: Readable, outputPath: string, options?: RecorderOptions): Recorder`
Records audio from a stream to disk using `ffmpeg`.

```ts
import { getMicrophoneStream, recordAudioToFile } from "@mastra/node-audio";

const mic = getMicrophoneStream();
const recorder = recordAudioToFile(mic, "output.mp3");

// Optionally stop recording later:
// recorder.stream.end();
```

### `createHuddle(options: HuddleOptions): Huddle`
Unified helper for managing mic + speaker + recording.

```ts
import { createHuddle } from "@mastra/node-audio";

const huddle = createHuddle({
  mic: { rate: 24100 },
  speaker: { sampleRate: 24100 },
  record: { outputPath: "session.mp3" },
});

huddle.start();

// Stream mic to agent
const micStream = huddle.getMicrophoneStream();
agent.voice.send(micStream);

// Play response from agent
agent.voice.on("speaker", (stream) => {
  huddle.play(stream);
});

// Gracefully stop
huddle.stop();
```

## 🛠 Development

Build both ESM and CommonJS outputs:

```bash
npm run build
```