@mastra/mcp-docs-server 1.1.9 → 1.1.10-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Storage
|
|
2
2
|
|
|
3
|
-
For agents to remember previous interactions, Mastra needs a
|
|
3
|
+
For agents to remember previous interactions, Mastra needs a storage adapter. Use one of the [supported providers](#supported-providers) and pass it to your Mastra instance.
|
|
4
4
|
|
|
5
5
|
```typescript
|
|
6
6
|
import { Mastra } from '@mastra/core'
|
|
@@ -24,7 +24,7 @@ export const mastra = new Mastra({
|
|
|
24
24
|
|
|
25
25
|
This configures instance-level storage, which all agents share by default. You can also configure [agent-level storage](#agent-level-storage) for isolated data boundaries.
|
|
26
26
|
|
|
27
|
-
Mastra automatically
|
|
27
|
+
Mastra automatically initializes the necessary storage structures on first interaction. See [Storage Overview](https://mastra.ai/reference/storage/overview) for domain coverage and the schema used by the built-in database-backed domains.
|
|
28
28
|
|
|
29
29
|
## Supported providers
|
|
30
30
|
|
|
@@ -35,7 +35,7 @@ Each provider page includes installation instructions, configuration parameters,
|
|
|
35
35
|
- [MongoDB](https://mastra.ai/reference/storage/mongodb)
|
|
36
36
|
- [Upstash](https://mastra.ai/reference/storage/upstash)
|
|
37
37
|
- [Cloudflare D1](https://mastra.ai/reference/storage/cloudflare-d1)
|
|
38
|
-
- [Cloudflare Durable Objects](https://mastra.ai/reference/storage/cloudflare)
|
|
38
|
+
- [Cloudflare KV & Durable Objects](https://mastra.ai/reference/storage/cloudflare)
|
|
39
39
|
- [Convex](https://mastra.ai/reference/storage/convex)
|
|
40
40
|
- [DynamoDB](https://mastra.ai/reference/storage/dynamodb)
|
|
41
41
|
- [LanceDB](https://mastra.ai/reference/storage/lance)
|
|
@@ -49,7 +49,7 @@ Storage can be configured at the instance level (shared by all agents) or at the
|
|
|
49
49
|
|
|
50
50
|
### Instance-level storage
|
|
51
51
|
|
|
52
|
-
Add storage to your Mastra instance so all agents, workflows, observability traces and scores share the same
|
|
52
|
+
Add storage to your Mastra instance so all agents, workflows, observability traces, and scores share the same storage backend:
|
|
53
53
|
|
|
54
54
|
```typescript
|
|
55
55
|
import { Mastra } from '@mastra/core'
|
|
@@ -71,7 +71,7 @@ This is useful when all primitives share the same storage backend and have simil
|
|
|
71
71
|
|
|
72
72
|
#### Composite storage
|
|
73
73
|
|
|
74
|
-
[Composite storage](https://mastra.ai/reference/storage/composite) is an alternative way to configure instance-level storage. Use `MastraCompositeStore` to
|
|
74
|
+
[Composite storage](https://mastra.ai/reference/storage/composite) is an alternative way to configure instance-level storage. Use `MastraCompositeStore` to route `memory` and any other [supported domains](https://mastra.ai/reference/storage/composite) to different storage providers.
|
|
75
75
|
|
|
76
76
|
```typescript
|
|
77
77
|
import { Mastra } from '@mastra/core'
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# Cloudflare storage
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Mastra provides two Cloudflare storage implementations:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- **Cloudflare KV** (`CloudflareKVStorage`) - A globally distributed, eventually consistent key-value store
|
|
6
|
+
- **Cloudflare Durable Objects** (`CloudflareDOStorage`) - A strongly consistent, SQLite-based storage using Durable Objects
|
|
7
|
+
|
|
8
|
+
> **Observability Not Supported:** Cloudflare storage **does not support the observability domain**. Traces from the `DefaultExporter` cannot be persisted, and Mastra Studio's observability features won't work with Cloudflare as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
|
|
6
9
|
|
|
7
10
|
## Installation
|
|
8
11
|
|
|
@@ -30,13 +33,17 @@ yarn add @mastra/cloudflare@latest
|
|
|
30
33
|
bun add @mastra/cloudflare@latest
|
|
31
34
|
```
|
|
32
35
|
|
|
33
|
-
##
|
|
36
|
+
## Cloudflare KV Storage
|
|
37
|
+
|
|
38
|
+
The KV storage implementation provides a globally distributed, serverless key-value store solution using Cloudflare Workers KV.
|
|
39
|
+
|
|
40
|
+
### Usage
|
|
34
41
|
|
|
35
42
|
```typescript
|
|
36
|
-
import {
|
|
43
|
+
import { CloudflareKVStorage } from '@mastra/cloudflare/kv'
|
|
37
44
|
|
|
38
45
|
// --- Example 1: Using Workers Binding ---
|
|
39
|
-
const storageWorkers = new
|
|
46
|
+
const storageWorkers = new CloudflareKVStorage({
|
|
40
47
|
id: 'cloudflare-workers-storage',
|
|
41
48
|
bindings: {
|
|
42
49
|
threads: THREADS_KV, // KVNamespace binding for threads table
|
|
@@ -47,7 +54,7 @@ const storageWorkers = new CloudflareStore({
|
|
|
47
54
|
})
|
|
48
55
|
|
|
49
56
|
// --- Example 2: Using REST API ---
|
|
50
|
-
const storageRest = new
|
|
57
|
+
const storageRest = new CloudflareKVStorage({
|
|
51
58
|
id: 'cloudflare-rest-storage',
|
|
52
59
|
accountId: process.env.CLOUDFLARE_ACCOUNT_ID!, // Cloudflare Account ID
|
|
53
60
|
apiToken: process.env.CLOUDFLARE_API_TOKEN!, // Cloudflare API Token
|
|
@@ -55,7 +62,7 @@ const storageRest = new CloudflareStore({
|
|
|
55
62
|
})
|
|
56
63
|
```
|
|
57
64
|
|
|
58
|
-
|
|
65
|
+
### Parameters
|
|
59
66
|
|
|
60
67
|
**id** (`string`): Unique identifier for this storage instance.
|
|
61
68
|
|
|
@@ -85,4 +92,68 @@ Cloudflare KV is an eventually consistent store, meaning that data may not be im
|
|
|
85
92
|
|
|
86
93
|
### Key Structure & Namespacing
|
|
87
94
|
|
|
88
|
-
Keys in Cloudflare KV are structured as a combination of a configurable prefix and a table-specific format (e.g., `threads:threadId`). For Workers deployments, `keyPrefix` is used to isolate data within a namespace; for REST API deployments, `namespacePrefix` is used to isolate entire namespaces between environments or applications.
|
|
95
|
+
Keys in Cloudflare KV are structured as a combination of a configurable prefix and a table-specific format (e.g., `threads:threadId`). For Workers deployments, `keyPrefix` is used to isolate data within a namespace; for REST API deployments, `namespacePrefix` is used to isolate entire namespaces between environments or applications.
|
|
96
|
+
|
|
97
|
+
## Cloudflare Durable Objects Storage
|
|
98
|
+
|
|
99
|
+
The Durable Objects storage implementation provides strongly consistent, SQLite-based storage using Cloudflare Durable Objects. This is ideal for applications that require transactional consistency and SQL query capabilities.
|
|
100
|
+
|
|
101
|
+
### Usage
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import { DurableObject } from 'cloudflare:workers'
|
|
105
|
+
import { CloudflareDOStorage } from '@mastra/cloudflare/do'
|
|
106
|
+
|
|
107
|
+
class AgentDurableObject extends DurableObject<Env> {
|
|
108
|
+
private storage: CloudflareDOStorage
|
|
109
|
+
|
|
110
|
+
constructor(ctx: DurableObjectState, env: Env) {
|
|
111
|
+
super(ctx, env)
|
|
112
|
+
this.storage = new CloudflareDOStorage({
|
|
113
|
+
sql: ctx.storage.sql,
|
|
114
|
+
tablePrefix: 'mastra_', // Optional: prefix for table names
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async run() {
|
|
119
|
+
const memory = await this.storage.getStore('memory')
|
|
120
|
+
await memory?.saveThread({
|
|
121
|
+
thread: { id: 'thread-1', resourceId: 'user-1', title: 'Chat', metadata: {} },
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Parameters
|
|
128
|
+
|
|
129
|
+
**sql** (`SqlStorage`): SqlStorage instance from Durable Objects ctx.storage.sql
|
|
130
|
+
|
|
131
|
+
**tablePrefix** (`string`): Optional prefix for table names (only letters, numbers, and underscores allowed)
|
|
132
|
+
|
|
133
|
+
**disableInit** (`boolean`): When true, automatic table creation/migrations are disabled. Useful for CI/CD pipelines where migrations run separately.
|
|
134
|
+
|
|
135
|
+
### Strong Consistency
|
|
136
|
+
|
|
137
|
+
Unlike KV, Durable Objects provide strong consistency guarantees. All reads and writes within a Durable Object are serialized, making it very suitable for fast, long-running agents.
|
|
138
|
+
|
|
139
|
+
### SQL Capabilities
|
|
140
|
+
|
|
141
|
+
Durable Objects storage uses SQLite under the hood, enabling efficient queries, filtering, and pagination that aren't possible with key-value storage.
|
|
142
|
+
|
|
143
|
+
## Schema Management
|
|
144
|
+
|
|
145
|
+
Both storage implementations handle schema creation and updates automatically. They create the following tables:
|
|
146
|
+
|
|
147
|
+
- `threads`: Stores conversation threads
|
|
148
|
+
- `messages`: Stores individual messages
|
|
149
|
+
- `workflow_snapshot`: Stores workflow run state
|
|
150
|
+
|
|
151
|
+
## Deprecated Aliases
|
|
152
|
+
|
|
153
|
+
For backwards compatibility, the following aliases are available:
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
// These are deprecated - use CloudflareKVStorage and CloudflareDOStorage instead
|
|
157
|
+
import { CloudflareStore } from '@mastra/cloudflare/kv' // alias for CloudflareKVStorage
|
|
158
|
+
import { DOStore } from '@mastra/cloudflare/do' // alias for CloudflareDOStorage
|
|
159
|
+
```
|
|
@@ -58,7 +58,7 @@ bun add @mastra/pg@latest @mastra/libsql@latest
|
|
|
58
58
|
|
|
59
59
|
## Storage domains
|
|
60
60
|
|
|
61
|
-
Mastra organizes storage into
|
|
61
|
+
Mastra organizes storage into domains, each handling a specific type of data. Each domain can be backed by a different storage adapter, and domain classes are exported from each storage package.
|
|
62
62
|
|
|
63
63
|
| Domain | Description |
|
|
64
64
|
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -67,6 +67,10 @@ Mastra organizes storage into five specialized domains, each handling a specific
|
|
|
67
67
|
| `scores` | Evaluation results from Mastra's evals system. Scores and metrics are persisted here for analysis and comparison over time. |
|
|
68
68
|
| `observability` | Telemetry data including traces and spans. Agent interactions, tool calls, and LLM requests generate spans collected into traces for debugging and performance analysis. |
|
|
69
69
|
| `agents` | Agent configurations for stored agents. Enables agents to be defined and updated at runtime without code deployments. |
|
|
70
|
+
| `datasets` | Evaluation datasets used for experiment runs. Stores dataset definitions, schemas, and versioned items. |
|
|
71
|
+
| `experiments` | Experiment runs and per-item experiment results linked to datasets and targets. |
|
|
72
|
+
|
|
73
|
+
> **Note:** `MastraCompositeStore` accepts all of the domain keys above, but storage adapter support varies by package. You can mix adapters per domain, but only for domains implemented and exported by those adapters. For example, `memory: new MemoryLibSQL(...)` and `workflows: new WorkflowsPG(...)` is valid because both packages export those domain classes.
|
|
70
74
|
|
|
71
75
|
## Usage
|
|
72
76
|
|
|
@@ -124,7 +128,9 @@ export const mastra = new Mastra({
|
|
|
124
128
|
|
|
125
129
|
**default** (`MastraCompositeStore`): Default storage adapter. Domains not explicitly specified in \`domains\` will use this storage's domains as fallbacks.
|
|
126
130
|
|
|
127
|
-
**
|
|
131
|
+
**disableInit** (`boolean`): When true, automatic initialization is disabled. You must call init() explicitly.
|
|
132
|
+
|
|
133
|
+
**domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over both \`editor\` and \`default\` storage.
|
|
128
134
|
|
|
129
135
|
**domains.memory** (`MemoryStorage`): Storage for threads, messages, and resources.
|
|
130
136
|
|
|
@@ -136,7 +142,9 @@ export const mastra = new Mastra({
|
|
|
136
142
|
|
|
137
143
|
**domains.agents** (`AgentsStorage`): Storage for stored agent configurations.
|
|
138
144
|
|
|
139
|
-
**
|
|
145
|
+
**domains.datasets** (`DatasetsStorage`): Storage for dataset metadata, dataset items, and dataset versions.
|
|
146
|
+
|
|
147
|
+
**domains.experiments** (`ExperimentsStorage`): Storage for experiment runs and per-item experiment results.
|
|
140
148
|
|
|
141
149
|
## Initialization
|
|
142
150
|
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
# Storage overview
|
|
2
2
|
|
|
3
|
-
Mastra
|
|
3
|
+
Mastra storage is organized into domains. Each domain owns a set of tables or collections. Depending on your adapter and configuration, you may use all domains or only a subset.
|
|
4
|
+
|
|
5
|
+
## Storage domains
|
|
6
|
+
|
|
7
|
+
`MastraCompositeStore` can route the following domain keys:
|
|
8
|
+
|
|
9
|
+
Not every storage adapter implements every domain. Composite storage lets you mix adapters per domain when the adapter packages export the corresponding domain classes.
|
|
10
|
+
|
|
11
|
+
| Domain | Description |
|
|
12
|
+
| --------------- | -------------------------------------------------------------------------------------- |
|
|
13
|
+
| `memory` | Conversation persistence: messages, threads, and resources (including working memory). |
|
|
14
|
+
| `workflows` | Workflow run snapshots used for suspend and resume. |
|
|
15
|
+
| `scores` | Evaluation score records from eval runs. |
|
|
16
|
+
| `observability` | Traces and spans used by observability exporters and Studio. |
|
|
17
|
+
| `datasets` | Dataset records, versioned items, and dataset versions used by experiments. |
|
|
18
|
+
| `experiments` | Experiment runs and per-item experiment results. |
|
|
19
|
+
|
|
20
|
+
The schema definitions below cover the built-in database-backed tables documented for `memory`, `workflows`, `scores`, and `observability`. Other domains, and non-database adapters, use implementation-specific storage structures.
|
|
4
21
|
|
|
5
22
|
## Core schema
|
|
6
23
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.1.10-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`cddf895`](https://github.com/mastra-ai/mastra/commit/cddf895532b8ee7f9fa814136ec672f53d37a9ba), [`aede3cc`](https://github.com/mastra-ai/mastra/commit/aede3cc2a83b54bbd9e9a54c8aedcd1708b2ef87), [`c4c7dad`](https://github.com/mastra-ai/mastra/commit/c4c7dadfe2e4584f079f6c24bfabdb8c4981827f), [`b9a77b9`](https://github.com/mastra-ai/mastra/commit/b9a77b951fa6422077080b492cce74460d2f8fdd), [`45c3112`](https://github.com/mastra-ai/mastra/commit/45c31122666a0cc56b94727099fcb1871ed1b3f6), [`45c3112`](https://github.com/mastra-ai/mastra/commit/45c31122666a0cc56b94727099fcb1871ed1b3f6), [`5e7c287`](https://github.com/mastra-ai/mastra/commit/5e7c28701f2bce795dd5c811e4c3060bf2ea2242), [`7e17d3f`](https://github.com/mastra-ai/mastra/commit/7e17d3f656fdda2aad47c4beb8c491636d70820c)]:
|
|
8
|
+
- @mastra/core@1.12.0-alpha.0
|
|
9
|
+
- @mastra/mcp@1.2.0-alpha.0
|
|
10
|
+
|
|
3
11
|
## 1.1.9
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10-alpha.0",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"jsdom": "^26.1.0",
|
|
30
30
|
"local-pkg": "^1.1.2",
|
|
31
31
|
"zod": "^4.3.6",
|
|
32
|
-
"@mastra/
|
|
33
|
-
"@mastra/
|
|
32
|
+
"@mastra/mcp": "^1.2.0-alpha.0",
|
|
33
|
+
"@mastra/core": "1.12.0-alpha.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@hono/node-server": "^1.19.9",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"tsx": "^4.21.0",
|
|
47
47
|
"typescript": "^5.9.3",
|
|
48
48
|
"vitest": "4.0.18",
|
|
49
|
-
"@internal/lint": "0.0.67",
|
|
50
49
|
"@internal/types-builder": "0.0.42",
|
|
51
|
-
"@
|
|
50
|
+
"@internal/lint": "0.0.67",
|
|
51
|
+
"@mastra/core": "1.12.0-alpha.0"
|
|
52
52
|
},
|
|
53
53
|
"homepage": "https://mastra.ai",
|
|
54
54
|
"repository": {
|