# MastraEditor class

The `MastraEditor` class sets up the editor system. Pass it to the `Mastra` constructor to turn on editor features like prompt blocks, agent code override, versioning, and tool providers.

See the [Editor overview](https://mastra.ai/docs/editor/overview) for an introduction to what the editor does.

## Usage example

```typescript
import { Mastra } from '@mastra/core'
import { MastraEditor } from '@mastra/editor'
import { ComposioToolProvider } from '@mastra/editor/providers/composio'

export const mastra = new Mastra({
  agents: {
    /* your agents */
  },
  editor: new MastraEditor({
    toolProviders: {
      composio: new ComposioToolProvider({
        apiKey: process.env.COMPOSIO_API_KEY!,
      }),
    },
  }),
})
```

## Constructor parameters

**logger** (`Logger`): Logger instance. Falls back to the Mastra instance logger if not set.

**toolProviders** (`Record<string, ToolProvider>`): Integration tool providers keyed by ID (for example, Composio or Arcade). Lets agents use third-party tools added through the editor. (Default: `{}`)

**processorProviders** (`Record<string, ProcessorProvider>`): Processor providers for configurable input/output processing (for example, moderation or token limiting). Built-in providers are always included. (Default: `{}`)

**filesystems** (`Record<string, FilesystemProvider>`): Filesystem providers for file access (for example, S3 or GCS). A local filesystem provider is always included. (Default: `{}`)

**sandboxes** (`Record<string, SandboxProvider>`): Sandbox providers for code execution (for example, E2B). A local sandbox provider is always included. (Default: `{}`)

**blobStores** (`Record<string, BlobStoreProvider>`): Blob storage providers for binary data (for example, S3). Falls back to the Mastra storage blob store if no provider is specified. (Default: `{}`)

## Namespaces

The editor exposes namespaces for managing different entity types. These are used by the Mastra server and Studio — you don't call them directly in application code.

**agent** (`EditorAgentNamespace`): CRUD operations and version management for stored agents. Handles applying stored overrides to code-defined agents.

**prompt** (`EditorPromptNamespace`): CRUD operations for prompt blocks. Includes a preview method for resolving instruction blocks with draft content.

**mcp** (`EditorMCPNamespace`): CRUD operations for stored MCP client configurations.

**mcpServer** (`EditorMCPServerNamespace`): CRUD operations for MCP server configurations.

**scorer** (`EditorScorerNamespace`): CRUD operations for scorer configurations.

## Methods

### Provider access

#### `getToolProvider(id)`

Returns a registered tool provider by its ID.

```typescript
const composio = mastra.getEditor()?.getToolProvider('composio')
```

#### `getToolProviders()`

Returns all registered tool providers as a `Record<string, ToolProvider>`.

#### `getProcessorProvider(id)`

Returns a registered processor provider by its ID.

#### `getProcessorProviders()`

Returns all registered processor providers.

#### `getFilesystemProviders()`

Returns all registered filesystem providers.

#### `getSandboxProviders()`

Returns all registered sandbox providers.

#### `getBlobStoreProviders()`

Returns all registered blob store providers.