@mastra/mcp-docs-server 1.2.8-alpha.2 → 1.2.8-alpha.23
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/docs/agent-builder/integrations.md +1 -3
- package/.docs/docs/agents/overview.md +17 -13
- package/.docs/docs/agents/skills.md +1 -3
- package/.docs/docs/agents/structured-output.md +14 -7
- package/.docs/docs/agents/using-tools.md +66 -49
- package/.docs/docs/browser/agent-browser.md +1 -0
- package/.docs/docs/browser/firecrawl.md +129 -0
- package/.docs/docs/browser/overview.md +16 -2
- package/.docs/docs/capabilities/channels/slack.md +111 -1
- package/.docs/docs/deployment/mastra-server.md +35 -0
- package/.docs/docs/deployment/monorepo.md +2 -0
- package/.docs/docs/deployment/overview.md +6 -0
- package/.docs/docs/deployment/sandbox.md +277 -0
- package/.docs/docs/editor/overview.md +2 -6
- package/.docs/docs/editor/tools.md +2 -6
- package/.docs/docs/evals/multi-turn.md +178 -0
- package/.docs/docs/evals/overview.md +1 -0
- package/.docs/docs/evals/running-in-ci.md +3 -9
- package/.docs/docs/getting-started/build-with-ai.md +2 -6
- package/.docs/docs/getting-started/manual-install.md +1 -1
- package/.docs/docs/index.md +17 -13
- package/.docs/docs/long-running-agents/background-tasks.md +2 -2
- package/.docs/docs/long-running-agents/durable-agents.md +2 -1
- package/.docs/docs/long-running-agents/goals.md +3 -1
- package/.docs/docs/mastra-platform/database.md +12 -6
- package/.docs/docs/mastra-platform/deploy.md +14 -7
- package/.docs/docs/mastra-platform/environments.md +5 -4
- package/.docs/docs/mastra-platform/observability.md +4 -12
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/mastra-platform/regions.md +73 -0
- package/.docs/docs/mastra-platform/workspace.md +111 -0
- package/.docs/docs/mcp/overview.md +1 -1
- package/.docs/docs/memory/observational-memory.md +77 -2
- package/.docs/docs/memory/overview.md +4 -0
- package/.docs/docs/observability/feedback.md +4 -0
- package/.docs/docs/observability/integrations/bridges/otel.md +1 -3
- package/.docs/docs/observability/integrations/exporters/otel.md +1 -3
- package/.docs/docs/server/auth/fga.md +40 -0
- package/.docs/docs/server/auth/simple-auth.md +1 -3
- package/.docs/docs/server/request-context.md +2 -0
- package/.docs/docs/studio/overview.md +2 -0
- package/.docs/docs/workflows/control-flow.md +1 -3
- package/.docs/docs/workspace/filesystem.md +1 -0
- package/.docs/docs/workspace/sandbox.md +1 -0
- package/.docs/guides/getting-started/quickstart.md +40 -25
- package/.docs/guides/index.md +1 -1
- package/.docs/guides/migrations/vnext-to-standard-apis.md +1 -3
- package/.docs/models/environment-variables.md +3 -0
- package/.docs/models/gateways/netlify.md +3 -1
- package/.docs/models/gateways/openrouter.md +343 -345
- package/.docs/models/gateways/vercel.md +8 -5
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/aki-io.md +78 -0
- package/.docs/models/providers/alibaba-token-plan-cn.md +22 -21
- package/.docs/models/providers/alibaba-token-plan.md +22 -21
- package/.docs/models/providers/ambient.md +12 -10
- package/.docs/models/providers/baseten.md +3 -2
- package/.docs/models/providers/cline-pass.md +82 -0
- package/.docs/models/providers/crossmodel.md +2 -1
- package/.docs/models/providers/deepinfra.md +4 -7
- package/.docs/models/providers/deepseek.md +3 -1
- package/.docs/models/providers/empiriolabs.md +2 -1
- package/.docs/models/providers/evroc.md +3 -2
- package/.docs/models/providers/google.md +6 -4
- package/.docs/models/providers/inferx.md +3 -3
- package/.docs/models/providers/kilo.md +1 -1
- package/.docs/models/providers/kimi-for-coding.md +10 -11
- package/.docs/models/providers/llmgateway.md +5 -8
- package/.docs/models/providers/moonshotai-cn.md +3 -2
- package/.docs/models/providers/moonshotai.md +3 -2
- package/.docs/models/providers/nebius.md +3 -1
- package/.docs/models/providers/novita-ai.md +3 -1
- package/.docs/models/providers/ollama-cloud.md +25 -42
- package/.docs/models/providers/opencode-go.md +5 -3
- package/.docs/models/providers/opencode.md +4 -2
- package/.docs/models/providers/orcarouter.md +1 -1
- package/.docs/models/providers/privatemode-ai.md +10 -10
- package/.docs/models/providers/thinkingmachines.md +73 -0
- package/.docs/models/providers/togetherai.md +2 -6
- package/.docs/models/providers/wandb.md +2 -1
- package/.docs/models/providers/zenmux.md +3 -1
- package/.docs/models/providers.md +3 -0
- package/.docs/reference/acp/acp-agent.md +2 -0
- package/.docs/reference/acp/create-acp-tool.md +28 -0
- package/.docs/reference/agent-controller/session.md +15 -0
- package/.docs/reference/agents/agent.md +13 -1
- package/.docs/reference/agents/durable-agent.md +23 -0
- package/.docs/reference/agents/generate.md +19 -1
- package/.docs/reference/browser/firecrawl-browser.md +71 -0
- package/.docs/reference/cli/create-mastra.md +118 -43
- package/.docs/reference/cli/mastra.md +47 -5
- package/.docs/reference/code-sdk/mount-agent-controller.md +4 -4
- package/.docs/reference/core/getMCPServer.md +1 -3
- package/.docs/reference/core/getMCPServerById.md +1 -3
- package/.docs/reference/core/getWorkflow.md +1 -3
- package/.docs/reference/core/listMCPServers.md +2 -6
- package/.docs/reference/datasets/addItem.md +1 -3
- package/.docs/reference/datasets/addItems.md +1 -3
- package/.docs/reference/datasets/compareExperiments.md +1 -3
- package/.docs/reference/datasets/create.md +1 -3
- package/.docs/reference/datasets/dataset.md +2 -6
- package/.docs/reference/datasets/datasets-manager.md +5 -15
- package/.docs/reference/datasets/delete.md +1 -3
- package/.docs/reference/datasets/deleteExperiment.md +1 -3
- package/.docs/reference/datasets/deleteItem.md +1 -3
- package/.docs/reference/datasets/deleteItems.md +1 -3
- package/.docs/reference/datasets/get.md +1 -3
- package/.docs/reference/datasets/getDetails.md +1 -3
- package/.docs/reference/datasets/getExperiment.md +1 -3
- package/.docs/reference/datasets/getItem.md +1 -3
- package/.docs/reference/datasets/getItemHistory.md +1 -3
- package/.docs/reference/datasets/list.md +1 -3
- package/.docs/reference/datasets/listExperimentResults.md +1 -3
- package/.docs/reference/datasets/listExperiments.md +1 -3
- package/.docs/reference/datasets/listItems.md +1 -3
- package/.docs/reference/datasets/listVersions.md +1 -3
- package/.docs/reference/datasets/startExperiment.md +1 -3
- package/.docs/reference/datasets/startExperimentAsync.md +1 -3
- package/.docs/reference/datasets/update.md +1 -3
- package/.docs/reference/datasets/updateItem.md +1 -3
- package/.docs/reference/editor/mastra-editor.md +1 -3
- package/.docs/reference/evals/context-recall.md +205 -0
- package/.docs/reference/evals/create-scorer.md +4 -10
- package/.docs/reference/evals/mastra-scorer.md +1 -3
- package/.docs/reference/evals/run-evals.md +94 -2
- package/.docs/reference/file-based-agents/tools.md +7 -6
- package/.docs/reference/index.md +5 -0
- package/.docs/reference/memory/observational-memory.md +21 -0
- package/.docs/reference/observability/tracing/exporters/posthog.md +39 -1
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +1 -3
- package/.docs/reference/processors/token-limiter-processor.md +1 -3
- package/.docs/reference/rag/database-config.md +12 -0
- package/.docs/reference/streaming/agents/stream.md +3 -1
- package/.docs/reference/templates/overview.md +6 -32
- package/.docs/reference/tools/create-tool.md +78 -52
- package/.docs/reference/tools/mcp-client.md +104 -24
- package/.docs/reference/tools/mcp-server.md +143 -44
- package/.docs/reference/tools/tavily.md +1 -1
- package/.docs/reference/tools/vector-query-tool.md +22 -0
- package/.docs/reference/vectors/mongodb.md +2 -0
- package/.docs/reference/vectors/turbopuffer.md +4 -0
- package/.docs/reference/voice/mistral.md +127 -0
- package/.docs/reference/workspace/daytona-sandbox.md +2 -6
- package/.docs/reference/workspace/platform-filesystem.md +182 -0
- package/.docs/reference/workspace/platform-sandbox.md +200 -0
- package/.docs/reference/workspace/railway-sandbox.md +37 -1
- package/CHANGELOG.md +78 -0
- package/dist/{chunk-GLPCVXXO.js → chunk-HGADBLKG.js} +2 -2
- package/dist/{chunk-GLPCVXXO.js.map → chunk-HGADBLKG.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/stdio.js +1 -1
- package/dist/tools/docs.d.ts.map +1 -1
- 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.
|
|
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`):
|
|
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
|
-
|
|
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
|
-
|
|
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 --
|
|
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 --
|
|
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 --
|
|
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 --
|
|
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
|
-
|
|
105
|
+
**Yarn**:
|
|
60
106
|
|
|
61
|
-
|
|
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
|
-
|
|
114
|
+
bun x create-mastra@latest my-mastra-project --template https://github.com/mastra-ai/template-agent-harness
|
|
65
115
|
```
|
|
66
116
|
|
|
67
|
-
|
|
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 --
|
|
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 --
|
|
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 --
|
|
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 --
|
|
140
|
+
bun x create-mastra@latest my-mastra-project --template
|
|
91
141
|
```
|
|
92
142
|
|
|
93
|
-
|
|
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
|
-
|
|
145
|
+
### Empty scaffold
|
|
96
146
|
|
|
97
|
-
|
|
147
|
+
Use `--empty` to create a provider-free project without agents, examples, model SDKs, or environment files:
|
|
98
148
|
|
|
99
|
-
|
|
149
|
+
**npm**:
|
|
100
150
|
|
|
101
|
-
|
|
151
|
+
```bash
|
|
152
|
+
npx create-mastra@latest my-empty-project --empty
|
|
153
|
+
```
|
|
102
154
|
|
|
103
|
-
|
|
155
|
+
**pnpm**:
|
|
104
156
|
|
|
105
|
-
|
|
157
|
+
```bash
|
|
158
|
+
pnpm dlx create-mastra@latest my-empty-project --empty
|
|
159
|
+
```
|
|
106
160
|
|
|
107
|
-
|
|
161
|
+
**Yarn**:
|
|
108
162
|
|
|
109
|
-
|
|
163
|
+
```bash
|
|
164
|
+
yarn dlx create-mastra@latest my-empty-project --empty
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Bun**:
|
|
110
168
|
|
|
111
|
-
|
|
169
|
+
```bash
|
|
170
|
+
bun x create-mastra@latest my-empty-project --empty
|
|
171
|
+
```
|
|
112
172
|
|
|
113
|
-
|
|
173
|
+
## Automatic setup
|
|
114
174
|
|
|
115
|
-
|
|
175
|
+
After installing dependencies, the command:
|
|
116
176
|
|
|
117
|
-
|
|
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
|
-
|
|
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
|
-
|
|
182
|
+
## Conflicts and validation
|
|
122
183
|
|
|
123
|
-
|
|
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
|
-
|
|
188
|
+
Invalid input is rejected before templates are fetched or files are created.
|
|
126
189
|
|
|
127
|
-
|
|
190
|
+
## Arguments and flags
|
|
128
191
|
|
|
129
|
-
|
|
192
|
+
**\[project-name]** (`string`): Project directory and package name. When omitted, the command prompts for it.
|
|
130
193
|
|
|
131
|
-
|
|
194
|
+
**--empty** (`boolean`): Create a minimal, provider-free Mastra project.
|
|
132
195
|
|
|
133
|
-
|
|
196
|
+
**-l, --llm \<provider>** (`string`): Managed agent-harness provider: openai, anthropic, google, or xai.
|
|
134
197
|
|
|
135
|
-
|
|
198
|
+
**-k, --llm-api-key \<key>** (`string`): Write the selected provider API key to the generated .env file.
|
|
136
199
|
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
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
|
```
|
|
@@ -361,7 +361,7 @@ File to write. Defaults to `.env`.
|
|
|
361
361
|
|
|
362
362
|
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
363
|
|
|
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
|
|
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). 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
365
|
|
|
366
366
|
Creating and deleting databases requires the `admin` role in the organization.
|
|
367
367
|
|
|
@@ -382,11 +382,15 @@ Emit machine-readable JSON.
|
|
|
382
382
|
|
|
383
383
|
Provisions a managed database, attaches it, and polls until it's ready. Provisioning errors are printed with the provider's error detail.
|
|
384
384
|
|
|
385
|
-
|
|
385
|
+
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.
|
|
386
|
+
|
|
387
|
+
Environment-scoped databases inherit their provider region from the environment. Shared databases accept `--region`.
|
|
386
388
|
|
|
387
389
|
```bash
|
|
388
|
-
mastra env db create
|
|
389
|
-
mastra env db create --kind
|
|
390
|
+
mastra env db create --kind turso # picks or prompts for an environment
|
|
391
|
+
mastra env db create staging --kind turso # scoped to the "staging" environment
|
|
392
|
+
mastra env db create --kind turso --shared # shared by all environments
|
|
393
|
+
mastra env db create --kind neon --name my-app-db --region aws-us-east-1 --shared
|
|
390
394
|
```
|
|
391
395
|
|
|
392
396
|
#### `--kind`
|
|
@@ -401,13 +405,17 @@ Database name. Defaults to a name derived from the project slug (for example `my
|
|
|
401
405
|
|
|
402
406
|
Provider region ID for shared databases. Ignored for environment-scoped databases.
|
|
403
407
|
|
|
408
|
+
#### `--shared`
|
|
409
|
+
|
|
410
|
+
Attach as a project-scoped database that's shared by every environment. Cannot be combined with an environment argument.
|
|
411
|
+
|
|
404
412
|
#### `--no-wait`
|
|
405
413
|
|
|
406
414
|
Return immediately after the attach is queued instead of polling until the database is ready. Check progress later with `mastra env db show`.
|
|
407
415
|
|
|
408
416
|
#### `--json`
|
|
409
417
|
|
|
410
|
-
Emit machine-readable JSON.
|
|
418
|
+
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
419
|
|
|
412
420
|
### `mastra env db show`
|
|
413
421
|
|
|
@@ -796,6 +804,40 @@ Use the [`list`](#list) command to get the correct ID.
|
|
|
796
804
|
|
|
797
805
|
List all available scorer templates. Use the ID for the `add` command.
|
|
798
806
|
|
|
807
|
+
## `mastra create`
|
|
808
|
+
|
|
809
|
+
Create a standalone Mastra project with the same project-creation flow as [`create-mastra`](https://mastra.ai/reference/cli/create-mastra).
|
|
810
|
+
|
|
811
|
+
**npm**:
|
|
812
|
+
|
|
813
|
+
```bash
|
|
814
|
+
npx mastra@latest create
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
**pnpm**:
|
|
818
|
+
|
|
819
|
+
```bash
|
|
820
|
+
pnpm dlx mastra@latest create
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
**Yarn**:
|
|
824
|
+
|
|
825
|
+
```bash
|
|
826
|
+
yarn dlx mastra@latest create
|
|
827
|
+
```
|
|
828
|
+
|
|
829
|
+
**Bun**:
|
|
830
|
+
|
|
831
|
+
```bash
|
|
832
|
+
bun x mastra@latest create
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
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.
|
|
836
|
+
|
|
837
|
+
The command installs Mastra skills for detected coding assistants and initializes Git when appropriate. Use `--no-skills` or `--no-git` to opt out.
|
|
838
|
+
|
|
839
|
+
See the [`create-mastra` reference](https://mastra.ai/reference/cli/create-mastra) for mode behavior, conflicts, validation, and complete flag descriptions.
|
|
840
|
+
|
|
799
841
|
## `mastra init`
|
|
800
842
|
|
|
801
843
|
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
|
|
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.
|