@mastra/mcp-docs-server 1.1.17 → 1.1.18-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 (94) hide show
  1. package/.docs/docs/agents/overview.md +4 -4
  2. package/.docs/docs/agents/processors.md +1 -1
  3. package/.docs/docs/community/licensing.md +7 -9
  4. package/.docs/docs/deployment/monorepo.md +0 -6
  5. package/.docs/docs/evals/built-in-scorers.md +1 -1
  6. package/.docs/docs/{observability → evals}/datasets/overview.md +12 -12
  7. package/.docs/docs/{observability → evals}/datasets/running-experiments.md +9 -9
  8. package/.docs/docs/evals/overview.md +8 -9
  9. package/.docs/docs/getting-started/manual-install.md +1 -2
  10. package/.docs/docs/index.md +1 -1
  11. package/.docs/docs/mastra-cloud/deployment.md +2 -2
  12. package/.docs/docs/mastra-cloud/observability.md +2 -2
  13. package/.docs/docs/mastra-cloud/overview.md +1 -1
  14. package/.docs/docs/mastra-cloud/setup.md +3 -3
  15. package/.docs/docs/mcp/publishing-mcp-server.md +20 -0
  16. package/.docs/docs/memory/message-history.md +6 -4
  17. package/.docs/docs/memory/observational-memory.md +20 -11
  18. package/.docs/docs/memory/overview.md +4 -4
  19. package/.docs/docs/memory/semantic-recall.md +28 -19
  20. package/.docs/docs/memory/storage.md +4 -4
  21. package/.docs/docs/observability/metrics/overview.md +114 -0
  22. package/.docs/docs/observability/overview.md +13 -5
  23. package/.docs/docs/observability/tracing/exporters/default.md +2 -4
  24. package/.docs/docs/observability/tracing/exporters/laminar.md +4 -4
  25. package/.docs/docs/observability/tracing/exporters/sentry.md +4 -4
  26. package/.docs/docs/observability/tracing/overview.md +2 -2
  27. package/.docs/docs/rag/chunking-and-embedding.md +2 -2
  28. package/.docs/docs/server/auth/composite-auth.md +1 -7
  29. package/.docs/docs/server/auth/custom-auth-provider.md +2 -4
  30. package/.docs/docs/server/auth/jwt.md +1 -1
  31. package/.docs/docs/server/auth/simple-auth.md +1 -7
  32. package/.docs/docs/server/auth.md +3 -3
  33. package/.docs/docs/server/custom-adapters.md +3 -1
  34. package/.docs/docs/server/custom-api-routes.md +1 -1
  35. package/.docs/docs/server/mastra-client.md +1 -3
  36. package/.docs/docs/server/mastra-server.md +8 -0
  37. package/.docs/docs/server/request-context.md +17 -17
  38. package/.docs/docs/server/server-adapters.md +8 -8
  39. package/.docs/docs/streaming/events.md +1 -90
  40. package/.docs/docs/streaming/overview.md +0 -42
  41. package/.docs/docs/studio/auth.md +142 -0
  42. package/.docs/docs/{deployment/studio.md → studio/deployment.md} +42 -16
  43. package/.docs/docs/studio/observability.md +98 -0
  44. package/.docs/docs/studio/overview.md +127 -0
  45. package/.docs/docs/workflows/agents-and-tools.md +7 -10
  46. package/.docs/docs/workflows/control-flow.md +1 -1
  47. package/.docs/docs/workflows/overview.md +12 -7
  48. package/.docs/docs/workflows/suspend-and-resume.md +1 -1
  49. package/.docs/guides/concepts/multi-agent-systems.md +4 -4
  50. package/.docs/guides/deployment/vercel.md +1 -1
  51. package/.docs/guides/getting-started/next-js.md +1 -1
  52. package/.docs/guides/getting-started/quickstart.md +1 -1
  53. package/.docs/guides/guide/ai-recruiter.md +1 -1
  54. package/.docs/guides/guide/chef-michel.md +1 -1
  55. package/.docs/guides/guide/code-review-bot.md +1 -1
  56. package/.docs/guides/guide/dev-assistant.md +1 -1
  57. package/.docs/guides/guide/docs-manager.md +1 -1
  58. package/.docs/guides/guide/github-actions-pr-description.md +1 -1
  59. package/.docs/guides/guide/notes-mcp-server.md +1 -1
  60. package/.docs/guides/guide/stock-agent.md +1 -1
  61. package/.docs/guides/guide/web-search.md +2 -2
  62. package/.docs/guides/index.md +1 -1
  63. package/.docs/guides/migrations/upgrade-to-v1/client.md +1 -1
  64. package/.docs/guides/migrations/upgrade-to-v1/tracing.md +1 -1
  65. package/.docs/models/gateways/netlify.md +65 -66
  66. package/.docs/models/gateways/openrouter.md +2 -1
  67. package/.docs/models/gateways/vercel.md +3 -1
  68. package/.docs/models/index.md +2 -2
  69. package/.docs/models/providers/aihubmix.md +17 -102
  70. package/.docs/models/providers/opencode.md +3 -2
  71. package/.docs/models/providers/synthetic.md +2 -1
  72. package/.docs/models/providers/vultr.md +11 -16
  73. package/.docs/models/providers/zenmux.md +2 -31
  74. package/.docs/models/providers.md +0 -1
  75. package/.docs/reference/agents/agent.md +1 -1
  76. package/.docs/reference/cli/mastra.md +3 -3
  77. package/.docs/reference/client-js/workflows.md +2 -2
  78. package/.docs/reference/configuration.md +4 -4
  79. package/.docs/reference/deployer/cloudflare.md +1 -1
  80. package/.docs/reference/deployer/vercel.md +1 -1
  81. package/.docs/reference/index.md +16 -14
  82. package/.docs/reference/memory/observational-memory.md +1 -1
  83. package/.docs/reference/observability/metrics/automatic-metrics.md +132 -0
  84. package/.docs/reference/storage/cloudflare-d1.md +1 -1
  85. package/.docs/reference/storage/cloudflare.md +3 -3
  86. package/.docs/reference/storage/convex.md +1 -1
  87. package/.docs/reference/storage/dynamodb.md +1 -1
  88. package/.docs/reference/storage/lance.md +1 -1
  89. package/.docs/reference/storage/upstash.md +1 -1
  90. package/.docs/reference/workspace/vercel.md +118 -0
  91. package/CHANGELOG.md +22 -0
  92. package/package.json +5 -5
  93. package/.docs/docs/getting-started/studio.md +0 -113
  94. package/.docs/docs/mastra-cloud/studio.md +0 -24
@@ -1,6 +1,6 @@
1
1
  # ![ZenMux logo](https://models.dev/logos/zenmux.svg)ZenMux
2
2
 
3
- Access 86 ZenMux models through Mastra's model router. Authentication is handled automatically using the `ZENMUX_API_KEY` environment variable.
3
+ Access 85 ZenMux models through Mastra's model router. Authentication is handled automatically using the `ZENMUX_API_KEY` environment variable.
4
4
 
5
5
  Learn more in the [ZenMux documentation](https://docs.zenmux.ai).
6
6
 
@@ -52,7 +52,6 @@ for await (const chunk of stream) {
52
52
  | `zenmux/google/gemini-2.5-flash-lite` | 1.0M | | | | | | $0.10 | $0.40 |
53
53
  | `zenmux/google/gemini-2.5-pro` | 1.0M | | | | | | $1 | $10 |
54
54
  | `zenmux/google/gemini-3-flash-preview` | 1.0M | | | | | | $0.50 | $3 |
55
- | `zenmux/google/gemini-3-pro-image-preview` | 1.0M | | | | | | $2 | $12 |
56
55
  | `zenmux/google/gemini-3-pro-preview` | 1.0M | | | | | | $2 | $12 |
57
56
  | `zenmux/google/gemini-3.1-flash-lite-preview` | 1.1M | | | | | | $0.25 | $2 |
58
57
  | `zenmux/google/gemini-3.1-pro-preview` | 1.0M | | | | | | $2 | $12 |
@@ -130,7 +129,7 @@ const agent = new Agent({
130
129
  id: "custom-agent",
131
130
  name: "custom-agent",
132
131
  model: {
133
- url: "https://zenmux.ai/api/anthropic/v1",
132
+ url: "https://zenmux.ai/api/v1",
134
133
  id: "zenmux/anthropic/claude-3.5-haiku",
135
134
  apiKey: process.env.ZENMUX_API_KEY,
136
135
  headers: {
@@ -153,32 +152,4 @@ const agent = new Agent({
153
152
  : "zenmux/anthropic/claude-3.5-haiku";
154
153
  }
155
154
  });
156
- ```
157
-
158
- ## Direct provider installation
159
-
160
- This provider can also be installed directly as a standalone package, which can be used instead of the Mastra model router string. View the [package documentation](https://www.npmjs.com/package/@ai-sdk/anthropic) for more details.
161
-
162
- **npm**:
163
-
164
- ```bash
165
- npm install @ai-sdk/anthropic
166
- ```
167
-
168
- **pnpm**:
169
-
170
- ```bash
171
- pnpm add @ai-sdk/anthropic
172
- ```
173
-
174
- **Yarn**:
175
-
176
- ```bash
177
- yarn add @ai-sdk/anthropic
178
- ```
179
-
180
- **Bun**:
181
-
182
- ```bash
183
- bun add @ai-sdk/anthropic
184
155
  ```
@@ -11,7 +11,6 @@ Direct access to individual AI model providers. Each provider offers unique mode
11
11
  - [xAI](https://mastra.ai/models/providers/xai)
12
12
  - [302.AI](https://mastra.ai/models/providers/302ai)
13
13
  - [Abacus](https://mastra.ai/models/providers/abacus)
14
- - [AIHubMix](https://mastra.ai/models/providers/aihubmix)
15
14
  - [Alibaba](https://mastra.ai/models/providers/alibaba)
16
15
  - [Alibaba (China)](https://mastra.ai/models/providers/alibaba-cn)
17
16
  - [Alibaba Coding Plan](https://mastra.ai/models/providers/alibaba-coding-plan)
@@ -6,7 +6,7 @@ The `Agent` class is the foundation for creating AI agents in Mastra. It provide
6
6
 
7
7
  ### Basic string instructions
8
8
 
9
- Passing instructions as a string or array of strings is the simplest way to set up an agent. This is useful for straightforward use cases where you just need to provide a prompt without additional configuration.
9
+ Passing instructions as a string or array of strings is the simplest way to set up an agent. This is useful for straightforward use cases where you need to provide a prompt without additional configuration.
10
10
 
11
11
  ```typescript
12
12
  import { Agent } from '@mastra/core/agent'
@@ -4,9 +4,9 @@ You can use the Command-Line Interface (CLI) provided by Mastra to develop, buil
4
4
 
5
5
  ## `mastra dev`
6
6
 
7
- Starts a server which exposes [Studio](https://mastra.ai/docs/getting-started/studio) and REST endpoints for your agents, tools, and workflows. You can visit <http://localhost:4111/swagger-ui> for an overview of all available endpoints once `mastra dev` is running.
7
+ Starts a server which exposes [Studio](https://mastra.ai/docs/studio/overview) and REST endpoints for your agents, tools, and workflows. You can visit <http://localhost:4111/swagger-ui> for an overview of all available endpoints once `mastra dev` is running.
8
8
 
9
- You can also [configure the server](https://mastra.ai/docs/getting-started/studio).
9
+ You can also [configure the server](https://mastra.ai/reference/configuration).
10
10
 
11
11
  ### Flags
12
12
 
@@ -157,7 +157,7 @@ Comma-separated list of custom arguments to pass to the Node.js process, e.g. `-
157
157
 
158
158
  ## `mastra studio`
159
159
 
160
- Starts [Mastra Studio](https://mastra.ai/docs/getting-started/studio) as a static server. After starting, you can enter your Mastra instance URL (e.g. `http://localhost:4111`) to connect Studio to your Mastra backend. Looks for `.env` and `.env.production` files in the current working directory for configuration.
160
+ Starts [Studio](https://mastra.ai/docs/studio/overview) as a static server. After starting, you can enter your Mastra instance URL (e.g. `http://localhost:4111`) to connect Studio to your Mastra backend. Looks for `.env` and `.env.production` files in the current working directory for configuration.
161
161
 
162
162
  ### Flags
163
163
 
@@ -55,7 +55,7 @@ The `resourceId` parameter associates the workflow run with a specific resource
55
55
 
56
56
  ### `startAsync()`
57
57
 
58
- Start a workflow run and await the full result:
58
+ Start a workflow run and await its completion, returning the full result as the workflow output.
59
59
 
60
60
  ```typescript
61
61
  const run = await workflow.createRun()
@@ -97,7 +97,7 @@ const result = await run.startAsync({
97
97
 
98
98
  ### `start()`
99
99
 
100
- Start a workflow run without waiting for completion:
100
+ Start a workflow run without waiting for completion (fire-and-forget). Returns immediately with a success message. Use `runById()` on the workflow instance to check results later:
101
101
 
102
102
  ```typescript
103
103
  const run = await workflow.createRun()
@@ -749,9 +749,9 @@ Return a `{ status, body }` object to override the default `400` response, or `u
749
749
 
750
750
  The `context` parameter indicates which part of the request failed validation:
751
751
 
752
- - `'query'` query parameters
753
- - `'body'` request body
754
- - `'path'` path parameters
752
+ - `'query'`: query parameters
753
+ - `'body'`: request body
754
+ - `'path'`: path parameters
755
755
 
756
756
  ```typescript
757
757
  import { Mastra } from '@mastra/core'
@@ -797,7 +797,7 @@ export const mastra = new Mastra({
797
797
  **Type:** `string`\
798
798
  **Default:** `/`
799
799
 
800
- Base path for hosting Mastra Studio. Use this to host the Studio on a sub-path of your existing application instead of the root.
800
+ Base path for hosting [Studio](https://mastra.ai/docs/studio/overview). Use this to host the Studio on a sub-path of your existing application instead of the root.
801
801
 
802
802
  This is useful when integrating with existing applications, using authentication tools like Cloudflare Zero Trust that benefit from shared domains, or managing multiple services under a single domain.
803
803
 
@@ -75,7 +75,7 @@ The `CloudflareDeployer` constructor accepts the same configuration options as `
75
75
 
76
76
  ## Secrets
77
77
 
78
- Environment variables from your `.env` file are **not** written to `wrangler.jsonc`. This prevents secrets from being committed to source control.
78
+ Environment variables from your `.env` file aren't written to `wrangler.jsonc`. This prevents secrets from being committed to source control.
79
79
 
80
80
  To make your `.env` secrets available to your Cloudflare Worker, upload them as [Cloudflare Secrets](https://developers.cloudflare.com/workers/configuration/secrets/):
81
81
 
@@ -47,7 +47,7 @@ export const mastra = new Mastra({
47
47
 
48
48
  The deployer accepts the following options:
49
49
 
50
- - `studio?: boolean` — Deploy [Studio](https://mastra.ai/docs/getting-started/studio) alongside your API as static assets served from Vercel's Edge CDN. Defaults to `false`.
50
+ - `studio?: boolean` — Deploy [Studio](https://mastra.ai/docs/studio/overview) alongside your API as static assets served from Vercel's Edge CDN. Defaults to `false`.
51
51
  - `maxDuration?: number` — Function execution timeout (in seconds)
52
52
  - `memory?: number` — Function memory (in MB)
53
53
  - `regions?: string[]` — Regions to deploy the function (e.g. `['sfo1','iad1']`)
@@ -84,6 +84,10 @@ The Reference section provides documentation of Mastra's API, including paramete
84
84
  - [Deployer](https://mastra.ai/reference/deployer)
85
85
  - [Netlify](https://mastra.ai/reference/deployer/netlify)
86
86
  - [Vercel](https://mastra.ai/reference/deployer/vercel)
87
+ - [createScorer()](https://mastra.ai/reference/evals/create-scorer)
88
+ - [MastraScorer](https://mastra.ai/reference/evals/mastra-scorer)
89
+ - [runEvals()](https://mastra.ai/reference/evals/run-evals)
90
+ - [Scorer Utils](https://mastra.ai/reference/evals/scorer-utils)
87
91
  - [Answer Relevancy Scorer](https://mastra.ai/reference/evals/answer-relevancy)
88
92
  - [Answer Similarity Scorer](https://mastra.ai/reference/evals/answer-similarity)
89
93
  - [Bias](https://mastra.ai/reference/evals/bias)
@@ -91,30 +95,16 @@ The Reference section provides documentation of Mastra's API, including paramete
91
95
  - [Content Similarity Scorer](https://mastra.ai/reference/evals/content-similarity)
92
96
  - [Context Precision Scorer](https://mastra.ai/reference/evals/context-precision)
93
97
  - [Context Relevance Scorer](https://mastra.ai/reference/evals/context-relevance)
94
- - [createScorer()](https://mastra.ai/reference/evals/create-scorer)
95
98
  - [Faithfulness](https://mastra.ai/reference/evals/faithfulness)
96
99
  - [Hallucination](https://mastra.ai/reference/evals/hallucination)
97
100
  - [Keyword Coverage Scorer](https://mastra.ai/reference/evals/keyword-coverage)
98
- - [MastraScorer](https://mastra.ai/reference/evals/mastra-scorer)
99
101
  - [Noise Sensitivity Scorer](https://mastra.ai/reference/evals/noise-sensitivity)
100
102
  - [Prompt Alignment Scorer](https://mastra.ai/reference/evals/prompt-alignment)
101
- - [runEvals()](https://mastra.ai/reference/evals/run-evals)
102
- - [Scorer Utils](https://mastra.ai/reference/evals/scorer-utils)
103
103
  - [Textual Difference Scorer](https://mastra.ai/reference/evals/textual-difference)
104
104
  - [Tone Consistency Scorer](https://mastra.ai/reference/evals/tone-consistency)
105
105
  - [Tool Call Accuracy Scorers](https://mastra.ai/reference/evals/tool-call-accuracy)
106
106
  - [Toxicity](https://mastra.ai/reference/evals/toxicity)
107
107
  - [Trajectory Accuracy Scorers](https://mastra.ai/reference/evals/trajectory-accuracy)
108
- - [Harness Class](https://mastra.ai/reference/harness/harness-class)
109
- - [Cloned Thread Utilities](https://mastra.ai/reference/memory/clone-utilities)
110
- - [Memory Class](https://mastra.ai/reference/memory/memory-class)
111
- - [Observational Memory](https://mastra.ai/reference/memory/observational-memory)
112
- - [.cloneThread()](https://mastra.ai/reference/memory/cloneThread)
113
- - [.createThread()](https://mastra.ai/reference/memory/createThread)
114
- - [.deleteMessages()](https://mastra.ai/reference/memory/deleteMessages)
115
- - [.getThreadById()](https://mastra.ai/reference/memory/getThreadById)
116
- - [.listThreads()](https://mastra.ai/reference/memory/listThreads)
117
- - [.recall()](https://mastra.ai/reference/memory/recall)
118
108
  - [Dataset Class](https://mastra.ai/reference/datasets/dataset)
119
109
  - [DatasetsManager Class](https://mastra.ai/reference/datasets/datasets-manager)
120
110
  - [.addItem()](https://mastra.ai/reference/datasets/addItem)
@@ -139,7 +129,18 @@ The Reference section provides documentation of Mastra's API, including paramete
139
129
  - [.startExperimentAsync()](https://mastra.ai/reference/datasets/startExperimentAsync)
140
130
  - [.update()](https://mastra.ai/reference/datasets/update)
141
131
  - [.updateItem()](https://mastra.ai/reference/datasets/updateItem)
132
+ - [Harness Class](https://mastra.ai/reference/harness/harness-class)
133
+ - [Cloned Thread Utilities](https://mastra.ai/reference/memory/clone-utilities)
134
+ - [Memory Class](https://mastra.ai/reference/memory/memory-class)
135
+ - [Observational Memory](https://mastra.ai/reference/memory/observational-memory)
136
+ - [.cloneThread()](https://mastra.ai/reference/memory/cloneThread)
137
+ - [.createThread()](https://mastra.ai/reference/memory/createThread)
138
+ - [.deleteMessages()](https://mastra.ai/reference/memory/deleteMessages)
139
+ - [.getThreadById()](https://mastra.ai/reference/memory/getThreadById)
140
+ - [.listThreads()](https://mastra.ai/reference/memory/listThreads)
141
+ - [.recall()](https://mastra.ai/reference/memory/recall)
142
142
  - [PinoLogger](https://mastra.ai/reference/logging/pino-logger)
143
+ - [Automatic Metrics](https://mastra.ai/reference/observability/metrics/automatic-metrics)
143
144
  - [Configuration](https://mastra.ai/reference/observability/tracing/configuration)
144
145
  - [Instances](https://mastra.ai/reference/observability/tracing/instances)
145
146
  - [Interfaces](https://mastra.ai/reference/observability/tracing/interfaces)
@@ -276,6 +277,7 @@ The Reference section provides documentation of Mastra's API, including paramete
276
277
  - [LocalSandbox](https://mastra.ai/reference/workspace/local-sandbox)
277
278
  - [S3Filesystem](https://mastra.ai/reference/workspace/s3-filesystem)
278
279
  - [SandboxProcessManager](https://mastra.ai/reference/workspace/process-manager)
280
+ - [VercelSandbox](https://mastra.ai/reference/workspace/vercel)
279
281
  - [Workspace Class](https://mastra.ai/reference/workspace/workspace-class)
280
282
  - [WorkspaceFilesystem](https://mastra.ai/reference/workspace/filesystem)
281
283
  - [WorkspaceSandbox](https://mastra.ai/reference/workspace/sandbox)
@@ -666,7 +666,7 @@ const selector = new ModelByInputTokens({
666
666
 
667
667
  #### Behavior
668
668
 
669
- - Thresholds are sorted internally, so the order in the config object does not matter.
669
+ - Thresholds are sorted internally, so the order in the config object doesn't matter.
670
670
  - `inputTokens ≤ smallest threshold` → uses that threshold's model
671
671
  - `inputTokens > largest threshold` → `resolve()` throws an error. If this happens during an OM Observer or Reflector run, OM aborts via TripWire, so callers receive an empty `text` result or streamed `tripwire` instead of a normal assistant response.
672
672
  - OM computes the input token count for the Observer or Reflector call and resolves the matching model tier directly
@@ -0,0 +1,132 @@
1
+ # Automatic metrics reference
2
+
3
+ Mastra automatically extracts performance and usage metrics from traced execution. This page is the complete reference for every metric name, label, and context field that Mastra emits.
4
+
5
+ For setup instructions, see the [Metrics overview](https://mastra.ai/docs/observability/metrics/overview).
6
+
7
+ ## When Mastra emits automatic metrics
8
+
9
+ Metrics are extracted from spans when they end. The observability layer inspects each completed span, calculates duration, and (for model generation spans) reads token usage data. No manual instrumentation is needed.
10
+
11
+ Metrics are routed through an internal event bus to the `DefaultExporter`, which batches and flushes them to storage. Only DuckDB and in-memory storage backends support metrics persistence today.
12
+
13
+ ### What affects whether a metric is available
14
+
15
+ Two conditions must be true for a metric to reach storage:
16
+
17
+ 1. `DefaultExporter` is configured as an exporter.
18
+ 2. The storage backend supports metrics (`DuckDB` or `InMemory`).
19
+
20
+ If metrics aren't appearing, see [troubleshooting](#troubleshooting).
21
+
22
+ ## Duration metrics
23
+
24
+ Duration metrics record execution time in milliseconds, calculated from the span's start and end timestamps. Each duration metric includes a `status` label set to `ok` or `error`, derived from the span's status.
25
+
26
+ | Metric name | Span type | Description |
27
+ | ------------------------------ | ---------------------------- | ------------------------------------------------------- |
28
+ | `mastra_agent_duration_ms` | `AGENT_RUN` | Execution time of an agent run |
29
+ | `mastra_tool_duration_ms` | `TOOL_CALL`, `MCP_TOOL_CALL` | Execution time of a tool call, including MCP tool calls |
30
+ | `mastra_workflow_duration_ms` | `WORKFLOW_RUN` | Execution time of a workflow run |
31
+ | `mastra_model_duration_ms` | `MODEL_GENERATION` | Execution time of a model generation |
32
+ | `mastra_processor_duration_ms` | `PROCESSOR_RUN` | Execution time of a processor run |
33
+
34
+ ## Token usage metrics
35
+
36
+ Token metrics are emitted only from `MODEL_GENERATION` spans that include `usage` data. If the provider doesn't report usage, no token metrics are emitted for that span.
37
+
38
+ ### Input token metrics
39
+
40
+ | Metric name | Description |
41
+ | --------------------------------------- | ---------------------------------------------- |
42
+ | `mastra_model_total_input_tokens` | Total input tokens |
43
+ | `mastra_model_input_text_tokens` | Text tokens in the input prompt |
44
+ | `mastra_model_input_cache_read_tokens` | Tokens read from prompt cache (e.g. Anthropic) |
45
+ | `mastra_model_input_cache_write_tokens` | Tokens written to prompt cache |
46
+ | `mastra_model_input_audio_tokens` | Audio tokens in the input (multimodal models) |
47
+ | `mastra_model_input_image_tokens` | Image tokens in the input (vision models) |
48
+
49
+ ### Output token metrics
50
+
51
+ | Metric name | Description |
52
+ | -------------------------------------- | ---------------------------------------------------------- |
53
+ | `mastra_model_total_output_tokens` | Total output tokens |
54
+ | `mastra_model_output_text_tokens` | Text tokens in the model's output |
55
+ | `mastra_model_output_reasoning_tokens` | Reasoning / chain-of-thought tokens (e.g. OpenAI o-series) |
56
+ | `mastra_model_output_audio_tokens` | Audio tokens in the model's output |
57
+ | `mastra_model_output_image_tokens` | Output image tokens |
58
+
59
+ ### Provider-reported detailed token categories
60
+
61
+ The detailed breakdown metrics (everything except `total_input` and `total_output`) are only emitted when the provider reports them. If a category has zero tokens, the metric is skipped for that span. Different providers report different levels of detail. For example, not all providers report cache or audio tokens.
62
+
63
+ ## Cost-related context
64
+
65
+ ### When cost context is attached
66
+
67
+ Cost context is attached to token metrics when the embedded pricing registry has a matching entry for the provider and model. The registry ships with Mastra and covers common providers and models. If no match is found, token metrics are still emitted but without cost fields.
68
+
69
+ ### What cost fields may be included
70
+
71
+ | Field | Description |
72
+ | --------------- | ---------------------------------------------------------------------------- |
73
+ | `provider` | Provider name (e.g. `openai`, `anthropic`) |
74
+ | `model` | Model identifier (e.g. `gpt-4o`, `claude-sonnet-4-20250514`) |
75
+ | `estimatedCost` | Estimated cost for this metric, calculated from token count and pricing tier |
76
+ | `costUnit` | Currency unit (e.g. `USD`) |
77
+ | `costMetadata` | Additional pricing context (tier information, error details) |
78
+
79
+ ## Correlation with traces
80
+
81
+ ### How metrics relate to spans and trace context
82
+
83
+ Each metric carries a `CorrelationContext` snapshot from the span that produced it. This context is stored alongside the metric value and lets you navigate from a metric to the exact span and trace.
84
+
85
+ The correlation fields are grouped into four categories:
86
+
87
+ **Trace correlation**
88
+
89
+ - `traceId`: trace identifier
90
+ - `spanId`: span identifier
91
+ - `tags`: tags from the span
92
+
93
+ **Entity hierarchy**
94
+
95
+ - `entityType`, `entityId`, `entityName`: The entity that produced the metric (e.g. agent, workflow)
96
+ - `parentEntityType`, `parentEntityId`, `parentEntityName`: The parent entity
97
+ - `rootEntityType`, `rootEntityId`, `rootEntityName`: The root entity in the call chain
98
+
99
+ **Identity**
100
+
101
+ - `userId`, `organizationId`, `resourceId`: Identity context from the request
102
+ - `runId`, `sessionId`, `threadId`, `requestId`: Correlation IDs
103
+
104
+ **Deployment**
105
+
106
+ - `environment`: Deployment environment (e.g. `production`, `staging`)
107
+ - `source`: Source identifier
108
+ - `serviceName`: Service name from the observability config
109
+ - `experimentId`: Experiment identifier, if applicable
110
+
111
+ ### Why correlation helps with debugging
112
+
113
+ When you spot a spike in latency or token usage on the Metrics dashboard, correlation context lets you drill directly into the trace that produced the metric. From there you can inspect the individual span to find the root cause: a slow tool call, a large prompt, or an unexpected error.
114
+
115
+ ## Troubleshooting
116
+
117
+ ### No metrics are appearing
118
+
119
+ - **Observability is configured**: Verify that your `Mastra` instance has an `observability` config with at least one exporter.
120
+ - **`DefaultExporter` is present**: Other exporters (Datadog, Langfuse, etc.) don't persist metrics to Mastra storage. `DefaultExporter` is required for the Studio dashboard.
121
+ - **Storage supports metrics**: Metrics require a separate OLAP store for observability. Relational databases like PostgreSQL, LibSQL, etc. are not supported for metrics. In-memory storage resets on restart.
122
+ - **Sampling isn't 0%**: If sampling probability is `0` or strategy is `never`, all spans become no-ops and no metrics are extracted.
123
+
124
+ ### Duration metrics are missing
125
+
126
+ - **Span has timestamps**: Duration is calculated from `startTime` and `endTime`. If either is missing, the metric is skipped.
127
+ - **Span type maps to a metric**: Only `AGENT_RUN`, `TOOL_CALL`, `MCP_TOOL_CALL`, `WORKFLOW_RUN`, `MODEL_GENERATION`, and `PROCESSOR_RUN` spans produce duration metrics.
128
+
129
+ ### Token metrics are missing
130
+
131
+ - **Span is a model generation**: Token metrics are only emitted from `MODEL_GENERATION` spans.
132
+ - **Provider reports usage**: The model provider must include `usage` data in its response. If usage is absent, no token metrics are emitted.
@@ -2,7 +2,7 @@
2
2
 
3
3
  The Cloudflare D1 storage implementation provides a serverless SQL database solution using Cloudflare D1, supporting relational operations and transactional consistency.
4
4
 
5
- > **Observability Not Supported:** Cloudflare D1 storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to D1, and Mastra Studio's observability features won't work with D1 as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
5
+ > **Observability Not Supported:** Cloudflare D1 storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to D1, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with D1 as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
6
6
 
7
7
  > **Row Size Limit:** Cloudflare D1 enforces a **1 MiB maximum row size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/storage) for workarounds including uploading attachments to external storage.
8
8
 
@@ -2,10 +2,10 @@
2
2
 
3
3
  Mastra provides two Cloudflare storage implementations:
4
4
 
5
- - **Cloudflare KV** (`CloudflareKVStorage`) - A globally distributed, eventually consistent key-value store
6
- - **Cloudflare Durable Objects** (`CloudflareDOStorage`) - A strongly consistent, SQLite-based storage using Durable Objects
5
+ - **Cloudflare KV** (`CloudflareKVStorage`): A globally distributed, eventually consistent key-value store
6
+ - **Cloudflare Durable Objects** (`CloudflareDOStorage`): A strongly consistent, SQLite-based storage using Durable Objects
7
7
 
8
- > **Observability Not Supported:** Cloudflare storage **does not support the observability domain**. Traces from the `DefaultExporter` cannot be persisted, and Mastra Studio's observability features won't work with Cloudflare as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
8
+ > **Observability Not Supported:** Cloudflare storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with Cloudflare as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
9
9
 
10
10
  ## Installation
11
11
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  The Convex storage implementation provides a serverless storage solution using [Convex](https://convex.dev), a full-stack TypeScript development platform with real-time sync and automatic caching.
4
4
 
5
- > **Observability Not Supported:** Convex storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to Convex, and Mastra Studio's observability features won't work with Convex as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
5
+ > **Observability Not Supported:** Convex storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to Convex, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with Convex as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
6
6
 
7
7
  > **Record Size Limit:** Convex enforces a **1 MiB maximum record size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/storage) for workarounds including uploading attachments to external storage like S3, Cloudflare R2, or [Convex file storage](https://docs.convex.dev/file-storage).
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  The DynamoDB storage implementation provides a scalable and performant NoSQL database solution for Mastra, leveraging a single-table design pattern with [ElectroDB](https://electrodb.dev/).
4
4
 
5
- > **Observability Not Supported:** DynamoDB storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to DynamoDB, and Mastra Studio's observability features won't work with DynamoDB as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
5
+ > **Observability Not Supported:** DynamoDB storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to DynamoDB, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with DynamoDB as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
6
6
 
7
7
  > **Item Size Limit:** DynamoDB enforces a **400 KB maximum item size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/storage) for workarounds including uploading attachments to external storage.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  The LanceDB storage implementation provides a high-performance storage solution using the LanceDB database system, which excels at handling both traditional data storage and vector operations.
4
4
 
5
- > **Observability Not Supported:** LanceDB storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to LanceDB, and Mastra Studio's observability features won't work with LanceDB as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
5
+ > **Observability Not Supported:** LanceDB storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to LanceDB, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with LanceDB as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
6
6
 
7
7
  ## Installation
8
8
 
@@ -4,7 +4,7 @@ The Upstash storage implementation provides a serverless-friendly storage soluti
4
4
 
5
5
  > **Pricing:** When using Mastra with Upstash, the pay-as-you-go model can result in unexpectedly high costs due to the high volume of Redis commands generated during agent conversations. We strongly recommend using a **fixed pricing plan** for predictable costs. See [Upstash pricing](https://upstash.com/pricing/redis) for details and [GitHub issue #5850](https://github.com/mastra-ai/mastra/issues/5850) for context.
6
6
 
7
- > **Observability Not Supported:** Upstash storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to Upstash, and Mastra Studio's observability features won't work with Upstash as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
7
+ > **Observability Not Supported:** Upstash storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to Upstash, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with Upstash as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
8
8
 
9
9
  ## Installation
10
10
 
@@ -0,0 +1,118 @@
1
+ # VercelSandbox
2
+
3
+ Executes commands as [Vercel](https://vercel.com) serverless functions. Provides globally-distributed, zero-infrastructure execution with automatic scaling.
4
+
5
+ > **Info:** For interface details, see [WorkspaceSandbox interface](https://mastra.ai/reference/workspace/sandbox).
6
+
7
+ > **Warning:** VercelSandbox is stateless. There is no persistent filesystem, no interactive shell, and no support for long-running or background processes. Only `/tmp` is writable and is ephemeral between invocations.
8
+
9
+ ## Installation
10
+
11
+ **npm**:
12
+
13
+ ```bash
14
+ npm install @mastra/vercel
15
+ ```
16
+
17
+ **pnpm**:
18
+
19
+ ```bash
20
+ pnpm add @mastra/vercel
21
+ ```
22
+
23
+ **Yarn**:
24
+
25
+ ```bash
26
+ yarn add @mastra/vercel
27
+ ```
28
+
29
+ **Bun**:
30
+
31
+ ```bash
32
+ bun add @mastra/vercel
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ Add a `VercelSandbox` to a workspace and assign it to an agent:
38
+
39
+ ```typescript
40
+ import { Agent } from '@mastra/core/agent'
41
+ import { Workspace } from '@mastra/core/workspace'
42
+ import { VercelSandbox } from '@mastra/vercel'
43
+
44
+ const workspace = new Workspace({
45
+ sandbox: new VercelSandbox({
46
+ token: process.env.VERCEL_TOKEN,
47
+ }),
48
+ })
49
+
50
+ const agent = new Agent({
51
+ name: 'dev-agent',
52
+ model: 'anthropic/claude-sonnet-4-6',
53
+ workspace,
54
+ })
55
+ ```
56
+
57
+ ### Team-scoped deployment with custom resources
58
+
59
+ ```typescript
60
+ const workspace = new Workspace({
61
+ sandbox: new VercelSandbox({
62
+ token: process.env.VERCEL_TOKEN,
63
+ teamId: 'team_abc123',
64
+ regions: ['iad1', 'sfo1'],
65
+ maxDuration: 120,
66
+ memory: 3008,
67
+ env: {
68
+ NODE_ENV: 'production',
69
+ },
70
+ }),
71
+ })
72
+ ```
73
+
74
+ ## Constructor parameters
75
+
76
+ **token** (`string`): Vercel API token. Falls back to \`VERCEL\_TOKEN\` environment variable.
77
+
78
+ **teamId** (`string`): Vercel team ID for team-scoped deployments.
79
+
80
+ **projectName** (`string`): Existing Vercel project name. Auto-generated if omitted.
81
+
82
+ **regions** (`string[]`): Deployment regions. (Default: `['iad1']`)
83
+
84
+ **maxDuration** (`number`): Function maximum duration in seconds. (Default: `60`)
85
+
86
+ **memory** (`number`): Function memory in MB. (Default: `1024`)
87
+
88
+ **env** (`Record<string, string>`): Environment variables baked into the deployed function source. These are embedded at deploy time, not set dynamically.
89
+
90
+ **commandTimeout** (`number`): Per-invocation command timeout in milliseconds. (Default: `55000`)
91
+
92
+ **instructions** (`string | ((opts) => string)`): Custom instructions that override the default instructions returned by \`getInstructions()\`. Pass a string to fully replace, or a function to extend the defaults.
93
+
94
+ ## Properties
95
+
96
+ **id** (`string`): Unique identifier for this sandbox instance.
97
+
98
+ **name** (`'VercelSandbox'`): Human-readable name.
99
+
100
+ **provider** (`'vercel'`): Provider type identifier.
101
+
102
+ **status** (`ProviderStatus`): Current lifecycle status: \`'pending'\`, \`'starting'\`, \`'running'\`, \`'stopping'\`, \`'stopped'\`, \`'destroying'\`, \`'destroyed'\`, or \`'error'\`.
103
+
104
+ ## Limitations
105
+
106
+ VercelSandbox uses serverless functions under the hood, which means:
107
+
108
+ - **No persistent filesystem**: Files written to `/tmp` are ephemeral and cleared between invocations.
109
+ - **No interactive shell**: Commands run via `/bin/sh -c` with no stdin streaming.
110
+ - **No background processes**: No process manager, PIDs, or long-running tasks.
111
+ - **No mounting**: Cloud storage mounting (S3, GCS) is not supported.
112
+ - **Timeout limits**: Maximum execution time is bounded by `maxDuration` (default 60s).
113
+
114
+ ## Related
115
+
116
+ - [WorkspaceSandbox interface](https://mastra.ai/reference/workspace/sandbox)
117
+ - [Workspace class](https://mastra.ai/reference/workspace/workspace-class)
118
+ - [E2BSandbox](https://mastra.ai/reference/workspace/e2b-sandbox) — full-featured cloud sandbox with persistent filesystem and process management
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 1.1.18-alpha.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`9c57f2f`](https://github.com/mastra-ai/mastra/commit/9c57f2f7241e9f94769aa99fc86c531e8207d0f9), [`5bfc691`](https://github.com/mastra-ai/mastra/commit/5bfc69104c07ba7a9b55c2f8536422c0878b9c57)]:
8
+ - @mastra/core@1.19.0-alpha.2
9
+
10
+ ## 1.1.18-alpha.2
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`9140989`](https://github.com/mastra-ai/mastra/commit/91409890e83f4f1d9c1b39223f1af91a6a53b549), [`d7c98cf`](https://github.com/mastra-ai/mastra/commit/d7c98cfc9d75baba9ecbf1a8835b5183d0a0aec8), [`acf5fbc`](https://github.com/mastra-ai/mastra/commit/acf5fbcb890dc7ca7167bec386ce5874dfadb997), [`24ca2ae`](https://github.com/mastra-ai/mastra/commit/24ca2ae57538ec189fabb9daee6175ad27035853), [`0762516`](https://github.com/mastra-ai/mastra/commit/07625167e029a8268ea7aaf0402416e6d8832874), [`2de3d36`](https://github.com/mastra-ai/mastra/commit/2de3d36932b7f73ad26bc403f7da26cfe89e903e), [`d3736cb`](https://github.com/mastra-ai/mastra/commit/d3736cb9ce074d2b8e8b00218a01f790fe81a1b4), [`c627366`](https://github.com/mastra-ai/mastra/commit/c6273666f9ef4c8c617c68b7d07fe878a322f85c), [`66a7412`](https://github.com/mastra-ai/mastra/commit/66a7412ec0550f3dfa01cd05b057d8c6e5b062bc)]:
15
+ - @mastra/core@1.18.1-alpha.1
16
+ - @mastra/mcp@1.4.0-alpha.0
17
+
18
+ ## 1.1.18-alpha.0
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [[`180aaaf`](https://github.com/mastra-ai/mastra/commit/180aaaf4d0903d33a49bc72de2d40ca69a5bc599)]:
23
+ - @mastra/core@1.18.1-alpha.0
24
+
3
25
  ## 1.1.17
4
26
 
5
27
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "1.1.17",
3
+ "version": "1.1.18-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",
@@ -29,8 +29,8 @@
29
29
  "jsdom": "^26.1.0",
30
30
  "local-pkg": "^1.1.2",
31
31
  "zod": "^4.3.6",
32
- "@mastra/core": "1.18.0",
33
- "@mastra/mcp": "^1.3.2"
32
+ "@mastra/core": "1.19.0-alpha.2",
33
+ "@mastra/mcp": "^1.4.0-alpha.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@hono/node-server": "^1.19.11",
@@ -46,9 +46,9 @@
46
46
  "tsx": "^4.21.0",
47
47
  "typescript": "^5.9.3",
48
48
  "vitest": "4.0.18",
49
+ "@internal/lint": "0.0.75",
49
50
  "@internal/types-builder": "0.0.50",
50
- "@mastra/core": "1.18.0",
51
- "@internal/lint": "0.0.75"
51
+ "@mastra/core": "1.19.0-alpha.2"
52
52
  },
53
53
  "homepage": "https://mastra.ai",
54
54
  "repository": {