@mastra/mcp-docs-server 1.3.4 → 1.3.5-alpha.3

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 (30) hide show
  1. package/.docs/docs/channels.md +7 -3
  2. package/.docs/docs/memory/observational-memory.md +25 -1
  3. package/.docs/docs/memory/semantic-recall.md +35 -1
  4. package/.docs/docs/storage.md +1 -0
  5. package/.docs/integrations/databases/clickhouse-managed-postgres.md +82 -0
  6. package/.docs/integrations/file-storage/mesa.md +40 -39
  7. package/.docs/integrations.md +1 -0
  8. package/.docs/models/gateways/netlify.md +3 -1
  9. package/.docs/models/gateways/openrouter.md +3 -1
  10. package/.docs/models/gateways/vercel.md +9 -2
  11. package/.docs/models/index.md +1 -1
  12. package/.docs/models/providers/aiand.md +17 -15
  13. package/.docs/models/providers/crossmodel.md +2 -1
  14. package/.docs/models/providers/deepinfra.md +57 -62
  15. package/.docs/models/providers/edenai.md +8 -5
  16. package/.docs/models/providers/fireworks-ai.md +2 -2
  17. package/.docs/models/providers/hyper.md +1 -1
  18. package/.docs/models/providers/kilo.md +12 -10
  19. package/.docs/models/providers/llmgateway-providers.md +13 -12
  20. package/.docs/models/providers/llmgateway.md +7 -7
  21. package/.docs/models/providers/nano-gpt.md +1 -1
  22. package/.docs/models/providers/nvidia.md +4 -4
  23. package/.docs/models/providers/opencode.md +2 -1
  24. package/.docs/models/providers/togetherai.md +21 -28
  25. package/.docs/reference/agent-controller/agent-controller-class.md +2 -0
  26. package/.docs/reference/agent-controller/session.md +8 -0
  27. package/.docs/reference/agents/channels.md +1 -1
  28. package/.docs/reference/memory/observational-memory.md +3 -3
  29. package/.docs/reference/server/elysia-adapter.md +18 -0
  30. package/package.json +4 -4
@@ -351,6 +351,14 @@ Return the active thread ID, or `null` when no thread is bound.
351
351
  const threadId = session.thread.getId()
352
352
  ```
353
353
 
354
+ ### `session.thread.ensureId({ requestContext? })`
355
+
356
+ Return the active thread ID, creating and binding a new thread when none is bound. Concurrent calls share one thread. Use it with sessions created with `createInitialThread: false`.
357
+
358
+ ```typescript
359
+ const threadId = await session.thread.ensureId()
360
+ ```
361
+
354
362
  ### `session.thread.list(options?)`
355
363
 
356
364
  List threads from storage. By default only threads for the current resource are returned, and transient forked subagent threads are hidden.
@@ -47,7 +47,7 @@ The `channels` property accepts a `ChannelConfig` object with the following fiel
47
47
 
48
48
  **userName** (`string`): Bot display name shown in platform messages. Defaults to the agent's name, or 'Mastra' if no name is set. (Default: `` agent's `name` ``)
49
49
 
50
- **threadContext** (`{ maxMessages?: number; addSystemMessage?: boolean }`): How the agent picks up context about the current thread. maxMessages controls how many recent platform messages are fetched on first mention (set to 0 to disable; only applies to non-DM threads). addSystemMessage: false skips the built-in system message that tells the agent which channel/platform a request came from. (Default: `{ maxMessages: 10, addSystemMessage: true }`)
50
+ **threadContext** (`{ maxMessages?: number; addSystemMessage?: boolean }`): How the agent picks up context about the current thread. maxMessages sets how many platform messages are saved to memory on first mention: the thread's first message plus up to maxMessages - 1 recent messages, with an omitted-count marker between them when needed (set to 0 to disable; only applies to non-DM threads). addSystemMessage: false skips the built-in system message that tells the agent which channel/platform a request came from. (Default: `{ maxMessages: 10, addSystemMessage: true }`)
51
51
 
52
52
  **chatOptions** (`Omit<ChatConfig, 'adapters' | 'state' | 'userName'>`): Additional options passed directly to the Chat SDK. Use for advanced configuration such as dedupeTtlMs, fallbackStreamingPlaceholderText, lockScope, and messageHistory.
53
53
 
@@ -41,7 +41,7 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
41
41
 
42
42
  **scope** (`'resource' | 'thread'`): Memory scope for observations. 'thread' keeps observations per-thread. 'resource' is deprecated and will be removed in a future release. It shares observations across all threads for a resource and works much worse than thread scope for prompt caching and agent understanding. For cross-thread continuity, use thread scope with retrieval or resource-scoped working memory. See resource scope (deprecated). (Default: `'thread'`)
43
43
 
44
- **activateAfterIdle** (`number | string | false | "auto"`): Time before buffered observations are forced to activate after inactivity, even before observation.messageTokens is reached. Accepts a numeric millisecond value such as 300\_000, duration strings like "5m" or "1hr", "auto" for a provider-aware prompt cache TTL, or false to disable inherited observation idle activation. Reflections do not inherit this setting. Use reflection.activateAfterIdle to opt reflections into idle activation.
44
+ **activateAfterIdle** (`number | string | false | "auto" | Record<string, number | string | false | "auto">`): Time before buffered observations are forced to activate after inactivity, even before observation.messageTokens is reached. Accepts a numeric millisecond value such as 300\_000, duration strings like "5m" or "1hr", "auto" for a provider-aware prompt cache TTL, false to disable inherited observation idle activation, or an object of per-provider TTLs such as { default: "auto", anthropic: "1h" }. Object keys match the actor model provider before the first ., case-insensitively, so anthropic covers the direct Anthropic provider but not Claude through another provider such as amazon-bedrock; default covers every other provider. Reflections do not inherit this setting. Use reflection.activateAfterIdle to opt reflections into idle activation.
45
45
 
46
46
  **activateOnProviderChange** (`boolean`): Force buffered observations to activate when the actor provider or model changes. Reflections do not inherit this setting. Use reflection.activateOnProviderChange to opt reflections into provider-change activation. (Default: `false`)
47
47
 
@@ -91,7 +91,7 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
91
91
 
92
92
  **observation.bufferActivation** (`number`): How much of the message window to clear when buffered observations activate. Values between 0 and 1 are the fraction of messageTokens to remove: 0.8 removes \~80% of the message history and keeps \~20% (6k tokens with the default 30k). Values of 1000 or more are the token count to keep: 4000 keeps \~4k message tokens after activation. Note the direction flips: a higher ratio removes more history, while a higher token count keeps more.
93
93
 
94
- **observation.activateAfterIdle** (`number | string | false | "auto"`): Time before buffered observations are forced to activate after inactivity. Accepts milliseconds, a duration string, "auto" for a provider-aware prompt cache TTL, or false. If unset, the top-level activateAfterIdle value is used for observations. Set false to disable the top-level idle setting for observations. Currently only applied when using the standalone ObservationalMemory class; new Memory(...) applies the top-level activateAfterIdle only.
94
+ **observation.activateAfterIdle** (`number | string | false | "auto" | Record<string, number | string | false | "auto">`): Time before buffered observations are forced to activate after inactivity. Accepts milliseconds, a duration string, "auto" for a provider-aware prompt cache TTL, false, or an object of per-provider TTLs. An object replaces the top-level value and is not merged with it. If unset, the top-level activateAfterIdle value is used for observations. Set false to disable the top-level idle setting for observations. Currently only applied when using the standalone ObservationalMemory class; new Memory(...) applies the top-level activateAfterIdle only.
95
95
 
96
96
  **observation.activateOnProviderChange** (`boolean`): Force buffered observations to activate when the actor provider or model changes. If unset, the top-level activateOnProviderChange value is used for observations. Currently only applied when using the standalone ObservationalMemory class; new Memory(...) applies the top-level activateOnProviderChange only.
97
97
 
@@ -125,7 +125,7 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
125
125
 
126
126
  **reflection.bufferActivation** (`number`): When background reflection starts, as a ratio (0-1) of observationTokens: 0.5 starts reflecting in the background once observations reach 50% of the threshold (20k tokens with the default 40k). When the full threshold is reached, the buffered reflection replaces the observations it covers, preserving any new observations appended after that range.
127
127
 
128
- **reflection.activateAfterIdle** (`number | string | false | "auto"`): Time before buffered reflections are forced to activate after inactivity. Accepts milliseconds, a duration string, "auto" for a provider-aware prompt cache TTL, or false. Reflections do not inherit top-level activateAfterIdle; set this explicitly to opt reflections into idle activation. Currently only applied when using the standalone ObservationalMemory class; this setting has no effect through new Memory(...).
128
+ **reflection.activateAfterIdle** (`number | string | false | "auto" | Record<string, number | string | false | "auto">`): Time before buffered reflections are forced to activate after inactivity. Accepts milliseconds, a duration string, "auto" for a provider-aware prompt cache TTL, false, or an object of per-provider TTLs. Reflections do not inherit top-level activateAfterIdle; set this explicitly to opt reflections into idle activation. Currently only applied when using the standalone ObservationalMemory class; this setting has no effect through new Memory(...).
129
129
 
130
130
  **reflection.activateOnProviderChange** (`boolean`): Force buffered reflections to activate when the actor provider or model changes. Reflections do not inherit top-level activateOnProviderChange; set this explicitly to opt reflections into provider-change activation. Currently only applied when using the standalone ObservationalMemory class; this setting has no effect through new Memory(...).
131
131
 
@@ -130,6 +130,24 @@ app.get('/custom/public', async ctx => {
130
130
  })
131
131
  ```
132
132
 
133
+ When the auth provider refreshes an expired session, `createAuthMiddleware()` forwards the refreshed session headers (such as `Set-Cookie`) to the response, including error responses. `MastraServer` registers the `applyAuthRefreshHeaders` hook during `init()`, so routes added after `init()` get these headers alongside any cookies your route sets.
134
+
135
+ If you use `createAuthMiddleware()` without `MastraServer`, register the hook yourself before defining routes:
136
+
137
+ ```typescript
138
+ import { Elysia } from 'elysia'
139
+ import { applyAuthRefreshHeaders, createAuthMiddleware } from '@mastra/elysia'
140
+ import { mastra } from './mastra'
141
+
142
+ const app = new Elysia()
143
+ .onAfterHandle({ as: 'global' }, applyAuthRefreshHeaders)
144
+ .onError({ as: 'global' }, applyAuthRefreshHeaders)
145
+
146
+ app.get('/custom/protected', () => ({ ok: true }), {
147
+ beforeHandle: createAuthMiddleware({ mastra }),
148
+ })
149
+ ```
150
+
133
151
  ## Accessing context
134
152
 
135
153
  In Elysia handlers registered after `init()`, access Mastra context from the handler context:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "1.3.4",
3
+ "version": "1.3.5-alpha.3",
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/core": "1.74.0",
30
- "@mastra/mcp": "^2.1.2"
29
+ "@mastra/mcp": "^2.1.2",
30
+ "@mastra/core": "1.75.0-alpha.1"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@hono/node-server": "^2.0.0",
@@ -45,7 +45,7 @@
45
45
  "vitest": "4.1.11",
46
46
  "@internal/lint": "0.0.140",
47
47
  "@internal/types-builder": "0.0.115",
48
- "@mastra/core": "1.74.0"
48
+ "@mastra/core": "1.75.0-alpha.1"
49
49
  },
50
50
  "homepage": "https://mastra.ai",
51
51
  "repository": {