New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@mastra/cloudflare

Package Overview
Dependencies
Maintainers
7
Versions
846
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
This package has malicious versions linked to the ongoing "Mastra AI framework compromise" supply chain attack.

Affected versions:

1.4.2
View campaign page

@mastra/cloudflare

Cloudflare provider for Mastra - includes db storage capabilities

latest
Source
npmnpm
Version
1.7.4
Version published
Weekly downloads
4.8K
-48.87%
Maintainers
7
Weekly downloads
 
Created
Source

@mastra/cloudflare

Cloudflare KV store for Mastra, providing scalable and serverless storage for threads, messages, workflow snapshots, and evaluations. Supports both Cloudflare Workers KV Bindings and the REST API for flexible deployment in serverless and Node.js environments.

Installation

npm install @mastra/cloudflare

Usage

import { CloudflareStore } from '@mastra/cloudflare';

const store = new CloudflareStore({
  accountId: process.env.CLOUDFLARE_ACCOUNT_ID!,
  apiToken: process.env.CLOUDFLARE_API_TOKEN!,
  namespacePrefix: 'myapp_',
});

// Save a thread
await store.saveThread({
  thread: {
    id: 'thread-123',
    resourceId: 'resource-456',
    title: 'My Thread',
    metadata: { key: 'value' },
    createdAt: new Date(),
  },
});

// Add messages
await store.saveMessages({
  messages: [
    {
      id: 'msg-1',
      threadId: 'thread-123',
      content: 'Hello Cloudflare!',
      role: 'user',
      createdAt: new Date(),
    },
  ],
});

// Query messages
const messages = await store.listMessages({ threadId: 'thread-123' });

Documentation

  • Cloudflare KV integration guide
  • Storage reference

Changelog

See the package changelog for version history and release notes.

Support

We have an open community Discord. Come and say hello and let us know if you have any questions or need any help getting things running.

FAQs

Package last updated on 15 Oct 2026

Related posts