# FilesystemProvider

`FilesystemProvider` is the interface a package implements to register a filesystem with [`MastraEditor`](https://mastra.ai/reference/editor/mastra-editor). The editor calls `createFilesystem(config)` at workspace hydration time, using the `provider` id from the stored [`StorageWorkspaceRef`](https://mastra.ai/reference/editor/storage-workspace-ref) 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

```typescript
import { MastraEditor } from '@mastra/editor'
import { s3FilesystemProvider } from '@mastra/s3'

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

## 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

```typescript
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`](https://mastra.ai/reference/editor/storage-workspace-ref).

## Related

- [Workspace](https://mastra.ai/docs/agent-builder/workspace) — concept and worked examples.
- [StorageWorkspaceRef](https://mastra.ai/reference/editor/storage-workspace-ref) — stored configuration consumed by `createFilesystem`.
- [SandboxProvider](https://mastra.ai/reference/editor/sandbox-provider) — sibling provider for command execution.
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor) — provider registry.