@mastra/mcp-docs-server 1.0.0-beta.15 → 1.0.0-beta.17

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.
Files changed (31) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +41 -41
  2. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +41 -41
  3. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +18 -18
  4. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +41 -41
  5. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +41 -41
  6. package/.docs/organized/changelogs/%40mastra%2Fconvex.md +40 -0
  7. package/.docs/organized/changelogs/%40mastra%2Fcore.md +179 -179
  8. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +17 -17
  9. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +49 -49
  10. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +41 -41
  11. package/.docs/organized/changelogs/%40mastra%2Flance.md +41 -41
  12. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +41 -41
  13. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +16 -16
  14. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +30 -30
  15. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +49 -49
  16. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +41 -41
  17. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +41 -41
  18. package/.docs/organized/changelogs/%40mastra%2Fpg.md +45 -45
  19. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +38 -38
  20. package/.docs/organized/changelogs/%40mastra%2Freact.md +15 -15
  21. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +10 -0
  22. package/.docs/organized/changelogs/%40mastra%2Fserver.md +63 -63
  23. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +41 -41
  24. package/.docs/raw/guides/migrations/upgrade-to-v1/storage.mdx +27 -0
  25. package/.docs/raw/reference/client-js/workflows.mdx +15 -0
  26. package/.docs/raw/reference/storage/composite.mdx +223 -0
  27. package/.docs/raw/reference/tools/mcp-server.mdx +9 -0
  28. package/.docs/raw/reference/workflows/run-methods/cancel.mdx +51 -3
  29. package/.docs/raw/reference/workflows/run.mdx +8 -2
  30. package/CHANGELOG.md +15 -0
  31. package/package.json +4 -4
@@ -0,0 +1,223 @@
1
+ ---
2
+ title: "Reference: Storage Composition | Storage"
3
+ description: Documentation for combining multiple storage backends in Mastra.
4
+ ---
5
+
6
+ # Storage Composition
7
+
8
+ MastraStorage can compose storage domains from different adapters. Use it when you need different databases for different purposes. For example, use LibSQL for memory and PostgreSQL for workflows.
9
+
10
+ ## Installation
11
+
12
+ MastraStorage is included in `@mastra/core`:
13
+
14
+ ```bash
15
+ npm install @mastra/core@beta
16
+ ```
17
+
18
+ You'll also need to install the storage adapters you want to compose:
19
+
20
+ ```bash
21
+ npm install @mastra/pg@beta @mastra/libsql@beta
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ### Basic composition
27
+
28
+ Import domain classes directly from each store package and compose them:
29
+
30
+ ```typescript
31
+ import { MastraStorage } from "@mastra/core/storage";
32
+ import { MemoryPG, WorkflowsPG, ScoresPG } from "@mastra/pg";
33
+ import { MemoryLibSQL } from "@mastra/libsql";
34
+ import { Mastra } from "@mastra/core";
35
+
36
+ const mastra = new Mastra({
37
+ storage: new MastraStorage({
38
+ id: "composite",
39
+ domains: {
40
+ memory: new MemoryLibSQL({ url: "file:./local.db" }),
41
+ workflows: new WorkflowsPG({ connectionString: process.env.DATABASE_URL }),
42
+ scores: new ScoresPG({ connectionString: process.env.DATABASE_URL }),
43
+ },
44
+ }),
45
+ });
46
+ ```
47
+
48
+ ### With a default storage
49
+
50
+ Use `default` to specify a fallback storage, then override specific domains:
51
+
52
+ ```typescript
53
+ import { MastraStorage } from "@mastra/core/storage";
54
+ import { PostgresStore } from "@mastra/pg";
55
+ import { MemoryLibSQL } from "@mastra/libsql";
56
+ import { Mastra } from "@mastra/core";
57
+
58
+ const pgStore = new PostgresStore({
59
+ id: "pg",
60
+ connectionString: process.env.DATABASE_URL,
61
+ });
62
+
63
+ const mastra = new Mastra({
64
+ storage: new MastraStorage({
65
+ id: "composite",
66
+ default: pgStore,
67
+ domains: {
68
+ memory: new MemoryLibSQL({ url: "file:./local.db" }),
69
+ },
70
+ }),
71
+ });
72
+ ```
73
+
74
+ ## Options
75
+
76
+ <PropertiesTable
77
+ content={[
78
+ {
79
+ name: "id",
80
+ type: "string",
81
+ description: "Unique identifier for this storage instance.",
82
+ isOptional: false,
83
+ },
84
+ {
85
+ name: "default",
86
+ type: "MastraStorage",
87
+ description:
88
+ "Default storage adapter. Domains not explicitly specified in `domains` will use this storage's domains as fallbacks.",
89
+ isOptional: true,
90
+ },
91
+ {
92
+ name: "domains",
93
+ type: "object",
94
+ description:
95
+ "Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over the default storage.",
96
+ isOptional: true,
97
+ },
98
+ {
99
+ name: "domains.memory",
100
+ type: "MemoryStorage",
101
+ description: "Storage for threads, messages, and resources.",
102
+ isOptional: true,
103
+ },
104
+ {
105
+ name: "domains.workflows",
106
+ type: "WorkflowsStorage",
107
+ description: "Storage for workflow snapshots.",
108
+ isOptional: true,
109
+ },
110
+ {
111
+ name: "domains.scores",
112
+ type: "ScoresStorage",
113
+ description: "Storage for evaluation scores.",
114
+ isOptional: true,
115
+ },
116
+ {
117
+ name: "domains.observability",
118
+ type: "ObservabilityStorage",
119
+ description: "Storage for traces and spans.",
120
+ isOptional: true,
121
+ },
122
+ {
123
+ name: "domains.agents",
124
+ type: "AgentsStorage",
125
+ description: "Storage for stored agent configurations.",
126
+ isOptional: true,
127
+ },
128
+ {
129
+ name: "disableInit",
130
+ type: "boolean",
131
+ description:
132
+ "When true, automatic initialization is disabled. You must call init() explicitly.",
133
+ isOptional: true,
134
+ },
135
+ ]}
136
+ />
137
+
138
+ ## Initialization
139
+
140
+ MastraStorage initializes each configured domain independently. When passed to the Mastra class, `init()` is called automatically:
141
+
142
+ ```typescript
143
+ import { MastraStorage } from "@mastra/core/storage";
144
+ import { MemoryPG, WorkflowsPG, ScoresPG } from "@mastra/pg";
145
+ import { Mastra } from "@mastra/core";
146
+
147
+ const storage = new MastraStorage({
148
+ id: "composite",
149
+ domains: {
150
+ memory: new MemoryPG({ connectionString: process.env.DATABASE_URL }),
151
+ workflows: new WorkflowsPG({ connectionString: process.env.DATABASE_URL }),
152
+ scores: new ScoresPG({ connectionString: process.env.DATABASE_URL }),
153
+ },
154
+ });
155
+
156
+ const mastra = new Mastra({
157
+ storage, // init() called automatically
158
+ });
159
+ ```
160
+
161
+ If using storage directly, call `init()` explicitly:
162
+
163
+ ```typescript
164
+ const storage = new MastraStorage({
165
+ id: "composite",
166
+ domains: {
167
+ memory: new MemoryPG({ connectionString: process.env.DATABASE_URL }),
168
+ },
169
+ });
170
+
171
+ await storage.init();
172
+
173
+ // Access domain-specific stores via getStore()
174
+ const memoryStore = await storage.getStore("memory");
175
+ const thread = await memoryStore?.getThreadById({ threadId: "..." });
176
+ ```
177
+
178
+ ## Use Cases
179
+
180
+ ### Separate databases for different workloads
181
+
182
+ Use a local database for development while keeping production data in a managed service:
183
+
184
+ ```typescript
185
+ import { MastraStorage } from "@mastra/core/storage";
186
+ import { MemoryPG, WorkflowsPG, ScoresPG } from "@mastra/pg";
187
+ import { MemoryLibSQL } from "@mastra/libsql";
188
+
189
+ const storage = new MastraStorage({
190
+ id: "composite",
191
+ domains: {
192
+ // Use local SQLite for development, PostgreSQL for production
193
+ memory:
194
+ process.env.NODE_ENV === "development"
195
+ ? new MemoryLibSQL({ url: "file:./dev.db" })
196
+ : new MemoryPG({ connectionString: process.env.DATABASE_URL }),
197
+ workflows: new WorkflowsPG({ connectionString: process.env.DATABASE_URL }),
198
+ scores: new ScoresPG({ connectionString: process.env.DATABASE_URL }),
199
+ },
200
+ });
201
+ ```
202
+
203
+ ### Specialized storage for observability
204
+
205
+ Use a time-series database for traces while keeping other data in PostgreSQL:
206
+
207
+ ```typescript
208
+ import { MastraStorage } from "@mastra/core/storage";
209
+ import { MemoryPG, WorkflowsPG, ScoresPG } from "@mastra/pg";
210
+ import { ObservabilityStorageClickhouse } from "@mastra/clickhouse";
211
+
212
+ const storage = new MastraStorage({
213
+ id: "composite",
214
+ domains: {
215
+ memory: new MemoryPG({ connectionString: process.env.DATABASE_URL }),
216
+ workflows: new WorkflowsPG({ connectionString: process.env.DATABASE_URL }),
217
+ scores: new ScoresPG({ connectionString: process.env.DATABASE_URL }),
218
+ observability: new ObservabilityStorageClickhouse({
219
+ url: process.env.CLICKHOUSE_URL,
220
+ }),
221
+ },
222
+ });
223
+ ```
@@ -41,6 +41,8 @@ const server = new MCPServer({
41
41
  id: "my-custom-server",
42
42
  name: "My Custom Server",
43
43
  version: "1.0.0",
44
+ description: "A server that provides weather data and agent capabilities",
45
+ instructions: "Use the available tools to help users with weather information and data processing tasks.",
44
46
  tools: { weatherTool },
45
47
  agents: { myAgent }, // this agent will become tool "ask_myAgent"
46
48
  workflows: {
@@ -102,6 +104,13 @@ The constructor accepts an `MCPServerConfig` object with the following propertie
102
104
  isOptional: true,
103
105
  description: "Optional description of what the MCP server does.",
104
106
  },
107
+ {
108
+ name: "instructions",
109
+ type: "string",
110
+ isOptional: true,
111
+ description:
112
+ "Optional instructions describing how to use the server and its features.",
113
+ },
105
114
  {
106
115
  name: "repository",
107
116
  type: "Repository", // { url: string; source: string; id: string; }
@@ -7,12 +7,15 @@ description: Documentation for the `Run.cancel()` method in workflows, which can
7
7
 
8
8
  The `.cancel()` method cancels a workflow run, stopping execution and cleaning up resources.
9
9
 
10
+ This method aborts any running steps and updates the workflow status to 'canceled'. It works for both actively running workflows and suspended/waiting workflows.
11
+
10
12
  ## Usage example
11
13
 
12
14
  ```typescript
13
15
  const run = await workflow.createRun();
14
16
 
15
17
  await run.cancel();
18
+ // Returns: { message: 'Workflow run canceled' }
16
19
  ```
17
20
 
18
21
  ## Parameters
@@ -34,14 +37,31 @@ await run.cancel();
34
37
  content={[
35
38
  {
36
39
  name: "result",
37
- type: "Promise<void>",
40
+ type: "Promise<{ message: string }>",
38
41
  description:
39
- "A promise that resolves when the workflow run has been cancelled",
42
+ "A promise that resolves with { message: 'Workflow run canceled' } when cancellation succeeds",
40
43
  },
41
44
  ]}
42
45
  />
43
46
 
44
- ## Extended usage example
47
+ ## How cancellation works
48
+
49
+ When called, the workflow will:
50
+ 1. **Trigger the abort signal** - Uses the standard Web API AbortSignal to notify running steps
51
+ 2. **Prevent subsequent steps** - No further steps will be executed
52
+
53
+ ## Abort signal behavior
54
+
55
+ Steps that check the `abortSignal` parameter can respond to cancellation:
56
+ - Steps can listen to the 'abort' event: `abortSignal.addEventListener('abort', callback)`
57
+ - Steps can check if already aborted: `if (abortSignal.aborted) { ... }`
58
+ - Useful for cancelling timeouts, network requests, or long-running operations
59
+
60
+ **Note:** Steps must actively check the abort signal to be canceled mid-execution. Steps that don't check the signal will run to completion, but subsequent steps won't execute.
61
+
62
+ ## Extended usage examples
63
+
64
+ ### Cancelling a workflow on error
45
65
 
46
66
  ```typescript
47
67
  const run = await workflow.createRun();
@@ -53,6 +73,34 @@ try {
53
73
  }
54
74
  ```
55
75
 
76
+ ### Creating a step that responds to cancellation
77
+
78
+ ```typescript
79
+ const step = createStep({
80
+ id: 'long-running-step',
81
+ execute: async ({ inputData, abortSignal, abort }) => {
82
+ const timeout = new Promise((resolve) => {
83
+ const timer = setTimeout(() => resolve('done'), 10000);
84
+
85
+ // Clean up if canceled
86
+ abortSignal.addEventListener('abort', () => {
87
+ clearTimeout(timer);
88
+ resolve('canceled');
89
+ });
90
+ });
91
+
92
+ const result = await timeout;
93
+
94
+ // Check if aborted after async operation
95
+ if (abortSignal.aborted) {
96
+ return abort(); // Stop execution
97
+ }
98
+
99
+ return { result };
100
+ }
101
+ });
102
+ ```
103
+
56
104
  ## Related
57
105
 
58
106
  - [Workflows overview](/docs/v1/workflows/overview#running-workflows)
@@ -53,8 +53,8 @@ if (result.status === "suspended") {
53
53
  },
54
54
  {
55
55
  name: "cancel",
56
- type: "() => Promise<void>",
57
- description: "Cancels the workflow execution",
56
+ type: "() => Promise<{ message: string }>",
57
+ description: "Cancels the workflow execution, stopping any running steps and preventing subsequent steps from executing",
58
58
  required: true,
59
59
  },
60
60
  {
@@ -102,6 +102,12 @@ A workflow run's `status` indicates its current execution state. The possible va
102
102
  description:
103
103
  "Workflow execution is paused waiting for resume, with suspended step information",
104
104
  },
105
+ {
106
+ name: "canceled",
107
+ type: "string",
108
+ description:
109
+ "Workflow execution was canceled via the cancel() method, stopping any running steps and preventing subsequent steps from executing",
110
+ },
105
111
  ]}
106
112
  />
107
113
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 1.0.0-beta.17
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`b5dc973`](https://github.com/mastra-ai/mastra/commit/b5dc9733a5158850298dfb103acb3babdba8a318)]:
8
+ - @mastra/core@1.0.0-beta.17
9
+
10
+ ## 1.0.0-beta.16
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`3d93a15`](https://github.com/mastra-ai/mastra/commit/3d93a15796b158c617461c8b98bede476ebb43e2), [`efe406a`](https://github.com/mastra-ai/mastra/commit/efe406a1353c24993280ebc2ed61dd9f65b84b26), [`119e5c6`](https://github.com/mastra-ai/mastra/commit/119e5c65008f3e5cfca954eefc2eb85e3bf40da4), [`74e504a`](https://github.com/mastra-ai/mastra/commit/74e504a3b584eafd2f198001c6a113bbec589fd3), [`e33fdbd`](https://github.com/mastra-ai/mastra/commit/e33fdbd07b33920d81e823122331b0c0bee0bb59), [`929f69c`](https://github.com/mastra-ai/mastra/commit/929f69c3436fa20dd0f0e2f7ebe8270bd82a1529), [`8a73529`](https://github.com/mastra-ai/mastra/commit/8a73529ca01187f604b1f3019d0a725ac63ae55f)]:
15
+ - @mastra/core@1.0.0-beta.16
16
+ - @mastra/mcp@1.0.0-beta.7
17
+
3
18
  ## 1.0.0-beta.15
4
19
 
5
20
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "1.0.0-beta.15",
3
+ "version": "1.0.0-beta.17",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,8 +28,8 @@
28
28
  "@modelcontextprotocol/sdk": "^1.17.5",
29
29
  "jsdom": "^26.1.0",
30
30
  "zod": "^3.25.76",
31
- "@mastra/core": "1.0.0-beta.15",
32
- "@mastra/mcp": "^1.0.0-beta.6"
31
+ "@mastra/mcp": "^1.0.0-beta.7",
32
+ "@mastra/core": "1.0.0-beta.17"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@hono/node-server": "^1.19.6",
@@ -46,7 +46,7 @@
46
46
  "typescript": "^5.8.3",
47
47
  "vitest": "4.0.12",
48
48
  "@internal/lint": "0.0.53",
49
- "@mastra/core": "1.0.0-beta.15"
49
+ "@mastra/core": "1.0.0-beta.17"
50
50
  },
51
51
  "homepage": "https://mastra.ai",
52
52
  "repository": {