@mastra/mcp-docs-server 1.0.0-beta.6 → 1.0.0-beta.8
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.
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +48 -48
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +65 -65
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +48 -48
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +48 -48
- package/.docs/organized/changelogs/%40mastra%2Fcodemod.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +47 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +196 -196
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +48 -48
- package/.docs/organized/changelogs/%40mastra%2Felasticsearch.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Flance.md +48 -48
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +48 -48
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +40 -40
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +43 -43
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +48 -48
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +48 -48
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +52 -52
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +41 -41
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Freact.md +14 -0
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +65 -65
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +48 -48
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +10 -10
- package/.docs/organized/changelogs/create-mastra.md +7 -7
- package/.docs/organized/changelogs/mastra.md +14 -14
- package/.docs/organized/code-examples/ai-elements.md +1 -1
- package/.docs/organized/code-examples/ai-sdk-useChat.md +1 -1
- package/.docs/organized/code-examples/ai-sdk-v5.md +1 -1
- package/.docs/organized/code-examples/assistant-ui.md +1 -1
- package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +1 -1
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +1 -1
- package/.docs/organized/code-examples/crypto-chatbot.md +1 -1
- package/.docs/organized/code-examples/mcp-server-adapters.md +2 -2
- package/.docs/organized/code-examples/server-app-access.md +2 -2
- package/.docs/organized/code-examples/server-express-adapter.md +87 -0
- package/.docs/organized/code-examples/server-hono-adapter.md +85 -0
- package/.docs/raw/agents/overview.mdx +2 -111
- package/.docs/raw/agents/processors.mdx +1 -1
- package/.docs/raw/agents/structured-output.mdx +224 -0
- package/.docs/raw/guides/build-your-ui/ai-sdk-ui.mdx +381 -431
- package/.docs/raw/guides/getting-started/quickstart.mdx +11 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +40 -1
- package/.docs/raw/memory/working-memory.mdx +1 -0
- package/.docs/raw/observability/tracing/bridges/otel.mdx +25 -1
- package/.docs/raw/observability/tracing/exporters/arize.mdx +19 -0
- package/.docs/raw/observability/tracing/exporters/langfuse.mdx +63 -0
- package/.docs/raw/observability/tracing/exporters/otel.mdx +30 -19
- package/.docs/raw/observability/tracing/exporters/posthog.mdx +20 -0
- package/.docs/raw/observability/tracing/overview.mdx +6 -1
- package/.docs/raw/reference/ai-sdk/chat-route.mdx +127 -0
- package/.docs/raw/reference/ai-sdk/handle-chat-stream.mdx +117 -0
- package/.docs/raw/reference/ai-sdk/handle-network-stream.mdx +64 -0
- package/.docs/raw/reference/ai-sdk/handle-workflow-stream.mdx +116 -0
- package/.docs/raw/reference/ai-sdk/network-route.mdx +99 -0
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-stream.mdx +289 -0
- package/.docs/raw/reference/ai-sdk/workflow-route.mdx +110 -0
- package/.docs/raw/reference/observability/tracing/bridges/otel.mdx +27 -0
- package/.docs/raw/reference/observability/tracing/exporters/arize.mdx +25 -0
- package/.docs/raw/reference/observability/tracing/exporters/langfuse.mdx +43 -0
- package/.docs/raw/reference/observability/tracing/exporters/otel.mdx +27 -43
- package/.docs/raw/reference/server/create-route.mdx +314 -0
- package/.docs/raw/reference/server/express-adapter.mdx +193 -0
- package/.docs/raw/reference/server/hono-adapter.mdx +174 -0
- package/.docs/raw/reference/server/mastra-server.mdx +316 -0
- package/.docs/raw/reference/server/routes.mdx +250 -0
- package/.docs/raw/reference/streaming/workflows/timeTravelStream.mdx +170 -0
- package/.docs/raw/reference/tools/mcp-client.mdx +54 -1
- package/.docs/raw/reference/workflows/run-methods/timeTravel.mdx +310 -0
- package/.docs/raw/reference/workflows/run.mdx +14 -0
- package/.docs/raw/server-db/custom-adapters.mdx +380 -0
- package/.docs/raw/server-db/custom-api-routes.mdx +5 -5
- package/.docs/raw/server-db/mastra-server.mdx +11 -32
- package/.docs/raw/server-db/server-adapters.mdx +286 -0
- package/.docs/raw/workflows/workflow-state.mdx +4 -5
- package/CHANGELOG.md +15 -0
- package/package.json +4 -4
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Server Adapters | Server & DB"
|
|
3
|
+
description: "Manually configure a Mastra server using Hono or Express adapters."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import PropertiesTable from "@site/src/components/PropertiesTable";
|
|
7
|
+
import Tabs from "@theme/Tabs";
|
|
8
|
+
import TabItem from "@theme/TabItem";
|
|
9
|
+
|
|
10
|
+
# Server Adapters
|
|
11
|
+
|
|
12
|
+
Server adapters let you run Mastra with your own HTTP server instead of using `mastra build`. While `mastra build` generates a standalone server for you, adapters give you full control over the server setup, letting you integrate Mastra into any Node.js application.
|
|
13
|
+
|
|
14
|
+
Use adapters when you need to:
|
|
15
|
+
|
|
16
|
+
- **Integrate Mastra into an existing application** - Add Mastra endpoints to an Express or Hono app you already have running
|
|
17
|
+
- **Control middleware ordering** - Insert your own middleware before or after Mastra's authentication and routing
|
|
18
|
+
- **Deploy to platforms requiring specific server setup** - Some platforms like Cloudflare Workers or custom Docker setups need direct access to the server instance
|
|
19
|
+
- **Use Express instead of Hono** - `mastra build` uses Hono internally, but you may prefer Express for its ecosystem or team familiarity
|
|
20
|
+
|
|
21
|
+
:::info
|
|
22
|
+
|
|
23
|
+
For simple deployments without custom server requirements, use `mastra build` instead. It configures server setup, registers middleware, and applies deployment settings based on your project configuration. See [Server Configuration](/docs/v1/server-db/mastra-server).
|
|
24
|
+
|
|
25
|
+
:::
|
|
26
|
+
|
|
27
|
+
## Available adapters
|
|
28
|
+
|
|
29
|
+
- **[@mastra/hono](/reference/v1/server/hono-adapter)** - Hono framework adapter
|
|
30
|
+
- **[@mastra/express](/reference/v1/server/express-adapter)** - Express framework adapter
|
|
31
|
+
|
|
32
|
+
## Basic setup
|
|
33
|
+
|
|
34
|
+
Both adapters follow the same pattern. The adapter wraps your framework's app instance and registers Mastra's routes and middleware onto it.
|
|
35
|
+
|
|
36
|
+
1. **Create your framework's app instance** - Initialize Hono or Express as you normally would
|
|
37
|
+
2. **Create a `MastraServer`** - Pass your app and Mastra instance to the adapter
|
|
38
|
+
3. **Call `init()`** - This registers context middleware, authentication, and all API routes
|
|
39
|
+
|
|
40
|
+
After `init()`, your app has all the Mastra endpoints (`/api/agents`, `/api/workflows`, etc.) and you can add your own routes before or after.
|
|
41
|
+
|
|
42
|
+
See the [Hono Adapter](/reference/v1/server/hono-adapter) or [Express Adapter](/reference/v1/server/express-adapter) docs for framework-specific setup and code examples.
|
|
43
|
+
|
|
44
|
+
## Constructor options
|
|
45
|
+
|
|
46
|
+
Both adapters accept the same options:
|
|
47
|
+
|
|
48
|
+
<PropertiesTable
|
|
49
|
+
content={[
|
|
50
|
+
{
|
|
51
|
+
name: "app",
|
|
52
|
+
type: "Hono | Application",
|
|
53
|
+
description: "Framework app instance",
|
|
54
|
+
isOptional: false,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "mastra",
|
|
58
|
+
type: "Mastra",
|
|
59
|
+
description: "Mastra instance",
|
|
60
|
+
isOptional: false,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "prefix",
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "Route path prefix (e.g., `/api/v2`)",
|
|
66
|
+
isOptional: true,
|
|
67
|
+
defaultValue: "''",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "openapiPath",
|
|
71
|
+
type: "string",
|
|
72
|
+
description: "Path to serve OpenAPI spec (e.g., `/openapi.json`)",
|
|
73
|
+
isOptional: true,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "bodyLimitOptions",
|
|
77
|
+
type: "{ maxSize: number, onError: (err) => unknown }",
|
|
78
|
+
description: "Request body size limits",
|
|
79
|
+
isOptional: true,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "streamOptions",
|
|
83
|
+
type: "{ redact?: boolean }",
|
|
84
|
+
description: "Stream redaction config. When true, redacts sensitive data from streams.",
|
|
85
|
+
isOptional: true,
|
|
86
|
+
defaultValue: "{ redact: true }",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "customRouteAuthConfig",
|
|
90
|
+
type: "Map<string, boolean>",
|
|
91
|
+
description: "Per-route auth overrides. Keys are `METHOD:PATH` (e.g., `GET:/api/health`). Value `false` makes route public, `true` requires auth.",
|
|
92
|
+
isOptional: true,
|
|
93
|
+
},
|
|
94
|
+
]}
|
|
95
|
+
/>
|
|
96
|
+
|
|
97
|
+
## Initialization flow
|
|
98
|
+
|
|
99
|
+
Calling `init()` runs three steps in order. Understanding this flow helps when you need to insert your own middleware at specific points.
|
|
100
|
+
|
|
101
|
+
1. **`registerContextMiddleware()`** - Attaches the Mastra instance, request context, tools, and abort signal to every request. This makes Mastra available to all subsequent middleware and route handlers.
|
|
102
|
+
2. **`registerAuthMiddleware()`** - Adds authentication and authorization middleware, but only if `server.auth` is configured in your Mastra instance. Skipped entirely if no auth is configured.
|
|
103
|
+
3. **`registerRoutes()`** - Registers all Mastra API routes for agents, workflows, and other features. Also registers MCP routes if MCP servers are configured.
|
|
104
|
+
|
|
105
|
+
### Manual initialization
|
|
106
|
+
|
|
107
|
+
For custom middleware ordering, call each method separately instead of `init()`. This is useful when you need middleware that runs before Mastra's context is set up, or when you need to insert logic between the initialization steps.
|
|
108
|
+
|
|
109
|
+
```typescript title="server.ts" copy showLineNumbers
|
|
110
|
+
const server = new MastraServer({ app, mastra });
|
|
111
|
+
|
|
112
|
+
// Your middleware first
|
|
113
|
+
app.use(loggingMiddleware);
|
|
114
|
+
|
|
115
|
+
server.registerContextMiddleware();
|
|
116
|
+
|
|
117
|
+
// Middleware that needs Mastra context
|
|
118
|
+
app.use(customMiddleware);
|
|
119
|
+
|
|
120
|
+
server.registerAuthMiddleware();
|
|
121
|
+
await server.registerRoutes();
|
|
122
|
+
|
|
123
|
+
// Routes after Mastra
|
|
124
|
+
app.get('/health', ...);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
:::tip
|
|
128
|
+
|
|
129
|
+
Use manual initialization when you need middleware that runs before Mastra's context is available, or when you need to insert middleware between the context and auth steps.
|
|
130
|
+
|
|
131
|
+
:::
|
|
132
|
+
|
|
133
|
+
## Adding custom routes
|
|
134
|
+
|
|
135
|
+
You can add your own routes to the app alongside Mastra's routes. Routes added after `init()` have access to the Mastra context (the Mastra instance, request context, authenticated user, etc.) through framework-specific mechanisms.
|
|
136
|
+
|
|
137
|
+
The timing matters: routes added before `init()` won't have Mastra context available, while routes added after `init()` will. See the framework-specific docs for syntax and examples:
|
|
138
|
+
|
|
139
|
+
- [Hono: Adding custom routes](/reference/v1/server/hono-adapter#adding-custom-routes)
|
|
140
|
+
- [Express: Adding custom routes](/reference/v1/server/express-adapter#adding-custom-routes)
|
|
141
|
+
|
|
142
|
+
## Route prefixes
|
|
143
|
+
|
|
144
|
+
By default, Mastra routes are registered at `/api/agents`, `/api/workflows`, etc. Use the `prefix` option to change this, which is useful for API versioning or when integrating with an existing app that has its own `/api` routes.
|
|
145
|
+
|
|
146
|
+
```typescript copy showLineNumbers
|
|
147
|
+
const server = new MastraServer({
|
|
148
|
+
app,
|
|
149
|
+
mastra,
|
|
150
|
+
prefix: '/api/v2',
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
With this prefix, Mastra routes become `/api/v2/agents`, `/api/v2/workflows`, etc. Custom routes you add directly to the app are not affected by this prefix.
|
|
155
|
+
|
|
156
|
+
## OpenAPI spec
|
|
157
|
+
|
|
158
|
+
Mastra can generate an OpenAPI specification for all registered routes. This is useful for documentation, client generation, or integration with API tools. Enable it by setting the `openapiPath` option:
|
|
159
|
+
|
|
160
|
+
```typescript copy showLineNumbers
|
|
161
|
+
const server = new MastraServer({
|
|
162
|
+
app,
|
|
163
|
+
mastra,
|
|
164
|
+
openapiPath: '/openapi.json',
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The spec is generated from the Zod schemas defined on each route and served at the specified path. It includes all Mastra routes as well as any custom routes created with `createRoute()`.
|
|
169
|
+
|
|
170
|
+
## Stream data redaction
|
|
171
|
+
|
|
172
|
+
When streaming agent responses over HTTP, the HTTP streaming layer redacts sensitive information from stream chunks before sending them to clients. This prevents accidental exposure of:
|
|
173
|
+
|
|
174
|
+
- System prompts and agent instructions
|
|
175
|
+
- Tool definitions and their parameters
|
|
176
|
+
- API keys and other credentials in request bodies
|
|
177
|
+
- Internal configuration data
|
|
178
|
+
|
|
179
|
+
This redaction happens at the HTTP boundary, so internal callbacks like `onStepFinish` still have access to the full request data for debugging and observability purposes.
|
|
180
|
+
|
|
181
|
+
By default, redaction is enabled. Configure this behavior via `streamOptions`:
|
|
182
|
+
|
|
183
|
+
```typescript copy showLineNumbers
|
|
184
|
+
const server = new MastraServer({
|
|
185
|
+
app,
|
|
186
|
+
mastra,
|
|
187
|
+
streamOptions: {
|
|
188
|
+
redact: true, // Default
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Set `redact: false` only for internal services or debugging scenarios where you need access to the full request data in stream responses.
|
|
194
|
+
|
|
195
|
+
## Per-route auth overrides
|
|
196
|
+
|
|
197
|
+
When authentication is configured on your Mastra instance, all routes require authentication by default. Sometimes you need exceptions: public health check endpoints, webhook receivers, or admin routes that need stricter controls.
|
|
198
|
+
|
|
199
|
+
Use `customRouteAuthConfig` to override authentication behavior for specific routes:
|
|
200
|
+
|
|
201
|
+
```typescript copy showLineNumbers
|
|
202
|
+
const server = new MastraServer({
|
|
203
|
+
app,
|
|
204
|
+
mastra,
|
|
205
|
+
customRouteAuthConfig: new Map([
|
|
206
|
+
['GET:/api/health', false], // Public health check
|
|
207
|
+
['GET:/api/openapi.json', false], // Public API spec
|
|
208
|
+
['POST:/api/webhooks/*', false], // Public webhook endpoints
|
|
209
|
+
['POST:/api/admin/reset', true], // Require auth even if globally disabled
|
|
210
|
+
['ALL:/api/internal/*', true], // Protect all methods on internal routes
|
|
211
|
+
]),
|
|
212
|
+
});
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Keys follow the format `METHOD:PATH` where method is `GET`, `POST`, `PUT`, `DELETE`, or `ALL`. Paths support wildcards (`*`) for matching multiple routes. Setting a value to `false` makes the route public, while `true` requires authentication.
|
|
216
|
+
|
|
217
|
+
## Accessing the app
|
|
218
|
+
|
|
219
|
+
After creating the adapter, you may need to access the underlying framework app instance—for example, to pass it to a platform's serve function or to add routes programmatically from another module.
|
|
220
|
+
|
|
221
|
+
```typescript copy showLineNumbers
|
|
222
|
+
// Via the MastraServer instance
|
|
223
|
+
const app = server.getApp();
|
|
224
|
+
|
|
225
|
+
// Via the Mastra instance (available after adapter construction)
|
|
226
|
+
const app = mastra.getServerApp();
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Both methods return the same app instance. Use whichever is more convenient based on what's in scope.
|
|
230
|
+
|
|
231
|
+
## Server config vs adapter options
|
|
232
|
+
|
|
233
|
+
When using server adapters, configuration comes from two places: the Mastra `server` config (passed to the `Mastra` constructor) and the adapter constructor options. Understanding which options come from where helps avoid confusion when settings don't seem to take effect.
|
|
234
|
+
|
|
235
|
+
### Used by adapters
|
|
236
|
+
|
|
237
|
+
The adapter reads these settings from `mastra.getServer()`:
|
|
238
|
+
|
|
239
|
+
| Option | Description |
|
|
240
|
+
|--------|-------------|
|
|
241
|
+
| `auth` | Authentication config, used by `registerAuthMiddleware()`. |
|
|
242
|
+
| `bodySizeLimit` | Default body size limit in bytes. Can be overridden per-adapter via `bodyLimitOptions`. |
|
|
243
|
+
|
|
244
|
+
### Adapter constructor only
|
|
245
|
+
|
|
246
|
+
These options are passed directly to the adapter constructor and are not read from the Mastra config:
|
|
247
|
+
|
|
248
|
+
| Option | Description |
|
|
249
|
+
|--------|-------------|
|
|
250
|
+
| `prefix` | Route path prefix |
|
|
251
|
+
| `openapiPath` | OpenAPI spec endpoint |
|
|
252
|
+
| `bodyLimitOptions` | Body size limit with custom error handler |
|
|
253
|
+
| `streamOptions` | Stream redaction settings |
|
|
254
|
+
| `customRouteAuthConfig` | Per-route auth overrides |
|
|
255
|
+
|
|
256
|
+
### Not used by adapters
|
|
257
|
+
|
|
258
|
+
These `server` config options are only used by `mastra build` and have no effect when using adapters directly:
|
|
259
|
+
|
|
260
|
+
| Option | Used by |
|
|
261
|
+
|--------|---------|
|
|
262
|
+
| `port`, `host` | `mastra dev`, `mastra build` |
|
|
263
|
+
| `cors` | `mastra build` adds CORS middleware |
|
|
264
|
+
| `timeout` | `mastra build` |
|
|
265
|
+
| `apiRoutes` | `registerApiRoute()` for `mastra build` |
|
|
266
|
+
| `middleware` | Middleware config for `mastra build` |
|
|
267
|
+
|
|
268
|
+
When using adapters, configure these features directly with your framework. For example, add CORS middleware using Hono's or Express's built-in CORS packages, and set the port when calling your framework's listen function.
|
|
269
|
+
|
|
270
|
+
## MCP support
|
|
271
|
+
|
|
272
|
+
Server adapters register MCP (Model Context Protocol) routes during `registerRoutes()` when MCP servers are configured in your Mastra instance. MCP allows external tools and services to connect to your Mastra server and interact with your agents.
|
|
273
|
+
|
|
274
|
+
The adapter registers routes for both HTTP and SSE (Server-Sent Events) transports, enabling different client connection patterns.
|
|
275
|
+
|
|
276
|
+
See [MCP](/docs/v1/mcp/overview) for configuration details and how to set up MCP servers.
|
|
277
|
+
|
|
278
|
+
## Related
|
|
279
|
+
|
|
280
|
+
- [Hono Adapter](/reference/v1/server/hono-adapter) - Hono-specific setup
|
|
281
|
+
- [Express Adapter](/reference/v1/server/express-adapter) - Express-specific setup
|
|
282
|
+
- [Custom Adapters](/docs/v1/server-db/custom-adapters) - Building adapters for other frameworks
|
|
283
|
+
- [Server Configuration](/docs/v1/server-db/mastra-server) - Using `mastra build` instead
|
|
284
|
+
- [Authentication](/docs/v1/auth) - Configuring auth for your server
|
|
285
|
+
- [MastraServer Reference](/reference/v1/server/mastra-server) - Full API reference
|
|
286
|
+
- [createRoute() Reference](/reference/v1/server/create-route) - Creating type-safe custom routes
|
|
@@ -28,7 +28,7 @@ const step1 = createStep({
|
|
|
28
28
|
console.log(state.sharedCounter);
|
|
29
29
|
|
|
30
30
|
// Update state for subsequent steps
|
|
31
|
-
setState({
|
|
31
|
+
await setState({ sharedCounter: state.sharedCounter + 1 });
|
|
32
32
|
|
|
33
33
|
// Return output that flows to next step's inputData
|
|
34
34
|
return { step1Output: "processed" };
|
|
@@ -50,8 +50,7 @@ const step1 = createStep({
|
|
|
50
50
|
const { message } = inputData;
|
|
51
51
|
const { processedItems } = state;
|
|
52
52
|
|
|
53
|
-
setState({
|
|
54
|
-
...state,
|
|
53
|
+
await setState({
|
|
55
54
|
processedItems: [...processedItems, "item-1", "item-2"],
|
|
56
55
|
});
|
|
57
56
|
|
|
@@ -124,7 +123,7 @@ const step1 = createStep({
|
|
|
124
123
|
execute: async ({ state, setState, suspend, resumeData }) => {
|
|
125
124
|
if (!resumeData) {
|
|
126
125
|
// First run: update state and suspend
|
|
127
|
-
setState({
|
|
126
|
+
await setState({ count: state.count + 1, items: [...state.items, "item-1"] });
|
|
128
127
|
await suspend({});
|
|
129
128
|
return {};
|
|
130
129
|
}
|
|
@@ -166,7 +165,7 @@ const parentStep = createStep({
|
|
|
166
165
|
stateSchema: z.object({ sharedValue: z.string() }),
|
|
167
166
|
execute: async ({ state, setState }) => {
|
|
168
167
|
// Modify state before nested workflow runs
|
|
169
|
-
setState({
|
|
168
|
+
await setState({ sharedValue: "modified-by-parent" });
|
|
170
169
|
return {};
|
|
171
170
|
},
|
|
172
171
|
});
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`0d41fe2`](https://github.com/mastra-ai/mastra/commit/0d41fe245355dfc66d61a0d9c85d9400aac351ff), [`6b3ba91`](https://github.com/mastra-ai/mastra/commit/6b3ba91494cc10394df96782f349a4f7b1e152cc), [`7907fd1`](https://github.com/mastra-ai/mastra/commit/7907fd1c5059813b7b870b81ca71041dc807331b)]:
|
|
8
|
+
- @mastra/core@1.0.0-beta.8
|
|
9
|
+
|
|
10
|
+
## 1.0.0-beta.7
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`7a3c1b4`](https://github.com/mastra-ai/mastra/commit/7a3c1b41815496da2a8cfff4cfb0c712b4ebf535), [`3076c67`](https://github.com/mastra-ai/mastra/commit/3076c6778b18988ae7d5c4c5c466366974b2d63f), [`85d7ee1`](https://github.com/mastra-ai/mastra/commit/85d7ee18ff4e14d625a8a30ec6656bb49804989b), [`c6c1092`](https://github.com/mastra-ai/mastra/commit/c6c1092f8fbf76109303f69e000e96fd1960c4ce), [`81dc110`](https://github.com/mastra-ai/mastra/commit/81dc11008d147cf5bdc8996ead1aa61dbdebb6fc), [`bfe1de6`](https://github.com/mastra-ai/mastra/commit/bfe1de659a279e6b2204a1c540a1fb9919299c0a), [`7aedb74`](https://github.com/mastra-ai/mastra/commit/7aedb74883adf66af38e270e4068fd42e7a37036), [`8f02d80`](https://github.com/mastra-ai/mastra/commit/8f02d800777397e4b45d7f1ad041988a8b0c6630), [`d7aad50`](https://github.com/mastra-ai/mastra/commit/d7aad501ce61646b76b4b511e558ac4eea9884d0), [`def4a85`](https://github.com/mastra-ai/mastra/commit/def4a856057db7d79d1d7c64894a2236be8b4ddd), [`ce0a73a`](https://github.com/mastra-ai/mastra/commit/ce0a73abeaa75b10ca38f9e40a255a645d50ebfb), [`a02e542`](https://github.com/mastra-ai/mastra/commit/a02e542d23179bad250b044b17ff023caa61739f), [`a372c64`](https://github.com/mastra-ai/mastra/commit/a372c640ad1fd12e8f0613cebdc682fc156b4d95), [`8846867`](https://github.com/mastra-ai/mastra/commit/8846867ffa9a3746767618e314bebac08eb77d87), [`42a42cf`](https://github.com/mastra-ai/mastra/commit/42a42cf3132b9786feecbb8c13c583dce5b0e198), [`ae08bf0`](https://github.com/mastra-ai/mastra/commit/ae08bf0ebc6a4e4da992b711c4a389c32ba84cf4), [`21735a7`](https://github.com/mastra-ai/mastra/commit/21735a7ef306963554a69a89b44f06c3bcd85141), [`1d877b8`](https://github.com/mastra-ai/mastra/commit/1d877b8d7b536a251c1a7a18db7ddcf4f68d6f8b)]:
|
|
15
|
+
- @mastra/mcp@1.0.0-beta.5
|
|
16
|
+
- @mastra/core@1.0.0-beta.7
|
|
17
|
+
|
|
3
18
|
## 1.0.0-beta.6
|
|
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.
|
|
3
|
+
"version": "1.0.0-beta.8",
|
|
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/
|
|
32
|
-
"@mastra/
|
|
31
|
+
"@mastra/core": "1.0.0-beta.8",
|
|
32
|
+
"@mastra/mcp": "^1.0.0-beta.5"
|
|
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.
|
|
49
|
+
"@mastra/core": "1.0.0-beta.8"
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://mastra.ai",
|
|
52
52
|
"repository": {
|