@mastra/mcp-docs-server 1.2.16-alpha.3 → 1.2.16-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.
- package/.docs/docs/agents/a2a.md +1 -1
- package/.docs/docs/agents/overview.md +2 -0
- package/.docs/docs/agents/processors.md +4 -4
- package/.docs/docs/agents/structured-output.md +1 -1
- package/.docs/docs/agents/using-tools.md +15 -11
- package/.docs/docs/browser/overview.md +22 -3
- package/.docs/docs/capabilities/subagents.md +2 -2
- package/.docs/docs/datasets/running-experiments.md +2 -2
- package/.docs/docs/deployment/overview.md +3 -3
- package/.docs/docs/deployment/sandbox.md +1 -1
- package/.docs/docs/deployment/workers.md +5 -5
- package/.docs/docs/deployment/workflow-runners.md +1 -1
- package/.docs/docs/editor/overview.md +3 -1
- package/.docs/docs/evals/custom-scorers.md +1 -1
- package/.docs/docs/evals/multi-turn.md +1 -1
- package/.docs/docs/evals/overview.md +3 -3
- package/.docs/docs/getting-started/develop.md +1 -1
- package/.docs/docs/harness/agent-controller.md +2 -2
- package/.docs/docs/harness/overview.md +1 -1
- package/.docs/docs/long-running-agents/background-tasks.md +2 -2
- package/.docs/docs/long-running-agents/goals.md +3 -2
- package/.docs/docs/long-running-agents/signals.md +2 -2
- package/.docs/docs/mastra-platform/deploy.md +1 -1
- package/.docs/docs/mastra-platform/github.md +1 -1
- package/.docs/docs/mastra-platform/observability.md +1 -1
- package/.docs/docs/mastra-platform/overview.md +3 -3
- package/.docs/docs/mastra-platform/server.md +2 -2
- package/.docs/docs/mastra-platform/trace-intelligence.md +3 -3
- package/.docs/docs/memory/memory-processors.md +1 -1
- package/.docs/docs/memory/message-history.md +2 -2
- package/.docs/docs/memory/observational-memory.md +13 -13
- package/.docs/docs/memory/semantic-recall.md +1 -1
- package/.docs/docs/memory/working-memory.md +1 -1
- package/.docs/docs/observability/logging.md +1 -1
- package/.docs/docs/observability/metrics/querying.md +1 -1
- package/.docs/docs/observability/tracing/overview.md +3 -3
- package/.docs/docs/server/custom-adapters.md +2 -2
- package/.docs/docs/server/custom-api-routes.md +1 -1
- package/.docs/docs/server/mastra-client.md +1 -1
- package/.docs/docs/server/server-adapters.md +1 -1
- package/.docs/docs/studio/deployment.md +2 -2
- package/.docs/docs/studio/observability.md +1 -1
- package/.docs/docs/studio/overview.md +2 -0
- package/.docs/docs/workflows/dynamic-workflows.md +1 -1
- package/.docs/docs/workflows/scheduled-workflows.md +1 -1
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/docs/workspace/overview.md +2 -1
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/docs/workspace/skills.md +1 -1
- package/.docs/integrations/browsers/agent-browser.md +2 -3
- package/.docs/integrations/browsers/firecrawl.md +0 -1
- package/.docs/integrations/browsers/stagehand.md +2 -3
- package/.docs/models/gateways/openrouter.md +1 -2
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/kilo.md +6 -7
- package/.docs/models/providers/nano-gpt.md +2 -1
- package/.docs/reference/acp/acp-agent.md +1 -1
- package/.docs/reference/agent-controller/session.md +1 -1
- package/.docs/reference/agents/channels.md +1 -1
- package/.docs/reference/agents/inngest-agent.md +1 -1
- package/.docs/reference/ai-sdk/overview.md +1 -1
- package/.docs/reference/auth/auth0.md +1 -1
- package/.docs/reference/auth/google.md +1 -1
- package/.docs/reference/browser/agent-browser.md +2 -2
- package/.docs/reference/browser/browser-viewer.md +1 -1
- package/.docs/reference/browser/stagehand-browser.md +2 -2
- package/.docs/reference/channels/channel-provider.md +1 -1
- package/.docs/reference/channels/slack-provider.md +1 -1
- package/.docs/reference/cli/mastra.md +5 -5
- package/.docs/reference/code-sdk/mount-agent-controller.md +1 -1
- package/.docs/reference/coding-agent/build-base-prompt.md +2 -1
- package/.docs/reference/configuration.md +3 -3
- package/.docs/reference/core/getAgentById.md +1 -1
- package/.docs/reference/core/getWorkflow.md +2 -2
- package/.docs/reference/core/mastra-class.md +1 -1
- package/.docs/reference/deployer/netlify.md +1 -1
- package/.docs/reference/deployer.md +1 -1
- package/.docs/reference/editor/prompt-blocks.md +1 -1
- package/.docs/reference/editor/tools.md +1 -1
- package/.docs/reference/evals/completeness.md +1 -1
- package/.docs/reference/evals/noise-sensitivity.md +1 -1
- package/.docs/reference/evals/summarization.md +1 -1
- package/.docs/reference/file-based-agents/config.md +1 -1
- package/.docs/reference/file-based-agents/skills.md +5 -5
- package/.docs/reference/file-based-agents/workspace.md +1 -1
- package/.docs/reference/logging/pino-logger.md +1 -1
- package/.docs/reference/memory/observational-memory.md +12 -4
- package/.docs/reference/migrations/upgrade-to-v1/agent.md +3 -3
- package/.docs/reference/migrations/upgrade-to-v1/client.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/evals.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/mastra.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/mcp.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/overview.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/processors.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/storage.md +5 -5
- package/.docs/reference/migrations/upgrade-to-v1/tools.md +1 -1
- package/.docs/reference/observability/tracing/bridges/datadog.md +1 -1
- package/.docs/reference/observability/tracing/bridges/otel.md +1 -1
- package/.docs/reference/observability/tracing/exporters/arize.md +1 -1
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +2 -2
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +1 -1
- package/.docs/reference/observability/tracing/exporters/otel.md +1 -1
- package/.docs/reference/observability/tracing/exporters/sentry.md +1 -1
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +27 -3
- package/.docs/reference/processors/batch-parts-processor.md +1 -1
- package/.docs/reference/processors/language-detector.md +1 -2
- package/.docs/reference/processors/processor-interface.md +16 -16
- package/.docs/reference/processors/stream-error-retry-processor.md +2 -2
- package/.docs/reference/rag/chunking-and-embedding.md +1 -1
- package/.docs/reference/rag/metadata-filters.md +1 -1
- package/.docs/reference/server/koa-adapter.md +1 -1
- package/.docs/reference/signals/webhook-signal-provider.md +1 -1
- package/.docs/reference/storage/retention.md +1 -1
- package/.docs/reference/tools/bedrock-kb-tool.md +1 -1
- package/.docs/reference/tools/mcp-client.md +3 -3
- package/.docs/reference/tools/mcp-server.md +5 -5
- package/.docs/reference/tools/task-tools.md +1 -1
- package/.docs/reference/tools/vector-query-tool.md +1 -1
- package/.docs/reference/vectors/chroma.md +1 -1
- package/.docs/reference/vectors/convex.md +1 -1
- package/.docs/reference/vectors/couchbase.md +1 -1
- package/.docs/reference/vectors/mongodb.md +2 -2
- package/.docs/reference/vectors/pg.md +1 -1
- package/.docs/reference/vectors/qdrant.md +2 -2
- package/.docs/reference/voice/overview.md +1 -1
- package/.docs/reference/voice/speech-to-speech.md +1 -1
- package/.docs/reference/voice/speech-to-text.md +1 -1
- package/.docs/reference/voice/voice.on.md +1 -1
- package/.docs/reference/voice/voice.updateConfig.md +1 -1
- package/.docs/reference/workspace/local-sandbox.md +1 -1
- package/.docs/reference/workspace/workspace-class.md +1 -1
- package/CHANGELOG.md +7 -0
- package/package.json +4 -4
- package/.docs/docs/browser/recording.md +0 -120
|
@@ -57,7 +57,7 @@ new SensitiveDataFilter(options?: SensitiveDataFilterOptions)
|
|
|
57
57
|
|
|
58
58
|
**redactionToken** (`string`): Replacement value used for full redaction and short values under partial redaction. (Default: `'[REDACTED]'`)
|
|
59
59
|
|
|
60
|
-
**redactionStyle** (`'full' | 'partial'`): Controls
|
|
60
|
+
**redactionStyle** (`'full' | 'partial' | 'indexed'`): Controls how matched values are redacted. (Default: `'full'`)
|
|
61
61
|
|
|
62
62
|
```typescript
|
|
63
63
|
interface SensitiveDataFilterOptions {
|
|
@@ -66,7 +66,7 @@ interface SensitiveDataFilterOptions {
|
|
|
66
66
|
redactionStyle?: RedactionStyle
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
type RedactionStyle = 'full' | 'partial'
|
|
69
|
+
type RedactionStyle = 'full' | 'partial' | 'indexed'
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
## Redaction styles
|
|
@@ -101,6 +101,30 @@ const filter = new SensitiveDataFilter({
|
|
|
101
101
|
{ "apiKey": "sk-…789" }
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
+
### Indexed redaction
|
|
105
|
+
|
|
106
|
+
Indexed redaction replaces each unique value with a stable token derived from the first field name that matched it, for example `[APIKEY_1]`. The same value maps to the same token across the spans of a trace while the trace's mapping is retained, so redacted values stay correlatable without exposing the raw value. Later occurrences under other sensitive fields reuse the first token.
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
const filter = new SensitiveDataFilter({
|
|
110
|
+
redactionStyle: 'indexed',
|
|
111
|
+
})
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```jsonc
|
|
115
|
+
// Before (two spans in the same trace)
|
|
116
|
+
[{ "apiKey": "sk-alice-key" }, { "apiKey": "sk-bob-key" }]
|
|
117
|
+
|
|
118
|
+
// After
|
|
119
|
+
[{ "apiKey": "[APIKEY_1]" }, { "apiKey": "[APIKEY_2]" }]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The mapping is scoped per trace. Numbering restarts for each trace, so tokens from different traces can't be linked.
|
|
123
|
+
|
|
124
|
+
State is bounded in two ways. The filter keeps mappings for the 1000 most recently used traces. The least recently used trace is evicted beyond that, and spans arriving for an evicted trace start a fresh mapping, so later values may receive new tokens. Each trace also tracks up to 1000 unique values. Once that cap is reached, already-tracked values keep their tokens and new values are redacted with `redactionToken`.
|
|
125
|
+
|
|
126
|
+
Non-string values are converted to strings before a token is assigned.
|
|
127
|
+
|
|
104
128
|
## Field matching
|
|
105
129
|
|
|
106
130
|
Field names are lowercased and stripped of non-alphanumeric characters before comparison:
|
|
@@ -165,7 +189,7 @@ Returns: `AnySpan`
|
|
|
165
189
|
|
|
166
190
|
#### `shutdown()`
|
|
167
191
|
|
|
168
|
-
Completes processor shutdown
|
|
192
|
+
Completes processor shutdown and clears the per-trace state used by indexed redaction.
|
|
169
193
|
|
|
170
194
|
```typescript
|
|
171
195
|
await filter.shutdown()
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# BatchPartsProcessor
|
|
4
4
|
|
|
5
|
-
The `BatchPartsProcessor` is an **output processor** that batches multiple stream parts together to reduce the frequency of emissions during streaming. This processor is useful for reducing network overhead
|
|
5
|
+
The `BatchPartsProcessor` is an **output processor** that batches multiple stream parts together to reduce the frequency of emissions during streaming. This processor is useful for reducing network overhead and consolidating small text chunks for users, while controlling emissions to optimize streaming performance.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -40,7 +40,7 @@ const processor = new LanguageDetector({
|
|
|
40
40
|
|
|
41
41
|
**options.includeDetectionDetails** (`boolean`): Whether to include detailed detection info in logs
|
|
42
42
|
|
|
43
|
-
**options.translationQuality** (`'speed' | 'quality' | 'balanced'`):
|
|
43
|
+
**options.translationQuality** (`'speed' | 'quality' | 'balanced'`): Deprecated. This option previously selected prompt-level "Quality Level" guidance, but that behavior was removed when the detection and translation prompts were streamlined. The option now has no effect. For model-specific speed and quality controls, use providerOptions when your provider supports them.
|
|
44
44
|
|
|
45
45
|
**options.providerOptions** (`ProviderOptions`): Provider-specific options passed to the internal detection agent. Use this to control model behavior like reasoning effort for thinking models (e.g., { openai: { reasoningEffort: 'low' } })
|
|
46
46
|
|
|
@@ -74,7 +74,6 @@ export const agent = new Agent({
|
|
|
74
74
|
'Detect language and translate non-English content to English while preserving original intent',
|
|
75
75
|
minTextLength: 10,
|
|
76
76
|
includeDetectionDetails: true,
|
|
77
|
-
translationQuality: 'quality',
|
|
78
77
|
}),
|
|
79
78
|
],
|
|
80
79
|
})
|
|
@@ -78,17 +78,17 @@ Processor methods run at different points in the agent execution lifecycle:
|
|
|
78
78
|
└────────────────────────────────────────────────────────────────────┘
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
| Method | When it runs
|
|
82
|
-
| --------------------- |
|
|
83
|
-
| `processInput` | Once at the start, before the agentic loop
|
|
84
|
-
| `processInputStep` | At each step of the agentic loop, before each LLM call
|
|
85
|
-
| `processLLMRequest` | After LLM request conversion, before the provider call
|
|
86
|
-
| `processAPIError` | When an LLM API call fails
|
|
87
|
-
| `processOutputStream` | On each streaming chunk during LLM response
|
|
88
|
-
| `processLLMResponse` | After the LLM step completes and stream chunks are collected
|
|
89
|
-
| `processOutputStep` | After each LLM response, before tool execution
|
|
90
|
-
| `processToolResult` | Per tool, after
|
|
91
|
-
| `processOutputResult` | Once after generation completes
|
|
81
|
+
| Method | When it runs | Use case |
|
|
82
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
|
|
83
|
+
| `processInput` | Once at the start, before the agentic loop | Validate/transform initial user input, add context |
|
|
84
|
+
| `processInputStep` | At each step of the agentic loop, before each LLM call | Transform messages between steps, handle tool results |
|
|
85
|
+
| `processLLMRequest` | After LLM request conversion, before the provider call | Rewrite the outbound `LanguageModelV2Prompt` for the current call without persisting changes |
|
|
86
|
+
| `processAPIError` | When an LLM API call fails | Inspect API rejections, optionally mutate state/messages, and request a retry |
|
|
87
|
+
| `processOutputStream` | On each streaming chunk during LLM response | Filter/modify streaming content, detect patterns in real-time |
|
|
88
|
+
| `processLLMResponse` | After the LLM step completes and stream chunks are collected | Capture or cache the full response, run post-call side effects paired with `processLLMRequest` |
|
|
89
|
+
| `processOutputStep` | After each LLM response, before tool execution | Validate output quality, implement guardrails with retry |
|
|
90
|
+
| `processToolResult` | Per tool, after a locally executed tool returns or a provider-executed result arrives, before the raw result is persisted to `messageList` | Inspect tool output and enforce security policies |
|
|
91
|
+
| `processOutputResult` | Once after generation completes | Post-process final response, log results |
|
|
92
92
|
|
|
93
93
|
## Interface definition
|
|
94
94
|
|
|
@@ -212,7 +212,7 @@ function getText(message: MastraDBMessage): string {
|
|
|
212
212
|
|
|
213
213
|
Key points:
|
|
214
214
|
|
|
215
|
-
- `message.content.parts` is the primary source. A single message can contain multiple parts
|
|
215
|
+
- `message.content.parts` is the primary source. A single message can contain multiple parts. Non-text parts include tool calls and tool results, plus file parts. Filter by `part.type === 'text'` before reading `part.text`.
|
|
216
216
|
- `message.content.content` is a flattened string kept for backward compatibility. Use it only as a fallback when `parts` is empty or missing.
|
|
217
217
|
- `message.content` itself is never a plain string on `MastraDBMessage`. Legacy `CoreMessage` shapes may be strings, but processors always receive `MastraDBMessage`.
|
|
218
218
|
|
|
@@ -365,7 +365,7 @@ System messages are **reset to their original values** at the start of each step
|
|
|
365
365
|
#### Use cases
|
|
366
366
|
|
|
367
367
|
- Dynamic model switching based on step number or context
|
|
368
|
-
- Disabling tools after a
|
|
368
|
+
- Disabling tools after a configured number of steps
|
|
369
369
|
- Dynamically adding or replacing tools based on conversation context
|
|
370
370
|
- Transforming message part types between providers (e.g., `reasoning` → `thinking` for Anthropic)
|
|
371
371
|
- Modifying messages based on step number or accumulated context
|
|
@@ -708,11 +708,11 @@ export class QualityGuardrail implements Processor {
|
|
|
708
708
|
|
|
709
709
|
### `processToolResult`
|
|
710
710
|
|
|
711
|
-
Processes a tool's result after
|
|
711
|
+
Processes a tool's result after a locally executed tool returns or a provider-executed result arrives, before the raw result is persisted to `messageList` or fed to the next LLM call. Symmetric with `processOutputStep`, which fires before tool execution. Use this method to enforce security policies on tool output. For example, scan for prompt injection or redact sensitive fields. Call `abort('reason', { retry: true })` to abort and retry the same step.
|
|
712
712
|
|
|
713
|
-
To replace the tool's result, mutate `messageList` in place via `messageList.updateToolInvocation`. The runtime re-reads the post-processor result from the message list and overwrites the downstream tool-result stream chunk before it
|
|
713
|
+
To replace the tool's result, mutate `messageList` in place via `messageList.updateToolInvocation`. The runtime re-reads the post-processor result from the message list and overwrites the downstream tool-result stream chunk before it's enqueued, so streaming clients see the processed value.
|
|
714
714
|
|
|
715
|
-
This method
|
|
715
|
+
This method doesn't fire when `tool.execute()` throws. It's called only for successful tool executions where a result is available.
|
|
716
716
|
|
|
717
717
|
```typescript
|
|
718
718
|
processToolResult?(args: ProcessToolResultArgs): ProcessorMessageResult;
|
|
@@ -49,7 +49,7 @@ For retryable errors with a `Retry-After` response header, the processor reads c
|
|
|
49
49
|
|
|
50
50
|
## Retry unknown errors
|
|
51
51
|
|
|
52
|
-
Set `retryUnknownErrors` to retry errors that don't match provider metadata
|
|
52
|
+
Set `retryUnknownErrors` to retry errors that don't match provider metadata or the built-in OpenAI matcher, including a custom matcher. Unknown-error retries use the processor-level `maxRetries` and `delayMs` values. Known authorization failures, including HTTP `401` and `403` responses, aren't retried:
|
|
53
53
|
|
|
54
54
|
```typescript
|
|
55
55
|
import { Agent } from '@mastra/core/agent'
|
|
@@ -105,7 +105,7 @@ export const agent = new Agent({
|
|
|
105
105
|
|
|
106
106
|
## Default OpenAI Responses matcher
|
|
107
107
|
|
|
108
|
-
`isRetryableOpenAIResponsesStreamError` matches OpenAI Responses stream error chunks with `type: 'error'` or `type: 'response.failed'`. It retries known transient OpenAI error codes
|
|
108
|
+
`isRetryableOpenAIResponsesStreamError` matches OpenAI Responses stream error chunks with `type: 'error'` or `type: 'response.failed'`. It retries known transient OpenAI error codes. As a fallback, it retries errors with explicit retry guidance such as `You can retry your request`.
|
|
109
109
|
|
|
110
110
|
`StreamErrorRetryProcessor` includes this matcher by default. You can also import it and reuse it in custom retry logic.
|
|
111
111
|
|
|
@@ -127,7 +127,7 @@ const { embeddings } = await embedMany({
|
|
|
127
127
|
})
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
> **Vector Database Compatibility:** When storing embeddings, the vector database index
|
|
130
|
+
> **Vector Database Compatibility:** When storing embeddings, configure the vector database index to match the output size of your embedding model to avoid errors or data corruption from mismatched dimensions.
|
|
131
131
|
|
|
132
132
|
## Example: Complete pipeline
|
|
133
133
|
|
|
@@ -201,7 +201,7 @@ const results = await store.query({
|
|
|
201
201
|
### Amazon S3 Vectors
|
|
202
202
|
|
|
203
203
|
- Equality values must be primitives (string/number/boolean). `null`/`undefined`, arrays, objects, and Date aren't allowed for equality. Range operators accept numbers or Date (Dates are normalized to epoch ms).
|
|
204
|
-
- `$in`/`$nin` require **non-empty arrays of primitives
|
|
204
|
+
- `$in`/`$nin` require **non-empty arrays of primitives**. Date elements are allowed and normalized to epoch ms. **Array equality** isn't supported.
|
|
205
205
|
- Implicit AND is canonicalized (`{a:1,b:2}` → `{$and:[{a:1},{b:2}]`). Logical operators must contain field conditions and use non-empty arrays. They may appear only at the root or within other logical operators (not inside field values).
|
|
206
206
|
- Keys listed in `nonFilterableMetadataKeys` at index creation are stored but not filterable. This setting is immutable.
|
|
207
207
|
- $exists requires a boolean value.
|
|
@@ -76,7 +76,7 @@ app.listen(3000, () => {
|
|
|
76
76
|
|
|
77
77
|
## Error handling
|
|
78
78
|
|
|
79
|
-
The Koa adapter propagates errors from route handlers up through Koa's middleware chain, following Koa's standard error handling pattern.
|
|
79
|
+
The Koa adapter propagates errors from route handlers up through Koa's middleware chain, following Koa's standard error handling pattern. You can use regular Koa error-handling middleware:
|
|
80
80
|
|
|
81
81
|
```typescript
|
|
82
82
|
const app = new Koa()
|
|
@@ -100,7 +100,7 @@ Returns: `boolean`
|
|
|
100
100
|
|
|
101
101
|
#### `handleWebhook(request)`
|
|
102
102
|
|
|
103
|
-
Process an incoming webhook request. Extracts the resource ID from the payload
|
|
103
|
+
Process an incoming webhook request. Extracts the resource ID from the payload and finds matching subscriptions. It builds a notification for each subscription and calls `notify()`.
|
|
104
104
|
|
|
105
105
|
```typescript
|
|
106
106
|
const result = await webhookProvider.handleWebhook({
|
|
@@ -234,7 +234,7 @@ const storage = new MongoDBStore({
|
|
|
234
234
|
|
|
235
235
|
`prune()` deletes rows but doesn't shrink the database file. On SQLite/libSQL the freed pages go on a freelist and are reused by future writes, so the file stops growing: for most users this alone solves the unbounded-growth problem.
|
|
236
236
|
|
|
237
|
-
Handing that free space back to the OS is a separate concern that Mastra doesn't manage. If you specifically need to shrink the file, run the underlying database's compaction (for example `VACUUM` on self-hosted libSQL) yourself in a maintenance window. A full `VACUUM` locks the file and needs roughly twice the file size in free disk. On PostgreSQL, autovacuum reclaims dead tuples for reuse automatically
|
|
237
|
+
Handing that free space back to the OS is a separate concern that Mastra doesn't manage. If you specifically need to shrink the file, run the underlying database's compaction (for example `VACUUM` on self-hosted libSQL) yourself in a maintenance window. A full `VACUUM` locks the file and needs roughly twice the file size in free disk. On PostgreSQL, autovacuum reclaims dead tuples for reuse automatically. A manual `VACUUM FULL` is only needed if you must return disk to the OS.
|
|
238
238
|
|
|
239
239
|
For MongoDB, deleted documents are reused by future insertions. To reclaim disk space, run [`db.runCommand({ compact: "collection_name" })`](https://www.mongodb.com/docs/manual/reference/command/compact/) during a maintenance window.
|
|
240
240
|
|
|
@@ -65,7 +65,7 @@ The tool returns an object with:
|
|
|
65
65
|
| ---------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
66
66
|
| `content` | `string` | The text content of the retrieved passage. |
|
|
67
67
|
| `source` | `string \| undefined` | The source URI when Bedrock provides one. Agentic retrieval only includes this field when the result metadata contains `_source_uri`. |
|
|
68
|
-
| `score` | `number \| undefined` | The relevance score returned by standard retrieval
|
|
68
|
+
| `score` | `number \| undefined` | The relevance score returned by standard retrieval, which the agentic API omits from result items. |
|
|
69
69
|
| `metadata` | `Record<string, unknown>` | Additional metadata from the retrieval result. |
|
|
70
70
|
|
|
71
71
|
## Retrieval Modes
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# MCPClient
|
|
4
4
|
|
|
5
|
-
The `MCPClient` class provides a way to manage multiple MCP server connections and their tools in a Mastra application. It handles connection lifecycle
|
|
5
|
+
The `MCPClient` class provides a way to manage multiple MCP server connections and their tools in a Mastra application. It handles connection lifecycle and tool namespacing while providing access to tools across all configured servers.
|
|
6
6
|
|
|
7
7
|
## Constructor
|
|
8
8
|
|
|
@@ -248,7 +248,7 @@ const res = await agent.stream(prompt, {
|
|
|
248
248
|
|
|
249
249
|
Returns every server's tools as plain, serializable definitions, grouped by server name and keyed by the server's own tool name (without the `serverName_toolName` namespacing that `listTools()` applies).
|
|
250
250
|
|
|
251
|
-
Unlike `listTools()`, the result contains no functions or references to a live client, so it can be passed through `JSON.stringify` and cached in Redis
|
|
251
|
+
Unlike `listTools()`, the result contains no functions or references to a live client, so it can be passed through `JSON.stringify` and cached in Redis or a database, as well as a build artifact. Each definition holds the data from the MCP `tools/list` response (name, description, input schema, output schema, annotations, and `_meta`), plus the server name, version, and instructions captured at discovery time.
|
|
252
252
|
|
|
253
253
|
```typescript
|
|
254
254
|
const definitions = await mcp.listToolDefinitions()
|
|
@@ -991,7 +991,7 @@ try {
|
|
|
991
991
|
|
|
992
992
|
Concurrent `authenticate()` calls for the same server join the pending flow. Different servers authenticate independently. With valid stored tokens the call reconnects without opening a browser.
|
|
993
993
|
|
|
994
|
-
Hosts that drive the flow themselves can capture the authorization code with the exported `createOAuthCallbackServer` helper, which binds a one-shot loopback server
|
|
994
|
+
Hosts that drive the flow themselves can capture the authorization code with the exported `createOAuthCallbackServer` helper, which binds a one-shot loopback server and validates the OAuth `state` parameter before resolving with the code. It creates a plain HTTP server, so it's only for local loopback redirects. Web applications that use an HTTPS redirect URL must host their own callback endpoint and drive the provider directly rather than using this helper:
|
|
995
995
|
|
|
996
996
|
```typescript
|
|
997
997
|
import { createOAuthCallbackServer, getCallbackUrlCandidates } from '@mastra/mcp'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# MCPServer
|
|
4
4
|
|
|
5
|
-
The `MCPServer` class provides the functionality to expose your existing Mastra tools and Agents as a Model Context Protocol (MCP) server.
|
|
5
|
+
The `MCPServer` class provides the functionality to expose your existing Mastra tools and Agents as a Model Context Protocol (MCP) server. Any MCP client, such as Cursor, Windsurf, or Claude Desktop, can connect to these capabilities and make them available to an agent.
|
|
6
6
|
|
|
7
7
|
Note that if you only need to use your tools or agents directly within your Mastra application, you don't necessarily need to create an MCP server. This API is specifically for exposing your Mastra tools and agents to _external_ MCP clients.
|
|
8
8
|
|
|
@@ -95,7 +95,7 @@ The constructor accepts an `MCPServerConfig` object with the following propertie
|
|
|
95
95
|
|
|
96
96
|
A powerful feature of `MCPServer` is its ability to automatically expose your Mastra Agents as callable tools. When you provide agents in the `agents` property of the configuration:
|
|
97
97
|
|
|
98
|
-
- **Tool Naming**: Each agent is converted into a tool
|
|
98
|
+
- **Tool Naming**: Each agent is converted into a tool with the name `ask_<agentKey>`, where `<agentKey>` is the key you used for that agent in the `agents` object. For instance, if you configure `agents: { myAgentKey: myAgentInstance }`, a tool with the name `ask_myAgentKey` will be created.
|
|
99
99
|
|
|
100
100
|
- **Tool Functionality**:
|
|
101
101
|
|
|
@@ -104,7 +104,7 @@ A powerful feature of `MCPServer` is its ability to automatically expose your Ma
|
|
|
104
104
|
- **Execution**: When this tool is called, it invokes the corresponding agent's `generate()` method with the provided `query`.
|
|
105
105
|
- **Output**: The direct result from the agent's `generate()` method is returned as the output of the tool.
|
|
106
106
|
|
|
107
|
-
- **Name collisions.** If an explicit tool defined in the `tools` configuration has the same name as an agent-derived tool (e.g., a tool
|
|
107
|
+
- **Name collisions.** If an explicit tool defined in the `tools` configuration has the same name as an agent-derived tool (e.g., a tool with the name `ask_myAgentKey` alongside an agent keyed as `myAgentKey`), the _explicitly defined tool will take precedence_. The agent won't be converted into a tool in this conflicting case, and a warning will be logged.
|
|
108
108
|
|
|
109
109
|
This makes it straightforward to allow MCP clients to interact with your agents using natural language queries, like any other tool.
|
|
110
110
|
|
|
@@ -116,7 +116,7 @@ The description for this generated tool will be: "Ask agent `<agent.name>` a que
|
|
|
116
116
|
|
|
117
117
|
For an agent to be converted into a tool, it **must** have a non-empty `description` string property set in its configuration when it was instantiated (e.g., `new Agent({ id: 'my-agent', name: 'myAgent', description: 'This agent does X.', ... })`). If an agent is passed to `MCPServer` with a missing or empty `description`, an error will be thrown when the `MCPServer` is instantiated, and server setup will fail.
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
Clients can use MCP to access your agents' generative capabilities and ask them questions directly.
|
|
120
120
|
|
|
121
121
|
### Accessing MCP Context in Tools
|
|
122
122
|
|
|
@@ -1240,7 +1240,7 @@ const customMiddleware = createOAuthMiddleware({
|
|
|
1240
1240
|
|
|
1241
1241
|
## Authentication context
|
|
1242
1242
|
|
|
1243
|
-
Tools can access request metadata via `context.mcp.extra` when using HTTP-based transports.
|
|
1243
|
+
Tools can access request metadata via `context.mcp.extra` when using HTTP-based transports. You can pass authentication info and user context, as well as custom data from your HTTP middleware to your MCP tools.
|
|
1244
1244
|
|
|
1245
1245
|
### How it works
|
|
1246
1246
|
|
|
@@ -25,7 +25,7 @@ const agent = new Agent({
|
|
|
25
25
|
})
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
Or import the tools directly:
|
|
28
|
+
Or import the tools directly. `taskWriteTool`, `taskUpdateTool`, `taskCompleteTool`, and `taskCheckTool` are the export names; `task_write`, `task_update`, `task_complete`, and `task_check` are the tool IDs the model sees in tool calls and traces:
|
|
29
29
|
|
|
30
30
|
```typescript
|
|
31
31
|
import { taskWriteTool, taskUpdateTool, taskCompleteTool, taskCheckTool } from '@mastra/core/tools'
|
|
@@ -353,7 +353,7 @@ const response = await agent.generate('Find information about deployment', {
|
|
|
353
353
|
})
|
|
354
354
|
```
|
|
355
355
|
|
|
356
|
-
|
|
356
|
+
Runtime configuration supports these use cases:
|
|
357
357
|
|
|
358
358
|
- Switch between environments (dev/staging/prod)
|
|
359
359
|
- Adjust performance parameters based on load
|
|
@@ -56,7 +56,7 @@ Otherwise, you have several options for setting up your single-node Chroma serve
|
|
|
56
56
|
|
|
57
57
|
Note: Forking is only supported on Chroma Cloud, or if you deploy your own OSS **distributed** Chroma.
|
|
58
58
|
|
|
59
|
-
`forkIndex`
|
|
59
|
+
`forkIndex` instantly forks an existing Chroma index without affecting the original index. Learn more on the [Chroma docs](https://docs.trychroma.com/cloud/collection-forking).
|
|
60
60
|
|
|
61
61
|
**indexName** (`string`): Name of the index to fork
|
|
62
62
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
The `ConvexVector` class provides vector storage and similarity search using [Convex](https://convex.dev). It stores embeddings inside Convex and performs cosine similarity search in the Mastra adapter.
|
|
6
6
|
|
|
7
|
-
> **Development-scale search:** `ConvexVector` reads matching vectors through the Mastra storage handler
|
|
7
|
+
> **Development-scale search:** `ConvexVector` reads matching vectors through the Mastra storage handler and filters them in JavaScript. It then computes cosine similarity and sorts the results before returning the top matches. Use it for local development, tests, and small datasets.
|
|
8
8
|
>
|
|
9
9
|
> For production vector search on Convex, use `ConvexNativeVector`. It uses the Convex native `vectorSearch` API, which requires a deployed Convex vector index and a Convex action.
|
|
10
10
|
|
|
@@ -101,7 +101,7 @@ Adds or updates vectors and their metadata in the collection.
|
|
|
101
101
|
|
|
102
102
|
Searches for similar vectors.
|
|
103
103
|
|
|
104
|
-
> **Warning:** The `filter` and `includeVector` parameters aren't currently supported. Filtering must be performed client-side after retrieving results
|
|
104
|
+
> **Warning:** The `filter` and `includeVector` parameters aren't currently supported. Filtering must be performed client-side after retrieving results or through the Couchbase SDK's Search capabilities. Retrieve the vector embedding by fetching the full document by ID with the Couchbase SDK.
|
|
105
105
|
|
|
106
106
|
**indexName** (`string`): Name of the index to search in
|
|
107
107
|
|
|
@@ -220,7 +220,7 @@ const results = await store.textQuery({
|
|
|
220
220
|
|
|
221
221
|
### `hybridQuery()`
|
|
222
222
|
|
|
223
|
-
Runs a hybrid search that fuses vector similarity and full-text results using MongoDB's server-side `$rankFusion`. It requires MongoDB >= 8.0 and is generally available from 8.1. On 8.0.x, it may
|
|
223
|
+
Runs a hybrid search that fuses vector similarity and full-text results using MongoDB's server-side `$rankFusion`. It requires MongoDB >= 8.0 and is generally available from 8.1. On 8.0.x, it may require a MongoDB support case for enablement. It runs where enabled, including Atlas 8.0.x. A full-text search index must exist: it's auto-created for managed indexes, but for a bring-your-own collection you must call `createSearchIndex()` first (opt-in).
|
|
224
224
|
|
|
225
225
|
**indexName** (`string`): Name of the Mastra index to search
|
|
226
226
|
|
|
@@ -276,7 +276,7 @@ interface IndexStats {
|
|
|
276
276
|
Deletes a vector index. Behavior depends on how the index was created:
|
|
277
277
|
|
|
278
278
|
- **Managed index** (created without `collectionName`): drops the entire collection and all its data.
|
|
279
|
-
- **Bring-your-own index** (created with `collectionName`): drops the Atlas vectorSearch index
|
|
279
|
+
- **Bring-your-own index** (created with `collectionName`): drops the Atlas vectorSearch index. If `createSearchIndex()` provisioned a companion full-text search index, it drops that index too. The caller's operational collection and its documents are preserved. This store never drops a collection it didn't create.
|
|
280
280
|
|
|
281
281
|
The BYO classification is recorded durably when the index is created, so it's applied correctly even by a different process (e.g. an index created by a setup job and later deleted by a long-lived service). Always pass the **logical index name** (the `indexName` used at `createIndex`), not the physical collection name.
|
|
282
282
|
|
|
@@ -350,7 +350,7 @@ The `PgVector` class exposes its underlying PostgreSQL connection pool as a publ
|
|
|
350
350
|
pgVector.pool // instance of pg.Pool
|
|
351
351
|
```
|
|
352
352
|
|
|
353
|
-
|
|
353
|
+
Direct pool access supports advanced operations such as direct SQL queries, transactions, or pool-state monitoring. When using the pool directly:
|
|
354
354
|
|
|
355
355
|
- You are responsible for releasing clients (`client.release()`) after use.
|
|
356
356
|
- The pool remains accessible after calling `disconnect()`, but new queries will fail.
|
|
@@ -24,7 +24,7 @@ The QdrantVector class provides vector search using [Qdrant](https://qdrant.tech
|
|
|
24
24
|
|
|
25
25
|
**namedVectors** (`Record<string, { size: number; distance: 'cosine' | 'euclidean' | 'dotproduct' }>`): Configuration for named vector spaces. When provided, creates a collection with multiple named vector fields.
|
|
26
26
|
|
|
27
|
-
#### Creating a
|
|
27
|
+
#### Creating a `named vectors` Collection
|
|
28
28
|
|
|
29
29
|
```typescript
|
|
30
30
|
// Create a collection with multiple named vector spaces
|
|
@@ -84,7 +84,7 @@ await store.upsert({
|
|
|
84
84
|
|
|
85
85
|
**using** (`string`): Name of the vector field to query when using named vectors. Use this when your collection has multiple named vector fields.
|
|
86
86
|
|
|
87
|
-
####
|
|
87
|
+
#### `named vectors`
|
|
88
88
|
|
|
89
89
|
Qdrant supports [multiple vectors per collection](https://qdrant.tech/documentation/concepts/vectors/#named-vectors), with a name assigned to each vector field. Use the `using` parameter to select the vector field to query:
|
|
90
90
|
|
|
@@ -748,7 +748,7 @@ Visit the [xAI Realtime Voice Reference](https://mastra.ai/integrations/voice/xa
|
|
|
748
748
|
|
|
749
749
|
### Realtime voice
|
|
750
750
|
|
|
751
|
-
Run live calls a user can talk over
|
|
751
|
+
Run live calls that a user can talk over in a browser or by phone. Mastra hands the audio loop to LiveKit for voice activity and semantic turn detection, plus barge-in. Your agent generates each reply with its own model, tools, and memory. For setup and configuration options, check out [Realtime voice](https://mastra.ai/integrations/voice/livekit).
|
|
752
752
|
|
|
753
753
|
## Voice configuration
|
|
754
754
|
|
|
@@ -80,7 +80,7 @@ export const agent = new Agent({
|
|
|
80
80
|
|
|
81
81
|
## Listen for realtime events
|
|
82
82
|
|
|
83
|
-
Realtime voice providers emit events you can use to update your UI
|
|
83
|
+
Realtime voice providers emit events you can use to update your UI and play assistant audio, while logging transcriptions and handling errors:
|
|
84
84
|
|
|
85
85
|
```typescript
|
|
86
86
|
agent.voice.on('speaking', ({ audio }) => {
|
|
@@ -35,7 +35,7 @@ Mastra supports several Speech-to-Text providers, each with their own capabiliti
|
|
|
35
35
|
- [**ElevenLabs**](https://mastra.ai/integrations/voice/elevenlabs): Advanced speech recognition with support for multiple languages
|
|
36
36
|
- [**Google**](https://mastra.ai/integrations/voice/google): Google's speech recognition with extensive language support
|
|
37
37
|
- [**Cloudflare**](https://mastra.ai/integrations/voice/cloudflare): Edge-optimized speech recognition for low-latency applications
|
|
38
|
-
- [**Deepgram**](https://mastra.ai/integrations/voice/deepgram): AI-powered speech recognition with high accuracy for
|
|
38
|
+
- [**Deepgram**](https://mastra.ai/integrations/voice/deepgram): AI-powered speech recognition with high accuracy for multiple accents
|
|
39
39
|
- [**Sarvam**](https://mastra.ai/integrations/voice/sarvam): Specialized in Indic languages and accents
|
|
40
40
|
|
|
41
41
|
Each provider is implemented as a separate package that you can install as needed:
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# voice.on()
|
|
4
4
|
|
|
5
|
-
The `on()` method registers event listeners for voice events. This is particularly important for real-time voice providers, where events are used to communicate transcribed text
|
|
5
|
+
The `on()` method registers event listeners for voice events. This is particularly important for real-time voice providers, where events are used to communicate transcribed text and audio responses, as well as other state changes.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# voice.updateConfig()
|
|
4
4
|
|
|
5
|
-
The `updateConfig()` method allows you to update the configuration of a voice provider at runtime. This is useful for changing voice settings
|
|
5
|
+
The `updateConfig()` method allows you to update the configuration of a voice provider at runtime. This is useful for changing voice settings and API keys, along with other provider-specific options without creating a new instance.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -146,7 +146,7 @@ const detection = LocalSandbox.detectIsolation()
|
|
|
146
146
|
|
|
147
147
|
## Environment isolation
|
|
148
148
|
|
|
149
|
-
By default, `LocalSandbox` only includes `PATH` in the environment.
|
|
149
|
+
By default, `LocalSandbox` only includes `PATH` in the environment. Commands can run without accidental exposure of API keys and secrets.
|
|
150
150
|
|
|
151
151
|
```typescript
|
|
152
152
|
// Default: only PATH is available (commands work, secrets protected)
|
|
@@ -278,7 +278,7 @@ const instructions = workspace.getInstructions({ requestContext })
|
|
|
278
278
|
|
|
279
279
|
#### `getInstructionsAsync(opts?)`
|
|
280
280
|
|
|
281
|
-
Returns combined workspace instructions. Use this when the workspace uses resolver-backed providers. A runtime-defined filesystem is resolved per request
|
|
281
|
+
Returns combined workspace instructions. Use this when the workspace uses resolver-backed providers. A runtime-defined filesystem is resolved per request. A runtime-defined sandbox contributes stable placeholder text unless `instructions.dynamicSandbox` is set to `'resolve'`.
|
|
282
282
|
|
|
283
283
|
```typescript
|
|
284
284
|
const instructions = await workspace.getInstructionsAsync({ requestContext })
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.2.16-alpha.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`898bba4`](https://github.com/mastra-ai/mastra/commit/898bba46d4806dd255a44e5dc3a3d5827eaefdfe), [`f9aab1c`](https://github.com/mastra-ai/mastra/commit/f9aab1cfc3fda03238a7fd7bd8b794e07497878c), [`e31421b`](https://github.com/mastra-ai/mastra/commit/e31421bc9c11c03c6e74f447ecb5820000e2b9d7), [`aece0e7`](https://github.com/mastra-ai/mastra/commit/aece0e7cb124ae1eb1230689b887f5554b9a0bf0)]:
|
|
8
|
+
- @mastra/core@1.59.0-alpha.2
|
|
9
|
+
|
|
3
10
|
## 1.2.16-alpha.2
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.2.16-alpha.
|
|
3
|
+
"version": "1.2.16-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",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"jsdom": "^26.1.0",
|
|
29
29
|
"local-pkg": "^1.1.2",
|
|
30
30
|
"zod": "^4.4.3",
|
|
31
|
-
"@mastra/core": "1.59.0-alpha.
|
|
31
|
+
"@mastra/core": "1.59.0-alpha.2",
|
|
32
32
|
"@mastra/mcp": "^1.16.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"typescript": "^6.0.3",
|
|
47
47
|
"vitest": "4.1.10",
|
|
48
48
|
"@internal/lint": "0.0.122",
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
49
|
+
"@mastra/core": "1.59.0-alpha.2",
|
|
50
|
+
"@internal/types-builder": "0.0.97"
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://mastra.ai",
|
|
53
53
|
"repository": {
|