@mastra/mcp-docs-server 1.2.8-alpha.2 → 1.2.8-alpha.25

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 (154) hide show
  1. package/.docs/docs/agent-builder/integrations.md +1 -3
  2. package/.docs/docs/agent-builder/overview.md +2 -0
  3. package/.docs/docs/agents/overview.md +17 -13
  4. package/.docs/docs/agents/skills.md +1 -3
  5. package/.docs/docs/agents/structured-output.md +14 -7
  6. package/.docs/docs/agents/using-tools.md +66 -49
  7. package/.docs/docs/browser/agent-browser.md +1 -0
  8. package/.docs/docs/browser/firecrawl.md +129 -0
  9. package/.docs/docs/browser/overview.md +16 -2
  10. package/.docs/docs/capabilities/channels/slack.md +111 -1
  11. package/.docs/docs/deployment/mastra-server.md +35 -0
  12. package/.docs/docs/deployment/monorepo.md +2 -0
  13. package/.docs/docs/deployment/overview.md +6 -0
  14. package/.docs/docs/deployment/sandbox.md +277 -0
  15. package/.docs/docs/editor/overview.md +2 -6
  16. package/.docs/docs/editor/tools.md +2 -6
  17. package/.docs/docs/evals/multi-turn.md +178 -0
  18. package/.docs/docs/evals/overview.md +1 -0
  19. package/.docs/docs/evals/running-in-ci.md +3 -9
  20. package/.docs/docs/getting-started/build-with-ai.md +2 -6
  21. package/.docs/docs/getting-started/manual-install.md +1 -1
  22. package/.docs/docs/index.md +17 -13
  23. package/.docs/docs/long-running-agents/background-tasks.md +2 -2
  24. package/.docs/docs/long-running-agents/durable-agents.md +2 -1
  25. package/.docs/docs/long-running-agents/goals.md +3 -1
  26. package/.docs/docs/mastra-platform/database.md +12 -6
  27. package/.docs/docs/mastra-platform/deploy.md +14 -7
  28. package/.docs/docs/mastra-platform/environments.md +5 -4
  29. package/.docs/docs/mastra-platform/observability.md +4 -12
  30. package/.docs/docs/mastra-platform/overview.md +1 -1
  31. package/.docs/docs/mastra-platform/regions.md +73 -0
  32. package/.docs/docs/mastra-platform/workspace.md +111 -0
  33. package/.docs/docs/mcp/overview.md +1 -1
  34. package/.docs/docs/memory/observational-memory.md +77 -2
  35. package/.docs/docs/memory/overview.md +4 -0
  36. package/.docs/docs/observability/feedback.md +4 -0
  37. package/.docs/docs/observability/integrations/bridges/otel.md +1 -3
  38. package/.docs/docs/observability/integrations/exporters/otel.md +1 -3
  39. package/.docs/docs/server/auth/fga.md +40 -0
  40. package/.docs/docs/server/auth/simple-auth.md +1 -3
  41. package/.docs/docs/server/request-context.md +2 -0
  42. package/.docs/docs/studio/overview.md +2 -0
  43. package/.docs/docs/workflows/control-flow.md +1 -3
  44. package/.docs/docs/workspace/filesystem.md +1 -0
  45. package/.docs/docs/workspace/sandbox.md +1 -0
  46. package/.docs/guides/getting-started/quickstart.md +40 -25
  47. package/.docs/guides/index.md +1 -1
  48. package/.docs/guides/migrations/vnext-to-standard-apis.md +1 -3
  49. package/.docs/models/environment-variables.md +3 -0
  50. package/.docs/models/gateways/netlify.md +3 -1
  51. package/.docs/models/gateways/openrouter.md +343 -345
  52. package/.docs/models/gateways/vercel.md +8 -5
  53. package/.docs/models/index.md +1 -1
  54. package/.docs/models/providers/aki-io.md +78 -0
  55. package/.docs/models/providers/alibaba-token-plan-cn.md +22 -21
  56. package/.docs/models/providers/alibaba-token-plan.md +22 -21
  57. package/.docs/models/providers/ambient.md +12 -10
  58. package/.docs/models/providers/baseten.md +3 -2
  59. package/.docs/models/providers/cline-pass.md +82 -0
  60. package/.docs/models/providers/crossmodel.md +2 -1
  61. package/.docs/models/providers/deepinfra.md +4 -7
  62. package/.docs/models/providers/deepseek.md +3 -1
  63. package/.docs/models/providers/empiriolabs.md +2 -1
  64. package/.docs/models/providers/evroc.md +3 -2
  65. package/.docs/models/providers/google.md +6 -4
  66. package/.docs/models/providers/inferx.md +3 -3
  67. package/.docs/models/providers/kilo.md +1 -1
  68. package/.docs/models/providers/kimi-for-coding.md +10 -11
  69. package/.docs/models/providers/llmgateway.md +5 -8
  70. package/.docs/models/providers/moonshotai-cn.md +3 -2
  71. package/.docs/models/providers/moonshotai.md +3 -2
  72. package/.docs/models/providers/nebius.md +3 -1
  73. package/.docs/models/providers/novita-ai.md +3 -1
  74. package/.docs/models/providers/ollama-cloud.md +25 -42
  75. package/.docs/models/providers/opencode-go.md +5 -3
  76. package/.docs/models/providers/opencode.md +4 -2
  77. package/.docs/models/providers/orcarouter.md +1 -1
  78. package/.docs/models/providers/privatemode-ai.md +10 -10
  79. package/.docs/models/providers/thinkingmachines.md +73 -0
  80. package/.docs/models/providers/togetherai.md +2 -6
  81. package/.docs/models/providers/wandb.md +2 -1
  82. package/.docs/models/providers/zenmux.md +3 -1
  83. package/.docs/models/providers.md +3 -0
  84. package/.docs/reference/acp/acp-agent.md +2 -0
  85. package/.docs/reference/acp/create-acp-tool.md +28 -0
  86. package/.docs/reference/agent-controller/session.md +15 -0
  87. package/.docs/reference/agents/agent.md +13 -1
  88. package/.docs/reference/agents/durable-agent.md +23 -0
  89. package/.docs/reference/agents/generate.md +19 -1
  90. package/.docs/reference/browser/firecrawl-browser.md +71 -0
  91. package/.docs/reference/cli/create-mastra.md +118 -43
  92. package/.docs/reference/cli/mastra.md +59 -5
  93. package/.docs/reference/code-sdk/mount-agent-controller.md +4 -4
  94. package/.docs/reference/core/getMCPServer.md +1 -3
  95. package/.docs/reference/core/getMCPServerById.md +1 -3
  96. package/.docs/reference/core/getWorkflow.md +1 -3
  97. package/.docs/reference/core/listMCPServers.md +2 -6
  98. package/.docs/reference/datasets/addItem.md +1 -3
  99. package/.docs/reference/datasets/addItems.md +1 -3
  100. package/.docs/reference/datasets/compareExperiments.md +1 -3
  101. package/.docs/reference/datasets/create.md +1 -3
  102. package/.docs/reference/datasets/dataset.md +2 -6
  103. package/.docs/reference/datasets/datasets-manager.md +5 -15
  104. package/.docs/reference/datasets/delete.md +1 -3
  105. package/.docs/reference/datasets/deleteExperiment.md +1 -3
  106. package/.docs/reference/datasets/deleteItem.md +1 -3
  107. package/.docs/reference/datasets/deleteItems.md +1 -3
  108. package/.docs/reference/datasets/get.md +1 -3
  109. package/.docs/reference/datasets/getDetails.md +1 -3
  110. package/.docs/reference/datasets/getExperiment.md +1 -3
  111. package/.docs/reference/datasets/getItem.md +1 -3
  112. package/.docs/reference/datasets/getItemHistory.md +1 -3
  113. package/.docs/reference/datasets/list.md +1 -3
  114. package/.docs/reference/datasets/listExperimentResults.md +1 -3
  115. package/.docs/reference/datasets/listExperiments.md +1 -3
  116. package/.docs/reference/datasets/listItems.md +1 -3
  117. package/.docs/reference/datasets/listVersions.md +1 -3
  118. package/.docs/reference/datasets/startExperiment.md +1 -3
  119. package/.docs/reference/datasets/startExperimentAsync.md +1 -3
  120. package/.docs/reference/datasets/update.md +1 -3
  121. package/.docs/reference/datasets/updateItem.md +1 -3
  122. package/.docs/reference/editor/mastra-editor.md +1 -3
  123. package/.docs/reference/evals/context-recall.md +205 -0
  124. package/.docs/reference/evals/create-scorer.md +4 -10
  125. package/.docs/reference/evals/mastra-scorer.md +1 -3
  126. package/.docs/reference/evals/run-evals.md +94 -2
  127. package/.docs/reference/file-based-agents/tools.md +7 -6
  128. package/.docs/reference/index.md +5 -0
  129. package/.docs/reference/memory/observational-memory.md +21 -0
  130. package/.docs/reference/observability/tracing/exporters/posthog.md +39 -1
  131. package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +1 -3
  132. package/.docs/reference/processors/token-limiter-processor.md +1 -3
  133. package/.docs/reference/rag/database-config.md +12 -0
  134. package/.docs/reference/streaming/agents/stream.md +3 -1
  135. package/.docs/reference/templates/overview.md +6 -32
  136. package/.docs/reference/tools/create-tool.md +78 -52
  137. package/.docs/reference/tools/mcp-client.md +104 -24
  138. package/.docs/reference/tools/mcp-server.md +143 -44
  139. package/.docs/reference/tools/tavily.md +1 -1
  140. package/.docs/reference/tools/vector-query-tool.md +22 -0
  141. package/.docs/reference/vectors/mongodb.md +2 -0
  142. package/.docs/reference/vectors/turbopuffer.md +4 -0
  143. package/.docs/reference/voice/mistral.md +127 -0
  144. package/.docs/reference/workspace/daytona-sandbox.md +2 -6
  145. package/.docs/reference/workspace/platform-filesystem.md +182 -0
  146. package/.docs/reference/workspace/platform-sandbox.md +200 -0
  147. package/.docs/reference/workspace/railway-sandbox.md +37 -1
  148. package/CHANGELOG.md +85 -0
  149. package/dist/{chunk-GLPCVXXO.js → chunk-HGADBLKG.js} +2 -2
  150. package/dist/{chunk-GLPCVXXO.js.map → chunk-HGADBLKG.js.map} +1 -1
  151. package/dist/index.js +1 -1
  152. package/dist/stdio.js +1 -1
  153. package/dist/tools/docs.d.ts.map +1 -1
  154. package/package.json +7 -7
@@ -76,6 +76,8 @@ export const claudeCodeAgent = new AcpAgent({
76
76
 
77
77
  **onPermissionRequest** (`(request: RequestPermissionRequest) => Promise<RequestPermissionResponse>`): Callback invoked when the ACP agent requests permission. Defaults to selecting the first permission option, or cancelling when no option is available.
78
78
 
79
+ **createClient** (`(defaultClient: Client) => Client`): Customize the ACP client used to answer agent requests. Receives the default client so it can be wrapped or extended, for example with extMethod and extNotification handlers. See Extension methods.
80
+
79
81
  **workspace** (`Workspace`): Workspace used for ACP file read and write requests. Defaults to a Workspace backed by LocalFilesystem at cwd or process.cwd().
80
82
 
81
83
  **model** (`ModelId`): Model ID to select after ACP session creation using the ACP session/set\_model method.
@@ -57,6 +57,8 @@ export const codeSupervisor = new Agent({
57
57
 
58
58
  **onPermissionRequest** (`(request: RequestPermissionRequest) => Promise<RequestPermissionResponse>`): Callback invoked when the ACP agent requests permission. Defaults to selecting the first permission option, or cancelling when no option is available.
59
59
 
60
+ **createClient** (`(defaultClient: Client) => Client`): Customize the ACP client used to answer agent requests. Receives the default client so it can be wrapped or extended, for example with extMethod and extNotification handlers.
61
+
60
62
  **workspace** (`Workspace`): Workspace option from the shared ACP connection options. During tool execution, createACPTool() passes the current Mastra workspace from the execution context when one is available; otherwise the ACP connection falls back to a local filesystem workspace. Use AcpAgent when you need to provide an explicit workspace instance.
61
63
 
62
64
  **model** (`ModelId`): Model ID to select after ACP session creation using the ACP session/set\_model method.
@@ -124,6 +126,32 @@ export const codeAgentTool = createACPTool({
124
126
 
125
127
  Use this callback to enforce local policy, inspect the permission title, or route the decision to your own approval flow.
126
128
 
129
+ ## Extension methods
130
+
131
+ Some ACP agents call custom extension methods on the client, outside the standard ACP request set. The default client rejects unknown methods with a "Method not found" error, which can abort the agent's turn.
132
+
133
+ Pass `createClient` to extend or replace the default client. The callback receives the default client and returns the client used for the connection:
134
+
135
+ ```typescript
136
+ import { createACPTool } from '@mastra/acp'
137
+
138
+ export const codeAgentTool = createACPTool({
139
+ id: 'code-agent',
140
+ description: 'Use an ACP-compatible coding agent',
141
+ command: 'acp-agent',
142
+ args: ['--stdio'],
143
+ createClient: defaultClient =>
144
+ Object.assign(defaultClient, {
145
+ async extMethod(method: string, params: Record<string, unknown>) {
146
+ return {}
147
+ },
148
+ async extNotification(method: string, params: Record<string, unknown>) {},
149
+ }),
150
+ })
151
+ ```
152
+
153
+ Return a fully custom `Client` implementation when you need to change the standard handlers as well. The `Client` type is re-exported from `@mastra/acp`.
154
+
127
155
  ## Related
128
156
 
129
157
  - [Agent Client Protocol docs](https://mastra.ai/docs/agents/acp)
@@ -57,6 +57,19 @@ The session is organized into sub-objects, each owning one domain of per-convers
57
57
 
58
58
  ## Methods
59
59
 
60
+ ### Workspace
61
+
62
+ #### `getWorkspace()`
63
+
64
+ Return the workspace resolved for this session. This preserves session-level overrides and workspaces selected from the session scope.
65
+
66
+ ```typescript
67
+ const workspace = agentController.session.getWorkspace()
68
+ const skill = await workspace.skills?.get('code-review')
69
+ ```
70
+
71
+ Returns: `Workspace`
72
+
60
73
  ### Permissions
61
74
 
62
75
  Session-scoped grants auto-approve tools without prompting. Grants are ephemeral — they reset when the session restarts and are never persisted.
@@ -211,6 +224,8 @@ Retrieve messages for a specific thread.
211
224
  const messages = await agentController.session.thread.listMessages({ threadId: 'thread-abc123' })
212
225
  ```
213
226
 
227
+ The message-reading methods `listActiveMessages`, `listMessages`, and `firstUserMessage` return `MastraDBMessage` objects, while `firstUserMessages` returns a `Map<string, MastraDBMessage>` keyed by thread ID. Each message has a `role`, an `id`, a `createdAt`, and a `content` object with `content.format` and a `content.parts` array. Read text, reasoning, tool calls, and attachments from `content.parts`. Signals such as system reminders and notifications are returned as separate messages with `role: 'signal'`.
228
+
214
229
  ### `session.thread.firstUserMessage({ threadId })`
215
230
 
216
231
  Retrieve the first user message for a thread, or `null` if none.
@@ -96,6 +96,18 @@ export const agent = new Agent({
96
96
  })
97
97
  ```
98
98
 
99
+ ## Model strings
100
+
101
+ For the simplest setup, pass `model` as a string in `provider/model` format. Separate the provider and model name with a slash. Mastra reads the matching provider credentials from the environment, so this format doesn't require a provider package or import.
102
+
103
+ Popular provider strings and credentials:
104
+
105
+ - **OpenAI**: `openai/gpt-5.5` uses `OPENAI_API_KEY`.
106
+ - **Anthropic**: `anthropic/claude-sonnet-4-6` uses `ANTHROPIC_API_KEY`.
107
+ - **Google**: `google/gemini-2.5-pro` uses `GOOGLE_API_KEY` or `GOOGLE_GENERATIVE_AI_API_KEY`.
108
+
109
+ See [models](https://mastra.ai/models) for supported model IDs and [environment variables](https://mastra.ai/models/environment-variables) for the complete provider list.
110
+
99
111
  ## Thread signals
100
112
 
101
113
  Use Agent signals to send real-time input and context into a memory thread. Message APIs are for user-authored input. `sendSignal()` is the lower-level API for system-generated context.
@@ -435,7 +447,7 @@ Returns an `AgentThreadSubscription` object with these members:
435
447
 
436
448
  **instructions** (`SystemMessage | ({ requestContext: RequestContext }) => SystemMessage | Promise<SystemMessage>`): Instructions that guide the agent's behavior. Can be a string, array of strings, system message object, array of system messages, or a function that returns any of these types dynamically. SystemMessage types: string | string\[] | CoreSystemMessage | CoreSystemMessage\[] | SystemModelMessage | SystemModelMessage\[]
437
449
 
438
- **model** (`MastraLanguageModel | ({ requestContext: RequestContext }) => MastraLanguageModel | Promise<MastraLanguageModel>`): The language model used by the agent. Can be provided statically or resolved at runtime.
450
+ **model** (`MastraLanguageModel | ({ requestContext: RequestContext }) => MastraLanguageModel | Promise<MastraLanguageModel>`): The language model used by the agent. Pass a model router string in provider/model format, a model configuration or provider instance, or a function that resolves the model at runtime. See Model strings for common providers and environment variables.
439
451
 
440
452
  **agents** (`Record<string, Agent> | ({ requestContext: RequestContext }) => Record<string, Agent> | Promise<Record<string, Agent>>`): Subagents that the agent can access. Can be provided statically or resolved dynamically.
441
453
 
@@ -37,6 +37,29 @@ const text = await output.text
37
37
  cleanup()
38
38
  ```
39
39
 
40
+ ### Using the `durable` config flag
41
+
42
+ Set `durable: true` on `AgentConfig` and the agent is automatically wrapped with `createDurableAgent` when it is attached to a `Mastra` instance. Use an object to forward advanced options such as `cache`, `pubsub`, `maxSteps`, or `cleanupTimeoutMs`.
43
+
44
+ ```typescript
45
+ import { Mastra } from '@mastra/core'
46
+ import { Agent } from '@mastra/core/agent'
47
+
48
+ const myAgent = new Agent({
49
+ id: 'my-agent',
50
+ name: 'My Agent',
51
+ instructions: 'You are a helpful assistant',
52
+ model: 'openai/gpt-5.5',
53
+ durable: true, // or: { maxSteps: 10, cleanupTimeoutMs: 60_000 }
54
+ })
55
+
56
+ export const mastra = new Mastra({
57
+ agents: { myAgent },
58
+ })
59
+ ```
60
+
61
+ `mastra.getAgent('myAgent')` returns the wrapped `DurableAgent`. Standalone agents (constructed but never registered on a `Mastra` instance) do not become durable; the wrapping is applied at registration.
62
+
40
63
  ## `createDurableAgent(options)`
41
64
 
42
65
  Wraps an `Agent` with durable execution and resumable streams. This is the recommended way to create a `DurableAgent`.
@@ -106,7 +106,7 @@ const result = await agent.generate('message for agent')
106
106
 
107
107
  **options.structuredOutput.instructions** (`string`): Additional instructions for the structured output model.
108
108
 
109
- **options.structuredOutput.jsonPromptInjection** (`boolean`): Injects system prompt into the main agent instructing it to return structured output, useful for when a model does not natively support structured outputs.
109
+ **options.structuredOutput.jsonPromptInjection** (`boolean | 'system' | 'inline' | 'auto'`): Controls how the JSON schema reaches the model. Set to 'auto' to use native structured output when supported and inline prompt injection otherwise.
110
110
 
111
111
  **options.structuredOutput.logger** (`IMastraLogger`): Optional logger instance for structured logging during output generation.
112
112
 
@@ -132,6 +132,8 @@ const result = await agent.generate('message for agent')
132
132
 
133
133
  **options.memory.options** (`MemoryConfig`): Additional memory configuration options including lastMessages, readOnly, semanticRecall, workingMemory, and filterIncompleteToolCalls.
134
134
 
135
+ **options.memory.onTitleGenerated** (`(title: string) => void | Promise<void>`): Callback fired asynchronously when a thread title is generated and persisted to storage. Title generation runs in the background and may complete after generate() returns. Only fires when generateTitle is enabled in memory options and the thread has no existing title.
136
+
135
137
  **options.onFinish** (`LoopConfig['onFinish']`): Callback fired when generation completes.
136
138
 
137
139
  **options.onStepFinish** (`LoopConfig['onStepFinish']`): Callback fired after each generation step.
@@ -456,4 +458,20 @@ const response = await agent.generate('Help me organize my day', {
456
458
  console.log({ text, toolCalls, toolResults, finishReason, usage })
457
459
  },
458
460
  })
461
+ ```
462
+
463
+ ### Using `onTitleGenerated`
464
+
465
+ When `generateTitle` is enabled in memory options, title generation runs asynchronously after the response completes. Use `onTitleGenerated` to react when the title is ready — for example, to push it to the client via SSE.
466
+
467
+ ```typescript
468
+ const response = await agent.generate('What is quantum computing?', {
469
+ memory: {
470
+ thread: threadId,
471
+ resource: userId,
472
+ onTitleGenerated: title => {
473
+ console.log('Thread title:', title)
474
+ },
475
+ },
476
+ })
459
477
  ```
@@ -0,0 +1,71 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # FirecrawlBrowser class
4
+
5
+ The `FirecrawlBrowser` class provides browser automation backed by the [Firecrawl Browser Sandbox](https://docs.firecrawl.dev/features/browser). It provisions remote browser sessions through the Firecrawl API and connects to them over the Chrome DevTools Protocol (CDP).
6
+
7
+ `FirecrawlBrowser` extends [`AgentBrowser`](https://mastra.ai/reference/browser/agent-browser) and exposes the same deterministic toolset. Use it when you want hosted browser sessions instead of a local Chromium install. For local automation, see [`AgentBrowser`](https://mastra.ai/reference/browser/agent-browser). For AI-powered interactions using natural language, see [`StagehandBrowser`](https://mastra.ai/reference/browser/stagehand-browser).
8
+
9
+ ## Usage example
10
+
11
+ ```typescript
12
+ import { Agent } from '@mastra/core/agent'
13
+ import { FirecrawlBrowser } from '@mastra/browser-firecrawl'
14
+
15
+ const browser = new FirecrawlBrowser({
16
+ apiKey: process.env.FIRECRAWL_API_KEY,
17
+ firecrawl: {
18
+ ttl: 600,
19
+ },
20
+ })
21
+
22
+ export const browserAgent = new Agent({
23
+ id: 'browser-agent',
24
+ name: 'Browser Agent',
25
+ instructions: `You can browse the web. Use browser_snapshot to see the page structure,
26
+ then interact with elements using their refs (e.g., @e5).`,
27
+ model: 'openai/gpt-5.5',
28
+ browser,
29
+ })
30
+ ```
31
+
32
+ ## Constructor parameters
33
+
34
+ `FirecrawlBrowser` accepts all [`AgentBrowser` constructor parameters](https://mastra.ai/reference/browser/agent-browser) plus the following:
35
+
36
+ **apiKey** (`string`): Firecrawl API key. Falls back to the FIRECRAWL\_API\_KEY environment variable. The constructor throws if neither is set.
37
+
38
+ **apiUrl** (`string`): Base URL for a self-hosted Firecrawl API.
39
+
40
+ **firecrawl** (`FirecrawlBrowserSessionOptions`): Session options passed to the Firecrawl browser() API when creating sandbox sessions.
41
+
42
+ **firecrawl.ttl** (`number`): Maximum session lifetime in seconds.
43
+
44
+ **firecrawl.activityTtl** (`number`): Idle timeout in seconds before the sandbox recycles the session.
45
+
46
+ **firecrawl.streamWebView** (`boolean`): When true, Firecrawl may stream WebView frames for the remote session.
47
+
48
+ **firecrawl.profile** (`{ name: string; saveChanges?: boolean }`): Named Firecrawl sandbox profile. Set saveChanges: true to persist cookies and login state when the session ends; naming a profile alone does not save changes. Distinct from the top-level AgentBrowser profile option, which is a local Playwright user-data directory path.
49
+
50
+ **firecrawl.integration** (`string`): Integration label for Firecrawl analytics and routing.
51
+
52
+ **firecrawl.origin** (`string`): Origin hint for the Firecrawl browser session.
53
+
54
+ ## Session lifecycle
55
+
56
+ Session provisioning depends on the `scope` option inherited from `AgentBrowser`:
57
+
58
+ - `'thread'` (default): Each conversation thread gets its own Firecrawl sandbox session, created on first use and deleted when the thread's browser session is destroyed.
59
+ - `'shared'`: One Firecrawl sandbox session is created when the browser launches and shared across all threads. The session is deleted when the browser closes.
60
+
61
+ In both cases, `FirecrawlBrowser` deletes the remote Firecrawl session when the browser closes, including when session creation or connection fails partway through.
62
+
63
+ ## Tools
64
+
65
+ `FirecrawlBrowser` provides the same toolset as `AgentBrowser`, including `browser_goto`, `browser_snapshot`, `browser_click`, `browser_type`, and `browser_screenshot`. See the [`AgentBrowser` tool reference](https://mastra.ai/reference/browser/agent-browser) for the full list and tool parameters.
66
+
67
+ ## Related
68
+
69
+ - [Firecrawl docs](https://mastra.ai/docs/browser/firecrawl)
70
+ - [`AgentBrowser` reference](https://mastra.ai/reference/browser/agent-browser)
71
+ - [Browser overview](https://mastra.ai/docs/browser/overview)
@@ -2,9 +2,7 @@
2
2
 
3
3
  # create-mastra
4
4
 
5
- The `create-mastra` command **creates** a new standalone Mastra project. Use this command to scaffold a complete Mastra setup in a dedicated directory. You can run it with additional flags to customize the setup process.
6
-
7
- ## Usage
5
+ Create a standalone Mastra project. By default, `create-mastra` installs a default starter and configures it for your selected model provider.
8
6
 
9
7
  **npm**:
10
8
 
@@ -30,116 +28,193 @@ yarn dlx create-mastra@latest
30
28
  bun x create-mastra@latest
31
29
  ```
32
30
 
33
- `create-mastra` automatically runs in _interactive_ mode, but you can also specify your project name and template with command line arguments.
31
+ ## Creation modes
32
+
33
+ ### Default starter
34
+
35
+ The default starter creates an agent harness with workspace tools, memory, task tracking, web access, recurring schedules, storage, and observability. Select OpenAI, Anthropic, Gemini, or xAI as your model provider.
36
+
37
+ Provide both the project name and provider to create the project without prompts. This example uses Anthropic; you can also pass `openai`, `google`, or `xai`:
34
38
 
35
39
  **npm**:
36
40
 
37
41
  ```bash
38
- npx create-mastra@latest my-mastra-project -- --template coding-agent
42
+ npx create-mastra@latest my-mastra-project --llm anthropic
39
43
  ```
40
44
 
41
45
  **pnpm**:
42
46
 
43
47
  ```bash
44
- pnpm dlx create-mastra@latest my-mastra-project -- --template coding-agent
48
+ pnpm dlx create-mastra@latest my-mastra-project --llm anthropic
45
49
  ```
46
50
 
47
51
  **Yarn**:
48
52
 
49
53
  ```bash
50
- yarn dlx create-mastra@latest my-mastra-project -- --template coding-agent
54
+ yarn dlx create-mastra@latest my-mastra-project --llm anthropic
51
55
  ```
52
56
 
53
57
  **Bun**:
54
58
 
55
59
  ```bash
56
- bun x create-mastra@latest my-mastra-project -- --template coding-agent
60
+ bun x create-mastra@latest my-mastra-project --llm anthropic
61
+ ```
62
+
63
+ Omit `--llm` to select the provider and optionally enter its API key interactively. The interactive setup also offers to connect your project to the Mastra platform. If enabled, the command opens the browser authentication flow, creates a platform project with the same name as the local project, and writes `MASTRA_PLATFORM_ACCESS_TOKEN` and `MASTRA_PROJECT_ID` to `.env`.
64
+
65
+ ### Template
66
+
67
+ Use a template slug or a public GitHub URL:
68
+
69
+ **npm**:
70
+
71
+ ```bash
72
+ npx create-mastra@latest my-mastra-project --template agent-harness
73
+ ```
74
+
75
+ **pnpm**:
76
+
77
+ ```bash
78
+ pnpm dlx create-mastra@latest my-mastra-project --template agent-harness
79
+ ```
80
+
81
+ **Yarn**:
82
+
83
+ ```bash
84
+ yarn dlx create-mastra@latest my-mastra-project --template agent-harness
85
+ ```
86
+
87
+ **Bun**:
88
+
89
+ ```bash
90
+ bun x create-mastra@latest my-mastra-project --template agent-harness
91
+ ```
92
+
93
+ **npm**:
94
+
95
+ ```bash
96
+ npx create-mastra@latest my-mastra-project --template https://github.com/mastra-ai/template-agent-harness
97
+ ```
98
+
99
+ **pnpm**:
100
+
101
+ ```bash
102
+ pnpm dlx create-mastra@latest my-mastra-project --template https://github.com/mastra-ai/template-agent-harness
57
103
  ```
58
104
 
59
- Check out the [full list](https://mastra.ai/api/templates.json) of templates and use the `slug` as input to the `--template` CLI flag.
105
+ **Yarn**:
60
106
 
61
- You can also use any GitHub repo as a template (it has to be a valid Mastra project):
107
+ ```bash
108
+ yarn dlx create-mastra@latest my-mastra-project --template https://github.com/mastra-ai/template-agent-harness
109
+ ```
110
+
111
+ **Bun**:
62
112
 
63
113
  ```bash
64
- npx create-mastra@latest my-mastra-project -- --template mastra-ai/template-coding-agent
114
+ bun x create-mastra@latest my-mastra-project --template https://github.com/mastra-ai/template-agent-harness
65
115
  ```
66
116
 
67
- You can install Mastra skills for specific agents during project creation:
117
+ Leave the template value blank to select a template interactively:
68
118
 
69
119
  **npm**:
70
120
 
71
121
  ```bash
72
- npx create-mastra@latest my-project -- --default --skills claude-code,cursor
122
+ npx create-mastra@latest my-mastra-project --template
73
123
  ```
74
124
 
75
125
  **pnpm**:
76
126
 
77
127
  ```bash
78
- pnpm dlx create-mastra@latest my-project -- --default --skills claude-code,cursor
128
+ pnpm dlx create-mastra@latest my-mastra-project --template
79
129
  ```
80
130
 
81
131
  **Yarn**:
82
132
 
83
133
  ```bash
84
- yarn dlx create-mastra@latest my-project -- --default --skills claude-code,cursor
134
+ yarn dlx create-mastra@latest my-mastra-project --template
85
135
  ```
86
136
 
87
137
  **Bun**:
88
138
 
89
139
  ```bash
90
- bun x create-mastra@latest my-project -- --default --skills claude-code,cursor
140
+ bun x create-mastra@latest my-mastra-project --template
91
141
  ```
92
142
 
93
- ## CLI flags
143
+ Template authors own their dependencies, models, environment variables, and source code. `create-mastra` doesn't apply `--llm` or `--llm-api-key`.
94
144
 
95
- Instead of an interactive prompt you can also define these CLI flags.
145
+ ### Empty scaffold
96
146
 
97
- **--version** (`boolean`): Output the version number
147
+ Use `--empty` to create a provider-free project without agents, examples, model SDKs, or environment files:
98
148
 
99
- **--project-name** (`string`): Project name that will be used in package.json and as the project directory name
149
+ **npm**:
100
150
 
101
- **--default** (`boolean`): Quickstart with defaults (src, OpenAI, no examples)
151
+ ```bash
152
+ npx create-mastra@latest my-empty-project --empty
153
+ ```
102
154
 
103
- **--components** (`string`): Comma-separated list of components (agents, tools, workflows, scorers)
155
+ **pnpm**:
104
156
 
105
- **--llm** (`string`): Default model provider (openai, anthropic, groq, google, or cerebras)
157
+ ```bash
158
+ pnpm dlx create-mastra@latest my-empty-project --empty
159
+ ```
106
160
 
107
- **--llm-api-key** (`string`): API key for the model provider
161
+ **Yarn**:
108
162
 
109
- **--example** (`boolean`): Include example code
163
+ ```bash
164
+ yarn dlx create-mastra@latest my-empty-project --empty
165
+ ```
166
+
167
+ **Bun**:
110
168
 
111
- **--no-example** (`boolean`): Do not include example code
169
+ ```bash
170
+ bun x create-mastra@latest my-empty-project --empty
171
+ ```
112
172
 
113
- **--template** (`string`): Create project from a template (use template name, public GitHub URL, or leave blank to select from list)
173
+ ## Automatic setup
114
174
 
115
- **--timeout** (`number`): Configurable timeout for package installation, defaults to 60000 ms
175
+ After installing dependencies, the command:
116
176
 
117
- **--dir** (`string`): Target directory for Mastra source code (default: src/)
177
+ 1. Detects supported coding assistants on `PATH` and installs Mastra skills. If none are detected, it installs universal skills.
178
+ 2. Creates an initial Git commit when the current directory and generated project aren't already inside Git repositories.
118
179
 
119
- **--mcp** (`string`): MCP Server for code editor (cursor, cursor-global, windsurf, vscode)
180
+ Use `--no-skills` or `--no-git` to skip these steps. Skills and Git setup failures produce warnings but don't remove a successfully created project.
120
181
 
121
- **--skills** (`string`): Comma-separated list of agents to install Mastra skills for (e.g., claude-code,cursor,windsurf)
182
+ ## Conflicts and validation
122
183
 
123
- **--observability** (`boolean`): Enable Observability on the Mastra platform during project creation. This opens browser login when needed, prompts for an organization, provisions a platform project, and configures the observability exporters.
184
+ - `--empty` and `--template` can't be used together.
185
+ - `--llm` and `--llm-api-key` are only valid for the default starter project.
186
+ - The project name must be a safe, lowercase, single directory name and the target must not already exist.
124
187
 
125
- **--no-observability** (`boolean`): Skip the Observability prompt during project creation.
188
+ Invalid input is rejected before templates are fetched or files are created.
126
189
 
127
- **--observability-project** (`string`): Set the platform project name to use when Mastra Observability is enabled.
190
+ ## Arguments and flags
128
191
 
129
- **--help** (`boolean`): Display help for command
192
+ **\[project-name]** (`string`): Project directory and package name. When omitted, the command prompts for it.
130
193
 
131
- ## Telemetry
194
+ **--empty** (`boolean`): Create a minimal, provider-free Mastra project.
132
195
 
133
- By default, Mastra collects anonymous information about your project like your OS, Mastra version or Node.js version. You can read the [source code](https://github.com/mastra-ai/mastra/blob/main/packages/cli/src/analytics/index.ts) to check what's collected.
196
+ **-l, --llm \<provider>** (`string`): Managed agent-harness provider: openai, anthropic, google, or xai.
134
197
 
135
- You can opt out of the CLI analytics by setting an environment variable:
198
+ **-k, --llm-api-key \<key>** (`string`): Write the selected provider API key to the generated .env file.
136
199
 
137
- ```bash
138
- MASTRA_TELEMETRY_DISABLED=1
139
- ```
200
+ **--no-skills** (`boolean`): Skip automatic Mastra skills installation.
201
+
202
+ **--no-git** (`boolean`): Skip automatic Git initialization and the initial commit.
203
+
204
+ **-t, --template \[template]** (`string`): Use a template slug or public GitHub URL. Omit the value to select interactively.
205
+
206
+ **--timeout \<milliseconds>** (`number`): Positive integer timeout for dependency installation. Defaults to 60000.
207
+
208
+ **--version** (`boolean`): Print the create-mastra version.
209
+
210
+ **--help** (`boolean`): Display command help.
211
+
212
+ ## Telemetry
213
+
214
+ Mastra collects anonymous CLI usage information, such as the operating system, Mastra version, and Node.js version. You can review the [analytics source](https://github.com/mastra-ai/mastra/blob/main/packages/cli/src/analytics/index.ts).
140
215
 
141
- You can also set this while using other `mastra` commands:
216
+ Set `MASTRA_TELEMETRY_DISABLED=1` to opt out:
142
217
 
143
218
  ```bash
144
- MASTRA_TELEMETRY_DISABLED=1 npx create-mastra@latest
219
+ MASTRA_TELEMETRY_DISABLED=1 npx create-mastra@latest my-project --empty
145
220
  ```
@@ -101,6 +101,18 @@ mastra dev
101
101
 
102
102
  These are forwarded to the Mastra model router and will work with any `"openai/..."` or `"anthropic/..."` model selections.
103
103
 
104
+ ## `mastra factory dev`
105
+
106
+ Starts a development server for [Agent Builder](https://mastra.ai/docs/agent-builder/overview) development. It uses the same dev runtime and flags as [`mastra dev`](#mastra-dev) and writes to the same `.mastra/output` directory.
107
+
108
+ ```bash
109
+ npx mastra factory dev
110
+ ```
111
+
112
+ Both commands share the same dev lock, so `mastra dev` and `mastra factory dev` can't run simultaneously in the same project. If one is already running, the other exits with a duplicate development server error.
113
+
114
+ Use `mastra factory dev` when developing Agent Builder features. It accepts the same flags as [`mastra dev`](#mastra-dev), including `--https`, `--inspect`, `--inspect-brk`, `--custom-args`, and `--request-context-presets`.
115
+
104
116
  ## `mastra build`
105
117
 
106
118
  The `mastra build` command bundles your Mastra project into a production-ready Hono server. [Hono](https://hono.dev/) is a lightweight, type-safe web framework that makes it straightforward to deploy Mastra agents as HTTP endpoints with middleware support.
@@ -361,7 +373,7 @@ File to write. Defaults to `.env`.
361
373
 
362
374
  Manages databases attached to a project on Mastra platform. Databases are provisioned from a managed provider (for example Turso or Neon) and inject their connection env vars into deploys automatically.
363
375
 
364
- A database is either **environment-scoped** (its env vars only go to one environment) or **shared** (project-scoped: its env vars go to all environments). Pass the environment argument to work with environment-scoped databases; omit it for shared databases.
376
+ A database is either **environment-scoped** (its env vars only go to one environment) or **shared** (project-scoped: its env vars go to all environments). Environment-scoped is the default for `mastra env db create` — pass an environment argument, or let the CLI pick or prompt for one. Pass `--shared` on create to attach a shared database instead. For other subcommands (`list`, `delete`, `keys`), pass the environment argument to work with environment-scoped databases and omit it for shared databases.
365
377
 
366
378
  Creating and deleting databases requires the `admin` role in the organization.
367
379
 
@@ -382,11 +394,15 @@ Emit machine-readable JSON.
382
394
 
383
395
  Provisions a managed database, attaches it, and polls until it's ready. Provisioning errors are printed with the provider's error detail.
384
396
 
385
- With an environment argument, the database is scoped to that environment: only it receives the database's connection env vars, and the provider region is derived from the environment's region. Without one, the database is shared by all environments.
397
+ By default the database is scoped to a single environment: pass an environment argument to pick it, or omit the argument to have the CLI pick for you. When the project has one environment, that environment is used. When it has several, the CLI prompts you to select one interactively; in non-interactive contexts (CI, `--json`) an environment argument is required. Pass `--shared` to attach a project-scoped database that's shared by every environment instead.
398
+
399
+ Environment-scoped databases inherit their provider region from the environment. Shared databases accept `--region`.
386
400
 
387
401
  ```bash
388
- mastra env db create <env> --kind turso
389
- mastra env db create --kind neon --name my-app-db --region aws-us-east-1
402
+ mastra env db create --kind turso # picks or prompts for an environment
403
+ mastra env db create staging --kind turso # scoped to the "staging" environment
404
+ mastra env db create --kind turso --shared # shared by all environments
405
+ mastra env db create --kind neon --name my-app-db --region aws-us-east-1 --shared
390
406
  ```
391
407
 
392
408
  #### `--kind`
@@ -401,13 +417,17 @@ Database name. Defaults to a name derived from the project slug (for example `my
401
417
 
402
418
  Provider region ID for shared databases. Ignored for environment-scoped databases.
403
419
 
420
+ #### `--shared`
421
+
422
+ Attach as a project-scoped database that's shared by every environment. Cannot be combined with an environment argument.
423
+
404
424
  #### `--no-wait`
405
425
 
406
426
  Return immediately after the attach is queued instead of polling until the database is ready. Check progress later with `mastra env db show`.
407
427
 
408
428
  #### `--json`
409
429
 
410
- Emit machine-readable JSON.
430
+ Emit machine-readable JSON. In this mode, an environment argument or `--shared` is required when the project has more than one environment (no interactive prompt).
411
431
 
412
432
  ### `mastra env db show`
413
433
 
@@ -796,6 +816,40 @@ Use the [`list`](#list) command to get the correct ID.
796
816
 
797
817
  List all available scorer templates. Use the ID for the `add` command.
798
818
 
819
+ ## `mastra create`
820
+
821
+ Create a standalone Mastra project with the same project-creation flow as [`create-mastra`](https://mastra.ai/reference/cli/create-mastra).
822
+
823
+ **npm**:
824
+
825
+ ```bash
826
+ npx mastra@latest create
827
+ ```
828
+
829
+ **pnpm**:
830
+
831
+ ```bash
832
+ pnpm dlx mastra@latest create
833
+ ```
834
+
835
+ **Yarn**:
836
+
837
+ ```bash
838
+ yarn dlx mastra@latest create
839
+ ```
840
+
841
+ **Bun**:
842
+
843
+ ```bash
844
+ bun x mastra@latest create
845
+ ```
846
+
847
+ Providing both the project name and `--llm` skips the interactive setup prompts. Use `--template [template]` for an arbitrary template or `--empty` for a minimal provider-free scaffold.
848
+
849
+ The command installs Mastra skills for detected coding assistants and initializes Git when appropriate. Use `--no-skills` or `--no-git` to opt out.
850
+
851
+ See the [`create-mastra` reference](https://mastra.ai/reference/cli/create-mastra) for mode behavior, conflicts, validation, and complete flag descriptions.
852
+
799
853
  ## `mastra init`
800
854
 
801
855
  The `mastra init` command initializes Mastra in an existing project. Use this command to scaffold the necessary folders and configuration without generating a new project from scratch.
@@ -4,7 +4,7 @@
4
4
 
5
5
  > **Beta:** The `@mastra/code-sdk` package is experimental and subject to breaking changes in minor versions.
6
6
 
7
- The `mountAgentControllerOnMastra()` function builds the Mastra Code agent controller the coding agent behind the [`mastracode`](https://www.npmjs.com/package/mastracode) CLI, with its modes, tools, memory, and thread management and registers it on a server-owned [Mastra](https://mastra.ai/reference/core/mastra-class) instance. Use it to serve the Mastra Code agent to your own UI (web app, editor, bot): each client creates or resumes its own isolated session through the returned [`AgentController`](https://mastra.ai/reference/agent-controller/agent-controller-class).
7
+ The `mountAgentControllerOnMastra()` function builds the Mastra Code agent controller (the coding agent behind the [`mastracode`](https://www.npmjs.com/package/mastracode) CLI, with its modes, tools, memory, and thread management) and registers it on a server-owned [Mastra](https://mastra.ai/reference/core/mastra-class) instance. Use it to serve the Mastra Code agent to your own UI (web app, editor, bot): each client creates or resumes its own isolated session through the returned [`AgentController`](https://mastra.ai/reference/agent-controller/agent-controller-class).
8
8
 
9
9
  To construct the `Mastra` instance yourself (for example in a deployable entry file), use `prepareAgentControllerMount()` from the same package, which returns the constructor args plus a `finalize()` callback.
10
10
 
@@ -27,9 +27,7 @@ Pass an existing `mastra` to mount the controller onto a Mastra instance that al
27
27
  import { Mastra } from '@mastra/core/mastra'
28
28
  import { mountAgentControllerOnMastra } from '@mastra/code-sdk'
29
29
 
30
- const mastra = new Mastra({
31
- /* ... */
32
- })
30
+ const mastra = new Mastra({/* ... */})
33
31
 
34
32
  const { controller } = await mountAgentControllerOnMastra({ mastra })
35
33
  ```
@@ -50,6 +48,8 @@ const { controller } = await mountAgentControllerOnMastra({ mastra })
50
48
 
51
49
  **postToolObserver** (`(context: ToolAfterHookContext) => void | Promise<void>`): Observes completed tool calls without replacing the tool or changing hook-manager behavior. Observer errors are logged and do not fail successful tool calls.
52
50
 
51
+ **inputProcessors** (`InputProcessor[]`): Stateless input processors prepended before Mastra Code's mandatory safety and compatibility processors. Custom processors extend the pipeline but can't replace the built-in processors.
52
+
53
53
  **disabledTools** (`string[]`): Tools removed from the dynamic tool set before exposure to the model.
54
54
 
55
55
  **storage** (`StorageConfig`): Custom storage config instead of the auto-detected default.
@@ -12,9 +12,7 @@ const myServer = new MCPServer({
12
12
  id: 'my-mcp-server',
13
13
  name: 'My Server',
14
14
  version: '1.0.0',
15
- tools: {
16
- /* ... */
17
- },
15
+ tools: {/* ... */},
18
16
  })
19
17
 
20
18
  export const mastra = new Mastra({