mastra-ai/mastra · error · HTTPException

Storage is not configured

Error message

Storage is not configured

What it means

The MCP client versions list handler calls mastra.getStorage() and, if no storage is configured on the Mastra instance, throws HTTPException 500 with 'Storage is not configured'. Listing MCP client version history requires a persistent storage backend, so the endpoint cannot function without one. This is a server configuration error, not a client mistake.

Source

Thrown at packages/server/src/server/handlers/mcp-client-versions.ts:49

 * GET /stored/mcp-clients/:mcpClientId/versions - List all versions for an MCP client
 */
export const LIST_MCP_CLIENT_VERSIONS_ROUTE = createRoute({
  method: 'GET',
  path: '/stored/mcp-clients/:mcpClientId/versions',
  requiresAuth: true,
  responseType: 'json',
  pathParamSchema: mcpClientVersionPathParams,
  queryParamSchema: listMCPClientVersionsQuerySchema,
  responseSchema: listMCPClientVersionsResponseSchema,
  summary: 'List MCP client versions',
  description: 'Returns a paginated list of all versions for a stored MCP client',
  tags: ['MCP Client Versions'],
  handler: async ({ mastra, mcpClientId, page, perPage, orderBy, 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 mcpClient = await mcpClientStore.getById(mcpClientId);
      if (!mcpClient) {
        throw new HTTPException(404, { message: `MCP client with id ${mcpClientId} not found` });
      }
      assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));

      const result = await mcpClientStore.listVersions({
        mcpClientId,
        page,
        perPage,
        orderBy,

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Configure storage on the Mastra instance (pass a storage adapter in the Mastra/server config, e.g. LibSQL/Postgres storage).
  2. Set the required storage environment variables (e.g. database connection URL) and restart the server.
  3. If storage is intentionally absent, avoid calling the MCP client versions endpoints or guard the UI behind a storage-available check.
  4. Confirm the configured storage adapter is registered so getStorage() returns a non-null value.

Example fix

// before
new Mastra({});
// after
import { Mastra } from '@mastra/core';
new Mastra({
  storage: new LibSQLStore({ url: process.env.DATABASE_URL }),
});
Defensive patterns

Strategy: fallback

Validate before calling

const storage = mastra.getStorage();
if (!storage) {
  console.warn('Storage not configured; MCP client version features disabled');
}

Type guard

function hasStorage(mastra: Mastra): boolean {
  return mastra.getStorage() != null;
}

Try / catch

try {
  const versions = await fetch(`/api/mcp-clients/${id}/versions`).then(r => {
    if (r.status === 500) throw new Error('storage-unavailable');
    return r.json();
  });
} catch (e) {
  if (e.message === 'storage-unavailable') {
    return showStorageRequiredNotice(); // degrade gracefully
  }
  throw e;
}

Prevention

When it happens

Trigger: GET the MCP client versions endpoint for a Mastra server instance that was constructed without a storage configuration (no storage passed to Mastra / no storage in server config).

Common situations: A dev server started without storage options; storage removed or never added when upgrading to a server that now requires it for MCP client version endpoints; environment-based storage config (e.g. database URL) missing so storage silently isn't set up.

Related errors


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