@mastra/mcp-docs-server 1.2.24-alpha.9 → 1.2.24
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/processors.md +1 -0
- package/.docs/docs/evals/datasets.md +13 -3
- package/.docs/docs/evals/experiments.md +8 -0
- package/.docs/docs/guides/agent-lifecycle.md +161 -0
- package/.docs/docs/harness/durable-agents.md +11 -0
- package/.docs/docs/index.md +7 -7
- package/.docs/docs/server/middleware.md +17 -7
- package/.docs/docs/server/request-context.md +7 -5
- package/.docs/docs/workflows/control-flow.md +0 -8
- package/.docs/integrations/browsers/browser-viewer.md +10 -2
- package/.docs/integrations/deploy/kubernetes-helm.md +13 -2
- package/.docs/integrations/frameworks/tanstack-start.md +3 -3
- package/.docs/integrations/observability/langfuse.md +3 -0
- package/.docs/integrations/tools/parallel.md +2 -2
- package/.docs/models/gateways/neon.md +5 -1
- package/.docs/models/gateways/netlify.md +2 -3
- package/.docs/models/gateways/openrouter.md +5 -8
- package/.docs/models/gateways/vercel.md +4 -4
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/302ai.md +52 -33
- package/.docs/models/providers/anthropic.md +1 -31
- package/.docs/models/providers/cerebras.md +6 -36
- package/.docs/models/providers/cortecs.md +2 -5
- package/.docs/models/providers/crof.md +27 -26
- package/.docs/models/providers/crossmodel.md +2 -2
- package/.docs/models/providers/deepinfra.md +2 -33
- package/.docs/models/providers/digitalocean.md +2 -1
- package/.docs/models/providers/edenai.md +12 -9
- package/.docs/models/providers/fireworks-ai.md +2 -1
- package/.docs/models/providers/freemodel.md +0 -28
- package/.docs/models/providers/google.md +1 -31
- package/.docs/models/providers/groq.md +1 -31
- package/.docs/models/providers/hyper.md +5 -4
- package/.docs/models/providers/kilo.md +15 -17
- package/.docs/models/providers/kimi-for-coding.md +0 -28
- package/.docs/models/providers/llmgateway-providers.md +5 -5
- package/.docs/models/providers/llmgateway.md +3 -3
- package/.docs/models/providers/meta.md +0 -28
- package/.docs/models/providers/minimax-cn-coding-plan.md +0 -28
- package/.docs/models/providers/minimax-cn.md +0 -28
- package/.docs/models/providers/minimax-coding-plan.md +0 -28
- package/.docs/models/providers/minimax.md +1 -31
- package/.docs/models/providers/mistral.md +1 -31
- package/.docs/models/providers/moonshotai-cn.md +4 -10
- package/.docs/models/providers/moonshotai.md +4 -10
- package/.docs/models/providers/nano-gpt.md +13 -16
- package/.docs/models/providers/neosmith.md +0 -28
- package/.docs/models/providers/ofox.md +2 -1
- package/.docs/models/providers/openai.md +1 -31
- package/.docs/models/providers/opencode.md +6 -1
- package/.docs/models/providers/orcarouter.md +2 -2
- package/.docs/models/providers/perplexity-agent.md +0 -28
- package/.docs/models/providers/perplexity.md +1 -31
- package/.docs/models/providers/privatemode-ai.md +3 -1
- package/.docs/models/providers/requesty.md +9 -8
- package/.docs/models/providers/sensenova.md +3 -1
- package/.docs/models/providers/subconscious.md +0 -28
- package/.docs/models/providers/thinkingmachines.md +0 -28
- package/.docs/models/providers/togetherai.md +1 -31
- package/.docs/models/providers/vivgrid.md +9 -32
- package/.docs/models/providers/xai.md +1 -31
- package/.docs/reference/agent-controller/session.md +2 -0
- package/.docs/reference/agents/durable-agent.md +7 -1
- package/.docs/reference/build-with-ai.md +8 -24
- package/.docs/reference/cli/mastra.md +30 -0
- package/.docs/reference/client-js/datasets.md +56 -1
- package/.docs/reference/datasets/dataset.md +1 -0
- package/.docs/reference/datasets/datasets-manager.md +14 -0
- package/.docs/reference/datasets/deleteExperiment.md +47 -9
- package/.docs/reference/datasets/purgeItem.md +41 -0
- package/.docs/reference/editor/versioning.md +1 -1
- package/.docs/reference/index.md +1 -0
- package/.docs/reference/processors/processor-interface.md +21 -83
- package/.docs/reference/server/routes.md +44 -19
- package/.docs/reference/tools/graph-rag-tool.md +3 -1
- package/.docs/reference/tools/vector-query-tool.md +4 -2
- package/package.json +5 -5
|
@@ -8,89 +8,27 @@ The `Processor` interface defines the contract for all processors in Mastra. Pro
|
|
|
8
8
|
|
|
9
9
|
## When processor methods run
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
│ │ │ │ │
|
|
33
|
-
│ │ ▼ │ │
|
|
34
|
-
│ │ ┌────────────────────────┐ │ │
|
|
35
|
-
│ │ │ processLLMRequest │ ← Before provider call │ │
|
|
36
|
-
│ │ └───────────┬────────────┘ │ │
|
|
37
|
-
│ │ │ │ │
|
|
38
|
-
│ │ ▼ │ │
|
|
39
|
-
│ │ LLM Execution ──── API Error? ───┐ │ │
|
|
40
|
-
│ │ │ │ │ │
|
|
41
|
-
│ │ │ ┌───────────┴──────────┐ │ │
|
|
42
|
-
│ │ │ │ processAPIError │ │ │
|
|
43
|
-
│ │ │ └──────────────────────┘ │ │
|
|
44
|
-
│ │ │ (retry loops back to LLM) │ │
|
|
45
|
-
│ │ ▼ │ │
|
|
46
|
-
│ │ ┌────────────────────────┐ │ │
|
|
47
|
-
│ │ │ processOutputStream │ ← Runs on EACH stream chunk │ │
|
|
48
|
-
│ │ └───────────┬────────────┘ │ │
|
|
49
|
-
│ │ │ │ │
|
|
50
|
-
│ │ ▼ │ │
|
|
51
|
-
│ │ ┌────────────────────────┐ │ │
|
|
52
|
-
│ │ │ processLLMResponse │ ← After stream completes │ │
|
|
53
|
-
│ │ └───────────┬────────────┘ │ │
|
|
54
|
-
│ │ │ │ │
|
|
55
|
-
│ │ ▼ │ │
|
|
56
|
-
│ │ ┌────────────────────────┐ │ │
|
|
57
|
-
│ │ │ processOutputStep │ ← Runs after EACH LLM step │ │
|
|
58
|
-
│ │ └───────────┬────────────┘ │ │
|
|
59
|
-
│ │ │ │ │
|
|
60
|
-
│ │ ▼ │ │
|
|
61
|
-
│ │ Tool Execution (if needed) │ │
|
|
62
|
-
│ │ │ │ │
|
|
63
|
-
│ │ ▼ │ │
|
|
64
|
-
│ │ ┌────────────────────────┐ │ │
|
|
65
|
-
│ │ │ processToolResult │ ← Runs per tool, after each │ │
|
|
66
|
-
│ │ └───────────┬────────────┘ tool.execute() returns │ │
|
|
67
|
-
│ │ │ │ │
|
|
68
|
-
│ │ └──────── Loop back if tools called ────────────│ │
|
|
69
|
-
│ │ │ │
|
|
70
|
-
│ └──────────────────────────────────────────────────────────────┘ │
|
|
71
|
-
│ │ │
|
|
72
|
-
│ ▼ │
|
|
73
|
-
│ ┌────────────────────────┐ │
|
|
74
|
-
│ │ processOutputResult │ ← Runs ONCE after completion │
|
|
75
|
-
│ └────────────────────────┘ │
|
|
76
|
-
│ │ │
|
|
77
|
-
│ ▼ │
|
|
78
|
-
│ Final Response │
|
|
79
|
-
│ │
|
|
80
|
-
└────────────────────────────────────────────────────────────────────┘
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
| Method | When it runs | Use case |
|
|
84
|
-
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
|
|
85
|
-
| `processInput` | Once at the start, before the agentic loop | Validate/transform initial user input, add context |
|
|
86
|
-
| `processInputStep` | At each step of the agentic loop, before each LLM call | Transform messages between steps, handle tool results |
|
|
87
|
-
| `processLLMRequest` | After LLM request conversion, before the provider call | Rewrite the outbound `LanguageModelV2Prompt` for the current call without persisting changes |
|
|
88
|
-
| `processAPIError` | When an LLM API call fails | Inspect API rejections, optionally mutate state/messages, and request a retry |
|
|
89
|
-
| `processOutputStream` | On each streaming chunk during LLM response | Filter/modify streaming content, detect patterns in real-time |
|
|
90
|
-
| `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` |
|
|
91
|
-
| `processOutputStep` | After each LLM response, before tool execution | Validate output quality, implement guardrails with retry |
|
|
92
|
-
| `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 |
|
|
93
|
-
| `processOutputResult` | Once after generation completes | Post-process final response, log results |
|
|
11
|
+
For a conceptual walkthrough of preparation, the agent loop, tool execution, and finalization, see the [agent lifecycle guide](https://mastra.ai/docs/guides/agent-lifecycle).
|
|
12
|
+
|
|
13
|
+
## Callback timing
|
|
14
|
+
|
|
15
|
+
| Callback or operation | Frequency | Position and visibility |
|
|
16
|
+
| ------------------------------------------------------------------------ | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `processInput` | Once per initial request | During input preparation before the loop. Resuming from a durable snapshot may skip it. |
|
|
18
|
+
| `processInputStep` | Once per model step | Before the provider request. It sees messages and tool results accumulated so far. |
|
|
19
|
+
| `processLLMRequest` | Once per provider call | Last processor stage for rewriting the provider-facing prompt. Its prompt changes aren't written back to the message list. |
|
|
20
|
+
| `processOutputStream` | Per streamed chunk | Runs while model output arrives. Data chunks are included when the processor opts in. |
|
|
21
|
+
| `processLLMResponse` | Once per completed provider stream | Receives the completed response for the current model step. |
|
|
22
|
+
| `processOutputStep` | Once per model step | Runs after the model response and before locally executed tools. |
|
|
23
|
+
| Tool [`onInputStart`](https://mastra.ai/reference/tools/create-tool) | When streamed tool input begins | Runs before complete tool arguments are available. |
|
|
24
|
+
| Tool [`onInputDelta`](https://mastra.ai/reference/tools/create-tool) | Per streamed tool-input chunk | Observes incremental tool arguments. |
|
|
25
|
+
| Tool [`onInputAvailable`](https://mastra.ai/reference/tools/create-tool) | Once when tool input is complete | Runs after arguments are parsed and validated, before execution. |
|
|
26
|
+
| Tool execution | Once per local tool call | Receives the live [`RequestContext`](https://mastra.ai/docs/server/request-context). Approval or suspension can delay execution. |
|
|
27
|
+
| Tool [`onOutput`](https://mastra.ai/reference/tools/create-tool) | Once after successful local execution | Receives the tool output. |
|
|
28
|
+
| `processToolResult` | Per local/client result, or when a deferred provider result arrives | Can inspect, redact, or abort before a raw tool result enters the message list. |
|
|
29
|
+
| `processAPIError` | On eligible provider API errors | Can update request state and request another provider attempt. |
|
|
30
|
+
| [`onIterationComplete`](https://mastra.ai/reference/agents/generate) | Once after each completed loop iteration | Observes the iteration result and can influence whether execution continues. |
|
|
31
|
+
| `processOutputResult` | Once at finalization | Post-processes the completed agent result before it's returned. |
|
|
94
32
|
|
|
95
33
|
## Interface definition
|
|
96
34
|
|
|
@@ -372,25 +372,50 @@ On authenticated servers, the read routes require the `stored-workflows:read` pe
|
|
|
372
372
|
|
|
373
373
|
## Datasets and experiments
|
|
374
374
|
|
|
375
|
-
| Method | Path | Description
|
|
376
|
-
| -------- | ---------------------------------------------------------------------- |
|
|
377
|
-
| `GET` | `/api/datasets` | List datasets
|
|
378
|
-
| `POST` | `/api/datasets` | Create a dataset
|
|
379
|
-
| `GET` | `/api/datasets/:datasetId` | Get dataset by ID
|
|
380
|
-
| `PATCH` | `/api/datasets/:datasetId` | Update a dataset
|
|
381
|
-
| `DELETE` | `/api/datasets/:datasetId` | Delete a dataset
|
|
382
|
-
| `GET` | `/api/datasets/:datasetId/items` | List dataset items
|
|
383
|
-
| `POST` | `/api/datasets/:datasetId/items` | Add a dataset item
|
|
384
|
-
| `
|
|
385
|
-
| `GET` | `/api/
|
|
386
|
-
| `
|
|
387
|
-
| `
|
|
388
|
-
| `POST` | `/api/datasets/:datasetId/experiments
|
|
389
|
-
| `POST` | `/api/datasets/:datasetId/experiments/:experimentId/
|
|
390
|
-
| `
|
|
391
|
-
| `
|
|
392
|
-
| `GET` | `/api/datasets/:datasetId/experiments/:experimentId
|
|
393
|
-
| `
|
|
375
|
+
| Method | Path | Description |
|
|
376
|
+
| -------- | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
377
|
+
| `GET` | `/api/datasets` | List datasets |
|
|
378
|
+
| `POST` | `/api/datasets` | Create a dataset |
|
|
379
|
+
| `GET` | `/api/datasets/:datasetId` | Get dataset by ID |
|
|
380
|
+
| `PATCH` | `/api/datasets/:datasetId` | Update a dataset |
|
|
381
|
+
| `DELETE` | `/api/datasets/:datasetId` | Delete a dataset |
|
|
382
|
+
| `GET` | `/api/datasets/:datasetId/items` | List dataset items |
|
|
383
|
+
| `POST` | `/api/datasets/:datasetId/items` | Add a dataset item |
|
|
384
|
+
| `DELETE` | `/api/datasets/:datasetId/items/:itemId/purge` | Permanently scrub an item's content from every dataset version and linked experiment result |
|
|
385
|
+
| `GET` | `/api/experiments` | List experiments across datasets |
|
|
386
|
+
| `DELETE` | `/api/experiments/:experimentId` | Delete an experiment, including one orphaned by dataset deletion |
|
|
387
|
+
| `GET` | `/api/datasets/:datasetId/experiments` | List experiments for a dataset |
|
|
388
|
+
| `POST` | `/api/datasets/:datasetId/experiments` | Trigger an experiment, or create one without starting it (`start: false`) |
|
|
389
|
+
| `POST` | `/api/datasets/:datasetId/experiments/:experimentId/items/:itemId/run` | Execute one experiment item server-side |
|
|
390
|
+
| `POST` | `/api/datasets/:datasetId/experiments/:experimentId/results` | Submit an externally computed item result |
|
|
391
|
+
| `POST` | `/api/datasets/:datasetId/experiments/:experimentId/finalize` | Finalize a caller-driven experiment |
|
|
392
|
+
| `GET` | `/api/datasets/:datasetId/experiments/:experimentId` | Get experiment by ID |
|
|
393
|
+
| `PATCH` | `/api/datasets/:datasetId/experiments/:experimentId` | Update an experiment's name, description or metadata |
|
|
394
|
+
| `DELETE` | `/api/datasets/:datasetId/experiments/:experimentId` | Delete an experiment that belongs to the dataset |
|
|
395
|
+
| `GET` | `/api/datasets/:datasetId/experiments/:experimentId/results` | List experiment results |
|
|
396
|
+
| `POST` | `/api/datasets/:datasetId/compare` | Compare two experiments |
|
|
397
|
+
|
|
398
|
+
### Delete an experiment
|
|
399
|
+
|
|
400
|
+
Both delete routes remove the experiment and its result records. When storage supports observability and trace deletion, Mastra also removes the traces produced by the experiment together with their spans and trace-linked signals.
|
|
401
|
+
|
|
402
|
+
Use the dataset-scoped route when you know the owning dataset:
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
curl -X DELETE http://localhost:4111/api/datasets/dataset-id/experiments/experiment-id
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
The route accepts optional `organizationId` and `projectId` query parameters. It returns `404` if the dataset is outside the supplied tenancy, the experiment doesn't exist, or the experiment doesn't belong to the dataset.
|
|
409
|
+
|
|
410
|
+
Use the top-level route when you don't have a dataset reference, including when dataset deletion has orphaned the experiment by clearing its `datasetId`:
|
|
411
|
+
|
|
412
|
+
```bash
|
|
413
|
+
curl -X DELETE http://localhost:4111/api/experiments/experiment-id
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
The top-level route accepts optional `organizationId` and `projectId` query parameters. When either is present, deletion is limited to that tenancy. A tenancy mismatch returns `{ "success": true }` without deleting the experiment. Without tenancy parameters, a missing experiment returns `404`.
|
|
417
|
+
|
|
418
|
+
A successful deletion returns `{ "success": true }`. The top-level route returns the same response for a tenancy mismatch, but doesn't delete anything. Both routes return `501` unless the installed `@mastra/core` advertises support through the `experiment-deletion` feature flag, including when an older version predates this support. When storage lacks observability or trace deletion support, Mastra logs a warning, leaves the traces in place, and still deletes the experiment with its result records. If trace cleanup fails after an earlier batch succeeds, the route returns `500` and preserves the experiment and result records even though some traces may already have been removed.
|
|
394
419
|
|
|
395
420
|
### Caller-driven experiment routes
|
|
396
421
|
|
|
@@ -61,7 +61,7 @@ const graphTool = createGraphRAGTool({
|
|
|
61
61
|
|
|
62
62
|
The tool returns an object with:
|
|
63
63
|
|
|
64
|
-
**relevantContext** (`string`):
|
|
64
|
+
**relevantContext** (`string[]`): Array of chunk text strings for the most relevant document chunks, in rank order, retrieved using graph-based ranking. Text is read from the text field of each chunk's metadata.
|
|
65
65
|
|
|
66
66
|
**sources** (`QueryResult[]`): Array of full retrieval result objects. Each object contains all information needed to reference the original document, chunk, and similarity score.
|
|
67
67
|
|
|
@@ -77,6 +77,8 @@ The tool returns an object with:
|
|
|
77
77
|
}
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
+
The graph is built from the `text` field of each result's metadata, so `document` (and `relevantContext`) contain that text. Store the chunk text under `metadata.text` when upserting.
|
|
81
|
+
|
|
80
82
|
## Default tool description
|
|
81
83
|
|
|
82
84
|
The default description focuses on:
|
|
@@ -79,7 +79,7 @@ const queryTool = createVectorQueryTool({
|
|
|
79
79
|
|
|
80
80
|
The tool returns an object with:
|
|
81
81
|
|
|
82
|
-
**relevantContext** (`
|
|
82
|
+
**relevantContext** (`any[]`): Array of metadata objects for the most relevant chunks, in rank order (one entry per result). The chunk text is available at relevantContext\[i].text when it was stored in metadata during ingestion.
|
|
83
83
|
|
|
84
84
|
**sources** (`QueryResult[]`): Array of full retrieval result objects. Each object contains all information needed to reference the original document, chunk, and similarity score.
|
|
85
85
|
|
|
@@ -95,6 +95,8 @@ The tool returns an object with:
|
|
|
95
95
|
}
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
+
`document` is only populated by vector stores whose `query()` returns document content, such as Chroma, Elasticsearch, LanceDB, and MongoDB. For other stores, such as PgVector, it's an empty string. Read the chunk text from `sources[i].metadata.text` (or whichever metadata key you stored it under).
|
|
99
|
+
|
|
98
100
|
## Default tool description
|
|
99
101
|
|
|
100
102
|
The default description focuses on:
|
|
@@ -489,7 +491,7 @@ The tool is created with:
|
|
|
489
491
|
|
|
490
492
|
- **ID**: `VectorQuery {vectorStoreName} {indexName} Tool`
|
|
491
493
|
- **Input Schema**: Requires queryText and filter objects
|
|
492
|
-
- **Output Schema**: Returns relevantContext
|
|
494
|
+
- **Output Schema**: Returns `relevantContext` (array of chunk metadata) and `sources` (array of `QueryResult`)
|
|
493
495
|
|
|
494
496
|
## Related
|
|
495
497
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.2.24
|
|
3
|
+
"version": "1.2.24",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"jsdom": "^26.1.0",
|
|
28
28
|
"local-pkg": "^1.1.2",
|
|
29
29
|
"zod": "^4.4.3",
|
|
30
|
-
"@mastra/core": "1.65.0
|
|
30
|
+
"@mastra/core": "1.65.0",
|
|
31
31
|
"@mastra/mcp": "^1.17.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"tsx": "^4.23.1",
|
|
45
45
|
"typescript": "^7.0.2",
|
|
46
46
|
"vitest": "4.1.10",
|
|
47
|
-
"@internal/lint": "0.0.
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
47
|
+
"@internal/lint": "0.0.131",
|
|
48
|
+
"@mastra/core": "1.65.0",
|
|
49
|
+
"@internal/types-builder": "0.0.106"
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://mastra.ai",
|
|
52
52
|
"repository": {
|