Skip to content

[FEATURE] MSSQL Storage Provider #5897

@bala-intron

Description

@bala-intron

First of all, thanks for the awesome project/framework!
Been keeping up with all the latest webinars and updates — everything is awesome and super helpful.

Problem Statement

Mastra currently supports memory providers like PostgreSQL, but lacks support for Microsoft SQL Server (MSSQL). MSSQL is widely used in enterprise environments, and the lack of native support limits adoption of Mastra in MSSQL-based infrastructures.

Proposed Solution

Introduce a new MSSQL-based memory provider that:

  • Uses the existing Mastra storage interfaces.
  • Implements all required CRUD operations using the mssql Node.js library.
  • Includes schema management, pagination, and JSON compatibility via NVARCHAR(MAX) and JSON_VALUE(...) for filtering.
  • Passes parity tests equivalent to existing providers like PostgreSQL.

I've already implemented the feature and opened a pull request here: [#5849]

Component

Memory

Alternatives Considered

No response

Example Use Case

`import { MSSQLStore, MSSQLConfig } from "@mastra/mssql";
import { Memory } from "@mastra/memory";

const DB_CONFIG: MSSQLConfig = {
server: process.env.MSSQL_HOST || 'localhost',
port: Number(process.env.MSSQL_PORT) || 1433,
database: process.env.MSSQL_DB || 'master',
user: process.env.MSSQL_USER || 'sa',
password: process.env.MSSQL_PASSWORD || 'Your_password123',
};

export const storage = new MSSQLStore(DB_CONFIG);

export const memory = new Memory({
options: {
lastMessages: 10,
semanticRecall: false,
threads: {
generateTitle: true
},
},
storage,
});
`

Additional Context

No response

Verification

  • I have searched the existing issues to make sure this is not a duplicate
  • I have provided sufficient context for the team to understand the request

Metadata

Metadata

Assignees

Labels

StorageIssues with Mastra Storage adapters for databases and vector storageenhancementNew feature or request

Projects

Status

Released in alpha

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions