@mastra/mcp-docs-server 1.3.7-alpha.3 → 1.3.7-alpha.7
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/harness/agent-controller.md +18 -0
- package/.docs/docs/mastra-platform/api.md +88 -0
- package/.docs/docs/mastra-platform/observability.md +27 -19
- package/.docs/docs/server/request-context.md +5 -5
- package/.docs/models/environment-variables.md +2 -1
- package/.docs/models/gateways/merge-gateway.md +2 -1
- package/.docs/models/gateways/netlify.md +5 -1
- package/.docs/models/gateways/openrouter.md +2 -1
- package/.docs/models/gateways/vercel.md +2 -2
- package/.docs/models/index.md +3 -2
- package/.docs/models/providers/aixy.md +14 -8
- package/.docs/models/providers/chutes.md +4 -4
- package/.docs/models/providers/cloudferro-sherlock.md +2 -2
- package/.docs/models/providers/edenai.md +10 -4
- package/.docs/models/providers/kenari.md +5 -1
- package/.docs/models/providers/kilo.md +8 -7
- package/.docs/models/providers/llmgateway-providers.md +8 -7
- package/.docs/models/providers/llmgateway.md +6 -5
- package/.docs/models/providers/lowrouter.md +16 -12
- package/.docs/models/providers/meta.md +3 -2
- package/.docs/models/providers/nano-gpt.md +3 -3
- package/.docs/models/providers/opencode-go.md +3 -3
- package/.docs/models/providers/opencode.md +5 -5
- package/.docs/models/providers/prime.md +136 -0
- package/.docs/models/providers.md +2 -1
- package/.docs/reference/agent-controller/agent-controller-class.md +1 -1
- package/.docs/reference/agent-controller/session.md +78 -12
- package/.docs/reference/cli/mastra.md +15 -15
- package/package.json +5 -5
|
@@ -92,20 +92,25 @@ Returns: `() => void`
|
|
|
92
92
|
|
|
93
93
|
### Messages and run control
|
|
94
94
|
|
|
95
|
-
#### `sendMessage({ content, files?, requestContext? })`
|
|
95
|
+
#### `sendMessage({ content, files?, requestContext?, author? })`
|
|
96
96
|
|
|
97
|
-
Send a user message. The session creates a thread first when no thread is active.
|
|
97
|
+
Send a user message. The session creates a thread first when no thread is active. Pass `author` when the host has authenticated the sender.
|
|
98
98
|
|
|
99
99
|
```typescript
|
|
100
100
|
await session.sendMessage({
|
|
101
101
|
content: 'Summarize this file.',
|
|
102
102
|
files: [{ data: fileContents, mediaType: 'text/plain', filename: 'notes.txt' }],
|
|
103
|
+
author: { id: 'user-123' },
|
|
103
104
|
})
|
|
104
105
|
```
|
|
105
106
|
|
|
106
|
-
When `requestContext` carries `MASTRA_MESSAGE_AUTHOR_KEY`, the
|
|
107
|
+
The author persists under `content.metadata.signal.author`. Read it with `getMessageAuthor(message)` from `@mastra/core/agent`. When `requestContext` carries `MASTRA_MESSAGE_AUTHOR_KEY`, the session uses that value if `author` is omitted. See [Reserved keys](https://mastra.ai/docs/server/request-context).
|
|
107
108
|
|
|
108
|
-
#### `
|
|
109
|
+
#### `queueMessage({ content, files?, requestContext?, author? })`
|
|
110
|
+
|
|
111
|
+
Queue a message for the next run, or send it immediately while the session is idle. Author metadata persists with the queued message.
|
|
112
|
+
|
|
113
|
+
#### `steer({ content, requestContext?, author? })`
|
|
109
114
|
|
|
110
115
|
Queue steering content into an active run.
|
|
111
116
|
|
|
@@ -225,9 +230,13 @@ session.respondToToolApproval({ decision: 'decline', toolCallId: event.toolCallI
|
|
|
225
230
|
session.respondToToolApproval({ decision: 'always_allow_category', toolCallId: event.toolCallId })
|
|
226
231
|
```
|
|
227
232
|
|
|
228
|
-
#### `respondToToolSuspension({ resumeData, toolCallId?, requestContext? })`
|
|
233
|
+
#### `respondToToolSuspension({ resumeData, address?, toolCallId?, requestContext? })`
|
|
234
|
+
|
|
235
|
+
Resume a suspended tool with application-provided data. Supply `toolCallId` for a prompt on the active thread. To resume after switching threads, retain the full `address` returned by `session.claimToolSuspension(toolCallId, runId)` and pass it instead of `toolCallId`.
|
|
229
236
|
|
|
230
|
-
|
|
237
|
+
An addressed resume uses the source thread's mode, model, and thread-owned preferences, without selecting that thread or replacing the active thread's subscription. Tool state callbacks remain bound to the source even if you switch threads during execution. Host-owned custom state and permission rules remain shared.
|
|
238
|
+
|
|
239
|
+
After a process restart, a full address can recover a persisted suspension through the controller's configured agents. Recovery requires a uniquely identified originating agent and the existing resume authorization checks. A setup failure leaves the prompt retryable; it doesn't finish another thread's active run.
|
|
231
240
|
|
|
232
241
|
```typescript
|
|
233
242
|
await session.respondToToolSuspension({
|
|
@@ -244,6 +253,8 @@ For `submit_plan`, pass `{ action: 'approved' }` or `{ action: 'rejected', feedb
|
|
|
244
253
|
|
|
245
254
|
Return a copy of the running token-usage tally for the active thread.
|
|
246
255
|
|
|
256
|
+
The executing run saves token usage to its own thread as each step finishes, including runs resumed while another thread is selected. If a storage operation fails, the execution owner retains the measured usage and retries it with the next step. Sessions that only subscribe to a thread display its saved total without counting replayed steps again or saving usage.
|
|
257
|
+
|
|
247
258
|
```typescript
|
|
248
259
|
const usage = session.getTokenUsage()
|
|
249
260
|
// { promptTokens, completionTokens, totalTokens, ... }
|
|
@@ -251,7 +262,7 @@ const usage = session.getTokenUsage()
|
|
|
251
262
|
|
|
252
263
|
## Identity
|
|
253
264
|
|
|
254
|
-
`session.identity`
|
|
265
|
+
`session.identity` identifies the process-local session host: the resource ID and session `id`, plus an `ownerId`. The `id` and `ownerId` are stable for the life of the host and don't change when the resource ID is switched. AgentController doesn't persist the live session or mirror these values to a `SessionRecord`.
|
|
255
266
|
|
|
256
267
|
### `session.identity.getId()`
|
|
257
268
|
|
|
@@ -263,7 +274,7 @@ const sessionId = session.identity.getId()
|
|
|
263
274
|
|
|
264
275
|
### `session.identity.getOwnerId()`
|
|
265
276
|
|
|
266
|
-
Return the stable owner identifier for the session.
|
|
277
|
+
Return the stable owner identifier for the process-local session host. This value isn't a durable thread owner.
|
|
267
278
|
|
|
268
279
|
```typescript
|
|
269
280
|
const ownerId = session.identity.getOwnerId()
|
|
@@ -289,12 +300,18 @@ To change the resource ID, use [`controller.setResourceId()`](https://mastra.ai/
|
|
|
289
300
|
|
|
290
301
|
## Thread
|
|
291
302
|
|
|
292
|
-
`session.thread` owns the active thread binding and resource-scoped thread operations. Stored threads and messages can survive controller recreation when storage is configured. The live session and its event bus don't.
|
|
303
|
+
`session.thread` owns the active thread binding and resource-scoped thread operations. Stored threads and messages can survive controller recreation when storage is configured. Conversation settings such as mode, model, thinking level, token usage, pending runs, and ownership are restored from the active thread when the session creates or switches threads. The live session and its event bus don't persist.
|
|
304
|
+
|
|
305
|
+
New threads store the Session host's `ownerId` in the reserved `metadata.ownerId` and `metadata.createdBy` fields. Clones use the cloning Session host for both fields. Existing threads without `metadata.ownerId` read as owned by the current Session host without writing a backfill.
|
|
293
306
|
|
|
294
307
|
### `session.thread.create({ title?, id?, requestContext? })`
|
|
295
308
|
|
|
296
309
|
Create a thread, bind the session to it, and open its event stream. Pass `requestContext` when memory is a function that reads the signed-in user.
|
|
297
310
|
|
|
311
|
+
For a session created with `createInitialThread: false`, explicit mode, model, and thread-preference selections made before its first binding seed the first new thread. This also applies to `ensureId()` and the first message. Failed creation leaves those selections available for retry.
|
|
312
|
+
|
|
313
|
+
After the session has bound a conversation, creating another thread uses controller defaults, not the previous conversation's choices. Clearing or deleting the binding doesn't restore the first-thread behavior. Opening an existing thread restores that thread's settings instead of applying unbound startup selections.
|
|
314
|
+
|
|
298
315
|
```typescript
|
|
299
316
|
const thread = await session.thread.create({
|
|
300
317
|
id: 'thread-7',
|
|
@@ -329,6 +346,8 @@ Returns: `Promise<AgentControllerThread>`
|
|
|
329
346
|
|
|
330
347
|
Switch to an owned stored thread and hydrate its mode, model, and observational memory settings. Pass `requestContext` when memory is a function that reads the signed-in user.
|
|
331
348
|
|
|
349
|
+
Switching away cancels a running local execution only when this session initiated it. A session listening to another session's run detaches without cancelling that run. This follows the current action's initiator, not ownership of the thread. Parked tool prompts remain available for later resume.
|
|
350
|
+
|
|
332
351
|
```typescript
|
|
333
352
|
await session.thread.switch({ threadId: 'thread-8' })
|
|
334
353
|
```
|
|
@@ -357,6 +376,43 @@ Return the active thread ID, creating and binding a new thread when none is boun
|
|
|
357
376
|
const threadId = await session.thread.ensureId()
|
|
358
377
|
```
|
|
359
378
|
|
|
379
|
+
### `session.thread.getOwner({ threadId? })`
|
|
380
|
+
|
|
381
|
+
Return a thread's durable owner. Omit `threadId` to read the active thread. The method returns `undefined` when no thread is selected. An owner-less legacy thread returns the Session host's `ownerId` without writing a backfill.
|
|
382
|
+
|
|
383
|
+
```typescript
|
|
384
|
+
const ownerId = await session.thread.getOwner()
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
Returns: `Promise<string | undefined>`
|
|
388
|
+
|
|
389
|
+
### `session.thread.transferOwnership({ toOwnerId })`
|
|
390
|
+
|
|
391
|
+
Store `toOwnerId` in the active thread's `metadata.ownerId` and emit `thread_owner_changed`. The original `metadata.createdBy` value doesn't change.
|
|
392
|
+
|
|
393
|
+
```typescript
|
|
394
|
+
await session.thread.transferOwnership({
|
|
395
|
+
toOwnerId: 'user-456',
|
|
396
|
+
})
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
Returns: `Promise<void>`
|
|
400
|
+
|
|
401
|
+
Transfers are serialized within one process. Storage-backed applications that require a durable cross-process compare-and-set should perform it in their own store first, then call this method to mirror the result.
|
|
402
|
+
|
|
403
|
+
A successful change emits:
|
|
404
|
+
|
|
405
|
+
```typescript
|
|
406
|
+
const event = {
|
|
407
|
+
type: 'thread_owner_changed',
|
|
408
|
+
threadId: 'thread-7',
|
|
409
|
+
fromOwnerId: 'user-123',
|
|
410
|
+
toOwnerId: 'user-456',
|
|
411
|
+
}
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
Runs snapshot ownership when they start. Within agent tools and dynamic runtime functions, `AgentControllerRequestContext.threadOwnerId` remains unchanged for the run's lifetime. A transfer becomes visible on the next run. `AgentControllerRequestContext.session.ownerId` continues to identify the process-local Session host.
|
|
415
|
+
|
|
360
416
|
### `session.thread.list(options?)`
|
|
361
417
|
|
|
362
418
|
List threads from storage. By default only threads for the current resource are returned, and transient forked subagent threads are hidden.
|
|
@@ -759,7 +815,13 @@ After every event, the session emits `display_state_changed` with the latest sna
|
|
|
759
815
|
|
|
760
816
|
## State
|
|
761
817
|
|
|
762
|
-
`session.state`
|
|
818
|
+
`session.state` exposes the active conversation's thread-owned preferences together with host-owned state. Updates are serialized and validated against the `stateSchema` passed to the AgentController. Visible state changes emit `state_changed`.
|
|
819
|
+
|
|
820
|
+
Thread-owned preferences include thinking level, observational memory settings, and subagent model selections. Switching threads leaves host-owned custom fields and permission rules unchanged and doesn't persist them.
|
|
821
|
+
|
|
822
|
+
A queued write keeps its source thread through asynchronous updates and validation. Switching from A to B while a write is pending doesn't apply A's preferences to B. Host-field updates still affect the host. A retained run and the active view of the same thread share update ordering. A resumed run sees edits made while it was parked. Events without a source address that affect the conversation display are emitted only while that source is active.
|
|
823
|
+
|
|
824
|
+
Inside a tool's controller request context, `state` is a snapshot taken when the context was built. Use `getState()` or `session.state.get()` to read the latest source-thread state after a write.
|
|
763
825
|
|
|
764
826
|
### `session.state.get()`
|
|
765
827
|
|
|
@@ -790,9 +852,13 @@ const added = await session.state.update(current => ({
|
|
|
790
852
|
|
|
791
853
|
## Persistence boundaries
|
|
792
854
|
|
|
793
|
-
A `Session` is a live runtime object. Its event bus, arbitrary
|
|
855
|
+
A `Session` is a live runtime object. Its event bus, arbitrary custom state, permission rules, permission grants, follow-ups, and active stream don't automatically survive controller or process recreation. The host must restore the host-owned state it needs.
|
|
856
|
+
|
|
857
|
+
Configured storage persists threads and messages along with token usage, while thread settings restore mode, model, and supported preferences. Restored settings can include thinking level, observational memory, and subagent model selections with per-agent-type overrides. Persisted suspended runs can be recovered using their full suspension address and originating agent; this doesn't make arbitrary custom state durable.
|
|
858
|
+
|
|
859
|
+
While a run retains a source-thread view, successful in-memory preference writes remain available when returning to that thread even if best-effort metadata persistence fails. A cold restart can recover only persisted settings and controller defaults.
|
|
794
860
|
|
|
795
|
-
|
|
861
|
+
A chat channel can map back to stored threads. However, `AgentControllerChannels` keeps channel-to-session and auto-approval state in memory.
|
|
796
862
|
|
|
797
863
|
## Related
|
|
798
864
|
|
|
@@ -1153,19 +1153,19 @@ See [Import existing traces](https://mastra.ai/docs/mastra-platform/observabilit
|
|
|
1153
1153
|
|
|
1154
1154
|
### Options
|
|
1155
1155
|
|
|
1156
|
-
#### `--project <name|slug|id>`
|
|
1156
|
+
#### `--target-project <name|slug|id>`
|
|
1157
1157
|
|
|
1158
|
-
Selects the destination Mastra Platform project. Takes precedence over `MASTRA_PROJECT_ID`. Without either value, the command uses the project linked in `.mastra-project.json`.
|
|
1158
|
+
Selects the destination Mastra Platform project that receives the traces. Takes precedence over `MASTRA_PROJECT_ID`. Without either value, the command uses the project linked in `.mastra-project.json`. The source project comes from the provider credentials, such as `LANGFUSE_PUBLIC_KEY` and `LANGFUSE_SECRET_KEY`.
|
|
1159
1159
|
|
|
1160
|
-
#### `--
|
|
1160
|
+
#### `--since <date>`
|
|
1161
1161
|
|
|
1162
|
-
Sets the inclusive start of the import window as an ISO 8601 date or timestamp. It defaults to 30 days before `--
|
|
1162
|
+
Sets the inclusive start of the import window as an ISO 8601 date or timestamp. It defaults to 30 days before `--until`, clamped to the current 30-day Platform retention boundary. `--from` is accepted as an alias.
|
|
1163
1163
|
|
|
1164
|
-
#### `--
|
|
1164
|
+
#### `--until <date>`
|
|
1165
1165
|
|
|
1166
|
-
Sets the exclusive end of the import window as an ISO 8601 date or timestamp. It defaults to the time when the import starts and can't be in the future.
|
|
1166
|
+
Sets the exclusive end of the import window as an ISO 8601 date or timestamp. It defaults to the time when the import starts and can't be in the future. `--to` is accepted as an alias.
|
|
1167
1167
|
|
|
1168
|
-
The complete window must fall within the current 30-day Platform retention period, `--
|
|
1168
|
+
The complete window must fall within the current 30-day Platform retention period, `--since` must be earlier than `--until`, and the window can't exceed 30 days.
|
|
1169
1169
|
|
|
1170
1170
|
#### `--dry-run`
|
|
1171
1171
|
|
|
@@ -1173,7 +1173,7 @@ Reads the source and prepares valid traces locally without uploading them. The c
|
|
|
1173
1173
|
|
|
1174
1174
|
#### `--resume <import-id>`
|
|
1175
1175
|
|
|
1176
|
-
Resumes a prepared import using its saved provider, destination project, date window, and acknowledged progress. Use the same destination project shown in the generated resume command. This option can't be combined with `--
|
|
1176
|
+
Resumes a prepared import using its saved provider, destination project, date window, and acknowledged progress. Use the same destination project shown in the generated resume command. This option can't be combined with `--since`, `--until`, or `--dry-run`.
|
|
1177
1177
|
|
|
1178
1178
|
#### `-y, --yes`
|
|
1179
1179
|
|
|
@@ -1185,29 +1185,29 @@ The command loads `.env` and `.env.local` from the current directory.
|
|
|
1185
1185
|
|
|
1186
1186
|
| Variable | Required | Description |
|
|
1187
1187
|
| ------------------------------ | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
1188
|
-
| `LANGFUSE_PUBLIC_KEY` | For new Langfuse imports | Public project API key.
|
|
1188
|
+
| `LANGFUSE_PUBLIC_KEY` | For new Langfuse imports | Public project API key. Together with the secret key, it selects the source Langfuse project. |
|
|
1189
1189
|
| `LANGFUSE_SECRET_KEY` | For new Langfuse imports | Secret project API key. |
|
|
1190
1190
|
| `LANGFUSE_BASE_URL` | No | Langfuse host. Defaults to `https://cloud.langfuse.com`. |
|
|
1191
1191
|
| `MASTRA_API_TOKEN` | For headless authentication | Mastra Platform API token. Without it, the command uses credentials from `mastra auth login`. |
|
|
1192
1192
|
| `MASTRA_ORG_ID` | With `MASTRA_API_TOKEN` | Organization that owns the destination project. |
|
|
1193
1193
|
| `MASTRA_PLATFORM_ACCESS_TOKEN` | For upload and read-back with interactive login | Mastra Platform access token for the destination. Not required for `--dry-run` or when `MASTRA_API_TOKEN` is set. |
|
|
1194
|
-
| `MASTRA_PROJECT_ID` | When no project is otherwise linked | Destination project ID. The `--project` flag takes precedence over it.
|
|
1194
|
+
| `MASTRA_PROJECT_ID` | When no project is otherwise linked | Destination project ID. The `--target-project` flag takes precedence over it. |
|
|
1195
1195
|
|
|
1196
1196
|
### Examples
|
|
1197
1197
|
|
|
1198
1198
|
Preview the default 30-day window without uploading:
|
|
1199
1199
|
|
|
1200
1200
|
```bash
|
|
1201
|
-
mastra traces import langfuse --project my-project --dry-run
|
|
1201
|
+
mastra traces import langfuse --target-project my-mastra-project --dry-run
|
|
1202
1202
|
```
|
|
1203
1203
|
|
|
1204
1204
|
Import a smaller date window without a confirmation prompt:
|
|
1205
1205
|
|
|
1206
1206
|
```bash
|
|
1207
1207
|
mastra traces import langfuse \
|
|
1208
|
-
--project my-project \
|
|
1209
|
-
--
|
|
1210
|
-
--
|
|
1208
|
+
--target-project my-mastra-project \
|
|
1209
|
+
--since "$SINCE" \
|
|
1210
|
+
--until "$UNTIL" \
|
|
1211
1211
|
--yes
|
|
1212
1212
|
```
|
|
1213
1213
|
|
|
@@ -1216,7 +1216,7 @@ Resume an existing import:
|
|
|
1216
1216
|
```bash
|
|
1217
1217
|
mastra traces import langfuse \
|
|
1218
1218
|
--resume 00000000-0000-0000-0000-000000000000 \
|
|
1219
|
-
--project my-project
|
|
1219
|
+
--target-project my-mastra-project
|
|
1220
1220
|
```
|
|
1221
1221
|
|
|
1222
1222
|
## `mastra api`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.3.7-alpha.
|
|
3
|
+
"version": "1.3.7-alpha.7",
|
|
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.1.2",
|
|
28
28
|
"zod": "^4.6.4",
|
|
29
|
-
"@mastra/
|
|
30
|
-
"@mastra/
|
|
29
|
+
"@mastra/core": "1.77.0-alpha.3",
|
|
30
|
+
"@mastra/mcp": "^2.4.0-alpha.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@hono/node-server": "^2.0.0",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"tsx": "^4.23.1",
|
|
44
44
|
"typescript": "^7.0.2",
|
|
45
45
|
"vitest": "4.1.11",
|
|
46
|
-
"@internal/lint": "0.0.142",
|
|
47
46
|
"@internal/types-builder": "0.0.117",
|
|
48
|
-
"@mastra/core": "1.77.0-alpha.
|
|
47
|
+
"@mastra/core": "1.77.0-alpha.3",
|
|
48
|
+
"@internal/lint": "0.0.142"
|
|
49
49
|
},
|
|
50
50
|
"homepage": "https://mastra.ai",
|
|
51
51
|
"repository": {
|