Skip to main content

FilesystemProvider

FilesystemProvider is the interface a package implements to register a filesystem with MastraEditor. The editor calls createFilesystem(config) at workspace hydration time, using the provider id from the stored StorageWorkspaceRef filesystem config as the lookup key.

The built-in local filesystem provider is auto-registered. External providers (for example, S3 or GCS) are supplied via MastraEditorConfig.filesystems.

Usage example
Direct link to Usage example

src/mastra/index.ts
import { MastraEditor } from '@mastra/editor'
import { s3FilesystemProvider } from '@mastra/s3'

new MastraEditor({
filesystems: {
[s3FilesystemProvider.id]: s3FilesystemProvider,
},
})

Properties
Direct link to Properties

id:

string
Unique provider identifier (for example, `"local"`, `"s3"`). Must match `StorageFilesystemConfig.provider` on every stored workspace that uses this provider.

name:

string
Human-readable name for UI display.

description?:

string
Short description shown in the workspace filesystem picker.

configSchema?:

Record<string, unknown>
JSON Schema describing provider-specific configuration. Used by the UI to render config forms.

createFilesystem:

(config: TConfig) => WorkspaceFilesystem | Promise<WorkspaceFilesystem>
Create a runtime `WorkspaceFilesystem` instance from the stored config. Called at workspace hydration time.

Implementing a provider
Direct link to Implementing a provider

src/providers/my-filesystem.ts
import type { FilesystemProvider, WorkspaceFilesystem } from '@mastra/core/editor'

export const myFilesystemProvider: FilesystemProvider<{ bucket: string; region: string }> = {
id: 'my-fs',
name: 'My Filesystem',
description: 'Object-store-backed filesystem.',
configSchema: {
type: 'object',
required: ['bucket', 'region'],
properties: {
bucket: { type: 'string' },
region: { type: 'string' },
},
},
async createFilesystem(config): Promise<WorkspaceFilesystem> {
return createMyFilesystem({ bucket: config.bucket, region: config.region })
},
}

Once registered, admins can reference the provider from an inline workspace config or a stored StorageWorkspaceRef.

On this page