mastra-ai/mastra · critical · HTTPException

Storage is not configured

Error message

Storage is not configured

What it means

The stored MCP clients list handler calls mastra.getStorage() and throws a 500 HTTPException when storage is not configured. Resolved MCP client records are persisted, so listing them requires a storage backend. Mastra has no implicit default storage.

Source

Thrown at packages/server/src/server/handlers/stored-mcp-clients.ts:43

/**
 * GET /stored/mcp-clients - List all stored MCP clients
 */
export const LIST_STORED_MCP_CLIENTS_ROUTE = createRoute({
  method: 'GET',
  path: '/stored/mcp-clients',
  responseType: 'json',
  queryParamSchema: listStoredMCPClientsQuerySchema,
  responseSchema: listStoredMCPClientsResponseSchema,
  summary: 'List stored MCP clients',
  description: 'Returns a paginated list of all MCP client configurations stored in the database',
  tags: ['Stored MCP Clients'],
  requiresAuth: true,
  handler: async ({ mastra, page, perPage, orderBy, status, authorId, metadata, requestContext }) => {
    try {
      const storage = mastra.getStorage();

      if (!storage) {
        throw new HTTPException(500, { message: 'Storage is not configured' });
      }

      const mcpClientStore = await storage.getStore('mcpClients');
      if (!mcpClientStore) {
        throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });
      }

      const scope = await getStoredResourceScope(mastra, requestContext);
      const result = await mcpClientStore.listResolved({
        page,
        perPage,
        orderBy,
        status,
        authorId,
        metadata: scopeStoredResourceMetadata(metadata, scope),
      });

      return result;

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Add storage to the Mastra instance, e.g. new LibSQLStore({ url: 'file:./mastra.db' }).
  2. Install the appropriate storage adapter package for your deployment.
  3. Verify env vars for the storage connection exist in the server environment.
  4. Gate MCP client management UI behind a storage-configured check.

Example fix

// before
const mastra = new Mastra({ server });

// after
const mastra = new Mastra({ server, storage: new PostgresStore({ connectionString: process.env.DATABASE_URL }) });
Defensive patterns

Strategy: validation

Validate before calling

if (!mastra.getStorage()) throw new Error('Storage is not configured; stored MCP client listing will fail.');

Type guard

const storageReady = (m: Mastra) => m.getStorage() != null;

Try / catch

try {
  const clients = await client.listStoredMCPClients({ page: 1, perPage: 20 });
} catch (e) {
  if (isMastraServerError(e) && e.status === 500 && e.message.includes('Storage is not configured')) {
    // surface setup instructions for storage
  } else throw e;
}

Prevention

When it happens

Trigger: GET /api/mcp/clients/stored (listStoredMCPClients, with page/perPage/orderBy/status/authorId/metadata filters) against a Mastra server built without a storage option.

Common situations: New projects missing storage config; storage option dropped during a refactor of the Mastra constructor; missing DATABASE_URL in a deployment causing storage to be skipped; minimal dev server used with full Studio UI.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/b451f6b7eacca5e9. Report an issue: GitHub.