@mastra/mcp-docs-server 1.2.1-alpha.2 → 1.2.1-alpha.4

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 (30) hide show
  1. package/.docs/docs/agents/background-tasks.md +89 -14
  2. package/.docs/docs/agents/durable-agents.md +231 -0
  3. package/.docs/docs/agents/using-tools.md +52 -0
  4. package/.docs/docs/getting-started/build-with-ai.md +273 -8
  5. package/.docs/docs/server/pubsub.md +2 -2
  6. package/.docs/docs/workflows/overview.md +71 -0
  7. package/.docs/guides/build-your-ui/ai-sdk-ui.md +3 -3
  8. package/.docs/guides/concepts/streaming.md +317 -0
  9. package/.docs/guides/getting-started/quickstart.md +1 -1
  10. package/.docs/models/index.md +1 -1
  11. package/.docs/models/providers/opencode.md +2 -1
  12. package/.docs/reference/agents/durable-agent.md +30 -1
  13. package/.docs/reference/agents/getDefaultOptions.md +1 -1
  14. package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
  15. package/.docs/reference/agents/inngest-agent.md +339 -0
  16. package/.docs/reference/ai-sdk/handle-workflow-stream.md +1 -1
  17. package/.docs/reference/ai-sdk/workflow-route.md +1 -1
  18. package/.docs/reference/index.md +1 -0
  19. package/.docs/reference/streaming/workflows/timeTravelStream.md +1 -1
  20. package/.docs/reference/tools/create-tool.md +1 -1
  21. package/.docs/reference/workflows/run.md +1 -1
  22. package/CHANGELOG.md +7 -0
  23. package/package.json +5 -5
  24. package/.docs/docs/build-with-ai/mcp-docs-server.md +0 -238
  25. package/.docs/docs/build-with-ai/skills.md +0 -63
  26. package/.docs/docs/streaming/background-task-streaming.md +0 -80
  27. package/.docs/docs/streaming/events.md +0 -148
  28. package/.docs/docs/streaming/overview.md +0 -136
  29. package/.docs/docs/streaming/tool-streaming.md +0 -189
  30. package/.docs/docs/streaming/workflow-streaming.md +0 -109
@@ -0,0 +1,339 @@
1
+ # `createInngestAgent()`
2
+
3
+ `createInngestAgent()` wraps an existing [`Agent`](https://mastra.ai/reference/agents/agent) with [Inngest](https://www.inngest.com/docs)-powered durable execution. Like [`createDurableAgent()`](https://mastra.ai/reference/agents/durable-agent), it streams events over [PubSub](https://mastra.ai/docs/server/pubsub) and supports resumable streams, but runs the agentic loop on Inngest's execution engine instead of in-process. Use it when a run must survive process restarts or run in a distributed environment.
4
+
5
+ For in-process durable execution, use [`createDurableAgent()`](https://mastra.ai/reference/agents/durable-agent). For fire-and-forget execution on the built-in workflow engine, use [`createEventedAgent()`](https://mastra.ai/reference/agents/durable-agent).
6
+
7
+ ## Usage example
8
+
9
+ Set up the Inngest client, wrap an agent, register it with Mastra, and expose the Inngest serve endpoint:
10
+
11
+ ```typescript
12
+ import { Mastra } from '@mastra/core'
13
+ import { Agent } from '@mastra/core/agent'
14
+ import { createInngestAgent, serve as inngestServe } from '@mastra/inngest'
15
+ import { Inngest } from 'inngest'
16
+
17
+ const inngest = new Inngest({ id: 'my-app' })
18
+
19
+ const agent = new Agent({
20
+ id: 'my-agent',
21
+ name: 'My Agent',
22
+ instructions: 'You are a helpful assistant',
23
+ model: 'openai/gpt-5.5',
24
+ })
25
+
26
+ const durableAgent = createInngestAgent({ agent, inngest })
27
+
28
+ export const mastra = new Mastra({
29
+ agents: { myAgent: durableAgent },
30
+ server: {
31
+ apiRoutes: [
32
+ {
33
+ path: '/inngest/api',
34
+ method: 'ALL',
35
+ createHandler: async ({ mastra }) => inngestServe({ mastra, inngest }),
36
+ },
37
+ ],
38
+ },
39
+ })
40
+ ```
41
+
42
+ Stream a response and read the result:
43
+
44
+ ```typescript
45
+ const { output, runId, cleanup } = await durableAgent.stream('Hello!')
46
+
47
+ const text = await output.text
48
+
49
+ cleanup()
50
+ ```
51
+
52
+ ## `createInngestAgent(options)`
53
+
54
+ Wraps an `Agent` with Inngest-powered durable execution and resumable streams.
55
+
56
+ ```typescript
57
+ import { createInngestAgent } from '@mastra/inngest'
58
+
59
+ const durableAgent = createInngestAgent({ agent, inngest })
60
+ ```
61
+
62
+ Returns: [`InngestAgent`](#inngestagent-interface)
63
+
64
+ ### Parameters
65
+
66
+ **agent** (`Agent`): The Agent to wrap with Inngest durable execution. Agent methods (e.g., \`generate()\`, \`listTools()\`, \`getMemory()\`) delegate to this agent via a Proxy.
67
+
68
+ **inngest** (`Inngest`): The Inngest client instance. Used to send workflow events and, in SDK v4, publish realtime stream events.
69
+
70
+ **id** (`string`): ID override. (Default: `agent.id`)
71
+
72
+ **name** (`string`): Name override. (Default: `agent.name`)
73
+
74
+ **pubsub** (`PubSub`): PubSub instance for streaming events. The default \`InngestPubSub\` uses Inngest Realtime, which works across processes. (Default: `InngestPubSub`)
75
+
76
+ **cache** (`MastraServerCache`): Cache for stored stream events, which enables resumable streams. When provided, the PubSub is automatically wrapped with \`CachingPubSub\`. If omitted, the agent inherits the cache from the Mastra instance.
77
+
78
+ **mastra** (`Mastra`): Mastra instance for observability. Set automatically when the agent is registered with Mastra.
79
+
80
+ ## `InngestAgent` interface
81
+
82
+ The object returned by `createInngestAgent()`. It implements the full `Agent` interface via a Proxy: any property or method not explicitly defined (e.g., `generate()`, `listTools()`, `getMemory()`) is forwarded to the underlying agent.
83
+
84
+ ### Properties
85
+
86
+ **id** (`string`): The agent ID.
87
+
88
+ **name** (`string`): The agent name.
89
+
90
+ **agent** (`Agent`): The underlying Mastra Agent.
91
+
92
+ **inngest** (`Inngest`): The Inngest client.
93
+
94
+ **cache** (`MastraServerCache | undefined`): The resolved cache instance, if resumable streams are enabled.
95
+
96
+ **pubsub** (`PubSub`): The PubSub instance used for streaming events.
97
+
98
+ ## Methods
99
+
100
+ ### Execution
101
+
102
+ #### `stream(messages, options?)`
103
+
104
+ Streams a response using Inngest's durable execution engine. The workflow is triggered via an Inngest event after the PubSub subscription is established.
105
+
106
+ ```typescript
107
+ const { output, runId, cleanup } = await durableAgent.stream('Hello!', {
108
+ onChunk: chunk => console.log(chunk),
109
+ onFinish: result => console.log('done', result),
110
+ })
111
+
112
+ const text = await output.text
113
+ cleanup()
114
+ ```
115
+
116
+ Returns: [`Promise<InngestAgentStreamResult>`](#inngestagentstreamresult)
117
+
118
+ #### `resume(runId, resumeData, options?)`
119
+
120
+ Resumes a suspended Inngest run, for example after a tool approval. Loads the workflow snapshot from storage, finds the suspended step, and sends a resume event to Inngest.
121
+
122
+ ```typescript
123
+ const { output, cleanup } = await durableAgent.resume(
124
+ runId,
125
+ {
126
+ approved: true,
127
+ },
128
+ { threadId: 'thread-1', resourceId: 'user-1' },
129
+ )
130
+
131
+ await output.text
132
+ cleanup()
133
+ ```
134
+
135
+ The third argument accepts `threadId` and `resourceId` in addition to the lifecycle callbacks:
136
+
137
+ **threadId** (`string`): Thread ID to associate with the resumed run.
138
+
139
+ **resourceId** (`string`): Resource ID to associate with the resumed run.
140
+
141
+ **onChunk** (`(chunk: ChunkType) => void | Promise<void>`): Called for each streamed chunk.
142
+
143
+ **onStepFinish** (`(result: AgentStepFinishEventData) => void | Promise<void>`): Called when a step in the agentic loop finishes.
144
+
145
+ **onFinish** (`(result: AgentFinishEventData) => void | Promise<void>`): Called when the run finishes.
146
+
147
+ **onError** (`(error: Error) => void | Promise<void>`): Called when the run errors.
148
+
149
+ **onSuspended** (`(data: AgentSuspendedEventData) => void | Promise<void>`): Called when the run suspends.
150
+
151
+ Returns: [`Promise<InngestAgentStreamResult>`](#inngestagentstreamresult)
152
+
153
+ #### `observe(runId, options?)`
154
+
155
+ Reconnects to an existing run, replaying cached events before delivering live ones. Use this after a network disconnection. Pass `offset` to start replay from a known position.
156
+
157
+ ```typescript
158
+ const { output, cleanup } = await durableAgent.observe(runId, {
159
+ offset: 0,
160
+ onChunk: chunk => console.log(chunk),
161
+ })
162
+
163
+ await output.text
164
+ ```
165
+
166
+ The result from `observe()` does not include `threadId` or `resourceId`.
167
+
168
+ Returns: `Promise<Omit<InngestAgentStreamResult, 'threadId' | 'resourceId'>>`
169
+
170
+ > **Warning:** The `cleanup()` returned by `observe()` destroys the run's registry entries and cached events. Only call it when you are done with the run. If the run is suspended and you intend to resume later, don't call `cleanup()`.
171
+
172
+ #### `prepare(messages, options?)`
173
+
174
+ Prepares a run for durable execution without triggering it. Returns the serialized workflow input that can be used to manually trigger the Inngest workflow event.
175
+
176
+ ```typescript
177
+ const { runId, messageId, workflowInput, threadId, resourceId } = await durableAgent.prepare(
178
+ 'Summarize the document',
179
+ {
180
+ memory: { threadId: 'thread-1', resourceId: 'user-1' },
181
+ },
182
+ )
183
+ ```
184
+
185
+ Returns:
186
+
187
+ ```typescript
188
+ interface PrepareResult {
189
+ runId: string
190
+ messageId: string
191
+ workflowInput: any
192
+ threadId?: string
193
+ resourceId?: string
194
+ }
195
+ ```
196
+
197
+ ### Introspection
198
+
199
+ #### `isInngestAgent(obj)`
200
+
201
+ Type guard that checks whether an object is an `InngestAgent`.
202
+
203
+ ```typescript
204
+ import { isInngestAgent } from '@mastra/inngest'
205
+
206
+ if (isInngestAgent(agent)) {
207
+ // agent is InngestAgent
208
+ }
209
+ ```
210
+
211
+ Returns: `boolean`
212
+
213
+ ## Stream options
214
+
215
+ `stream()` accepts an `InngestAgentStreamOptions` object. It supports the same agent execution options as [`DurableAgent.stream()`](https://mastra.ai/reference/agents/durable-agent), plus lifecycle callbacks.
216
+
217
+ **runId** (`string`): Unique identifier for this run. Use it later with \`resume()\` or \`observe()\`.
218
+
219
+ **instructions** (`AgentExecutionOptions['instructions']`): Overrides the agent's default instructions for this run.
220
+
221
+ **context** (`ModelMessage[]`): Additional context messages to provide to the agent.
222
+
223
+ **memory** (`object`): Memory configuration for conversation persistence and retrieval.
224
+
225
+ **requestContext** (`RequestContext`): Request context carrying dynamic configuration and state for this run.
226
+
227
+ **maxSteps** (`number`): Maximum number of steps to run.
228
+
229
+ **toolsets** (`object`): Additional tool sets available for this run.
230
+
231
+ **clientTools** (`object`): Client-side tools available during execution.
232
+
233
+ **toolChoice** (`'auto' | 'none' | 'required' | { type: 'tool'; toolName: string }`): Tool selection strategy.
234
+
235
+ **modelSettings** (`object`): Model-specific settings such as temperature.
236
+
237
+ **requireToolApproval** (`boolean`): Require approval for all tool calls, which suspends the run until resumed.
238
+
239
+ **autoResumeSuspendedTools** (`boolean`): Automatically resume tools that suspended, instead of waiting for an external \`resume()\` call.
240
+
241
+ **toolCallConcurrency** (`number`): Maximum number of tool calls to execute concurrently.
242
+
243
+ **includeRawChunks** (`boolean`): Include raw provider chunks in the stream output.
244
+
245
+ **maxProcessorRetries** (`number`): Maximum number of processor retries per generation.
246
+
247
+ **untilIdle** (`boolean | { maxIdleMs?: number }`): When set, keeps the stream open across background-task continuations until the agent is idle. Pass \`true\` for the default 5-minute idle timeout, or \`{ maxIdleMs }\` to customise.
248
+
249
+ **onChunk** (`(chunk: ChunkType) => void | Promise<void>`): Called for each streamed chunk.
250
+
251
+ **onStepFinish** (`(result: AgentStepFinishEventData) => void | Promise<void>`): Called when a step in the agentic loop finishes.
252
+
253
+ **onFinish** (`(result: AgentFinishEventData) => void | Promise<void>`): Called when the run finishes.
254
+
255
+ **onError** (`(error: Error) => void | Promise<void>`): Called when the run errors.
256
+
257
+ **onSuspended** (`(data: AgentSuspendedEventData) => void | Promise<void>`): Called when the run suspends, for example for tool approval.
258
+
259
+ `observe()` accepts the lifecycle callbacks (`onChunk`, `onStepFinish`, `onFinish`, `onError`, `onSuspended`) plus an `offset` to control where replay starts.
260
+
261
+ ## `InngestAgentStreamResult`
262
+
263
+ The object returned by `stream()` and `resume()`. The `observe()` method returns the same shape but omits `threadId` and `resourceId`.
264
+
265
+ ```typescript
266
+ interface InngestAgentStreamResult<OUTPUT = undefined> {
267
+ output: MastraModelOutput<OUTPUT>
268
+ readonly fullStream: ReadableStream<any>
269
+ runId: string
270
+ threadId?: string
271
+ resourceId?: string
272
+ cleanup: () => void
273
+ }
274
+ ```
275
+
276
+ **output** (`MastraModelOutput`): The streaming output. Await \`output.text\` for the full text, or consume \`output.fullStream\`.
277
+
278
+ **fullStream** (`ReadableStream`): The full event stream, delegating to \`output.fullStream\`.
279
+
280
+ **runId** (`string`): The unique run ID. Pass it to \`resume()\` or \`observe()\` to reconnect.
281
+
282
+ **threadId** (`string`): Thread ID when using memory.
283
+
284
+ **resourceId** (`string`): Resource ID when using memory.
285
+
286
+ **cleanup** (`() => void`): Unsubscribes from PubSub and clears registry entries for the run. Call it when done with the run.
287
+
288
+ ## Serving Inngest functions
289
+
290
+ The `@mastra/inngest` package provides `serve()` and `createServe()` to register Inngest workflow functions with your HTTP framework.
291
+
292
+ ### `serve(options)`
293
+
294
+ Serves Mastra workflows with Hono (the default framework). Collects all Inngest-backed workflows from Mastra and registers them as Inngest functions.
295
+
296
+ ```typescript
297
+ import { serve } from '@mastra/inngest'
298
+
299
+ app.use('/inngest/api', async c => {
300
+ return serve({ mastra, inngest })(c)
301
+ })
302
+ ```
303
+
304
+ ### `createServe(adapter)`
305
+
306
+ Factory that accepts any Inngest serve adapter (`inngest/express`, `inngest/fastify`, `inngest/next`, etc.) and returns a serve function for that framework.
307
+
308
+ ```typescript
309
+ import { createServe } from '@mastra/inngest'
310
+ import { serve } from 'inngest/express'
311
+
312
+ const serveExpress = createServe(serve)
313
+ app.use('/inngest/api', serveExpress({ mastra, inngest }))
314
+ ```
315
+
316
+ ```typescript
317
+ import { createServe } from '@mastra/inngest'
318
+ import { serve } from 'inngest/next'
319
+
320
+ const serveNext = createServe(serve)
321
+ export const { GET, POST, PUT } = serveNext({ mastra, inngest })
322
+ ```
323
+
324
+ ### Serve options
325
+
326
+ **mastra** (`Mastra`): The Mastra instance containing registered agents and workflows.
327
+
328
+ **inngest** (`Inngest`): The Inngest client instance.
329
+
330
+ **functions** (`InngestFunction.Like[]`): Additional Inngest functions to serve alongside Mastra workflows.
331
+
332
+ **registerOptions** (`RegisterOptions`): Options passed to the Inngest registration handler.
333
+
334
+ ## Related
335
+
336
+ - [DurableAgent reference](https://mastra.ai/reference/agents/durable-agent)
337
+ - [Agent class](https://mastra.ai/reference/agents/agent)
338
+ - [Inngest deployment guide](https://mastra.ai/guides/deployment/inngest)
339
+ - [PubSub](https://mastra.ai/docs/server/pubsub)
@@ -10,7 +10,7 @@ Use [`workflowRoute()`](https://mastra.ai/reference/ai-sdk/workflow-route) if yo
10
10
 
11
11
  > **Agent streaming in workflows:** When a workflow step pipes an agent's stream to the workflow writer (e.g., `await response.fullStream.pipeTo(writer)`), the agent's text chunks and tool calls are forwarded to the UI stream in real time, even when the agent runs inside workflow steps.
12
12
  >
13
- > See [Workflow Streaming](https://mastra.ai/docs/streaming/workflow-streaming) for more details.
13
+ > See [Workflow Streaming](https://mastra.ai/docs/workflows/overview) for more details.
14
14
 
15
15
  ## Usage example
16
16
 
@@ -8,7 +8,7 @@ Use [`handleWorkflowStream()`](https://mastra.ai/reference/ai-sdk/handle-workflo
8
8
 
9
9
  > **Agent streaming in workflows:** When a workflow step pipes an agent's stream to the workflow writer (e.g., `await response.fullStream.pipeTo(writer)`), the agent's text chunks and tool calls are forwarded to the UI stream in real time, even when the agent runs inside workflow steps.
10
10
  >
11
- > See [Workflow Streaming](https://mastra.ai/docs/streaming/workflow-streaming) for more details.
11
+ > See [Workflow Streaming](https://mastra.ai/docs/workflows/overview) for more details.
12
12
 
13
13
  ## Usage example
14
14
 
@@ -6,6 +6,7 @@ The Reference section provides documentation of Mastra's API, including paramete
6
6
  - [createACPTool()](https://mastra.ai/reference/acp/create-acp-tool)
7
7
  - [Agent Class](https://mastra.ai/reference/agents/agent)
8
8
  - [Channels](https://mastra.ai/reference/agents/channels)
9
+ - [createInngestAgent()](https://mastra.ai/reference/agents/inngest-agent)
9
10
  - [DurableAgent](https://mastra.ai/reference/agents/durable-agent)
10
11
  - [.generate()](https://mastra.ai/reference/agents/generate)
11
12
  - [.generateLegacy()](https://mastra.ai/reference/agents/generateLegacy)
@@ -137,6 +137,6 @@ const result = await output.result
137
137
 
138
138
  - [Run.timeTravel()](https://mastra.ai/reference/workflows/run-methods/timeTravel)
139
139
  - [Time Travel](https://mastra.ai/docs/workflows/time-travel)
140
- - [Workflow Streaming](https://mastra.ai/docs/streaming/workflow-streaming)
140
+ - [Workflow Streaming](https://mastra.ai/docs/workflows/overview)
141
141
  - [Run.stream()](https://mastra.ai/reference/streaming/workflows/stream)
142
142
  - [Run.resumeStream()](https://mastra.ai/reference/streaming/workflows/resumeStream)
@@ -445,5 +445,5 @@ These annotations follow the [MCP specification](https://spec.modelcontextprotoc
445
445
  - [MCP Overview](https://mastra.ai/docs/mcp/overview)
446
446
  - [Using Tools with Agents](https://mastra.ai/docs/agents/using-tools)
447
447
  - [Agent Approval](https://mastra.ai/docs/agents/agent-approval)
448
- - [Tool Streaming](https://mastra.ai/docs/streaming/tool-streaming)
448
+ - [Tool Streaming](https://mastra.ai/docs/agents/using-tools)
449
449
  - [Request Context](https://mastra.ai/docs/server/request-context)
@@ -55,5 +55,5 @@ A workflow run's `status` indicates its current execution state. The possible va
55
55
  - [Run.cancel()](https://mastra.ai/reference/workflows/run-methods/cancel)
56
56
  - [Run.restart()](https://mastra.ai/reference/workflows/run-methods/restart)
57
57
  - [Run.timeTravel()](https://mastra.ai/reference/workflows/run-methods/timeTravel)
58
- - [Run.stream()](https://mastra.ai/docs/streaming/workflow-streaming)
58
+ - [Run.stream()](https://mastra.ai/docs/workflows/overview)
59
59
  - [Run.timeTravelStream()](https://mastra.ai/reference/streaming/workflows/timeTravelStream)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 1.2.1-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`65f255a`](https://github.com/mastra-ai/mastra/commit/65f255a38667beb6ceeadabfa9eb5059bfec8298), [`4a88c6e`](https://github.com/mastra-ai/mastra/commit/4a88c6e2bdce316f8d7551b4ec3449b0b06fc71c), [`87a17ef`](https://github.com/mastra-ai/mastra/commit/87a17efbd725aca6639febdc5e69e2abb3048689), [`e11ff30`](https://github.com/mastra-ai/mastra/commit/e11ff301408bf1731dca2fb7fbfcd8c819500a35), [`9d2c946`](https://github.com/mastra-ai/mastra/commit/9d2c946d0859e90ae4bcec5beeb1da7398d2ad1e), [`f1ec385`](https://github.com/mastra-ai/mastra/commit/f1ec385386f62b1a0847ec5353ae2bb169d1c3d9), [`e14986f`](https://github.com/mastra-ai/mastra/commit/e14986f6e5478d6384d04ff9a7f9a79a46a8b529), [`0be490f`](https://github.com/mastra-ai/mastra/commit/0be490fabb538c5a7de796ea0aff7d04a0bea1f3), [`0be490f`](https://github.com/mastra-ai/mastra/commit/0be490fabb538c5a7de796ea0aff7d04a0bea1f3), [`974f614`](https://github.com/mastra-ai/mastra/commit/974f614e083bd68278536f94453f7b320b86a3c7), [`31be1cf`](https://github.com/mastra-ai/mastra/commit/31be1cf5f2a7b5eef12f6123a40653b4d8115c16)]:
8
+ - @mastra/core@1.46.0-alpha.3
9
+
3
10
  ## 1.2.1-alpha.2
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "1.2.1-alpha.2",
3
+ "version": "1.2.1-alpha.4",
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
  "jsdom": "^26.1.0",
29
29
  "local-pkg": "^1.1.2",
30
30
  "zod": "^4.4.3",
31
- "@mastra/core": "1.46.0-alpha.2",
32
- "@mastra/mcp": "^1.12.0-alpha.0"
31
+ "@mastra/mcp": "^1.12.0-alpha.0",
32
+ "@mastra/core": "1.46.0-alpha.3"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@hono/node-server": "^1.19.11",
@@ -45,9 +45,9 @@
45
45
  "tsx": "^4.22.4",
46
46
  "typescript": "^6.0.3",
47
47
  "vitest": "4.1.8",
48
- "@internal/types-builder": "0.0.82",
49
48
  "@internal/lint": "0.0.107",
50
- "@mastra/core": "1.46.0-alpha.2"
49
+ "@internal/types-builder": "0.0.82",
50
+ "@mastra/core": "1.46.0-alpha.3"
51
51
  },
52
52
  "homepage": "https://mastra.ai",
53
53
  "repository": {
@@ -1,238 +0,0 @@
1
- # Mastra docs server
2
-
3
- The `@mastra/mcp-docs-server` package provides direct access to Mastra’s full documentation via the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/docs/getting-started/intro). It works with Cursor, Windsurf, Cline, Claude Code, VS Code, Codex or any tool that supports MCP.
4
-
5
- These tools are designed to help agents retrieve precise, task-specific information — whether you're adding a feature to an agent, scaffolding a new project, or exploring how something works.
6
-
7
- In this guide you'll learn how to add Mastra's MCP server to your AI tooling.
8
-
9
- [YouTube video player](https://www.youtube-nocookie.com/embed/vciV57lF0og)
10
-
11
- ## Installation
12
-
13
- ### create-mastra
14
-
15
- During the interactive [create-mastra](https://mastra.ai/reference/cli/create-mastra) wizard, choose one of your tools in the MCP step.
16
-
17
- ### Manual setup
18
-
19
- If there are no specific instructions for your tool below, you may be able to add the MCP server with this common JSON configuration anyways.
20
-
21
- ```json
22
- {
23
- "mcpServers": {
24
- "mastra": {
25
- "type": "stdio",
26
- "command": "npx",
27
- "args": ["-y", "@mastra/mcp-docs-server@latest"]
28
- }
29
- }
30
- }
31
- ```
32
-
33
- ### Claude Code CLI
34
-
35
- Install using the terminal command:
36
-
37
- ```bash
38
- claude mcp add --scope project mastra -- npx -y @mastra/mcp-docs-server@latest
39
- ```
40
-
41
- This creates a project-scoped `.mcp.json` file if one doesn't already exist. You can use the same command when using Claude Code as a [Visual Studio Code extension](https://code.claude.com/docs/en/vs-code#connect-to-external-tools-with-mcp).
42
-
43
- [More info on using MCP servers with Claude Code](https://docs.claude.com/en/docs/claude-code/mcp)
44
-
45
- ### OpenAI Codex CLI
46
-
47
- 1. Register it from the terminal:
48
-
49
- ```bash
50
- codex mcp add mastra-docs -- npx -y @mastra/mcp-docs-server@latest
51
- ```
52
-
53
- 2. Run `codex mcp list` to confirm the server shows as `enabled`.
54
-
55
- [More info on using MCP servers with OpenAI Codex](https://developers.openai.com/codex/mcp)
56
-
57
- ### Cursor
58
-
59
- Install by selecting the button below:
60
-
61
- [![Install MCP Server](https://cursor.com/deeplink/mcp-install-light.svg)](cursor://anysphere.cursor-deeplink/mcp/install?name=mastra\&config=eyJjb21tYW5kIjoibnB4IC15IEBtYXN0cmEvbWNwLWRvY3Mtc2VydmVyIn0%3D)
62
-
63
- If you followed the automatic installation, you'll see a popup when you open cursor in the bottom left corner to prompt you to enable the Mastra Docs MCP Server.
64
-
65
- ![Popup inside Cursor showing: \&quot;New MCP server detected: mastra\&quot;. The user can \&quot;Skip\&quot; or \&quot;Enable\&quot; it as an action.](/assets/images/enable-mastra-docs-cursor-cd5872abdc36c0e10951a59a47f25e12.png)
66
-
67
- [More info on using MCP servers with Cursor](https://cursor.com/de/docs/context/mcp)
68
-
69
- ### Antigravity
70
-
71
- Google Antigravity is an agent-first development platform that supports MCP servers for accessing external documentation, APIs, and project context.
72
-
73
- 1. Open your Antigravity MCP configuration file:
74
-
75
- - Click on **Agent session** and select the **“…” dropdown** at the top of the editor’s side panel, then select **MCP Servers** to access the **MCP Store**.
76
- - You can access it through the MCP Store interface in Antigravity
77
-
78
- ![The Antigravity MCP store. At the top is a search bar and below a list of available MCP servers. On the very top right is a dropdown menu.](/assets/images/antigravity_mcp_server-689ea495d9c7139cc431f1f1b9827f9b.png)
79
-
80
- 2. To add a custom MCP server, select **Manage MCP Servers** at the top of the MCP Store and select **View raw config** in the main tab.
81
-
82
- ![The Antigravity MCP store showing the Manage MCP Servers option and the View raw config button.](/assets/images/antigravity_managed_mcp-b661e8c04b3219000f8d842e5eb26a1a.png)
83
-
84
- 3. Add the Mastra MCP server configuration:
85
-
86
- ```json
87
- {
88
- "mcpServers": {
89
- "mastra-docs": {
90
- "command": "npx",
91
- "args": ["-y", "@mastra/mcp-docs-server"]
92
- }
93
- }
94
- }
95
- ```
96
-
97
- 4. Save the configuration and restart Antigravity
98
-
99
- ![The UI shows that the MCP server is enabled. You can also toggle individual tools.](/assets/images/antigravity_final_interface_mcp-7fa132dbe76cdee9f61136a26d6e6615.png)
100
-
101
- Once configured, the Mastra MCP server exposes the following to Antigravity agents:
102
-
103
- - Indexed documentation and API schemas for Mastra, enabling programmatic retrieval of relevant context during code generation
104
- - Access to example code snippets and usage patterns stored in Mastra Docs
105
- - Structured data for error handling and debugging references in the editor
106
- - Metadata about current Mastra project patterns for code suggestion and completion
107
-
108
- The MCP server will appear in Antigravity's MCP Store, where you can manage its connection status and authentication if needed.
109
-
110
- [More info on using MCP servers with Antigravity](https://antigravity.google)
111
-
112
- ### Visual Studio Code
113
-
114
- 1. Create a `.vscode/mcp.json` file in your workspace
115
-
116
- 2. Insert the following configuration:
117
-
118
- ```json
119
- {
120
- "servers": {
121
- "mastra": {
122
- "type": "stdio",
123
- "command": "npx",
124
- "args": ["-y", "@mastra/mcp-docs-server@latest"]
125
- }
126
- }
127
- }
128
- ```
129
-
130
- Once you installed the MCP server, you can use it like so:
131
-
132
- 1. Open VSCode settings.
133
-
134
- 2. Navigate to MCP settings.
135
-
136
- 3. Click "enable" on the Chat > MCP option.
137
-
138
- ![Entry in VSCode\&#39;s settings page. The option is called \&quot;Chat \&gt; MCP: Enabled (Preview)\&quot;. The description says: \&quot;Enables integration with Model Context Protocol servers to provide additional tools and functionality.\&quot;](/assets/images/vscode-mcp-setting-8d1eb4f3df1e33606503f8c5e937e9e3.png)
139
-
140
- MCP only works in Agent mode in VSCode. Once you are in agent mode, open the `mcp.json` file and select the "start" button. Note that the "start" button will only appear if the `.vscode` folder containing `mcp.json` is in your workspace root, or the highest level of the in-editor file explorer.
141
-
142
- ![A screenshot of the mcp.json file showing the start button in the editor](/assets/images/vscode-start-mcp-26480d86080c4907cb497a325de106a4.png)
143
-
144
- After starting the MCP server, select the tools button in the Copilot pane to see available tools.
145
-
146
- ![Tools page of VSCode to see available tools](/assets/images/vscode-mcp-running-d92d6ed234d1148093dc804b0ead3515.png)
147
-
148
- [More info on using MCP servers with Visual Studio Code](https://code.visualstudio.com/docs/copilot/customization/mcp-servers)
149
-
150
- ### Windsurf
151
-
152
- 1. Open `~/.codeium/windsurf/mcp_config.json` in your editor
153
-
154
- 2. Insert the following configuration:
155
-
156
- ```json
157
- {
158
- "mcpServers": {
159
- "mastra": {
160
- "command": "npx",
161
- "args": ["-y", "@mastra/mcp-docs-server@latest"]
162
- }
163
- }
164
- }
165
- ```
166
-
167
- 3. Save the configuration and restart Windsurf
168
-
169
- [More info on using MCP servers with Windsurf](https://docs.windsurf.com/windsurf/cascade/mcp#mcp-config-json)
170
-
171
- ### OpenCode
172
-
173
- You can define MCP servers in your [OpenCode configuration](https://opencode.ai/docs/config/) under `mcp`. Create an `opencode.jsonc` file in your project root with the following content:
174
-
175
- ```json
176
- {
177
- "$schema": "https://opencode.ai/config.json",
178
- "mcp": {
179
- "mastra": {
180
- "type": "local",
181
- "command": ["npx", "-y", "@mastra/mcp-docs-server@latest"],
182
- "enabled": true
183
- }
184
- }
185
- }
186
- ```
187
-
188
- [More info on using MCP servers with OpenCode](https://opencode.ai/docs/mcp-servers)
189
-
190
- ### Zed
191
-
192
- 1. Open `~/.config/zed/settings.json` in your editor
193
- 2. Insert the following configuration:
194
-
195
- ```json
196
- {
197
- "context_servers": {
198
- "Mastra": {
199
- "command": "npx",
200
- "args": ["-y", "@mastra/mcp-docs-server@latest"]
201
- }
202
- }
203
- }
204
- ```
205
-
206
- ## Usage
207
-
208
- Once configured, you can ask your AI tool questions about Mastra or instruct it to take actions. For these steps, it'll take the up-to-date information from Mastra's MCP server.
209
-
210
- **Add features:**
211
-
212
- - "Add evals to my agent and write tests"
213
- - "Write me a workflow that does the following `[task]`"
214
- - "Make a new tool that allows my agent to access `[3rd party API]`"
215
-
216
- **Ask about integrations:**
217
-
218
- - "Does Mastra work with the AI SDK? How can I use it in my `[React/Svelte/etc]` project?"
219
- - "Does Mastra support `[provider]` speech and voice APIs? Show me an example in my code of how I can use it."
220
-
221
- **Debug or update existing code:**
222
-
223
- - "I'm running into a bug with agent memory, have there been any related changes or bug fixes recently?"
224
- - "How does working memory behave in Mastra and how can I use it to do `[task]`? It doesn't seem to work the way I expect."
225
- - "I saw there are new workflow features, explain them to me and then update `[workflow]` to use them."
226
-
227
- ### Troubleshooting
228
-
229
- 1. **Server Not Starting**
230
-
231
- - Ensure [npx](https://docs.npmjs.com/cli/v11/commands/npx) is installed and working.
232
- - Check for conflicting MCP servers.
233
- - Verify your configuration file syntax.
234
-
235
- 2. **Tool Calls Failing**
236
-
237
- - Restart the MCP server and/or your IDE.
238
- - Update to the latest version of your IDE.