@mastra/mcp-docs-server 0.13.20 → 0.13.21-alpha.0

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 (44) hide show
  1. package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +8 -8
  2. package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
  3. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +8 -0
  4. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +19 -19
  5. package/.docs/organized/changelogs/%40mastra%2Fcloud.md +13 -13
  6. package/.docs/organized/changelogs/%40mastra%2Fcore.md +41 -41
  7. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +21 -21
  8. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +17 -17
  9. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +17 -17
  10. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +17 -17
  11. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +22 -22
  12. package/.docs/organized/changelogs/%40mastra%2Fevals.md +12 -12
  13. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +10 -10
  14. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +17 -17
  15. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +10 -10
  16. package/.docs/organized/changelogs/%40mastra%2Fpg.md +10 -10
  17. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +21 -21
  18. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
  19. package/.docs/organized/changelogs/%40mastra%2Fserver.md +17 -17
  20. package/.docs/organized/changelogs/create-mastra.md +5 -5
  21. package/.docs/organized/changelogs/mastra.md +21 -21
  22. package/.docs/organized/code-examples/agent.md +34 -9
  23. package/.docs/organized/code-examples/ai-sdk-v5.md +16 -14
  24. package/.docs/organized/code-examples/heads-up-game.md +3 -3
  25. package/.docs/raw/auth/clerk.mdx +142 -0
  26. package/.docs/raw/getting-started/installation.mdx +3 -1
  27. package/.docs/raw/getting-started/model-providers.mdx +31 -31
  28. package/.docs/raw/observability/ai-tracing.mdx +123 -24
  29. package/.docs/raw/reference/agents/ChunkType.mdx +857 -0
  30. package/.docs/raw/reference/agents/MastraModelOutput.mdx +321 -0
  31. package/.docs/raw/reference/agents/generateVNext.mdx +519 -0
  32. package/.docs/raw/reference/agents/streamVNext.mdx +6 -20
  33. package/.docs/raw/reference/auth/clerk.mdx +71 -0
  34. package/.docs/raw/reference/scorers/answer-similarity.mdx +179 -0
  35. package/.docs/raw/scorers/off-the-shelf-scorers.mdx +1 -0
  36. package/.docs/raw/server-db/production-server.mdx +27 -2
  37. package/.docs/raw/tools-mcp/mcp-overview.mdx +144 -159
  38. package/.docs/raw/workflows/control-flow.mdx +1 -1
  39. package/.docs/raw/workflows/suspend-and-resume.mdx +5 -0
  40. package/CHANGELOG.md +9 -0
  41. package/dist/stdio.js +11 -4
  42. package/dist/tools/docs.d.ts.map +1 -1
  43. package/package.json +4 -4
  44. /package/.docs/raw/reference/{templates.mdx → templates/overview.mdx} +0 -0
@@ -51,27 +51,11 @@ For the latest updates, see [GitHub issue #6773](https://github.com/mastra-ai/ma
51
51
 
52
52
  ## Basic Configuration
53
53
 
54
- Here's a simple example of enabling AI Tracing:
55
-
56
54
  ```ts filename="src/mastra/index.ts" showLineNumbers copy
57
- import { LangfuseExporter } from '@mastra/langfuse';
58
-
59
55
  export const mastra = new Mastra({
60
56
  // ... other config
61
57
  observability: {
62
- instances: {
63
- langfuse: {
64
- serviceName: 'my-service',
65
- exporters: [
66
- new LangfuseExporter({
67
- publicKey: process.env.LANGFUSE_PUBLIC_KEY,
68
- secretKey: process.env.LANGFUSE_SECRET_KEY,
69
- baseUrl: process.env.LANGFUSE_BASE_URL, // Optional - defaults to Langfuse cloud
70
- realtime: true,
71
- }),
72
- ],
73
- },
74
- },
58
+ default: { enabled: true }, // Enables DefaultExporter and CloudExporter
75
59
  },
76
60
  });
77
61
  ```
@@ -82,11 +66,16 @@ The AI tracing config accepts these properties:
82
66
 
83
67
  ```ts
84
68
  type AITracingConfig = {
69
+ // Enable default configuration with built-in exporters
70
+ default?: {
71
+ enabled?: boolean;
72
+ };
73
+
85
74
  // Map of tracing instance names to their configurations
86
- instances: Record<string, AITracingInstanceConfig | MastraAITracing>;
75
+ configs?: Record<string, AITracingInstanceConfig | MastraAITracing>;
87
76
 
88
77
  // Optional function to select which tracing instance to use
89
- selector?: TracingSelector;
78
+ configSelector?: TracingSelector;
90
79
  };
91
80
 
92
81
  type AITracingInstanceConfig = {
@@ -108,6 +97,33 @@ type AITracingInstanceConfig = {
108
97
  };
109
98
  ```
110
99
 
100
+ ### Default Configuration
101
+
102
+ When `default.enabled` is set to `true`, Mastra automatically configures AI tracing with sensible defaults:
103
+
104
+ ```ts filename="src/mastra/index.ts" showLineNumbers copy
105
+ export const mastra = new Mastra({
106
+ observability: {
107
+ default: { enabled: true },
108
+ configs: {
109
+ // Your custom configs can coexist with the default
110
+ }
111
+ }
112
+ });
113
+ ```
114
+
115
+ The default configuration includes:
116
+ - **Service Name**: `"mastra"`
117
+ - **Sampling**: Always sample (100% of traces)
118
+ - **Exporters**:
119
+ - `DefaultExporter` - Persists traces to your configured storage
120
+ - `CloudExporter` - Sends traces to Mastra Cloud (requires `MASTRA_CLOUD_ACCESS_TOKEN`)
121
+ - **Processors**: `SensitiveDataFilter` - Automatically redacts sensitive fields
122
+
123
+ <Callout type="info">
124
+ **Note**: You cannot name a custom config `"default"` when the default configuration is enabled. This will throw an error to prevent naming conflicts.
125
+ </Callout>
126
+
111
127
  ### Sampling Configuration
112
128
 
113
129
  Control which traces are collected and exported:
@@ -115,7 +131,7 @@ Control which traces are collected and exported:
115
131
  ```ts filename="src/mastra/index.ts" showLineNumbers copy
116
132
  export const mastra = new Mastra({
117
133
  observability: {
118
- instances: {
134
+ configs: {
119
135
  langfuse: {
120
136
  serviceName: 'my-service',
121
137
  // Sample all traces (default)
@@ -152,6 +168,66 @@ export const mastra = new Mastra({
152
168
 
153
169
  ## Exporters
154
170
 
171
+ ### Built-in Exporters
172
+
173
+ Mastra includes two built-in exporters that are automatically configured when using the default configuration:
174
+
175
+ #### DefaultExporter
176
+
177
+ The `DefaultExporter` persists traces to your configured Mastra storage backend. It handles batching and retry logic automatically.
178
+
179
+ **Features:**
180
+ - Automatic batching with configurable batch size
181
+ - Retry logic for failed exports
182
+ - Strategy selection based on storage capabilities
183
+ - No external dependencies required
184
+
185
+ **Configuration:**
186
+ ```ts
187
+ import { DefaultExporter } from '@mastra/core';
188
+
189
+ new DefaultExporter({
190
+ maxBatchSize: 1000, // Maximum spans per batch
191
+ maxBatchWaitMs: 5000, // Maximum wait time before flushing
192
+ maxRetries: 4, // Number of retry attempts
193
+ strategy: 'auto', // 'auto' | 'realtime' | 'batch-with-updates' | 'insert-only'
194
+ });
195
+ ```
196
+
197
+ <Callout type="info">
198
+ If storage is not configured, the DefaultExporter will log a warning and operate as a no-op, allowing your application to continue without errors.
199
+ </Callout>
200
+
201
+ #### CloudExporter
202
+
203
+ The `CloudExporter` sends traces to Mastra Cloud for online visualization and analysis.
204
+
205
+ **Features:**
206
+ - Real-time trace visualization in Mastra Cloud dashboard
207
+ - Automatic batching and compression
208
+ - Secure token-based authentication
209
+ - Graceful fallback when token is not configured
210
+
211
+ **Configuration:**
212
+ ```ts
213
+ import { CloudExporter } from '@mastra/core';
214
+
215
+ new CloudExporter({
216
+ accessToken: process.env.MASTRA_CLOUD_ACCESS_TOKEN, // Required (but can be pulled directly from the environment)
217
+ endpoint: 'https://api.mastra.ai/ai/spans/publish', // Optional custom endpoint
218
+ maxBatchSize: 1000, // Maximum spans per batch
219
+ maxBatchWaitMs: 5000, // Maximum wait time before flushing
220
+ });
221
+ ```
222
+
223
+ **Environment Variables:**
224
+ - `MASTRA_CLOUD_ACCESS_TOKEN` - Your Mastra Cloud access token
225
+ - `MASTRA_CLOUD_AI_TRACES_ENDPOINT` - Optional custom endpoint URL
226
+
227
+ <Callout type="warning">
228
+ If `MASTRA_CLOUD_ACCESS_TOKEN` is not set, the CloudExporter will log a message directing you to sign up at [mastra.ai](https://mastra.ai) and operate as a no-op.
229
+ </Callout>
230
+
155
231
  ### Langfuse Exporter
156
232
 
157
233
  #### Installation
@@ -188,7 +264,7 @@ import { LangfuseExporter } from '@mastra/langfuse';
188
264
 
189
265
  export const mastra = new Mastra({
190
266
  observability: {
191
- instances: {
267
+ configs: {
192
268
  langfuse: {
193
269
  serviceName: process.env.SERVICE_NAME || 'mastra-app',
194
270
  sampling: { type: 'always' },
@@ -262,7 +338,7 @@ import { BraintrustExporter } from '@mastra/braintrust';
262
338
 
263
339
  export const mastra = new Mastra({
264
340
  observability: {
265
- instances: {
341
+ configs: {
266
342
  braintrust: {
267
343
  serviceName: 'my-service',
268
344
  exporters: [
@@ -284,7 +360,7 @@ You can configure multiple tracing instances and use a selector to choose which
284
360
  ```ts filename="mastra.config.ts" showLineNumbers copy
285
361
  export const mastra = new Mastra({
286
362
  observability: {
287
- instances: {
363
+ configs: {
288
364
  production: {
289
365
  serviceName: 'prod-service',
290
366
  sampling: { type: 'ratio', probability: 0.1 },
@@ -296,7 +372,7 @@ export const mastra = new Mastra({
296
372
  exporters: [devLangfuseExporter],
297
373
  },
298
374
  },
299
- selector: (context, availableTracers) => {
375
+ configSelector: (context, availableTracers) => {
300
376
  // Use development tracer for debug sessions
301
377
  if (context.runtimeContext?.get('debug') === 'true') {
302
378
  return 'development';
@@ -307,6 +383,29 @@ export const mastra = new Mastra({
307
383
  });
308
384
  ```
309
385
 
386
+ You can also combine the default configuration with custom configs:
387
+
388
+ ```ts filename="mastra.config.ts" showLineNumbers copy
389
+ export const mastra = new Mastra({
390
+ observability: {
391
+ default: { enabled: true }, // Provides 'default' instance
392
+ configs: {
393
+ langfuse: {
394
+ serviceName: 'langfuse-service',
395
+ exporters: [langfuseExporter],
396
+ },
397
+ },
398
+ configSelector: (context, availableTracers) => {
399
+ // Route specific requests to langfuse, others to default
400
+ if (context.runtimeContext?.get('useExternalTracing')) {
401
+ return 'langfuse';
402
+ }
403
+ return 'default';
404
+ },
405
+ },
406
+ });
407
+ ```
408
+
310
409
  ## Span Types and Attributes
311
410
 
312
411
  AI Tracing automatically creates spans for different AI operations. Mastra supports the following span types: