@mastra/mcp-docs-server 1.3.10 → 1.3.11-alpha.1

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 (88) hide show
  1. package/.docs/course/01-first-agent/16-adding-memory-to-agent.md +7 -1
  2. package/.docs/course/02-agent-tools-mcp/25-creating-notes-directory.md +8 -0
  3. package/.docs/course/02-agent-tools-mcp/26-updating-mcp-config-filesystem.md +10 -7
  4. package/.docs/course/02-agent-tools-mcp/27-updating-agent-instructions-filesystem.md +3 -1
  5. package/.docs/course/02-agent-tools-mcp/29-troubleshooting-filesystem.md +3 -2
  6. package/.docs/course/02-agent-tools-mcp/31-enhancing-memory-configuration.md +2 -2
  7. package/.docs/course/03-agent-memory/04-creating-basic-memory-agent.md +3 -1
  8. package/.docs/course/03-agent-memory/08-configuring-conversation-history.md +1 -1
  9. package/.docs/course/03-agent-memory/09-using-memory-in-application.md +8 -6
  10. package/.docs/course/03-agent-memory/10-storage-configuration.md +11 -1
  11. package/.docs/course/03-agent-memory/12-handling-memory-frontend.md +5 -3
  12. package/.docs/course/03-agent-memory/13-vector-store-configuration.md +4 -2
  13. package/.docs/course/03-agent-memory/16-configuring-semantic-recall.md +2 -2
  14. package/.docs/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +2 -2
  15. package/.docs/course/03-agent-memory/21-configuring-working-memory.md +2 -2
  16. package/.docs/course/03-agent-memory/22-custom-working-memory-templates.md +2 -5
  17. package/.docs/course/03-agent-memory/25-combining-memory-features.md +2 -2
  18. package/.docs/course/03-agent-memory/27-creating-learning-assistant.md +2 -2
  19. package/.docs/course/04-workflows/05-chaining-steps-together.md +2 -1
  20. package/.docs/course/04-workflows/12-using-agent-in-workflow.md +11 -14
  21. package/.docs/course/04-workflows/20-building-conditional-workflow.md +32 -6
  22. package/.docs/docs/agents/guardrails.md +1 -1
  23. package/.docs/docs/agents/human-in-the-loop.md +1 -1
  24. package/.docs/docs/agents/structured-output.md +11 -0
  25. package/.docs/docs/channels.md +2 -0
  26. package/.docs/docs/classifier.md +103 -0
  27. package/.docs/docs/deployment/mastra-server.md +3 -1
  28. package/.docs/docs/evals/custom-scorers.md +20 -0
  29. package/.docs/docs/evals/quick-checks.md +7 -7
  30. package/.docs/docs/guides/context-engineering.md +2 -2
  31. package/.docs/docs/mastra-platform/observability.md +1 -1
  32. package/.docs/docs/memory/memory-processors.md +49 -3
  33. package/.docs/docs/memory/observational-memory.md +27 -1
  34. package/.docs/docs/observability/tracing/overview.md +41 -1
  35. package/.docs/docs/workflows/control-flow.md +1 -1
  36. package/.docs/integrations/databases/postgresql.md +31 -0
  37. package/.docs/integrations/deploy/vercel.md +11 -0
  38. package/.docs/integrations/frameworks/angular.md +367 -0
  39. package/.docs/integrations/observability/langfuse.md +13 -0
  40. package/.docs/integrations/sandboxes/vercel.md +3 -1
  41. package/.docs/integrations.md +1 -0
  42. package/.docs/models/gateways/netlify.md +2 -5
  43. package/.docs/models/gateways/openrouter.md +2 -10
  44. package/.docs/models/gateways/vercel.md +1 -1
  45. package/.docs/models/index.md +1 -1
  46. package/.docs/models/providers/cortecs.md +1 -1
  47. package/.docs/models/providers/deepinfra.md +0 -1
  48. package/.docs/models/providers/edenai.md +25 -4
  49. package/.docs/models/providers/empiriolabs.md +2 -1
  50. package/.docs/models/providers/google.md +1 -4
  51. package/.docs/models/providers/inceptron.md +4 -4
  52. package/.docs/models/providers/kilo.md +10 -23
  53. package/.docs/models/providers/llmgateway-providers.md +5 -18
  54. package/.docs/models/providers/llmgateway.md +4 -3
  55. package/.docs/models/providers/melious.md +10 -10
  56. package/.docs/models/providers/mistral.md +25 -24
  57. package/.docs/models/providers/nano-gpt.md +7 -18
  58. package/.docs/models/providers/ofox.md +3 -1
  59. package/.docs/models/providers/openai.md +1 -4
  60. package/.docs/models/providers/opencode.md +0 -1
  61. package/.docs/reference/agents/channels.md +61 -1
  62. package/.docs/reference/agents/generate.md +0 -10
  63. package/.docs/reference/agents/generateLegacy.md +0 -10
  64. package/.docs/reference/agents/network.md +0 -10
  65. package/.docs/reference/browser/agent-browser.md +7 -3
  66. package/.docs/reference/browser/mastra-browser.md +34 -0
  67. package/.docs/reference/classifier/classifier.md +3 -1
  68. package/.docs/reference/cli/mastra.md +8 -0
  69. package/.docs/reference/client-js/observability.md +16 -15
  70. package/.docs/reference/configuration.md +3 -1
  71. package/.docs/reference/connect/providers.md +65 -1
  72. package/.docs/reference/core/getDeployer.md +1 -1
  73. package/.docs/reference/core/mastra-class.md +1 -1
  74. package/.docs/reference/deployer/vercel.md +24 -1
  75. package/.docs/reference/editor/mastra-editor.md +1 -1
  76. package/.docs/reference/evals/tool-call-accuracy.md +7 -4
  77. package/.docs/reference/memory/memory-class.md +77 -0
  78. package/.docs/reference/observability/tracing/advanced-queries.md +33 -16
  79. package/.docs/reference/observability/tracing/exporters/langfuse.md +11 -0
  80. package/.docs/reference/observability/tracing/exporters/otel.md +123 -3
  81. package/.docs/reference/observability/tracing/interfaces.md +15 -0
  82. package/.docs/reference/observability/tracing/spans.md +1 -1
  83. package/.docs/reference/signals/signal-provider.md +42 -1
  84. package/.docs/reference/streaming/agents/stream.md +19 -10
  85. package/.docs/reference/streaming/agents/streamLegacy.md +0 -10
  86. package/.docs/reference/workspace/filesystem.md +1 -1
  87. package/.docs/reference/workspace/local-filesystem.md +1 -1
  88. package/package.json +4 -4
@@ -555,6 +555,9 @@ interface AgentRunAttributes {
555
555
 
556
556
  /** When the run's model streamed its first chunk, copied from the agent's own first generation */
557
557
  completionStartTime?: Date
558
+
559
+ /** Time to first token of the model inference that streamed the run's first chunk, copied the same way */
560
+ timeToFirstTokenMs?: number
558
561
  }
559
562
  ```
560
563
 
@@ -606,6 +609,12 @@ interface ModelGenerationAttributes {
606
609
  /** Whether this was a streaming response */
607
610
  streaming?: boolean
608
611
 
612
+ /** When the generation's first inference streamed its first chunk */
613
+ completionStartTime?: Date
614
+
615
+ /** Time to first token of the model inference that streamed the generation's first chunk */
616
+ timeToFirstTokenMs?: number
617
+
609
618
  /** Reason the generation finished */
610
619
  finishReason?: string
611
620
  }
@@ -665,6 +674,9 @@ interface ModelStepAttributes {
665
674
 
666
675
  /** When the step's first inference streamed its first chunk */
667
676
  completionStartTime?: Date
677
+
678
+ /** Time to first token of the model inference that streamed the step's first chunk */
679
+ timeToFirstTokenMs?: number
668
680
  }
669
681
  ```
670
682
 
@@ -695,6 +707,9 @@ interface ModelInferenceAttributes {
695
707
  /** When the first token/chunk of the completion was received */
696
708
  completionStartTime?: Date
697
709
 
710
+ /** Milliseconds from the start of the model inference that streamed the first chunk to that chunk */
711
+ timeToFirstTokenMs?: number
712
+
698
713
  /** Result warnings */
699
714
  warnings?: Record<string, any>
700
715
 
@@ -161,7 +161,7 @@ interface ExportedSpan<TType extends SpanType> extends BaseSpan<TType> {
161
161
  /** Structured details behind stopReason, such as the limit that was hit */
162
162
  stopReasonContext?: Record<string, unknown>
163
163
 
164
- /** Milliseconds from the model call to the first token received */
164
+ /** Milliseconds from the start of the model inference that streamed the first chunk to that chunk */
165
165
  timeToFirstTokenMs?: number
166
166
 
167
167
  /** Errors in this span and all nested spans */
@@ -293,7 +293,7 @@ provider.stopPolling()
293
293
 
294
294
  Handle an incoming webhook request. Override to parse the payload and match it to subscriptions. Then emit notification signals. See [`WebhookSignalProvider`](https://mastra.ai/reference/signals/webhook-signal-provider) for a ready-to-use implementation.
295
295
 
296
- Call this method from an application-defined HTTP endpoint after verifying the webhook request.
296
+ Call this method from a route returned by [`getRoutes()`](#getroutes) or from your own HTTP endpoint, after verifying the webhook request.
297
297
 
298
298
  ```typescript
299
299
  async handleWebhook(request) {
@@ -313,6 +313,47 @@ async handleWebhook(request) {
313
313
 
314
314
  Returns: `Promise<{ status?: number; body?: unknown }>`
315
315
 
316
+ #### `getRoutes()`
317
+
318
+ Return API routes this provider needs on the Mastra server, such as webhook receivers or OAuth callbacks. Optional. When the provider's agent is registered, Mastra adds these routes to `server.apiRoutes`, so you don't add them by hand.
319
+
320
+ Routes are collected when the agent is registered. If you add an agent with `addAgent()` after the server has started, its provider routes aren't served until the server restarts. `removeAgent()` removes the agent's provider routes, unless another registered agent uses the same provider instance.
321
+
322
+ If a route with the same method and path is already registered, the existing route wins:
323
+
324
+ - A provider shared by several agents mounts its routes once.
325
+ - A route in `server.apiRoutes` or a file-system route replaces the provider route, and Mastra logs a warning.
326
+ - If two different providers declare the same route, the first one registered is mounted and Mastra logs a warning.
327
+
328
+ ```typescript
329
+ getRoutes() {
330
+ return [
331
+ registerApiRoute('/acme/webhook', {
332
+ method: 'POST',
333
+ requiresAuth: false,
334
+ handler: async c => {
335
+ // Public route: verify the sender before handling the payload
336
+ const rawBody = await c.req.text()
337
+ if (!verifyAcmeSignature(rawBody, c.req.header('x-acme-signature'))) {
338
+ return c.json({ error: 'invalid signature' }, 401)
339
+ }
340
+ const result = await this.handleWebhook({ body: JSON.parse(rawBody), headers: c.req.header() })
341
+ return c.json(result.body ?? {}, result.status ?? 200)
342
+ },
343
+ }),
344
+ ]
345
+ }
346
+ ```
347
+
348
+ Returns: `ApiRoute[]`
349
+
350
+ Provider routes follow the same rules as other [custom API routes](https://mastra.ai/docs/server/custom-api-routes). Adding a provider to an agent mounts its routes with no extra step from the user, so set access on each route deliberately:
351
+
352
+ - Routes require authentication by default when the server has auth configured.
353
+ - A route with `requiresAuth: false` is public. Verify the sender, for example with a webhook signature, before calling `handleWebhook()`.
354
+ - An authenticated route should set `requiresPermission` or `fga`. When an FGA provider audits protected routes, routes with neither are reported at startup.
355
+ - Paths can't start with the server's `apiPrefix` (`/api` by default). The server throws at startup. Use a provider-specific prefix such as `/acme/...`.
356
+
316
357
  ### Lifecycle
317
358
 
318
359
  #### `start()`
@@ -138,16 +138,6 @@ const stream = await agent.stream('message for agent')
138
138
 
139
139
  **options.onStepFinish** (`StreamTextOnStepFinishCallback<any> | never`): Callback function called after each execution step. Receives step details as a JSON string. Unavailable for structured output
140
140
 
141
- **options.telemetry** (`TelemetrySettings`): Settings for OTLP telemetry collection during streaming (not Tracing).
142
-
143
- **options.telemetry.isEnabled** (`boolean`): Enable or disable telemetry. Disabled by default while experimental.
144
-
145
- **options.telemetry.recordInputs** (`boolean`): Enable or disable input recording. Enabled by default. You might want to disable input recording to avoid recording sensitive information.
146
-
147
- **options.telemetry.recordOutputs** (`boolean`): Enable or disable output recording. Enabled by default. You might want to disable output recording to avoid recording sensitive information.
148
-
149
- **options.telemetry.functionId** (`string`): Identifier for this function. Used to group telemetry data by function.
150
-
151
141
  **options.modelSettings** (`CallSettings`): Model-specific settings like temperature, maxOutputTokens, topP, etc. These settings control how the language model generates responses.
152
142
 
153
143
  **options.modelSettings.temperature** (`number`): Controls randomness in generation (0-2). Higher values make output more random.
@@ -294,6 +284,25 @@ Unlike streams, [memory recall](https://mastra.ai/reference/memory/recall) hides
294
284
 
295
285
  Exclusions control returned data, not authorization or delivery. They aren't a security boundary. Signal options such as `ifActive`, `ifIdle`, `persist`/`discard`, and `transient` retain their delivery and persistence meanings.
296
286
 
287
+ ## Aborting a run
288
+
289
+ Pass an [`abortSignal`](#parameters) to stop a run from outside the agent:
290
+
291
+ ```ts
292
+ const controller = new AbortController()
293
+ const stream = await agent.stream('Summarize this repo', { abortSignal: controller.signal })
294
+
295
+ setTimeout(() => controller.abort(), 5_000)
296
+ ```
297
+
298
+ What abort does and doesn't do:
299
+
300
+ - **The stream carries an `abort` chunk.** When the signal fires, the run stops at its next check and `fullStream` emits an `abort` chunk. The run's status ends as canceled with an `aborted` finish reason, and `onAbort` receives the steps that completed before the abort plus the assistant text streamed so far for the in-flight step.
301
+ - **The abort is cooperative.** It takes effect at the next check inside the run. It doesn't forcibly stop tool code or an `onOutput` hook that's already executing, and side effects those started may still complete.
302
+ - **Text the user already saw is saved.** With writable memory, the assistant text streamed before the abort is persisted to the thread as an ordinary assistant message, without an error part. Canceled runs still pass through output processors, so a processor that throws can still affect that save. Output that never reaches them isn't persisted.
303
+
304
+ To abort a run you no longer hold a handle to, use the `runId` with [`durableAgent.abortRunStream(runId)`](https://mastra.ai/reference/agents/durable-agent), which ends the run the same way.
305
+
297
306
  ## Extended usage example
298
307
 
299
308
  ### Mastra Format (Default)
@@ -58,16 +58,6 @@ await agent.streamLegacy('message for agent')
58
58
 
59
59
  **options.resourceId** (`string`): \*\*Deprecated.\*\* Use memory.resource instead. Identifier for the user or resource interacting with the agent. Must be provided if threadId is provided.
60
60
 
61
- **options.telemetry** (`TelemetrySettings`): Settings for telemetry collection during streaming.
62
-
63
- **options.telemetry.isEnabled** (`boolean`): Enable or disable telemetry. Disabled by default while experimental.
64
-
65
- **options.telemetry.recordInputs** (`boolean`): Enable or disable input recording. Enabled by default. You might want to disable input recording to avoid recording sensitive information.
66
-
67
- **options.telemetry.recordOutputs** (`boolean`): Enable or disable output recording. Enabled by default. You might want to disable output recording to avoid recording sensitive information.
68
-
69
- **options.telemetry.functionId** (`string`): Identifier for this function. Used to group telemetry data by function.
70
-
71
61
  **options.temperature** (`number`): Controls randomness in the model's output. Higher values (e.g., 0.8) make the output more random, lower values (e.g., 0.2) make it more focused and deterministic.
72
62
 
73
63
  **options.threadId** (`string`): \*\*Deprecated.\*\* Use memory.thread instead. Identifier for the conversation thread. Allows for maintaining context across multiple interactions. Must be provided if resourceId is provided.
@@ -200,7 +200,7 @@ const stat = await filesystem.stat('docs/guide.md')
200
200
  ```typescript
201
201
  interface FileStat {
202
202
  name: string // File or directory name (basename only)
203
- path: string // Path relative to the filesystem basePath
203
+ path: string // Path within the filesystem namespace; relative to basePath for LocalFilesystem
204
204
  type: 'file' | 'directory'
205
205
  size: number
206
206
  createdAt: Date
@@ -147,7 +147,7 @@ await filesystem.writeFile('nested/path/file.md', content, { recursive: true })
147
147
 
148
148
  ### `appendFile(path, content)`
149
149
 
150
- Append content to an existing file.
150
+ Append content to a file, creating it if it doesn't exist.
151
151
 
152
152
  ```typescript
153
153
  await filesystem.appendFile('logs/app.log', 'New log entry\n')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "1.3.10",
3
+ "version": "1.3.11-alpha.1",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,8 +26,8 @@
26
26
  "@mastra/mcp-legacy": "npm:@mastra/mcp@^1.18.0",
27
27
  "local-pkg": "^1.2.1",
28
28
  "zod": "^4.6.7",
29
- "@mastra/mcp": "^2.6.0",
30
- "@mastra/core": "1.80.0"
29
+ "@mastra/core": "1.81.0-alpha.0",
30
+ "@mastra/mcp": "^2.6.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@hono/node-server": "^2.1.3",
@@ -44,7 +44,7 @@
44
44
  "vitest": "4.1.12",
45
45
  "@internal/lint": "0.0.146",
46
46
  "@internal/types-builder": "0.0.121",
47
- "@mastra/core": "1.80.0"
47
+ "@mastra/core": "1.81.0-alpha.0"
48
48
  },
49
49
  "homepage": "https://mastra.ai",
50
50
  "repository": {